fix(engine): repair two stale test mocks broken by #1910
restart.integration.test.ts's `../pi.js` factory replaces the module wholesale but omits ModelFallbackExhaustedError, which triage.ts references via `err instanceof ModelFallbackExhaustedError` — evaluating the guard threw "No ModelFallbackExhaustedError export is defined on the mock". Added a plain Error-subclass stub (no restart test enters the fallback-exhausted branch). mission-validation-trigger-gap.test.ts's two recovery-path missionStore mocks omit getMission, which #1910's mission-active gate now walks (getSlice → getMilestone → getMission) inside resolveFeatureMission. The throw was swallowed by processTaskOutcome's catch, aborting recovery before it ensured assertions / started the validator run — surfacing as ensureFeatureAssertionLinked called 0 times. Added getMission returning an active mission. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -215,6 +215,11 @@ describe("FN-5715 reliability: mission validation trigger gap", () => {
|
||||
completeValidatorRun: vi.fn(),
|
||||
getSlice: vi.fn(() => ({ id: "SL-001", milestoneId: "MS-001", status: "active" })),
|
||||
getMilestone: vi.fn(() => ({ id: "MS-001", missionId: "M-001" })),
|
||||
// resolveFeatureMission (reached via processTaskOutcome during recovery)
|
||||
// walks getSlice → getMilestone → getMission to gate on mission.status.
|
||||
// Without getMission the walk throws and recovery aborts before it can
|
||||
// ensure assertions / start the validator run this test asserts on.
|
||||
getMission: vi.fn(() => ({ id: "M-001", status: "active" })),
|
||||
logMissionEvent: vi.fn(),
|
||||
transitionLoopState: vi.fn(),
|
||||
setFeatureCurrentTaskRunId: vi.fn(),
|
||||
@@ -277,6 +282,11 @@ describe("FN-5715 reliability: mission validation trigger gap", () => {
|
||||
completeValidatorRun: vi.fn(),
|
||||
getSlice: vi.fn(() => ({ id: "SL-001", milestoneId: "MS-001", status: "active" })),
|
||||
getMilestone: vi.fn(() => ({ id: "MS-001", missionId: "M-001" })),
|
||||
// resolveFeatureMission (reached via processTaskOutcome during recovery)
|
||||
// walks getSlice → getMilestone → getMission to gate on mission.status.
|
||||
// Without getMission the walk throws and recovery aborts before it can
|
||||
// ensure assertions / start the validator run this test asserts on.
|
||||
getMission: vi.fn(() => ({ id: "M-001", status: "active" })),
|
||||
logMissionEvent: vi.fn(),
|
||||
transitionLoopState: vi.fn(),
|
||||
setFeatureCurrentTaskRunId: vi.fn(),
|
||||
|
||||
@@ -43,6 +43,12 @@ vi.mock("../pi.js", () => ({
|
||||
// session. The mock must expose the export so the resume/triage paths can
|
||||
// reach finalization instead of throwing on a missing mock member.
|
||||
formatModelMarkerDetails: vi.fn((model: string) => model),
|
||||
// triage.ts guards its catch block with `err instanceof ModelFallbackExhaustedError`
|
||||
// (imported from pi.js). Because this factory replaces pi.js wholesale, the class
|
||||
// must be exported or evaluating the `instanceof` throws "No ModelFallbackExhaustedError
|
||||
// export is defined on the mock". No restart test enters the fallback-exhausted branch,
|
||||
// so a plain Error subclass is a faithful stub (instanceof simply returns false).
|
||||
ModelFallbackExhaustedError: class ModelFallbackExhaustedError extends Error {},
|
||||
}));
|
||||
vi.mock("../reviewer.js", () => ({
|
||||
reviewStep: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user