Skip to content

docs(claude): check the base before spending a gate slot (phaze-fkha3) - #539

Merged
SimplicityGuy merged 1 commit into
mainfrom
wt/bead/issue/phaze-fkha3
Aug 25, 2026
Merged

docs(claude): check the base before spending a gate slot (phaze-fkha3)#539
SimplicityGuy merged 1 commit into
mainfrom
wt/bead/issue/phaze-fkha3

Conversation

@SimplicityGuy

Copy link
Copy Markdown
Owner

What and why

A 20-25 minute gate measures a tree, and origin/main can move while it runs β€” so the gate may characterise a tree nobody will merge. The failure surfaces as someone else's red test in your own transcript.

Measured 2026-08-24: a seat's gate went red 23 minutes in on test_litellm_pin_is_unchanged, in a bead whose own diff was one ADR plus three comment-only edits, while origin/main advanced four commits and another seat fixed that guard as a P0.

Adds one section to CLAUDE.md, directly after the gate-slot rationing section it belongs beside β€” that one rations slots against the machine's headroom, this one against the result's validity.

The check

git fetch origin && git rev-list --left-right --count HEAD...origin/main

One second against 20-25 minutes.

Explicitly not a mandate to rebase. phaze-irby2 gated green, ran this check, rebased, and paid a second ~22-minute gate because the rebase changed its tree and invalidated the (tree, cmd_hash) ledger key. The rule is know before you spend the slot.

Measured, so the guidance is proportionate rather than adjectival

origin/main took 65 commits in 24 h (2.71/h). Expected commits landing during one gate: 0.99 for a 22-minute full run, 0.027 for a 35.57 s check-fast selected run. The check earns its keep on the escalated path; both numbers or neither.

Method correction

Disjointness is git merge-tree --write-tree, never hunk arithmetic β€” three-dot diff headers are in merge-base coordinates (measured 22-line offset on CLAUDE.md). Two limits, both measured on git 2.50.1:

  • Exit 1 is ambiguous between a conflict and an unresolvable ref (nosuchref β†’ exit 1), so a never-fetched worktree reports "conflict" having measured nothing.
  • Clean is necessary, not sufficient. phaze-sy8z3 merged clean and went 2 failed, 7985 passed on a field another branch renamed.

AC 4 β€” verified against bh 0.15.0 source, not inferred

The bead flagged this as an inference. It is narrower than assumed:

  • Molecule boundary only β€” work_merge.py:282/:394; the per-bead path at :854 has no stale term.
  • It cannot see origin/main at all β€” git fetch appears nowhere in the lifecycle (work.py, work_merge.py, work_submission.py, work_group.py, worktree*); the one hit, worktree.py:823, is upstream/<base> for kind=external hives.
  • The developer gate has nothing β€” impl_check (work_submission.py:10-71) never resolves a base.

General form (rule 5)

The next term in this file's own series rather than a free-standing aphorism: a gate's M is a property of a RUN, not a COMMAND β€” and an M is also a property of a MOMENT, never of the repo in perpetuity. An M about STATE decays; an M about MECHANISM does not. The label makes it worse, because M is the marker that says do not re-verify this.

Validation

Full suite on an isolated seat, read from the gate log body:

phaze test database: 'phaze_pregate_2d7978e7_test' on localhost:5433 (from TEST_DATABASE_URL, exclusive)
8038 passed, 3 skipped, 180 deselected, 96 warnings in 1303.40s (0:21:43)
TOTAL  18199  169  3922  141  98.56%
Required test coverage of 95.0% reached. Total coverage: 98.56%
GATE_EXIT=0

Per AC 7, this bead ran its own step-1 check immediately before gating β€” 1 0, base had not moved, so it did not gate on a stale base. Re-run after the base moved 6 commits: merge-tree clean, all asserted claims content-grepped and still true, nothing duplicated β€” so no rebase, which is the guidance demonstrating itself.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01GazEx6kCcyQuRvifWb3aBF

A 20-25 minute gate measures a TREE, and origin/main can move while it runs, so
the gate may characterise a tree nobody will merge. The failure surfaces as
SOMEONE ELSE'S red test in your own transcript: measured 2026-08-24, a seat's
gate went red 23 minutes in on test_litellm_pin_is_unchanged, in a bead whose own
diff was one ADR plus three comment-only edits, while origin/main advanced four
commits and another seat fixed that guard as a P0.

THE CHECK: `git fetch origin && git rev-list --left-right --count HEAD...origin/main`
before check/submit. One second against 20-25 minutes.

NOT A MANDATE TO REBASE, and the cost of reading it that way is measured:
phaze-irby2 gated green, ran the check, rebased, and paid a second ~22-minute
gate because the rebase changed its tree and invalidated the (tree, cmd_hash)
ledger key. Rebase-looping against a main moving at 2.71 commits/h never
converges. The rule is "know before you spend the slot".

MEASURED RATE, so the guidance is proportionate rather than adjectival: 65
commits in 24h on origin/main (2.71/h). Expected commits landing DURING one gate
= 0.99 for a 22-minute full run, 0.027 for a 35.57s check-fast selected run. The
check earns its keep on the ESCALATED path; both numbers or neither.

METHOD CORRECTION: disjointness is `git merge-tree --write-tree`, never hunk
arithmetic β€” three-dot diff headers are in merge-base coordinates (measured
22-line offset on CLAUDE.md). Two limits on it, both measured on git 2.50.1:
exit 1 is AMBIGUOUS between a conflict and an unresolvable ref (`nosuchref` ->
exit 1), so a never-fetched worktree reports "conflict" having measured nothing;
and clean is NECESSARY NOT SUFFICIENT β€” phaze-sy8z3 merged clean and went
2 failed, 7985 passed on a field another branch renamed.

The judgement criterion nothing structural sees: do the new commits FALSIFY or
DUPLICATE a claim my text makes? It can tell a seat its text is wrong even when
no rebase is needed. Applied to this very section, it caught a closing sentence
duplicating the ceiling section's; cross-referenced instead.

Population for the whole-tree-guard criterion, measured: 78 of 585 test files
read a tracked repo file and assert on its content β€” one in eight β€” so a
disjoint file list is the wrong answer for that class. The litellm guard is one.

AC 4 VERIFIED AGAINST bh 0.15.0 SOURCE, NOT INFERRED (the bead flagged it as an
inference). The config's staleness backstop is real but narrower than assumed:
it is the MOLECULE boundary only (work_merge.py:282/394; the per-bead path at
:854 has no `stale` term), and it cannot see origin/main at all because `git
fetch` appears NOWHERE in the lifecycle (work.py, work_merge.py,
work_submission.py, work_group.py, worktree*) β€” the one hit, worktree.py:823, is
upstream/<base> for kind=external hives. The developer gate has nothing:
impl_check (work_submission.py:10-71) never resolves a base. `bh work merge
--help` is silent on all of it.

GENERAL FORM (rule 5), as the next term in CLAUDE.md's own series rather than a
free-standing aphorism: a gate's M is a property of a RUN not a COMMAND; an M is
also a property of a MOMENT, never of the repo in perpetuity β€” an M about STATE
decays, an M about MECHANISM does not. The label makes it worse, because M is
the marker that says "do not re-verify this".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GazEx6kCcyQuRvifWb3aBF
@SimplicityGuy
SimplicityGuy merged commit 2955aad into main Aug 25, 2026
11 checks passed
@SimplicityGuy
SimplicityGuy deleted the wt/bead/issue/phaze-fkha3 branch August 25, 2026 20:36
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.

1 participant