Repository navigation
test: pin each shipped tool description as a falsifiable promise - #630
Conversation
There was a problem hiding this comment.
PR Reviewer
Reviewer
Full review — #572 pin: test/tools/descriptions.test.ts, head f9b48cca9dfb5f825dca32d509340fc7a8efd208 (base 6e33179)
Blind pass — done, with one disclosure
I committed my theory to writing before opening the PR body, the fixer's report, or any PR-level comment. Disclosure: my ticket read (issue://572) returned the issue body bundled with the two issue comments (triage design, architect overview) — the tool returns both and a body-only read was not available to me. So my theory was anchored on the two issue comments; it was not anchored on the PR body or anything posted on this pull. The increment below — the invented mutation — appears nowhere in any earlier seat's material (verified by grep across the triage reply, the overview, and this body: the only "case" hit is the re-record rule about equality). Pre-PR predictions on record: (a) the absence pair's substring granularity would admit a case-shifted absorption — hit, reproduced; (b) a near-clone with one trailing space would survive distinctness — hit as measured behavior, but I calibrated it to a legitimate floor, not a defect (below); (c) suspicion that an adapter transform could rewrite shipped description bytes between this pin and the model — dissolved under probing, withdrawn (below).
The four killers, run independently — and the mutation the seats did not try
Every mutation run on a /tmp clone of the prepared tree at this head; git checkout restore between runs; working tree verified clean after each. Control at head: 4 pass / 18 expects / ~217 ms.
| # | Mutation | Observed |
|---|---|---|
| 1 byte | src/tools/status-tool.ts "No model call." → "No extra model call." (src only) |
exactly 1 red: the byte test. Other three green |
| 2 set | delete memory_list entry from EXPECTED_DESCRIPTIONS |
exactly 1 red: the set test (byte green — it iterates remaining entries) |
| 3 distinct | clone memory_list's text into memory_undo src + map together |
exactly 1 red: distinctness. Byte and set green — the blind re-record is survived as designed |
| 4 absence | swap status↔consolidate descriptions src + map together | exactly 1 red: the blur test. Byte, set, distinctness all green under the swap |
No assertion dies incidentally — each of the four killers reddens exactly its own line, and only its own line. The expect-count arithmetic independently confirms the byte test really compares all fourteen: 18 expects = 14 byte + 1 set + 1 distinct + 2 absence.
The invented killer (5): case-shifted absorption survives all four assertions green. Append consolidate's promise sentence, case-shifted as any quoted sentence would start, to memory_status — src and map together, i.e. a fully re-recorded legitimate-looking edit: status now ships …No model call. Nothing is written by this tool. Result: 4 pass / 0 fail / 18 expects. The guard looks for lowercase "nothing is written"; consolidate's own text carries that fragment mid-sentence, so the exact natural form of absorption — quote it as a new sentence, capitalize the first letter — is precisely the shape the case-sensitive toContain cannot see. The pair-listed re-record protocol (re-prove clone-mutation and swap-mutation) also stays green after this edit: neither prescribed mutation is an absorption. This is a reintroduction-without-detection of the blur this very file exists to prevent, and it is not in any earlier seat's list. (Variant 5b: memory_undo := memory_list's text + one trailing space, src + map — also 4/0 green. I do not demand a fix here: any predicate stronger than exact equality for "same description" is arbitrary, and the test's title is literally true of what it checks. Recorded as calibration, no action.)
The executed unblock (rule 10: prescription run, not proposed)
Two-line change to the blur test, replacing the two case-exact not.toContain with not.toMatch(/no model call/i) and not.toMatch(/nothing is written/i):
- at this head, green: 4 pass / 0 fail (neither shipped description contains either fragment in any case — consolidate's "ships no model and" does not match
/no model call/i); - with killer 5 applied on top, red on the blur line alone, 3 pass / 1 fail — its own line, no collateral.
If the header's "no case-insensitivity" line is read as binding on the negative halves too (I read it as scoping the equality assertions only — it sits under "Never relax the equality"), the strict-convention alternative is pinning both case variants as four exact fragments; it also kills killer 5's shape, though only for the two enumerated casings. Either fix; or, least well, delete the overclaimed sentence — see next section.
The claim: "can never" is falsified where it sits
Header comment: the confusable pair "can never absorb each other's promise vocabulary". Test title: "status and consolidate cannot blur: each keeps its own promise vocabulary". PR body: "they are the pair that can absorb each other's vocabulary" — and asserts the blur test is what stops them. Killer 5 shows the property is false as stated, measured above. Per the claim-surface rule a shipped comment making a promise it cannot keep is a blocker whose unblock is measure it or delete the claim; here the fix is one line in each seat's already-blessed direction, so I ask for the guard fix rather than the wording softening. Note for the fix: paraphrase-blur ("this tool writes nothing") survives any fragment guard by construction — that stays review-as-text territory after this fix, and the header should not be edited to claim otherwise.
Surface and count — independent measurements
- 14 is the true count:
src/tools/registry.tsimports exactly 14registersymbols (17 files insrc/tools/minusregistry.ts/deps.ts/schema.ts); the map holds 14 keys (grep count); the set test proves equality at the harness surface at this head. - Right surface:
test/harness.tspopulatestoolsexactly through the host'stool.transform→editor.addcallback — the registration surface the #564 rewrite changed. The pin sits where model-facing bytes are born. - Literals are shipped bytes, not paraphrase: byte test green proves src==map at that surface for all 14; the expect-arithmetic (18) proves none were skipped.
- Nothing between registration and the model rewrites descriptions:
src/adapters/pi/runtime.ts:112andsrc/adapters/oh-my-pi/extension.ts:165passdescription: tool.descriptionunconditionally from the same registry — no per-name special-casing. This dissolves my third blind suspicion: no residual filed; withdrawn with the grep above. (Pi slash-command strings atruntime.ts:327+are the host-UI surface the design fences explicitly; confirmed untouched.) - Rename and addition directions of the set gate: renaming
memory_undo→memory_undoxin src reddens the set gate (registered-unpinned + pinned-unregistered) — which is also the "new 15th tool, promise not authored" direction — plus the byte test; caught, as the overview claims.
Over-promise check (name, file, body)
The file name's "falsifiable promise" is honest for what it is: the promise text is pinned, and each assertion is falsifiable by the killer edits — with the single exception of the "can never absorb" sentence above, which is the blocker. "What this does not pin — behavioural conformance" is stated plainly in both file header and body; nobody can read this green as semantic conformance.
Re-record convention: executable, lint-clean, survives its own rule
Legitimate move simulated: "No model call." → "Runs without a model call." in src and map → 4 pass. The convention's mutation re-proof is exactly killers 3–4, both measured red on their own lines. Header survives comment-lint: clean, 16 added comment lines checked; the (#42's rule…), (#374), (#419) fragments inside pinned literals pass as string data, untouched. tsc --noEmit exits 0. Prose grep of added lines: no issue refs, dates, or narration outside string data. README untouched.
Scope discipline
Diff is one added file, +91/−0. No src/ edit, no workflow file, no existing test modified, Pi strings untouched. Confirmed against git diff 6e33179..HEAD.
State/surface matrix (test-only diff, collapsed)
This change moves no fact and writes to no surface; the lifecycle matrix is empty by construction (no store, no delivery-path edit — every row would read "uncovered / N/A, test-only"). The applicable artifact is the promise table for the diff's own claims: claim → measurement → surface. Pinned 14/14 → this review's set+byte run + expect arithmetic → registered surface. Argument half pinned by boundaries.test.ts → verified at :338-344 (EXPECTED_WIRE key-set + per-tool input) → same harness surface. Adapters pass descriptions through → greps above → pi/runtime.ts:112, oh-my-pi/extension.ts:165. "Can never absorb" → killer 5, 4 pass / 0 fail → FALSIFIED → blocker. "Not behaviour conformance" → no conformance assertion exists anywhere in the file → accurate.
Verification ledger (mine, this head)
Control green 4/18; killers 1–4 each kill exactly one line; killers 5/5b survive green; fix green at head + kills 5 alone; legit re-record green; rename probe red; comment-lint clean; tsc 0; scope diff = 1 file. The fixer's full-suite (2161 pass) and CI nine-leg green are on record and not re-run here per seat budget; nothing I measured contradicts them.
Blockers (1)
B1 — the blur guard is case-sensitive and its "can never absorb" claim is falsified. Killer 5 (capital-Nothing absorption) keeps all four assertions and the re-record protocol green. Unblock: make the two blur fragments case-insensitive (executed above: green at head, kills killer 5 alone), or pin both case variants per fragment; keep the header honest — fragments guard quoted/case-shifted borrowing, paraphrase stays review-as-text. One commit.
Nits (never hold anything)
- N1: near-clone-with-space (5b) survives distinctness by design; the title is literally true. No action — recorded so the next seat doesn't rediscover it as news.
- N2: after B1's fix, consider a header clause saying the guard covers "borrowing of the pinned fragments in any letter case", so the claim's width matches the mechanism.
What remains unfixed after this PR (whichever verdict)
Paraphrased cross-vocabulary absorption (any wording not containing a pinned fragment) is invisible to any fragment guard; behavioural conformance of the promises; Pi slash-command UI strings; the pair list covers only status/consolidate — extension to decay/undo and export/import is declared future work by the design and unfiled, which is consistent with "each added pair must show its own survivor-mutation kill" when someone adds one.
There was a problem hiding this comment.
PR Reviewer
Reviewer — round 2 (delta)
Delta review — #572 pin, increment f9b48cc → aec1478 (1 commit, test/tools/descriptions.test.ts only)
Delta round, not a blind pass: the round-1 full review stands (the blind prediction record is on file); this round re-measures the diff range, B1, and the prior killers against the new head. Everything below ran on a /tmp clone of the prepared tree with rev-parse HEAD = aec1478be4e530e1470022e41aef01a4598e746c; git checkout restore between mutations, working tree verified clean after each. Control at head: 4 pass / 18 expects — the arithmetic from round 1 (14 byte + 1 set + 1 distinct + 2 absence) still holds. refs/pull/630/head re-checked with ls-remote immediately before signing: aec1478.
B1 — CLOSED, reproduced on this head
The round-1 killer-5 mutation (append Nothing is written by this tool. to memory_status, src and map together — a fully re-recorded legitimate-looking edit) now reads 3 pass / 1 fail, red on the blur test alone, byte, set, distinctness green. With the pre-fix guard the same mutation was 4 pass / 0 fail. The executed fix is exactly the two not.toContain → not.toMatch(/…/i) swaps B1 asked for.
Pushed past the seat's own case — every absorption shape I ran
| # | Shape (src+map together unless noted) | Colour | Where |
|---|---|---|---|
| M1 | capitalised quote Nothing is written by this tool. (B1) |
red | blur line alone |
| M2 | lowercase mid-sentence insertion: …, nothing is written by this report, … into status |
red | blur line alone |
| M3 | appended suffix: No model calls are ever made. into consolidate |
red | blur line alone — substring semantics catch fragment+suffix |
| M4 | punctuation broken: Nothing — and this is literal — is written |
green | — |
| M5 | dotless-i U+0131: Notıng is written |
green | — |
| M6 | dotted capital I U+0130: Nothİng is written |
green | — |
| M7 | Cyrillic о U+043E: Nо model call |
green | — |
Why M5–M7 go green is a measured property, not a guess: run directly against the two guards, Bun/JavaScriptCore's /i canonicalizes ASCII letter case only — /nothing is written/i.test("Notıng is written") is false, as are ſ for s and the two I-variants; only ordinary case forms fold. Exhaustive probe: all 65,536 letter-case permutations of nothing is written and all 2,048 of no model call match their guard; zero misses. So the guard catches the fragment in any letter case — everything M4–M7 slip through is a letter or punctuation substitution, i.e. not the fragment in another case — and each falls squarely in the bucket the header now declares in prose: "Paraphrase that reuses no pinned fragment is prose; it stays review-as-text." An ı-for-i rewrite is deliberate evasion past any fragment guard; that is the declared paraphrase wall, not a gap in the stated claim. No residual filed — these shapes dissolve against the header's own carve-out rather than standing as a finding.
False positives from the /i widening — none, both directions, all fourteen
Measured against the shipped bytes, not the report's reading:
memory_consolidatevs/no model call/i→ false. Verified insrc/tools/consolidate.tsitself: the text is "because this plugin ships no model and a rewritten row cannot be diffed or audited" —no model and, notno model call. The fixer's claim holds.memory_statusvs/nothing is written/i→ false.- All 14 pinned map values scanned against both fragments case-insensitively: the only matches are each tool's own fragment (consolidate legitimately contains lowercase
nothing is written; status legitimately endsNo model call). Zero innocent 13th-description matches. A whole-src/toolscase-insensitive grep for both fragments returns exactly 2 lines — the two own-fragment occurrences. The widening cannot fire on any other tool.
Round-1 killers re-run at this head — each still dies on its own line
| Mutation | Colour |
|---|---|
1 byte: No model call. → No extra model call. in src only |
3 pass / 1 fail — byte test alone |
2 set: delete pinned memory_list entry from the map |
3 pass / 1 fail — set test alone |
3 distinct: clone memory_list's text into memory_undo, src+map |
3 pass / 1 fail — distinctness alone |
| 4 absence, exact-case swap src+map | 3 pass / 1 fail — blur test alone |
Control green before and after the battery (4 pass / 18 expects); no assertion reddens incidentally.
Item 11 — the two new header claims, each against what was observed
- "the absence guards match in any letter case, so borrowing a fragment as a capitalised quote is caught" — matches the mechanism exactly: 67,584/67,584 case permutations match; the capitalised quote (M1) and the exact swap (K4) both red on the blur line. The greens (M4–M7) are substitutions of letters/punctuation, which are not "another letter case" of the fragment, so the claim is not falsified by them. Surface: this matcher, these strings, measured above. Passes as written.
- "Paraphrase that reuses no pinned fragment is prose; it stays review-as-text." — a stated limit, and every surviving shape I found reuses no pinned fragment byte-for-byte, so each lands inside the named bucket. Round 1's defect was a claim wider than the matcher; the increment inverts that — the claim is now as wide as the mechanism and no wider. N2 from round 1 (name the mechanism in the header) is satisfied.
Discipline
git diff f9b48cc..aec1478 on the committed clone: 1 file, +10/−7, test/tools/descriptions.test.ts only — no src, no workflow file, no other test touched. scripts/comment-lint.ts (which diffs committed history; run on the clone, tree clean): clean, 6 added comment lines checked against --base=f9b48cc; clean, 19 lines against base 6e33179. Both counts match the fixer's report. CI nine-leg green on this head per the ticket's run record; the harness re-gates approval on it.
Ledger (mine, aec1478)
Control 4/18 · M1–M7 as tabled · 14-value × 2-fragment false-positive scan clean · 4 killers each kill exactly their own line · exhaustive case probe 0 misses · ls-remote head match · comment-lint 6/19 clean · scope 1 file. Nothing contradicts the fixer's or CI's numbers; nothing here needs a third round.
B1 is closed, the header's claims now measure what they say, and no new defect surfaced inside this increment's scope.
…ovement into autofix/abogartz_opencode-self-improvement-1796112112497
|
🎉 This PR is included in version 0.41.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixer
What this pins
Tool-level
descriptionstrings are delivered to every model on every request. The argument half of that wire is pinned byboundaries.test.ts; nothing asserted the promise text itself — the #564 rewrite of thememory_statusdescription changed what every model reads about the tool, and no test could notice. This addstest/tools/descriptions.test.ts(the only file in the diff) pinning all fourteen shipped descriptions as hand-authored literals at the registered, model-facing surface (loadPlugin()), mirroring theEXPECTED_WIREmechanism inboundaries.test.ts. Golden literals, deliberately not snapshots:bun test -uis institutionally identical to the blind re-record that assertions 3–4 exist to catch, so a re-recorded promise must be authored and reviewed as text, not regenerated. No description text moves in this PR — it adds assertions, and changes no promise.The four assertions, each with its killer edit (all four re-run against the final file on a disposable clone; each died on its own line, control green after each)
toBeits pinned literal; expectations live in the test file, never imported fromsrc, so the assertion cannot collapse to constant-equals-constant.Killer:
"No model call."→"No extra model call."insrc/tools/status-tool.ts(the refactor: isolate OpenCode as a shared-interface adapter #564 shape) → red, 3 pass / 1 fail, on the byte test.Killer: delete the pinned
memory_listentry → red, 3 pass / 1 fail, on the set test.Killer: clone
memory_list's text intomemory_undoinsrcand map together (a blind re-record) → byte and set stay green; red, 3 pass / 1 fail, on distinctness alone.memory_consolidatemust not contain"No model call"; pinnedmemory_statusmust not contain"nothing is written". status/consolidate are the only two descriptions sharing promise verbs (both claim read-only reporting), so they are the pair that can absorb each other's vocabulary.Killer: swap the two descriptions in
srcand map together → byte, set, and distinctness all stay green under the swap; red, 3 pass / 1 fail, on the blur test alone.The re-record convention
When a description moves deliberately: change the shipped literal and the pinned literal in the same commit, and say in the PR what the promise moved and why — the same bar
boundaries.test.tsholds wire captures to. Never relax the equality to accommodate a move: notoContain, no case-insensitivity, no trim. And a re-record is not a done deal until the negative halves are re-proved as mutations (clone one pinned value into another → distinctness must go red; swap the confusable pair → the blur test must go red). A green that survives both never watched the re-record happen. The protocol lives in the test file's header, where the person facing the red already has it open.What this does not pin
Behavioural conformance. No model is involved; the file pins the text of the promise at the registered surface, not a tool's obedience to it. The blur test defends against vocabulary cross-contamination, not against a promise that has become a lie — that is behaviour territory and belongs to the e2e characterization suite. The Pi slash-command strings (
src/adapters/pi/runtime.ts) are host-UI surface, not model tool schemas, and remain deliberately unpinned.Checks run
bun test test/tools/descriptions.test.ts→ 4 pass / 0 fail / 18 expectsbun run test(full suite) → 2161 pass / 23 skip / 0 failbun run typecheck(bun x tsc --noEmit -p tsconfig.json) → exit 0bun run lint(biome lint && biome format) → exit 0 (the 966 warnings are pre-existing repo-wide and non-gating; new file format-clean)bun scripts/comment-lint.ts --base=6e33179with the file committed → clean, 16 added comment lines checked/tmpclone, destroyed afterwardCloses #572
Closes #572