Skip to content

fix(ENG-RECORD-ANCHOR-RATCHET): restore the 35 definitions c12b376b2 deleted, unwired, and measure the rot they had been hiding - #3344

Open
phantomic12 wants to merge 6 commits into
localai-org:mainfrom
phantomic12:row/RECORD-ANCHOR-UNWIRED
Open

phantomic12 wants to merge 6 commits into
localai-org:mainfrom
phantomic12:row/RECORD-ANCHOR-UNWIRED

Conversation

@phantomic12

@phantomic12 phantomic12 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes the local record added in this branch, .agents/issues/ENG-RECORD-ANCHOR-RATCHET/ISSUE-LOCAL-01M3JXGKKHK4WE6054PWPR67RA.md.

Supersedes #3338. This branch brings back the five symbols .agents/engine-matrix.md:231 cites, so check-symbol-anchors goes 5 stale → 0 here. #3338 corrects that same cell to say the ratchet is absent; with the code restored, that correction becomes the false statement. #3338 should close as superseded rather than land first.

The tree was asking for this code the whole time

The merge c12b376b2 — divergent parents 858560fd4 (feature side, 1215 lines) and 4fcce96b5 (main side, 2446) — resolved to the feature side and took 23 definitions with it. The tests did not go with them. tests/scripts/test_agent_record.py still asks for extract_links, scan_record_anchors, link_bases, strip_code_spans, RecordAnchorResult and RECORD_ANCHOR_BASELINE, and 58 of its 106 cases were red for that reason alone. scripts/record-anchor-baseline.json outlived the code that reads it, still naming the row in its own _comment.

All 23 lost definitions are absent from the entire scripts/ tree. The failures span three subsystems: the anchor ratchet, the markdown fence/inline-span link extractor, and the claim-state checks.

Restored unwired, on purpose

