diff --git a/extensions/gentle-ai.ts b/extensions/gentle-ai.ts index 39edf9a2e..7a18d90cd 100644 --- a/extensions/gentle-ai.ts +++ b/extensions/gentle-ai.ts @@ -7095,7 +7095,7 @@ function nativeOperationFailure(operation: ReviewControllerOperation | "gentle_r const preservesNativeTargetStatusDiagnostic = nativeDiagnostics?.operation === NATIVE_REVIEW_OPERATION.STATUS; const preservesAnswerConsentStartDiagnostic = operation === REVIEW_CONTROLLER_OPERATION.ANSWER_CONSENT && nativeDiagnostics?.operation === NATIVE_REVIEW_OPERATION.START; const diagnostics = operation === REVIEW_CONTROLLER_OPERATION.START && error instanceof CandidateViewError && value.candidateViewPreNative === true - ? error.diagnostics ?? { code: error.reason, message: "candidate view rejected before native START" } + ? error.diagnostics ?? { code: error.reason, message: error.message } : error instanceof CandidateViewError ? { code: error.reason, message: error.message } : nativeDiagnostics?.operation === `review/${operation}` || preservesNativeTargetStatusDiagnostic || preservesAnswerConsentStartDiagnostic diff --git a/odd/tasks/fix-2376-candidate-owner-preparation-errno-diagnostic.md b/odd/tasks/fix-2376-candidate-owner-preparation-errno-diagnostic.md new file mode 100644 index 000000000..b2d3774dc --- /dev/null +++ b/odd/tasks/fix-2376-candidate-owner-preparation-errno-diagnostic.md @@ -0,0 +1,28 @@ +# Task Breakdown: Fix #2376 Candidate Owner Preparation Errno Diagnostic + +**Feature:** `fix-2376-candidate-owner-preparation-errno-diagnostic` +**Issue:** #2376 (`gentle_review START: candidate-owner-preparation-failed drops the errno, leaving the failure undiagnosable`) +**Strategy:** Strict TDD, ODD workflow, Conventional Commits + +--- + +## Tasks + +### 1. Test (RED): Unit test for candidate owner preparation errno diagnostic +- [x] In `tests/gentle-ai.test.ts`: + - Update `ordinary START reports candidate-owner preparation failure as pre-native no mutation` to throw `new CandidateViewError("candidate view owner preparation failed (EACCES)", "candidate-owner-preparation-failed")`. + - Assert that `result.diagnostics` preserves `message: "candidate view owner preparation failed (EACCES)"`. + - Evidence: Red test failure `message: 'candidate view rejected before native START'` observed before fix. + +### 2. Implementation (GREEN): Preserve CandidateViewError message +- [x] In `extensions/gentle-ai.ts`: + - In `nativeOperationFailure`, update the pre-native `CandidateViewError` fallback from `"candidate view rejected before native START"` to `error.message`. + - Evidence: 123/123 tests passing in `tests/gentle-ai.test.ts`. + +### 3. Verification & Regressions +- [x] Run test suite: `node --experimental-strip-types --test tests/gentle-ai.test.ts`. +- [x] Run typecheck: `npm run typecheck` (0 diagnostics, 0 regressions). +- [x] Evidence: 0 regressions, all tests passing. + +### 4. Work-Unit Commit +- [x] Create conventional commit: `fix(review): preserve candidate-owner preparation errno in diagnostic message (#2376)`. diff --git a/tests/gentle-ai.test.ts b/tests/gentle-ai.test.ts index 9755f62f9..bacd8f2f7 100644 --- a/tests/gentle-ai.test.ts +++ b/tests/gentle-ai.test.ts @@ -1085,7 +1085,7 @@ test("ordinary START reports candidate-owner preparation failure as pre-native n start: async () => { nativeStarts += 1; throw new Error("native START must not run"); }, } as unknown as NativeReviewCli; const candidateViews = { - createOrReuse: () => { throw new CandidateViewError("candidate view owner preparation failed", "candidate-owner-preparation-failed"); }, + createOrReuse: () => { throw new CandidateViewError("candidate view owner preparation failed (EACCES)", "candidate-owner-preparation-failed"); }, } as unknown as CandidateViewRegistry; const result = await __testing.executeReviewControllerOperation( { operation: "start", input: JSON.stringify({ mode: "ordinary" }) }, @@ -1099,7 +1099,7 @@ test("ordinary START reports candidate-owner preparation failure as pre-native n assert.equal(result.mutation_outcome, "none"); assert.deepEqual(result.diagnostics, { code: "candidate-owner-preparation-failed", - message: "candidate view rejected before native START", + message: "candidate view owner preparation failed (EACCES)", }); let materializationStatusCalls = 0;