Skip to content

Default factory CLI to real clients#266

Merged
kjgbot merged 2 commits into
mainfrom
factory-sdk-v2fix10b-real-sb-impl2
Jun 13, 2026
Merged

Default factory CLI to real clients#266
kjgbot merged 2 commits into
mainfrom
factory-sdk-v2fix10b-real-sb-impl2

Conversation

@kjgbot

@kjgbot kjgbot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make loadConfig leave fixtureFiles undefined when the operator config omits it, instead of manufacturing a truthy empty {}.
  • Gate CLI FakeMount/FakeFleet selection on explicit fixture config (fixtureFiles present after loadConfig), making real RelayfileCloudMountClient/createFleet the factory CLI default.
  • Add operator-path tests for runFleetCli → loadConfig → buildFleet/buildMount: fixture-less configs use the real constructor seams, while explicit fixture configs still use Fake clients for harness runs.

Notes

  • V2FIX-10 (packages:external) was benign but did not fix this bug; the issue was the CLI loadConfig/buildMount/buildFleet path, not esbuild packaging.
  • The new tests intentionally exercise the operator CLI path rather than a fromConfig-direct/source shim.

Verification

  • npx vitest run packages/factory-sdk/src/cli/fleet.test.ts → 15 tests passed
  • npx vitest run packages/factory-sdk → 21 files, 275 tests passed
  • npx tsc --noEmit → passed

Cert Scope

This code path and the binary discovery V1 are writeback-independent and landable now: node bin/fleet.mjs factory run-once|loop --config <live> should select real clients and enumerate live issues. The full binary reap-orphans quad remains writeback-dependent and should wait for cloud#2106 recovery.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR extends fleet CLI fixture handling with explicit opt-in detection. Configuration loading now distinguishes missing vs. explicitly-set fixtureFiles, and a new hasExplicitFixtureFiles guard selects between fake and real clients. Dependency injection is extended to allow custom cloudMountFromConfig injection for testing. Three integration tests verify fixture-less dry-run execution, explicit fixture modes, and null fixture opt-in.

Changes

Fleet CLI fixture handling and DI improvements

Layer / File(s) Summary
DI extension for custom mount factory
packages/factory-sdk/src/cli/fleet.ts
FleetCliDeps now accepts optional cloudMountFromConfig parameter to enable test injection of custom mount factories.
Config loading with explicit fixture detection
packages/factory-sdk/src/cli/fleet.ts
loadConfig only populates fixtureFiles when the input JSON explicitly has it as an own property; otherwise leaves it undefined to distinguish missing vs. explicit configuration.
Fleet and mount building with fixture guard
packages/factory-sdk/src/cli/fleet.ts
buildFleet and buildMount use shared hasExplicitFixtureFiles type guard to select between FakeFleetClient/FakeMountClient and real cloud-backed clients; mount building integrates injected cloudMountFromConfig.
Fixture handling integration tests
packages/factory-sdk/src/cli/fleet.test.ts
Three new test cases verify dry-run behavior for fixture-less configs (SDK facades invoked), explicit fixtureFiles (dry-run on fakes), and fixtureFiles: null opt-in (expected reports without side effects).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • AgentWorkforce/pear#232: Introduced createFleet and InternalFleetClient fleet-client seam that this PR extends with cloudMountFromConfig injection and explicit fixture mode detection.

Poem

🐰 A fixture that whispers "I'm here when you need me,"
Now explicit, not hidden, the config flows freely,
With guards that decide: shall we fake or be real?
Your dry runs stay dry, your tests get the deal! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Default factory CLI to real clients' directly reflects the main change: modifying the factory CLI to use real clients by default instead of fake ones when fixtureFiles is not explicitly provided.
Description check ✅ Passed The description comprehensively explains the changeset: the fixtureFiles undefined behavior change, the gating of fake client selection on explicit config, the new tests, and verification steps. It is clearly related to the code changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch factory-sdk-v2fix10b-real-sb-impl2

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed due to a network error.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Implemented two PR-scope fixes:

  • Fixed cloudMountFromConfig injection typing so tests and callers can return any MountClient, not only concrete RelayfileCloudMountClient: fleet.ts
  • Made fixtureFiles detection use own-property presence instead of truthiness, with a regression test for present-but-empty parsed fixture configs: fleet.ts, fleet.test.ts

Addressed comments

  • gemini-code-assist[bot]: quota-limit warning only; no actionable code finding to validate or fix.
  • coderabbitai[bot]: review-rate-limit/usage-credit warning only; no actionable code finding to validate or fix.

Advisory Notes

  • Existing lint warnings remain outside the PR scope; lint exits successfully with warnings only.
  • I could not reproduce the macOS packaging job in this Linux sandbox. npm run verify:mcp-spawn also cannot run standalone here because it expects dist/ from npm run dist:mac.

Local validation run:

  • npm ci
  • npm run verify:mcp-resources-drift
  • npm run lint
  • npm run typecheck:web
  • npm run typecheck:node
  • npx vitest run packages/factory-sdk/src/cli/fleet.test.ts
  • npm test
  • npx vitest run
  • npm run build
  • npm run build:web
  • npx playwright install --with-deps chromium
  • npx playwright test --config playwright.fidelity.config.ts
  • npx playwright test --config playwright.redraw.config.ts

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #266 against .workforce/pr.diff, changed files, context, surrounding callers/types/tests, and GitHub comments. I found no validated breakage requiring code changes.