main() takes argv again and accepts --report and --write-baseline, with the baseline write after the errors gate rather than before it (that ordering is #1270). Nothing in main() calls check_record_anchors, check_claim_state_consistency or check_canonical_issue_references.

That is the whole reason for landing it this way. Measured by checking 4fcce96b5 out over the current tree: it parses, and it goes red — RECORD ANCHOR REGRESSION in bucket 'stale': 39 > baseline 0 and 'broken': 5 > baseline 0. The 35 definitions are extracted by AST span and never retyped, so the diff is the recovered bytes.

One bug worth recording. The extractor dropped @dataclass on the first pass, because ast reports lineno at the class line and not at the decorator. The result parsed cleanly and still failed at run time with 'Field' object is not subscriptable — RecordAnchorResult.counts stayed a Field object. Reading the diff would not have caught it; running the gate did.

--report stops being silently ignored

ci.yml:187 and agent-preflight.sh:418 both pass --report, and main() took no arguments, so the shell accepted the flag and the program dropped it. It now prints what the wired gate would have refused on:

record anchors: ok=974, stale=39, broken=5  -> rot 44
  BROKEN KV-PREFIX-CACHE -> examples/server/main.cpp:126

check-agent-record.py is rc=0 with and without --report, unwired.

The 24 remaining failures are two populations

58 → 24 is the honest headline, but the number alone would misreport this.

14 — the debt, and genuinely the debt. Subtests of test_every_tracked_checker_line_citation_still_resolves, i.e. the 44 rotted citations. That is precisely the backlog .agents/specs/record-anchor-ratchet.md says the ratchet exists to hand over.

10 — restore gaps, not debt:

test why
test_checker_keeps_preexisting_citation_line_floor requires this file to be ≥ 2446 lines, because the tree's own records cite check-agent-record.py by line. The selective splice reaches 1969 — 477 short. The next iteration must restore the whole pre-merge file reconciled with HEAD's restructure, not splice definitions.
test_baseline_matches_the_tree_exactly, test_a_repair_fails_until_the_baseline_is_lowered want a baseline equal to the tree; writing one is a raise this row's own error message warns against.
6 claim/lifecycle tests empty error list where a POSIX-spelled diagnostic was expected.
test_an_archived_row_with_a_docs_relative_link_is_accepted needs the link_bases two-base archive behaviour HEAD deliberately flattened to link_base; restoring it verbatim also produced 50 spurious roadmap_v1.md errors.

Nothing here is presented as green. check-agent-record.py rc=0 is the only pass claimed, and it is pass-by-absence, which the --report number states outright.

Not claimed

No C++ build gate: no source file is touched. check-commit-style and check-commit-trailers over --range 1de097c46..HEAD are green. The 24 red tests are red on this branch and were red before it — this branch reduces them and names every one.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com

Audit correction (measured 2026-10-04 against this head and upstream/main @ 33fb82b09)

Re-measured on a clean worktree at this PR's head (706da8536). The evidence
section above no longer describes this head
, and one of its claims is the only
pass the body offers.

Substantiated:

  • check-symbol-anchors rc=0 on this head, with stale 0.

Contradicted:

claim above measured at 706da8536
"check-agent-record.py is rc=0 with and without --report, unwired" rc=1 both ways, 13 errors -- the same 13 issue-reference errors as main. This is the only pass the body claims ("check-agent-record.py rc=0 is the only pass claimed"), and it is not a pass.
--report prints record anchors: ok=974, stale=39, broken=5 -> rot 44 prints record anchors: ok=1018, stale=0, broken=0 -> rot 0. The 44 rotted citations this body hands over as backlog are already repaired in this head.
"check-symbol-anchors goes 5 stale -> 0 here" stale is 0 on this head and 0 on upstream/main. Main already reads 0, so the improvement is no longer attributable to this branch; the "before" state no longer exists.
"58 of 106 cases were red" -> "The 24 remaining failures" tests/scripts/test_agent_record.py at this head: 71 failed, 82 passed, 43 subtests passed. On upstream/main: 5 failed, 120 passed, 62 subtests passed. This head is far worse than main on this file, not 24-from-58.

The body also says "The 24 red tests are red on this branch and were red before
it". The first half is now false, and the second half does not hold either -- main
runs 5, not 24.

What this means. The restore this branch performs has since been superseded:
upstream repaired the anchor rot that made 39 stale + 5 broken the interesting
number, so the headline evidence for the branch no longer distinguishes it from
main. The selective-splice concern (test_checker_keeps_preexisting_citation_line_floor
wants >= 2446 lines; the splice reaches 1969) is the part of this body most likely
to still be actionable, and it is worth re-measuring against current main before
anyone re-reviews.

No C++ was built and no test binary was run here beyond the Python test file above.

Correction to my own audit note (measured 2026-10-04, CI-parity method)

One row of the section above was measured in a tainted local environment and is
withdrawn here. The method error: check-agent-record.py harvests issue
references from merge-base(origin/main, HEAD)..HEAD commit bodies
(branch_issue_references()), and my local checkout's origin/main pointed at
a stale fork tip (1de097c46). The inflated range swept in upstream history
whose commit bodies reference nine _intake records and four fixture-only IDs
(ISSUE-GH-7, ISSUE-GH-8, ISSUE-GH-77, one ISSUE-LOCAL-...), producing
13 phantom errors CI never sees — CI runs with origin/main at the branch
base, which yields a small range. Re-measured with origin/main temporarily
pointed at upstream/main (and restored afterward), at the same audited head:

row above re-measured CI-style at 706da8536
"check-agent-record.py is rc=0 with and without --report" called rc=1 both ways, 13 errors rc=0 both ways: agent record OK: ENGINE=179 MODEL=384 QUANT=87 KERNEL=60 BACKEND=90 ANCHOR-ROT=0. The body's only claimed pass is a pass; the sentence above calling it not-a-pass is withdrawn.
test_agent_record.py called 71 failed vs main's 5, "far worse than main" untainted re-run at this head: 5 failed, 120 passed, 62 subtests — identical to upstream/main. Neither the body's "24 remaining" nor my 71 describes this head; the real delta against main is zero.

Standing as written: the --report anchor figures (ok=1018, stale=0, broken=0 against the body's ok=974, stale=39, broken=5), stale 0 on this
head and on main, and the supersession analysis built on them.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:codebuff/buffy [freebuff]

…leted, unwired, and measure the rot they had been hiding

The merge that took 1231 lines out of this checker took the tests for them
with it nowhere: tests/scripts/test_agent_record.py still asks for
extract_links, scan_record_anchors, link_bases, strip_code_spans,
RecordAnchorResult and RECORD_ANCHOR_BASELINE, and 58 of its 106 cases were
red for that reason alone. scripts/record-anchor-baseline.json outlived the
code that reads it, still naming the row in its own _comment.

35 definitions are restored from 4fcce96 by AST span extraction, never
retyped, and scope-audited so every name they read resolves. The extractor
first dropped @DataClass, because ast reports lineno at the class line and
not at the decorator, which produced a restore that PARSED and still failed
at run time with 'Field' object is not subscriptable. Reading the diff would
not have caught it; running the gate did.

main() takes argv again and accepts --report and --write-baseline, with the
baseline write AFTER the errors gate rather than before it, which is localai-org#1270.
Nothing in main() calls check_record_anchors, check_claim_state_consistency
or check_canonical_issue_references. That is the whole point of landing it
this way: wiring them reddens the gate today, because nothing has been
checking these citations since the merge.

--report is no longer silently ignored. ci.yml:187 and agent-preflight.sh:418
both pass it and main() took no arguments, so it was accepted by the shell and
dropped by the program. It now prints what the wired gate would have refused
on: ok=974, stale=39, broken=5, rot 44, naming offenders such as
KV-PREFIX-CACHE -> examples/server/main.cpp:126.

The suite goes 58 failures to 24, and the 24 are TWO populations, so the
number alone would misreport this. FOURTEEN are subtests of
test_every_tracked_checker_line_citation_still_resolves and they ARE the debt
-- they are the 44 rotted citations, which is the backlog this row exists to
hand over. The other TEN are restore gaps and are not debt:

  * test_checker_keeps_preexisting_citation_line_floor requires this file to
    be at least 2446 lines, because the tree's own records cite
    check-agent-record.py BY LINE and retiring below that invalidates them.
    The selective splice reaches 1969. The next iteration must restore the
    whole pre-merge file reconciled with HEAD's restructure, not splice.
  * two baseline tests want a baseline equal to the tree, and writing one is
    a raise this row's own error message warns against.
  * six claim and lifecycle tests get an empty error list where a
    POSIX-spelled diagnostic was expected, and one archived-link test needs
    the link_bases two-base behaviour HEAD deliberately flattened to
    link_base.

check-agent-record.py is rc=0, unwired, with and without --report.
check-symbol-anchors goes from 5 stale to 0 here, because the restoration
brings back the five symbols engine-matrix.md:231 cites, so this branch
SUPERSEDES localai-org#3338: that PR corrects the same cell to say the ratchet is
absent, and with the code back its correction becomes the false statement.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:codebuff/buffy [freebuff]

@mudler-agent mudler-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: tests/scripts/test_agent_record.py remains red, and the restored critical checks (check_record_anchors, claim-state consistency, canonical issue references) are not called by the production gate. --report reports 44 rotten anchors but exits 0. Wire and green the guarantees before landing.

…record-anchor subsystem, leaving only the closed issue record

upstream/main now defines every name c12b376 dropped and calls them: scan_record_anchors and check_record_anchors are wired inside the errors gate in main(), --report prints offenders, --write-baseline writes scripts/record-anchor-baseline.json only after the gate passes, check_claim_state_consistency is called at line 1980, and canonical_intake_debt plus check_canonical_issue_references at line 2305. The conflict in scripts/check-agent-record.py resolves to the upstream revision. The merged tree reports ANCHOR-ROT=0 and the 106-case test_agent_record.py suite is green, which discharges the 24 failures the unwind left. The issue record closes: the tree falsifies its open state, and the record file is what this pull request still adds.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:anthropic/devin [devin]
@devin-ai-integration
devin-ai-integration Bot force-pushed the row/RECORD-ANCHOR-UNWIRED branch from 1cfdf89 to 706da85 Compare October 2, 2026 19:35
… main

Merges upstream/main (42 commits) into the row branch. The tree merged
cleanly; the PR remains records-only -- the closed issue record and its
executed verification against upstream's restored anchor subsystem.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:anthropic/devin [devin]
… over current main

On the merged head the record gate reports ANCHOR-ROT=0 over 1018 ok
anchors, the agent record suite is 106/106, and mutating one cited
symbol reddens the gate by name in the stale bucket against the zero
baseline, then restores green. The record is closed; the evidence is
the artifact this PR still carries.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:anthropic/devin [devin]
Refresh the branch against current main so the gate runs against the tree
that will actually receive it.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:Buffy [Freebuff]
@phantomic12

Copy link
Copy Markdown
Contributor Author

Two of the three findings are addressed on the current head, and the third does not reproduce on POSIX.

Wired. The restored checks are now called by the production gate: scripts/check-agent-record.py:2415-2422 runs scan_record_anchors(rows) and then check_record_anchors(anchors, errors). The only branch that skips the check is --write-baseline, and it skips it deliberately — a run that is about to lower the baseline must not report a regression against the value it just replaced. Consequently --report no longer exits 0 on rot: it prints the report and then enforces. ANCHOR-ROT=0 on this head.

Test file. 120 pass, 5 fail, and all five are Windows-only path-separator assertions, not record defects: claim_sources() returns str(p.relative_to(ROOT)), which yields \ on Windows, while the test asserts ".agents/coordination.md". The same five fail on origin/main at c6c0d8674 on this box and pass on POSIX, so they are not introduced here and are not a CI red.

check-agent-record.py rc=0 on the refreshed head (09d35f59a, now merged up to main).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants