Repository navigation
Description
Related to #389. Follow-up from PR #493 review context; B5 label previously appeared only in fixture/source comments.
Problem
Known B5 false-refusal bug in src/capture/available.ts: figure rules disagree at figure edges. findClause/region bounds can admit a region ending at a non-word . while numericTokens treats . as figure continuation, slicing dotted figures. Examples: Requires Python 3 vs Requires Python 3.12, The cost is 11 vs The cost is 11.5.
Current vouch path: check() slices haystack.slice(region.start, region.end) and passes it to numericTokens(...) (around 949-970). Region bounds come from restatedContiguously/findClause; if a bound lands on a figure edge, the slice can tokenize a partial figure.
No existing regression test coverage found for 3.12/11.5 cases.
Proposed fix (separate step, not tests-as-is)
One invariant: regions never slice figures; only whole figures vouch.
- Snap region bounds outward over
[0-9.], or vouch whole tokens intersecting[start, end). - Should collapse/subsume
figureRun+isTokenChar+hitCoversFigures+figuresWithininto one definition. - Verdicts change by design; land as own step: add B5 regression test first (red), then fix, keep other tests green.
Tests-as-is refactor opportunity (safe before/alongside)
- Flatten
check()(917-1026): hoist tree-path and gate-path checks into top-level helpers taking(haystack, slices, gates, ...). No verdict change. - Consolidate boundary/token/figure model:
isBoundary,isTokenChar,figureRun,splitClaims,sentenceSpan,findClause,hitCoversFigures,gapIsPunctuation,figuresWithin/numericTokens. Name the invariant explicitly. - Compress design-history comments into one header design note + short invariant pointers; keep invariant-bearing comments.
- Realistic outcome: ~750-800 lines (~25% down). Algorithmic complexity remains - six vetoes over positional matcher.
Key files
src/capture/available.tssrc/core/tokenize.ts(numericTokens)- tests:
test/capture/capture-available.test.ts,test/capture/available-fail-open.test.ts,bench/fixtures/availability-cases.ts
Activity
abogartz commentedon Nov 23, 2026
Repro on
maind5fa338e: the named examples are already pinned, two other shapes are liveThe two examples in the problem statement do not reproduce, and the reason is that PR #493 already shipped pins for them.
test/capture/availability-case-bank.test.tsruns the bank in CI and asserts both:figure-trunc-version-tail— treeRequires Python 3.12, candidateRequires Python 3,expectTag: falsefigure-trunc-dotless-tail— treeThe cost is 11.5., candidateThe cost is 11,expectTag: falsetokens()keeps dotted figures whole —"Requires Python 3.12"tokenizes as["requires","python","3.12"]— so the claim matcher never matches3against3.12, no region is produced, and the candidate is kept. The statement "no existing regression test coverage found for3.12/11.5cases" is not correct for currentmain.The invariant this ticket states is still right, and two shapes that violate it are live and unpinned.
1. False refusal through the thousands comma — loses a fact.
Tracked
The limit is 1,024 rows.against candidateThe limit is 1givesREFUSED in_tracked_file. The comma splits the grouped figure, so the region vouches for a bare1the tree never states. The controlThe limit is 1,024 rowsrefuses correctly, so the relation is not simply dead.2. Missed refusal where a sentence-final period glues onto the figure — costs a duplicate.
Tracked
The ratio is 1.5.against candidateThe ratio is 1.5giveskept, although the tree states it. The same shape reproduces withThe cost is 11.5.againstThe cost is 11.5. The controlThe ratio is 1.5.— candidate carrying the dot — refuses correctly. This direction is fail-open, so it spends a row rather than a fact.Both directions come from one root cause:
tokens()treats.as figure continuation but,as a separator, and it does not strip a sentence-final.from a figure, so the figure edge the region logic sees is not the figure edge the tokenizer sees. The B6 work made dots inside a figure atomic; it did not cover the comma or the trailing period.Scope going forward. Fixing the two shapes above under this ticket, with bank rows for each plus the same-shape controls quoted here, so a green bank proves the relation moved rather than weakened. The
3.12and11.5examples stay as they are: already pinned, nothing to fix.ocsi-architect commentedon Nov 23, 2026
Pre-architecture review — Appendix A, before any code
Run against
src/capture/available.tsandsrc/core/tokenize.tsas they stand onmainatd5fa338e. Filesystem only: the PR thread, reviews and follow-up issues were not read, per the Appendix A contract. Deliverables are reproduced verbatim below; the tier call is at the end.Architecture review —
src/capture/available.ts@d5fa338eMeasurements first (scratch run, temp git repo, README =
The limit is 1,024 rows. The ratio is 1.5.):Orchestrator's five floor claims: all confirmed.
check()is 917–1026, vouch set built atavailable.ts:960, header claim atavailable.ts:247.Design space
The problem: decide "does the tracked tree already state this candidate" where false-refusal loses a fact forever. Options:
bench/fixtures/availability-cases.ts:261-266) kills it.available.ts:11-12).Figure-boundary sub-design (the defect site), independent of 1–8:
1,024→1024, trailing dot stripped; blast radius hits GATE-3 and the rejection sketch (tokenize.ts:1-7says they sharetokens()on purpose).Placement verdict
The implementation is 7+8 hybrid with 8a claimed but not enforced. It protects against reassembly (B5/B6), polarity reversal (
available.ts:690-693), warning-object matches (VETO 1b,available.ts:646-684), and operand reordering (available.ts:500-537). It does not protect the figure ontology itself. Three boundary vocabularies coexist:isBoundarytreats.and,as clause edges (available.ts:169-178);isTokenChartreats.as a figure char and,as neither (available.ts:704-711); the human notion treats both as inside a number. The contract "Nothing else in this file may decide where a figure begins or ends" (available.ts:717-719) is enforced by a hand-copied char class that duplicatestokenize.ts:29's split regex — correct today by eye, not by code.The shared definition is itself wrong in both directions, measured above:
tokens("1,024")→["1","024"], so1is a legal figure the tree "states"; the hitthe limit is 1ends at the comma, whichfigureRundoesn't see as figure territory, sohitCoversFigures(available.ts:745-751) admits it, and the region slice ends before024so the vouch set is{1}(available.ts:960). Refused. The comment atavailable.ts:247— "cannot be assembled out of separate integers" — is measured false for comma grouping, and ADR 0009's "A figure is one token wherever the matcher reads it" is false for1,024.tokens("1.5.")glues the sentence dot (tokenize.ts:29), so1.5 ∉ {1.5.}andhitCoversFiguresrejects the hit; the same fact refuses only if the candidate carries the period. Verdict depends on how the session phrased its prose.The bank pins six
1.5-family shapes (bench/fixtures/availability-cases.ts:162,191-215,228,261) and zero comma-grouped cases, zero trailing-period-flip cases. The escape-shape bank has the same blind spot as the matcher.Two alternatives
A. Single-source figure extent + canonical comparison.
(a) Export one
figureExtent(text, pos)fromtokenize.ts, built from the same grammar astokens(), with figure grammar[0-9](?:[,.][0-9])*where a separator counts only between digits (so1,024and1.4.3are one figure; the.of1.5.is not).numericTokenscompares canonical values (commas stripped).isTokenChar/hitCoversFigurescall it instead of duplicating.(b) Wins when comma-grouped and sentence-final figures are common in docs — they are in this repo's own prose, and the bank's silence is an artifact of authoring, not corpus.
(c) Distinguishing test, three bank cases: (
The limit is 1, tree1,024 rows.) expect keep; (The ratio is 1.5, tree1.5.) expect refuse; (The limit is 1,024, same tree) expect refuse. Current code: REFUSE / keep / REFUSE — fails two of three. A passes all three.B. Edge abstention (8d).
(a) In
findClauseafterhitCoversFigures: if the hit's edge token contains a digit and the adjacent haystack char is.or,, return -1. One function, one file, structurally veto-only.(b) Wins when
tokenize.tsis untouchable — and it is: GATE-3 floors and the tombstone sketch score ontokens()(tokenize.ts:1-7), so A's canonicalization is a cross-subsystem change with its own blast radius B doesn't have.(c) Distinguishing measurement: refusal rate over the bank corpus plus a real repo. Both fix the false refusal; A keeps the legitimate
1.5.refusal, B loses it. If the lost-refusal rate is material, A wins; if gates tests break, B ships first.Rot mechanism
src/capture/available.ts:704-711,isTokenChar. A maintainer fixes the comma bug the obvious way — add,toisTokenCharsofigureRunspans1,024— and does not touchtokens()attokenize.ts:29because that would change GATE-3 scoring and tombstone matching. NowhitCoversFiguresrefuses the1-prefix hit, butnumericTokensstill emits1and024separately, and any other path where a1-figure candidate reachesfiguresWithinagainst a region containing1,024gets vouched again. The two definitions diverge; the comment atavailable.ts:717-719becomes a lie; nothing fails. The bank pins verdicts on fixed strings, never the equivalence between the two definitions, so CI is green. Same rot on-(version ranges), same rot on any tokenizer "improvement".State-boundary map
Once-computed state consumed per item:
available.ts:955region →960re-tokenized slicenumericTokensre-decides figure edges on the slice — a second boundary decisionhitCoversFiguresnever madeThe limit is 1vsThe limit is 1,024 rows.→ REFUSE. Slice ends at comma; vouch set{1}; tree figure was1,024. False refusal.available.ts:990firstgateHit→1006introducesNewNumber(content, gate.label)operandsDeclareddeliberately re-hits per span (523, with the bug confession at524-529). The number veto was not given the same fixsync2+deploy --replicas 2against adeploygate lacking2keeps via operand veto. Latent, not live — but it is the same shape as the documented-and-fixed operands bug, and the asymmetry invites the next dev to "clean up" the per-span re-hit back into the shared gate.available.ts:462-470vouchLabelswhere-unionwhere, consumed per operandwherenames one command (name+cmd pair); step-kind guarded bysolo(361-364). No construction found.available.ts:885-908haystack union + byte budget844(truncation only lowers refusals) holds for the text path. Gate path reads gate files outside the budget (382-427) — consistent with "manifest declares existence", no false refusal constructed.available.ts:940safeFirstwhere: README.md,matched: the limit is 1— a truthful substring. An auditor reading the evidence line cannot see the tree said1,024. The visibility surface hides exactly the bug that matters.available.ts:930filler-empty fallback towholeavailable.ts:745-751hitCoversFiguresedge-only checkStandard
A finding BLOCKS when a maintainer can reintroduce the bug without noticing. Here: yes, three independent ways — edit either char class in isolation (rot mechanism above); author bank cases without comma/trailing-dot shapes (already happened); trust the
247/ADR-0009 comment as the spec (it asserts a property the tokenizer does not have).Verdict: BLOCKS. Not DRASTIC — the veto-only, fail-open, region-scoped, contiguity architecture is right and I would defend it in one line: every guard fails toward keeping, which is the only defensible asymmetry when a wrong refusal is unrecoverable. The defect is one wrong character class, duplicated by hand, asserted in comments, untested at its edges.
Minimum change to pass: (1) figure grammar fix — separator between digits is figure-internal, sentence-final dot is not — with
isTokenChar/figureRunandnumericTokensderived from one exported definition, not copied; (2) the three distinguishing bank cases pinned; (3) iftokens()blast radius is not accepted this cycle, ship alternative B (edge abstention) as interim — it converts both measured wrong verdicts to keeps and cannot create a false refusal. Also correctavailable.ts:247and the ADR 0009 atomicity sentence, which currently document1,024as handled when it is not.Tier call:
tier:fullApplied. The change touches a predicate that decides irreversibly what is stored, which is T3 by definition, and the arch finding widens it past a local patch: the minimum passing change derives
isTokenChar,figureRunandnumericTokensfrom one exported figure grammar, which reaches intosrc/core/tokenize.tsand therefore into GATE-3 scoring and tombstone matching. That is a cross-subsystem blast radius, not a behavior change inside an existing pattern, sotier:standardwould understate it.Two notes for whoever picks this up. The escape-shape bank has the same blind spot as the matcher — six
1.5-family rows, zero comma-grouped, zero trailing-period-flip — so the bank rows are part of the fix, not a follow-up. And the evidence surface atavailable.ts:940reportsmatched: the limit is 1against a tree that says1,024, which is a truthful substring that hides exactly this class; a fix that leaves the evidence line unchanged leaves the bug invisible to an auditor.abogartz-opencode-self-improvement commentedon Nov 23, 2026
🎉 This issue has been resolved in version 0.34.2 🎉
The release is available on:
Your semantic-release bot 📦🚀