fix(tri): the meta-gate over the ledgers had gone stale by my own addition - #2950
Merged
Conversation
…ition
`tri ledgers audit` plants a false entry in each ledger and demands the gate
fail. Its list of ledgers was hardcoded at four.
Two passes ago I ADDED a ledger -- `docs/reports/orphan_modules.json`, the
orphan ceilings -- and did not add it to the audit. A guard written as a list,
gone stale by addition, and this time the addition was mine.
Adding it needed the audit to learn two shapes:
* a gate that is a `tri` subcommand rather than a python script, and
* a plant that leaves the file VALID. Appending a line to a JSON ledger makes
the gate fail because the file no longer PARSES -- a catch for the wrong
reason, which is a control reporting success without measuring anything.
The planted entry is a ceiling for a crate the workspace does not declare:
valid JSON, false claim.
Planting that exposed a second live defect. `mods orphan --gate` iterates the
crates and looks up each one's ceiling, so a ceiling for a crate that does NOT
exist was never visited and sat in the ledger unmentioned. The ledger's own rule
is "exact match, not an upper bound"; a ghost entry is slack in the other
direction, and slack is where the next one hides. The gate now fails on it.
Historical control -- revert only the gate fix, keep the ledger in the audit:
MISSED docs/reports/orphan_modules.json <- a stale entry here exits 0
stale entry MISSED 1 exit 1
and with the fix, `caught ... by tri mods orphan --gate`, exit 0.
SELF-CORRECTION, and the bigger half. I opened this saying the audit covered
four of seven ledgers. Counting from DISK says fifteen: nine
`tools/*baseline*.txt` and six `docs/reports/*.json`. My seven was a sample
taken from memory while chasing something else -- this repository's own lesson
about counts, applied to me.
So the audit no longer holds a list of what exists. It enumerates ledger-shaped
files from the tree:
ledger-shaped files on disk 15 planted into 5, excused 2, unclassified 8
The two excused carry the measurement that excuses them (the corpus ratchet is
too slow to plant into before a commit; a sha1-keyed ledger cannot be given a
planted entry that is false by construction). The eight are named as a work
list, not a verdict -- a meta-gate that prints only what it covers reads as
coverage.
An enumeration read from the tree cannot go stale by addition, which is the
defect this meta-gate exists to catch, in the meta-gate.
cargo test -p tri 391 passed, 0 failed (was 389; two new)
cargo clippy 120 warnings, same as master
Refs #2864
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
… the wrong reason; a remembered count is a sample (Refs #2864)
Contributor
PR DashboardGenerated at: 2026-08-30 14:26:17 UTC
Summary
Seal Status
|
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
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.
The meta-gate over the ledgers had gone stale by my own addition
tri ledgers auditplants a false entry in each ledger and demands the gatefail. Its list of ledgers was hardcoded at four.
Two passes ago I added a ledger —
docs/reports/orphan_modules.json, theorphan ceilings from #2941 — and
did not add it to the audit. A guard written as a list, gone stale by addition,
and this time the addition was mine.
Adding it needed two shapes the audit did not have
A gate that is a
trisubcommand, not a python script.A plant that leaves the file valid. Appending a line to a JSON ledger makes
the gate fail because the file no longer parses — a catch for the wrong
reason, which is a control reporting success without measuring anything. The
planted entry is a ceiling for a crate the workspace does not declare: valid
JSON, false claim.
Planting it exposed a second live defect
mods orphan --gateiterates the crates and looks up each one's ceiling, so aceiling for a crate that does not exist was never visited and sat in the
ledger unmentioned:
The ledger's own
_ruleis "exact match, not an upper bound". A ghost entryis slack in the other direction, and slack is where the next one hides.
Historical control
Revert only the gate fix, keep the ledger in the audit:
With the fix:
caught docs/reports/orphan_modules.json by tri mods orphan --gate.Self-correction, and the bigger half
I opened this saying the audit covered four of seven ledgers. Counting from
disk says fifteen — nine
tools/*baseline*.txtand sixdocs/reports/*.json. My seven was a sample taken from memory while chasingsomething else: this repository's own lesson about counts, applied to me.
So the audit no longer holds a list of what exists. It enumerates from the tree:
An enumeration read from the tree cannot go stale by addition — which is the
defect this meta-gate exists to catch, in the meta-gate.
The output also names the gate that caught each plant. "caught" alone says a
stale entry fails something, and which one is the next reader's question.
Tests, mutation-checked
tools/seal_baseline.txt is excused and also planted into· FAILthe walk found 6 ledger-shaped files, which is fewer than this repository carries· FAILMISSED, exit 1The three pre-existing tests were updated rather than dropped: one ledger no
longer has a
{spec}template, so the JSON plant is asserted on the propertythat matters instead — the planted file must still parse.
Checks
cargo test -p tri— 391 passed, 0 failed (was 389; two new)cargo clippy --all-targets— 120 warnings, identical to mastertri ledgers audit·tri mods orphan --gate·tri census audit— all exit 0Refs #2864