Repository navigation
Commit afe6024
committed
refactor(task): drop the registry accessors no production code calls
Row 4488930532 on Zoo-Code-Org#1394 asks whether has, clear and size earn their keep. Measured across
src, packages, webview-ui and apps before touching anything: production touches this registry
in exactly three places - ReadFileTool.ts:846 (observe), 848 (forget) and Task.ts:303
(constructing it) - and has, clear and size had no production call site anywhere; every access
was in a spec (get 15, size 6, has 4, clear 1). has and size are removed.
get stays, for a different kind of evidence than a spec calling it: it has a named consumer in
the header, the S4 guard that will compare these tokens against the pre-write recomputation.
clear goes on a structural argument rather than a count. Task.ts:303 makes the registry a
readonly field of the Task, so each Task constructs its own and nothing anywhere clears or
disposes one; a per-task instance needs no reset because the next task constructs a new
registry. clear would only be meaningful under a design that shares one registry across
tasks, which phase S4 has not decided, so the reset lands with whoever needs it and the header
says so. The unbounded-map concern points the other way only if a registry outlives its task,
and today nothing outlives the task.
What each removal cost, stated per case rather than in aggregate:
- the has case tested a member that is gone, and its presence claim was already carried by the
get assertions in the case above it: that one was a duplicate, not a coverage.
- the size case and the clear case tested members that are gone; with no size and no clear
there is no behaviour of theirs left to cover, so no observable fact went with them.
- the two reg.size === 0 assertions in readFileTool.spec.ts each sat immediately below an
assertion that reg.get(observedPath) was undefined and restated it, so they were deleted.
- the three assertions written against observationRegistry!.size were rewritten to a get on
each case's own path instead of deleted, because the fact they were asserting is that no
observation was recorded: in a fresh registry with a single file involved, target-absence is
the same fact. The case title that named the registry size was retitled to match what it now
asserts, and the two comments that said the registry stays empty now say what that means.
Control on the rewrites: making ObservationRegistry.forget return true without deleting
reddens them - 1 failed | 4 passed (5) here and 2 failed | 94 passed (96) in
readFileTool.spec.ts - so the rewritten assertions describe behaviour rather than merely
compiling. The whole core/tools directory passes: Test Files 31 passed (31) Tests 699 passed | 5 skipped (704).
readFileTool.spec.ts passes at Test Files 1 passed (1) Tests 96 passed (96) and Task.spec.ts at
Test Files 1 passed (1) Tests 201 passed (201), both with the narrowed registry.
Suppressions: eslint --prune-suppressions exits 0 on all three files and the entry for
core/tools/__tests__/readFileTool.spec.ts stays at 95 - no increase - while
observationRegistry.ts and its spec have no entry. Prune rewrites the whole file's indentation
(1441 insertions and 1441 deletions with every count unchanged), so the HEAD bytes were
restored after probing and this commit carries no suppressions churn.
Gates run against this tree before staging: pnpm --dir src run lint exit 0 in 27s with the
eslint cache deleted first and rewritten by the run, tsc --noEmit -p . exit 0 with no diagnostics,
prettier --check exit 0 on the three files. ReadFileTool.ts and Task.ts are untouched.1 parent 323d2d8 commit afe6024
3 files changed
Lines changed: 12 additions & 47 deletions
File tree
- src/core
- task
- __tests__
- tools/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 43 | | |
51 | 44 | | |
52 | 45 | | |
53 | 46 | | |
54 | 47 | | |
55 | 48 | | |
56 | 49 | | |
57 | | - | |
58 | 50 | | |
59 | 51 | | |
60 | 52 | | |
61 | 53 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 54 | + | |
81 | 55 | | |
82 | 56 | | |
83 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 49 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1845 | 1845 | | |
1846 | 1846 | | |
1847 | 1847 | | |
1848 | | - | |
| 1848 | + | |
1849 | 1849 | | |
1850 | 1850 | | |
1851 | 1851 | | |
| |||
1859 | 1859 | | |
1860 | 1860 | | |
1861 | 1861 | | |
1862 | | - | |
| 1862 | + | |
1863 | 1863 | | |
1864 | 1864 | | |
1865 | 1865 | | |
| |||
1885 | 1885 | | |
1886 | 1886 | | |
1887 | 1887 | | |
1888 | | - | |
1889 | | - | |
| 1888 | + | |
| 1889 | + | |
1890 | 1890 | | |
1891 | 1891 | | |
1892 | 1892 | | |
| |||
1937 | 1937 | | |
1938 | 1938 | | |
1939 | 1939 | | |
1940 | | - | |
1941 | 1940 | | |
1942 | 1941 | | |
1943 | 1942 | | |
| |||
1979 | 1978 | | |
1980 | 1979 | | |
1981 | 1980 | | |
1982 | | - | |
1983 | | - | |
| 1981 | + | |
| 1982 | + | |
1984 | 1983 | | |
1985 | 1984 | | |
1986 | 1985 | | |
| |||
2043 | 2042 | | |
2044 | 2043 | | |
2045 | 2044 | | |
2046 | | - | |
2047 | 2045 | | |
2048 | 2046 | | |
2049 | 2047 | | |
| |||
0 commit comments