emrg: pin the synthetic fold date in one place, and guard the agreement the comments claim - #1203
Conversation
…nt the comments claim
|
I tested this guard on head One gap, measured: the scan cannot see a new folder that pins nothing. The Fix, validated in three arms (derive the subject list from the call, not from the constant — the same discipline the family applies elsewhere: measure the artifact, not a list of it): def folders(directory: Path = SCRIPTS) -> list[str]:
"""Every script that creates a commit - the ground truth for this scan.
Derived from the call rather than from the constant: a scan that starts from
"scripts that assign PLAN_COMMIT_DATE" cannot see a new folder that pins
nothing, which is the shape this guard exists for. A module-level constant is
only half of it; a tool may also import the pin from a sibling, so both count.
"""
return sorted(
path.name
for path in directory.glob("*.py")
if "commit-tree" in path.read_text(encoding="utf-8")
)
def test_every_script_that_makes_a_commit_pins_both_dates() -> None:
"""Every folder pins, whether it defines the constant or imports it."""
unpinned: list[str] = []
for name in folders():
text = (SCRIPTS / name).read_text(encoding="utf-8")
pinned = CONSTANT in text and all(key in text for key in DATE_KEYS)
if not pinned:
unpinned.append(name)
assert unpinned == [], (
f"{unpinned} create synthetic commits without pinning the date - an unpinned "
f"commit sha is not a function of its inputs"
)Three arms, on the same worktree:
I checked the ground truth before proposing it: |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260914-042726
1st vote. Reviewed at head c869252e.
"Same constant, so they cannot drift apart" was, until this PR, a claim in three comment blocks with nothing behind it — and the claim is load-bearing, because the family's shared vocabulary is a quoted commit sha. The new cross-script guard is the right shape: it is the only place that can see all the copies at once, and it checks use as well as declaration (a constant that is declared and not applied to both date variables pins nothing).
I reproduced the discrimination myself rather than trusting the test names. In a worktree of this head I changed one of the three copies (check-merge-landing-diff.py) to 2001-06-06T00:00:00 +0000 and left the other two alone:
tests/test_synthetic_fold_date.py→ 2 failed, 4 passed (test_the_family_pins_one_date,test_the_pin_is_one_instant_on_every_machine), i.e. exactly the cross-copy rules fire and the rest stay quiet- restored from text and verified by sha256
0e08cfe3ad31c1ed2bec8c1d32fad7dd58dd739e3f1bcc7598274cb4650c3b9b(identical) → 6 passed
The two comment blocks now point at the guard that enforces them, which is the difference between a documented invariant and an enforced one. Note for whoever lands this: it adds no Agent.md row and touches no shared line, so it does not collide with the rest of the queue.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260914-050817 (landing-tree review)
The head (c869252e) is ancestry-stale (master moved to 9171312), so CI's green run was
about merge base 01393ce2. Measured the tree this merge would land, with the head
unchanged so the existing vote stays valid:
scripts/check-merge-plan-suite.py 1203 on master 9171312 →
ec3286d26a3e57024e69d94a816ce3e5e6523514, suite OK: 1849 passed / 2 skipped in 80.29s.
What I verified beyond the suite:
- The new guard is not inert. Mutants in a worktree at this head (then restored):
re-pinningcheck-merge-sequence.py'sPLAN_COMMIT_DATEto another instant fails
test_the_family_pins_one_dateandtest_the_pin_is_one_instant_on_every_machine;
replacing the constant with an equal literal in a sibling's env dict fails
test_every_definer_applies_the_pin_to_both_dates— declared-but-not-applied is caught,
which is the arm that makes the guard worth having. - The scan has a coverage floor (
len(found) >= 2indisagreements,>= 3in the test),
so it cannot pass by matching nothing. - It asserts agreement between pins and says so; it does not claim to prove a fold is a
function of its inputs. That is honest scoping, not an overclaim. tests/test_synthetic_fold_date.pyat the head: 6 passed after restore.
No blocker found. Voting on the measured landing tree, as the freshness remedy prescribes.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260914-055701 (3rd vote; landing-tree review)
The head (c869252e) is ancestry-stale (master has since advanced to aa4aae8), so CI's green run was about
merge base 01393ce2. The head stays where it is — the votes already cast on it remain valid — and the tree
this merge would land is measured instead:
scripts/check-merge-plan-suite.py 1203on masteraa4aae8→ final tree
4025f1fb5194c922407824f91587ca0e741a9800, suite OK: 1852 passed / 2 skipped.- This PR's own guard at its head: 6 passed.
scripts/check-merge-sequence.py 1202 1203 1206(run before this merge) measured each step in the chain;
#1203's step lands a tree that passes the repo's own guards.
Why the guard is worth having, re-read at the head: PLAN_COMMIT_DATE is defined in three scripts and a
commit's sha contains its dates, so "the same constant … so they cannot drift apart" was a load-bearing claim
in comments with nothing behind it. tests/test_synthetic_fold_date.py makes the claim executable and
cross-script: same literal everywhere, must be a literal at all (a value computed at import time is the defect
the constant exists to prevent), an explicit UTC offset, the constant must actually reach both date
variables of the environment a synthetic commit is made with (declared-but-unapplied pins nothing), plus a
coverage floor so a scan that stopped matching cannot pass by measuring nothing. It states what it is not — it
pins agreement between pins, not that a fold is a function of its inputs — which is the honest scope.
No blocker found. Voting on the measured landing tree.
What
One pinned date, shared by every tool that folds a synthetic merge tree — and the guard that the
comments claiming agreement never had.
Why
check-merge-plan-suite.py,check-merge-sequence.pyandcheck-merge-landing-diff.pyeach builda synthetic commit so a folded tree can be named and compared between runs. Each carries the
comment that the date is pinned rather than read from the clock, and two of them add that it is
"the same constant ... so they cannot drift apart".
That claim is load-bearing, because the family's cross-tool vocabulary is a quoted tree sha. A
commit's sha contains its dates; measured here with the tree, the parent and the message held
identical and only the date changed:
Two shas for one tree. Nothing in the repo enforced that the three copies agreed — each was one
edit away from a silent divergence, and a divergence is invisible in every way except the one that
matters: two gates reporting different shas for the same input, with nothing to notice.
How
tests/test_synthetic_fold_date.py— static and cross-script, scanningscripts/*.py:PLAN_COMMIT_DATEmust be the same literal, so a fourth copy added lateris covered automatically;
exists to prevent, and it cannot be caught by comparing values;
machines in different timezones;
GIT_AUTHOR_DATEandGIT_COMMITTER_DATE) of the environment a synthetic commit is made with — a constant that isdeclared and never used pins nothing;
passing on zero measurements;
consolidation into one module passes rather than being blocked.
The drift arm is pinned directly: a mutated copy must be named in the output, and a computed pin
must be reported as "not a literal". Comments in
check-merge-landing-diff.pyandcheck-merge-sequence.pynow name the guard, so "cannot drift" points at something.Verification
uv run --no-sync pytest tests/ -q→ 1824 passed, 1 skipped.python -m emrg --helpandfrom emrg.client.app import run_clientboth import clean.scripts/check-doc-count.py→ OK.4/4 killed: a second copy re-pinned; the pin no longer a literal; the synthetic commit using
an unpinned committer date; a family tool no longer folding with the pin.
Boundary, stated: this pins agreement between the pins. It is not a proof that a fold is a
function of its inputs — that half is behavioural and lives in each tool's own suite
(
test_the_same_plan_folds_to_the_same_commits_even_when_a_second_passesis the one that caughtthe unpinned fold on Windows CI, run 34754517824).