Unit U6 of the PR #1066 split (5/6).
Split plan: #703
PR: #1932
Content source of record: tag pr1066-source = 46d1d218701f0ce2d675b1b315489bacb6b0f77d (easonLiangWorldedtech/Zoo-Code).
Unit contract
The execute() cleanup invariant: a finally around handleError so the diff cleanup runs even when handleError rejects, the writeApproved flag, and the consecutive-mistake-counter order.
Why this unit exists on its own
Single provider group + single gate scope (the execute() error path).
Boundary
Files and budget
src/core/tools/WriteToFileTool.ts +45/-11 — content subset of source
src/core/tools/__tests__/writeToFileTool.spec.ts +379/-4 — content subset of source
- budget: 439 a+d / 2 files — SOFT-OVERSHOOT (rationale: single provider group + single gate scope; under the 1000 hard cap)
- mutation gate: 34 changed executable lines — under the 500 cap; valid mutants for the whole PR are 116 / 400, so no directive was added by this unit.
Verification (must pass by once, binary)
zdt split verify --contract U6.json --worktree <wt> --head 9b93a6f882a4 — PASS (every changed file is a content subset of the source of record, or an explicitly sanctioned allowNew file).
- Tests: 259 passed / 5 skipped, exit 0 (narrowest relevant suites:
Task.spec.ts, writeToFileTool.spec.ts, writeToFileTool-partial-state-cleanup.spec.ts, removeClineFromStack-delegation.spec.ts, presentAssistantMessage-custom-tool.spec.ts).
- Changed-line coverage: 14 covered / 0 uncovered — PASS.
- ESLint
--prune-suppressions --max-warnings=0: clean on every touched file; suppression counts unchanged.
- No
.changeset file, no CHANGELOG edit (AGENTS.md).
Deviations recorded
- Owns the test
reports a filesystem error only once across the streaming and execute phases, originally attributed to U5 (see U5).
Reproduce
git fetch https://github.com/easonLiangWorldedtech/Zoo-Code p1066/u6-execute-error-path-cleanup
node zdt.mjs split verify --contract U6.json --worktree <wt> --head 9b93a6f882a4
node zdt.mjs split measure --worktree <wt> --base e3c10401f760 --head 9b93a6f882a4
pnpm --dir src exec eslint --prune-suppressions --max-warnings=0 <touched file>
Unit U6 of the PR #1066 split (5/6).
Split plan: #703
PR: #1932
Content source of record: tag
pr1066-source=46d1d218701f0ce2d675b1b315489bacb6b0f77d(easonLiangWorldedtech/Zoo-Code).Unit contract
The
execute()cleanup invariant: afinallyaroundhandleErrorso the diff cleanup runs even whenhandleErrorrejects, thewriteApprovedflag, and the consecutive-mistake-counter order.Why this unit exists on its own
Single provider group + single gate scope (the execute() error path).
Boundary
e3c10401f760(previous unit head, U3)9b93a6f882a4Files and budget
src/core/tools/WriteToFileTool.ts+45/-11 — content subset of sourcesrc/core/tools/__tests__/writeToFileTool.spec.ts+379/-4 — content subset of sourceVerification (must pass by once, binary)
zdt split verify --contract U6.json --worktree <wt> --head 9b93a6f882a4— PASS (every changed file is a content subset of the source of record, or an explicitly sanctionedallowNewfile).Task.spec.ts,writeToFileTool.spec.ts,writeToFileTool-partial-state-cleanup.spec.ts,removeClineFromStack-delegation.spec.ts,presentAssistantMessage-custom-tool.spec.ts).--prune-suppressions --max-warnings=0: clean on every touched file; suppression counts unchanged..changesetfile, no CHANGELOG edit (AGENTS.md).Deviations recorded
reports a filesystem error only once across the streaming and execute phases, originally attributed to U5 (see U5).Reproduce