fix: the orphan scan counted one ledger row in two buckets (#1270) - #1273
Conversation
|
The fix is right, and ask 1 is not the judgement call you think it is — it is The choice is settled by arithmetic, not by tasteReading the surrounding code rather than the diff alone: checkable = {k for k in rows if (k[0],k[1]) in parts and (rows[k][0] & run_majors)}
unchecked = set(rows) - checkable
absent = checkable - now
orphans = [k for k in absent if ...]
unprunable = [k for k in absent if ...]
The assertion holds identically with So the answer to "should a row the run emits count as matched regardless of its I agree with where you put the row, and separately from the arithmetic: the two Ask 2: the control is right, and here is precisely what it does not coverIt bounds the failure you named — Neither arm tests Your flag observation deserves the separate issue
The CHANGELOG correction is the part I would keepYou had written "no longer reports FAIL PG19 on a clean tree" and the gate Blocking only on the red
🤖 Generated with Claude Code |
The ledger orphan scan refused its own arithmetic, and that refusal reddened
PG19 in run_all_versions.sh on a clean tree with every suite passing.
matched was set(rows) & now, drawn from every ledger row, while orphans,
unprunable and not-checked all partition checkable. A row the run still emits,
whose ledger majors do not name the running major, therefore landed in matched
and in not-checked at once, and the integrity assertion correctly refused a
classification that did not partition. matched is now checkable & now, from the
same side of that line.
The row belongs in not-checked. This scan asks whether the ledger names a check
that no longer exists, and a row claiming majors this run is not cannot be
answered here in either direction.
Measured on pg19-projection_scan_io.log, the one log that aborted the scan:
before matched 11 + orphans 0 + unprunable 0 + not checked 1766 != 1774 rc=2
after parts in the run=1, rows in those parts=8, orphans=0 rc=0
and across every pg19 log, logs returning a status outside {0,1} went 1 to 0.
This does NOT make PG19 green. A clean tree still reports FAIL PG19 for a
second, unrelated reason: three projection_scan_io checks run on 19 while their
ledger rows claim only 15;16;17;18, so the ledger gate refuses a check it has
never seen. That refusal is correct, names the three checks, and prints the
merge command that fixes it. It is present on pristine main before this change
and is separate maintenance.
The integrity assertion is not the defect. It caught a real classification
error rather than reporting a clean scan.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MpajdQbkVJ9ey1XyYHcikP
0e92400 to
8b3b01d
Compare
|
Correcting my own review: I endorsed the I wrote "File it; I would review it" about two independent conditions sharing Three distinct messages at three distinct sites — and the comment at 1722 records Why I endorsed it. I checked the arithmetic in this PR line by line — the That is the same failure the withdrawal itself describes, one remove out. Everything else in my review stands, and none of it depended on the withdrawn
🤖 Generated with Claude Code |
OffgridwithJD
left a comment
There was a problem hiding this comment.
Approving at 8b3b01d6. 15 of 15, pytest (harness guards, no database)
SUCCESS, both suites SUCCESS, CLEAN. TESTS.md now names the new test and
guard_tests reads 404.
The substance was settled in my earlier comment and nothing has changed it. The
short form:
The fix is forced, not chosen. checkable ⊎ unchecked = rows,
absent ⊎ (checkable ∩ now) = checkable, orphans ⊎ unprunable = absent, so
the sum collapses to |checkable| + |unchecked| = |rows| identically with
checkable & now and cannot hold with set(rows) & now whenever a row sits in
both unchecked and now. 11 + 1766 = 1777 is what the algebra predicts.
The control is stronger than you credited — it and the subject pin matched
from both sides. Neither covers checkable's own definition, which is worth
remembering rather than fixing.
Two corrections stand on the record, and I would rather they did:
- I endorsed the
verfailfinding without checking it. Verified since: the
runner emits the conditions at three distinct sites, and the comment at
run_all_versions.sh:1722records that collapsing them was already found and
fixed. I checked your arithmetic line by line and trusted your diagnosis
because it sounded like a lesson I had been applying all day. - The
TESTS.mdomission was the whole cause of all three reds.
guard_tests 403 -> 404was never the problem, and running the full guard set
the way CI does rather than one file is what separates 404 collected / 1131
checks / 0 failures from three reds.
Not merging this; it is yours.
🤖 Generated with Claude Code
The ported test adds one collected test to the cluster half, and `--pgc-expect-tests` is exact rather than a floor -- both cluster jobs would collect 484 against a declared 483 and fail. Caught by @jdatcmd before CI reached it. RE-DERIVED BY COLLECTION, not incremented, using the command the file documents: guard files 24, cluster files 53 guard collected 403 cluster collected 484 The file says why the distinction matters: the numbers are collected tests, not test functions, so a later parametrization expands one function into several and an increment would be wrong in a way a rerun would not show. `guard_tests` needs nothing here. This branch carries 403 and main carries 404 from #1273; the line is untouched on this side and merges clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XiFn3HteTXnGdRiA2xDP2n
Every test in the corpus must be named there, and the ported test was not -- so `test_every_file_and_test_is_named_in_the_document` reddened all three pytest jobs from one omission. Same cause as #1273, which @jdatcmd had hit and warned me about an hour earlier; I added the test and not the entry. It joins section 81's "Every test" table rather than taking a section of its own, matching the two tests already in that file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XiFn3HteTXnGdRiA2xDP2n
The orphan-scan half of #1270. Deliberately no closing keyword: the
second cause described below is still open, and GitHub ignores the
qualifier in a phrase like "fixes the X half of #N" and closes #N anyway.
The ledger orphan scan refused its own arithmetic, and that refusal reddened
PG19 in
run_all_versions.shon a clean tree with every suite passing.The bug
matchedwas drawn from every ledger row while the other three bucketspartition
checkable:So a row the run still emits, whose ledger majors do not name the running
major, landed in
matchedand inuncheckedat once. The four categoriesstopped partitioning and the integrity assertion refused.
matchedis nowcheckable & now. The row belongs innot checked: this scanasks whether the ledger names a check that no longer exists, and a row claiming
majors this run is not cannot be answered here in either direction.
Red, then green, on the real artifact
The new pytest test fails first, for its own reason, with both premises passing:
After the fix, and on the actual log that aborted the scan:
The test carries the control that matters: a run on the claimed major must
still be clean with
not checked=0. Without it the test passes on a build wherematchedis always zero, which would break every legitimate match.guard_testsgoes 403 -> 404, re-derived with the collect-only commandexpected_tests.txtdocuments rather than incremented by hand.This does NOT make PG19 green, and I am not claiming it does
A clean tree still reports
FAIL PG19, now for a second and unrelated reason:Those three checks run on 19 while their ledger rows claim only
15;16;17;18.That refusal is correct: it names the three checks and prints the
mergecommand that fixes it, which needs one log per gated major. I verified it is
present on pristine
mainbefore this change, so it is separate maintenance andnot something to smuggle in here.
Both causes were live at once, which is why the first diagnosis only found one:
the orphan scan aborted before the picture was complete.
Gate
Rebased onto
5b45f3dso it sits on top of #1271.The orphan-scan abort that this PR is about no longer appears. An earlier run of
this same gate failed
docs_styleon two em dashes I had written into my ownCHANGELOG entry; the plain-language checker caught me and they are gone.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MpajdQbkVJ9ey1XyYHcikP