Repository navigation
Description
Split-unit tracking note for the file-write-safety chain (#1375), filed 2026-11-11 for upstream PR 1918, unit U7 of that split. This note is the plan-of-record carrier for it.
Refreshed 2026-12-02 by the lead. The figures written on 2026-11-11 - head 1d993fb42d4b1ae7657336371b40cac9aad72396, deciding package extension at 1853 changed executable lines measured against main tip 18861b2e3572 - are superseded. The head has moved through fifteen pushes of review fixes since then, and the size figure below is measured against the base the pull itself reports, which is the base its CI uses.
Unit and measurement basis
- Unit U7: branch
fws/u7-tool-wiring, upstream PR 1918. Head29e7a62a30a792be93af2a1ed7251ba0c6b84fec(push 143, 2026-12-02). - Base tip for every figure here:
41cf71a72c45fefb69b6be785c4620669f41c1e9. Picking a different base moves the number: an earlier round of mine reported a constant plus-five against the gate and that five was this base difference, not an instrument difference. - Verbatim from this head's gate job:
Mutation gate failed: extension has 2349 changed executable lines (limit 500). Split the PR or obtain a maintainer-reviewed narrow exclusion. - This is a size failure, not a mutant failure. Writing more tests cannot clear it: only a split, or a maintainer-reviewed narrow exclusion.
Where the mass is
Changed executable lines in the deciding package at this head, per file, descending:
- 823
src/integrations/editor/DiffViewProvider.ts - 427
src/services/file-safety/safeWriteText.ts - 402
src/core/tools/guardedWrite.ts - 322
src/core/tools/ApplyPatchTool.ts - 152
src/utils/safeWriteJson.ts - 43
src/core/tools/ReadFileTool.ts - 41
src/utils/fileLock.ts - 30
src/core/tools/ApplyDiffTool.ts
Sum over the files: 2349, equal to the figure the gate printed. DiffViewProvider.ts alone is 823, over the cap on its own, so it is cut across two units at a member seam.
Plan: six units, every one inside the cap
Branch names are placeholders fixed at cut time. Counts are changed executable lines in the deciding package, measured rather than estimated: each line was attributed to the class member that owns it, using the fact that prettier indents class members by exactly one tab and statements inside them by two or more, and the attribution reconciles to the file total with nothing left over.
| unit | executable lines | scope, read off the members and files that carry it |
|---|---|---|
| -u1-member | 497 | 174 previewUndoRegions, 162 revertChanges, 161 saveChanges |
| -u2-member | 326 | 43 open, 38 closeOwnDiffView, 34 saveDirectly, 32 runTeardown, 21 lastEligibleCopyEnd and 26 smaller |
| -u3-src-services-file-safety-safe-writ | 427 | 427 services/file-safety/safeWriteText.ts |
| -u4-src-core-tools-guarded-write | 402 | 402 core/tools/guardedWrite.ts |
| -u5-src-core-tools-apply-patch-tool | 474 | 322 core/tools/ApplyPatchTool.ts, 152 utils/safeWriteJson.ts |
| -u6-src-core-tools-read-file-tool | 223 | 43 core/tools/ReadFileTool.ts, 41 utils/fileLock.ts, 30 core/tools/ApplyDiffTool.ts, 26 core/tools/WriteToFileTool.ts, 23 core/tools/EditTool.ts and 7 smaller |
| total | 2349 | equals the gate figure 2349 |
Topology and merge order
Stacked chain on top of fws/u7-tool-wiring, declared merge order fws/u7-split-u1-member then fws/u7-split-u2-member then fws/u7-split-u3-src-services-file-safety-safe-writ then fws/u7-split-u4-src-core-tools-guarded-write then fws/u7-split-u5-src-core-tools-apply-patch-tool then fws/u7-split-u6-src-core-tools-read-file-tool. No unit carries the next unit's content. Until the last unit lands, upstream PR 1918 keeps its red advisory mutation-diff, which is expected and not a regression.
Cross-unit contract points
safeWriteText.tsandguardedWrite.tstravel whole. They are leaf primitives, so no seam is cut inside either.- The seam inside
DiffViewProvider.tsfalls between the publish and revert path on one side and the session, open, teardown and eligibility helpers on the other. Session state is shared by both paths, so whichever unit is cut first keeps the fields and the other unit may only add behaviour on top: it must not redeclare state. - Test files ride with the unit that owns the production file they test. A unit of production code alone with its spec left behind in a later unit is not merely untidy: the gate rejects it with
extension has no tests related to the changed executable lines. - Two further limits read straight out of
scripts/stryker-diff.mjs. The size test ischangedExecutableLines > MAX_CHANGED_LINESwith that constant set to 500, so a unit at exactly 500 passes and has no headroom.MAX_MUTANTS = 400is a separate per-package currency, applied as an advisory on valid mutants generated, not on lines.
Provenance
Measured with scripts/stryker-diff.mjs: parseChangedLines then executableChangedLines, counted per package with spec paths excluded, run locally against the head and base named above. The same instrument now reproduces the CI figure at four heads: 2349 for this pull, 3032 for upstream PR 1565, 697 for 2237 and 2128 for 1552, each equal to the number that head's own gate job printed.
What upstream PR 1918 becomes
It stays open until the units above land. Its body points at this note, and each unit PR cites this issue.
Activity