fix(GATE-ISSUE-INDEX-TABLE-SHAPE): count the index's cells, and repair the row that proves nothing did (#1033) - #1078
Open
localai-bot wants to merge 6 commits into
Open
fix(GATE-ISSUE-INDEX-TABLE-SHAPE): count the index's cells, and repair the row that proves nothing did (#1033)#1078localai-bot wants to merge 6 commits into
localai-bot wants to merge 6 commits into
Conversation
…g measured (#1033) `check_table_shapes` in `scripts/check-agent-record.py` already counts unescaped pipes per table row with exactly the regex a malformed row needs. Its call site hands it the roadmap, coordination, every matrix and every live spec, and does not hand it `.agents/issue-index.md`. No other checker counts that file's cells, so the one record surface every change must write is the only markdown table in the record set with no shape gate. This spec commits before the implementation, because arming a gate on a new path is a semantic checker change: it needs a red-before, a green-after, and an argument for the append-only exception the row repair requires. It records the measurement that will be red (line 279 reads 9 pipes where the header reads 5), the three test cases, and the stop conditions that keep the repair to escaping and out of the row's meaning. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
…r the row that proves nothing did (#1033) `check_table_shapes` already carried the right measurement -- unescaped pipes per table line, `re.findall(r"(?<!\\)\|", line)` at `scripts/check-agent-record.py:1292` -- and its call site handed it the roadmap, coordination, every matrix and every live spec. It did not hand it `.agents/issue-index.md`, and nothing else in the tree counts that file's cells. So the one record surface every change must write, whose rows are prose long enough to hide a stray pipe inside a code span, was the only markdown table in the record set with no shape gate at all. The function is untouched. Only its argument list was short, and widening the function to absorb a red would be the move AGENTS.md forbids. ## RED, then GREEN Path added, `#1003` unrepaired, run bare: ``` $ python3 scripts/check-agent-record.py ERROR: .agents/issue-index.md:279: table has 9 pipes; expected 5 RC=1 ``` Exactly one row, which is the stop condition this spec set: a second red would have meant another defect landed while this was in flight and would have needed its own issue rather than a silent repair here. After escaping the four pipes, the same command bare: ``` $ python3 scripts/check-agent-record.py agent record OK: ENGINE=157 MODEL=377 QUANT=82 KERNEL=51 BACKEND=83 RC=0 ``` `tests/scripts/test_agent_record.py` gains three cases and is red on both counts before the call-site change (`FAILED (failures=2)`, exit 1), green after (80 tests, exit 0). The first captures the paths `main()` really hands the gate, from the real call rather than from the source text, so a commented-out line or an unused constant cannot satisfy it. The second runs the gate on the shipped file. The third mutates a copy -- strips the trailing pipe from the last row -- and asserts on the error text, which cannot be produced unless the mutation was both written and read back. ## The row repair, and the exception it needs Line 279 is the `#1003` `ORACLE-LLAMACPP-REPIN-STOCK` row, which arrived with `283c7e492` (#1051) carrying four unescaped pipes inside code spans, at columns 2705, 3106, 3115 and 3338. Only the escaping changes: the repaired line is byte-identical to the original once the four added backslashes are removed, it is four bytes longer, and it is the only line of the file that differs from `main`. Every other row is byte-identical and in the same order, the key list is a strict prefix plus `#1033`, and a pipe histogram over all 290 table lines now reads `{5: 290}`. That edit is what `scripts/check-issue-index-append-only.py` forbids, and that gate is RED on this branch. It is not weakened, and there is no waiver registry, so the argument lives here with the diff. The append-only contract cannot repair a malformed row: appending a corrected copy leaves the broken one in place and adds a duplicate key, which makes `check-agent-record` angrier, and the file only becomes well-formed by editing the row where it sits. The two gates are in genuine contradiction on this tree, and that contradiction is the defect. This is the same argument `ff264cb82` (#1025) made for the duplicate `#995` repair, and the same containment: the gate is preflight-only, `.github/workflows/ci.yml` runs the record gate at `:121` and runs no append-only job, so this costs no CI red, and once merged a later branch diffs a `main` whose row is already repaired and sees no removal in its range. ## Two premises of the report measured false Recorded rather than quietly dropped, because a wrong premise that survives costs the next reader an investigation. The checker does NOT stop at the first finding. #1033 attributes part of the two-day concealment to that shape. `main()` threads one `errors` list through every check and prints all of it at the end; the `if not errors:` guard above the block covers only the missing-canonical-record case. A scratch index carrying a duplicate key, a short row and the unrepaired `#1003` row reports all three in one run and exits 1 once. So there was nothing to contain and nothing is changed there -- the concealment was real, and its only cause was that `check_table_shapes` never saw this path. The four pipes are not in a `git diff` piped into `grep`. That span does not exist in the row: it carries one `git diff` and three `git grep`, none piped. They were located by re-running the checker's own regex over the line, which is the only reason the discrepancy is visible. Closes #1033. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
`main` advanced to a332fb9 and GitHub reported CONFLICTING on `.agents/issue-index.md`. GitHub does not run the `merge=union` driver that `.gitattributes:7` sets, so the resolution happens locally where it does. The union auto-merge was DISCARDED rather than trusted: took a332fb9's file wholesale, then re-applied this branch's two edits by key -- the four `\|` escapes in the `#1003` row, and this row's own appended index row. A clean union merge INTERLEAVES, which preserves well-formedness, uniqueness and presence and fails only the PREFIX property. Verified rather than assumed: 289 rows, zero duplicate keys, and the pipe-part histogram over every row is now {6: 289} -- that is the gate this PR adds, reporting on the merged tree. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
localai-bot
pushed a commit
that referenced
this pull request
Aug 17, 2026
`main` advanced to b5756ea and GitHub reported CONFLICTING on `.agents/issue-index.md`. GitHub does not run the `merge=union` driver that `.gitattributes:7` sets, so the resolution happens locally where it does. The union auto-merge was DISCARDED rather than trusted: took b5756ea's file wholesale, then re-appended only this row's three rows. A clean union merge INTERLEAVES, which preserves well-formedness, uniqueness and presence and fails only the PREFIX property. Verified rather than assumed: 293 rows, zero duplicate keys, main's file a strict PREFIX of the result. The pipe-part histogram reads {6: 292, 10: 1}; the single 10-part row is `#1003`, malformed on `main` and INHERITED here -- it is repaired by #1078, which owns it, and taking main's file wholesale means this branch picks that repair up automatically once #1078 lands. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
`main` advanced and GitHub reported CONFLICTING on `.agents/issue-index.md`. GitHub does not run the `merge=union` driver `.gitattributes:7` sets, so the resolution happens locally where it does. The union auto-merge was DISCARDED: main's file taken wholesale, then this branch's two edits re-applied BY KEY -- the four `\|` escapes in the `#1003` row, and this row's own appended row. Verified: zero duplicate keys, and the pipe-part histogram over every row reads {6: N}, which is the gate this PR adds reporting on its own merged tree. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
…e now sees `main` gained a THIRD malformed row while this branch was gating. Row `#1083` (`MODEL-MUSIC3`, arrived with #1089) carries two unescaped `|` inside regex code spans -- `($|[^*])` at column 213 and `(^|[^*])` at column 1385 -- so it splits into 8 parts where a well-formed 4-column row splits into 6. This PR is the gate that catches it, so it cannot land while the row is broken: `check-agent-record.py` reports `.agents/issue-index.md:308: table has 7 pipes; expected 5`. Repairing it here is the same in-scope repair `#1003` needed. This is exactly the recurrence the issue predicted. An unescaped `|` inside a code span is the NATURAL way to write a regex alternation or a shell pipeline in a Title cell -- it is not carelessness, it is the obvious way to write the thing, which is why the gate has to exist rather than the habit being fixed. Three separate rows have now needed it: `#995` (twice), `#1003`, `#1083`. Verified mechanically, not by eye: exactly two pipes escaped, the row is 2 bytes longer, and unescape-normalising the result reproduces the original byte-for-byte, so only the escaping changed. The pipe-part histogram over every row now reads {6: 292}, and `check-agent-record.py` exits 0. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
… is the point `main` gained TWO more malformed rows while this branch gated: `#1094` (9 parts, three unescaped `|` inside `git grep -i "logc3|HDRTransfer| to_hdr_linear|acescct"`) and `#1096` (8 parts, two inside `git grep "build_from_sigma|GuiderFactory|per_sigma"`). Both are repaired here for the same reason `#1003` and `#1083` were: this PR IS the gate, and a gate cannot land while the file it now checks is broken. That makes FIVE malformed rows from FIVE different authors in one day -- `#995` (twice), `#1003`, `#1083`, `#1094`, `#1096` -- and every one of them is the same shape: an alternation or a pipeline written inside a code span, which is simply how one writes `git grep "a|b"` or `cmd | grep`. It is not carelessness and it will not be fixed by asking people to be careful. It is arriving faster than it is being repaired, which is the argument for the gate rather than an obstacle to it. Verified mechanically per row, not by eye: the escaped row unescape-normalises byte-for-byte to the original, its length grows by exactly the number of pipes escaped, and the anchor column is asserted to hold a `|` before substitution. The pipe-part histogram over every row now reads {6: 303}. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
check_table_shapesalready carried the right measurement -- unescaped pipesper table line,
re.findall(r"(?<!\\)\|", line)atscripts/check-agent-record.py:1292-- and its call site handed it the roadmap,coordination, every matrix and every live spec. It did not hand it
.agents/issue-index.md, and nothing else in the tree counts that file's cells.So the one record surface every change must write, whose rows are prose long
enough to hide a stray pipe inside a code span, was the only markdown table in
the record set with no shape gate at all.
The function is untouched. Only its argument list was short, and widening the
function to absorb a red would be the move AGENTS.md forbids.
RED, then GREEN
Path added,
#1003unrepaired, run bare:Exactly one row, which is the stop condition this spec set: a second red would
have meant another defect landed while this was in flight and would have needed
its own issue rather than a silent repair here. After escaping the four pipes,
the same command bare:
tests/scripts/test_agent_record.pygains three cases and is red on both countsbefore the call-site change (
FAILED (failures=2), exit 1), green after (80tests, exit 0). The first captures the paths
main()really hands the gate,from the real call rather than from the source text, so a commented-out line or
an unused constant cannot satisfy it. The second runs the gate on the shipped
file. The third mutates a copy -- strips the trailing pipe from the last row --
and asserts on the error text, which cannot be produced unless the mutation was
both written and read back.
The row repair, and the exception it needs
Line 279 is the
#1003ORACLE-LLAMACPP-REPIN-STOCKrow, which arrived with283c7e492(#1051) carrying four unescaped pipes inside code spans, at columns2705, 3106, 3115 and 3338. Only the escaping changes: the repaired line is
byte-identical to the original once the four added backslashes are removed, it
is four bytes longer, and it is the only line of the file that differs from
main. Every other row is byte-identical and in the same order, the key list isa strict prefix plus
#1033, and a pipe histogram over all 290 table lines nowreads
{5: 290}.That edit is what
scripts/check-issue-index-append-only.pyforbids, and thatgate is RED on this branch. It is not weakened, and there is no waiver registry,
so the argument lives here with the diff. The append-only contract cannot repair
a malformed row: appending a corrected copy leaves the broken one in place and
adds a duplicate key, which makes
check-agent-recordangrier, and the fileonly becomes well-formed by editing the row where it sits. The two gates are in
genuine contradiction on this tree, and that contradiction is the defect. This
is the same argument
ff264cb82(#1025) made for the duplicate#995repair,and the same containment: the gate is preflight-only,
.github/workflows/ci.ymlruns the record gate at
:121and runs no append-only job, so this costs no CIred, and once merged a later branch diffs a
mainwhose row is alreadyrepaired and sees no removal in its range.
Two premises of the report measured false
Recorded rather than quietly dropped, because a wrong premise that survives
costs the next reader an investigation.
The checker does NOT stop at the first finding. #1033 attributes part of the
two-day concealment to that shape.
main()threads oneerrorslist throughevery check and prints all of it at the end; the
if not errors:guard abovethe block covers only the missing-canonical-record case. A scratch index
carrying a duplicate key, a short row and the unrepaired
#1003row reports allthree in one run and exits 1 once. So there was nothing to contain and nothing
is changed there -- the concealment was real, and its only cause was that
check_table_shapesnever saw this path.The four pipes are not in a
git diffpiped intogrep. That span does notexist in the row: it carries one
git diffand threegit grep, none piped.They were located by re-running the checker's own regex over the line, which is
the only reason the discrepancy is visible.
Gates
scripts/agent-preflight.sh --quietat271fff52c, exit 1, one failure andzero skips:
That is the exception argued above, and it is the only red. Every other record
gate, mutation suite, committed-range gate and trailer gate is
ok.CI's
windows-msvc-cpuandwindows-msvc-vulkanare red on every pull request(#584, #968) with no
mainbaseline. Not this change: the diff is one checker,one test file, one spec and one record, and carries no C++.
Spec:
.agents/specs/gate-issue-index-table-shape.md.The spec commits first (
aed1424aa), the implementation second (271fff52c),so the commit order proves spec-before-code inside the one pull request.
The index will go CONFLICTING here
.gitattributesgives.agents/issue-index.mdmerge=union, and GitHub doesnot run that driver, so this file conflicts on the web the moment
mainappendsa row. Do not take the auto-merge. Merge
origin/mainlocally, discard themerged file (
git checkout <main-sha> -- .agents/issue-index.md), re-apply thefour
#1003escapes and re-append the#1033row, then assert by hand thatmain's file is a strict prefix apart from line 279 and that every other row isbyte-identical and in the same order.
Closes #1033.
FOLLOWING_AGENTS_PROTOCOL
Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5 [claude-code]