Addressed comments

  • gemini-code-assist[bot]: quota-limit notice only; no review finding to validate or fix.
  • coderabbitai[bot]: review limit / usage-credit notice only; no review finding to validate or fix.

Advisory Notes

  • npm run lint passes but reports existing warnings outside this PR’s files. I left them unchanged as unrelated to this PR scope.
  • GitHub metadata reports the PR as mergeable. The connector only exposed CodeRabbit status as success; it did not expose full Actions check state.

Verification

Passed locally:

  • npm ci
  • npm run verify:mcp-resources-drift
  • npm run lint
  • npm run typecheck:web
  • npm run typecheck:node
  • npm test
  • npx vitest run
  • npm run build
  • npx playwright install --with-deps chromium
  • npm run test:fidelity
  • npm run test:redraw

I also ran the focused factory CLI test: npx vitest run packages/factory-sdk/src/cli/fleet.test.ts, passing 15 tests.

agent-relay-code Bot added a commit that referenced this pull request Jun 13, 2026
@agent-relay-code

Copy link
Copy Markdown
Contributor

Fixed one PR-scoped regression in fixture detection.

The PR intended “fixture-less config” to mean the fixtureFiles key is absent. The implementation used truthiness, so an explicit fixtureFiles: null stopped opting into the fake harness path. I changed config loading to use key presence instead, preserving the explicit fixture opt-in behavior in packages/factory-sdk/src/cli/fleet.ts, and added a regression test in packages/factory-sdk/src/cli/fleet.test.ts.

Addressed comments

  • No bot or reviewer comments were available in the local .workforce metadata; only context.json, pr.diff, and changed-files.txt were present.

Validation

Passed locally:

  • npm run verify:mcp-resources-drift
  • npm run lint
  • npm run typecheck:web
  • npm run typecheck:node
  • npm test
  • npx vitest run
  • npm run build
  • npm run build:web
  • npx playwright test --config playwright.fidelity.config.ts
  • npx playwright test --config playwright.redraw.config.ts
  • focused: npm exec vitest -- run packages/factory-sdk/src/cli/fleet.test.ts

I did not run the macOS-only dist:mac packaged smoke job in this Linux environment, and I cannot verify GitHub mergeability or remote CI state from the local checkout.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/factory-sdk/src/cli/fleet.ts (1)

285-293: ⚠️ Potential issue | 🟠 Major

Fix fixture opt-in behavior for --backend relay in buildFleet

  • buildFleet only switches to FakeFleetClient when backend === 'internal' && hasExplicitFixtureFiles(loaded) (fleet.ts ~287), but buildMount switches to FakeMountClient for fixture files regardless of backend (fleet.ts ~312).
  • When --backend relay is used, createFleet returns RelayFleetClient, whose methods all throw RelayFleetClient not implemented — see relay#1056 (create-fleet.ts / relay-fleet-client.ts). So with fixture files you’ll get a fake mount but a non-functional relay fleet, leading to runtime failure.
  • Make buildFleet ignore the backend check when fixture files are present (use FakeFleetClient whenever hasExplicitFixtureFiles), or add an explicit refusal/consistent gating for relay + fixtureFiles so behavior is predictable.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/factory-sdk/src/cli/fleet.ts` around lines 285 - 293, buildFleet
currently only returns FakeFleetClient when backend === 'internal', causing a
mismatch with buildMount which uses FakeMountClient for fixtures regardless of
backend; update buildFleet (function buildFleet) to check
hasExplicitFixtureFiles(loaded) first and return new FakeFleetClient() whenever
fixtures are present (i.e., remove the backend === 'internal' gating), so that
when hasExplicitFixtureFiles(loaded) is true you never call createFleet (and
thus never instantiate RelayFleetClient), keeping behavior consistent with
buildMount and avoiding runtime failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/factory-sdk/src/cli/fleet.ts`:
- Around line 285-293: buildFleet currently only returns FakeFleetClient when
backend === 'internal', causing a mismatch with buildMount which uses
FakeMountClient for fixtures regardless of backend; update buildFleet (function
buildFleet) to check hasExplicitFixtureFiles(loaded) first and return new
FakeFleetClient() whenever fixtures are present (i.e., remove the backend ===
'internal' gating), so that when hasExplicitFixtureFiles(loaded) is true you
never call createFleet (and thus never instantiate RelayFleetClient), keeping
behavior consistent with buildMount and avoiding runtime failures.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f85cffee-09da-4f9d-8663-26dc943709f5

📥 Commits

Reviewing files that changed from the base of the PR and between 506024b and e76232a.

📒 Files selected for processing (2)
  • packages/factory-sdk/src/cli/fleet.test.ts
  • packages/factory-sdk/src/cli/fleet.ts

@kjgbot kjgbot force-pushed the factory-sdk-v2fix10b-real-sb-impl2 branch from e76232a to 51545c0 Compare June 13, 2026 01:07
@kjgbot kjgbot merged commit 119d425 into main Jun 13, 2026
8 checks passed
@kjgbot kjgbot deleted the factory-sdk-v2fix10b-real-sb-impl2 branch June 13, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant