Objective
Replace two overlapping rebuild harness implementations with one shared core and two named profiles.
Evidence
test/helpers/rebuild-flow-harness.ts is 872 lines.
test/helpers/rebuild-flow-test-harness.ts is 695 lines.
- Both load the rebuild graph, create sessions, install overlapping spies, emulate sandbox state, and restore mocks.
- The older harness owns DCode route and image behavior.
- The newer harness owns broader generic recovery, credential, messaging, and prepared-image behavior.
test/helpers/rebuild-flow-test-support.ts already owns part of the reusable type and session layer.
Scope
- Extract one core for shared module loading, session creation, common spies, sandbox state, and cleanup.
- Add only two profiles: generic and Deep Agents Code.
- Migrate all current harness consumers.
- Remove the superseded duplicate implementation.
- Keep DCode-only image and route mocks out of the generic profile.
- Keep generic credential, messaging, and prepared-image mocks from becoming mandatory DCode setup.
- Do not change production source, supported behavior, test titles, or assertions.
Relationships
This is not a good first issue: it changes mock lifecycle across the rebuild suite.
Acceptance criteria
- Common session, environment, module-loading, and mock lifecycle logic has one implementation.
- Every rebuild suite selects the generic or DCode profile explicitly.
- Profile-specific mocks remain isolated.
- Existing test titles and collected-test counts remain unchanged.
- Repository size, complexity, and project checks pass.
- The change has a negative net LOC delta.
Validation
npx vitest run --project cli src/lib/actions/sandbox/rebuild*.test.ts
npm run typecheck:cli
npm run checks:repository
Objective
Replace two overlapping rebuild harness implementations with one shared core and two named profiles.
Evidence
test/helpers/rebuild-flow-harness.tsis 872 lines.test/helpers/rebuild-flow-test-harness.tsis 695 lines.test/helpers/rebuild-flow-test-support.tsalready owns part of the reusable type and session layer.Scope
Relationships
This is not a
good first issue: it changes mock lifecycle across the rebuild suite.Acceptance criteria
Validation
npx vitest run --project cli src/lib/actions/sandbox/rebuild*.test.ts npm run typecheck:cli npm run checks:repository