Skip to content

fix(devtools): keep the layering gate read-only; prune on request - #5710

Merged
Sinity merged 1 commit into
masterfrom
fix/gates-read-only
Sep 28, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/gates-read-only

Conversation

@Sinity

@Sinity Sinity commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

The layering gate no longer rewrites tracked baselines during a run. Stale layering and SQLite-degradation baseline entries become blocking findings that name the fix command, devtools gate layering --prune-baselines, the only route that writes.

Problem

When a baseline entry no longer reproduced, the gate pruned docs/plans/layering-surface-baseline.json and docs/plans/sqlite-degradation-baseline.json in place. devtools verify compares the Git-visible content before and after the run, saw the change, and voided the result as checkout_moved_during_run. Every branch carrying a stale entry therefore failed the hosted quick gate with no code fault (bead polylogue-hzyyv). Reproduced locally on #5704's head: verify --quick ended checkout_moved_during_run, with only those two baselines modified.

Solution

  • devtools/verify_layering.py: new --prune-baselines flag. Without it, stale entries are layering_baseline_stale / sqlite_degradation_baseline_stale violations and nothing is written. The ratchet property is kept: a fixed violation's exemption cannot survive, because the gate fails until the shrink is committed.
  • Tests updated to pass the flag where they exercised pruning, plus a test that the plain gate leaves the baseline byte-identical.

Verification

  • devtools gate layering on master: passed, working tree unchanged.
  • devtools test tests/unit/devtools/test_layering_gates.py: one failure in the new test (an over-strict set assertion), fixed; rerun of that test: PASSED.

Residuals

Branches whose base predates #5698 now fail visibly with layering_baseline_stale instead of a voided run; rebasing onto master clears it.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

… on request

The layering gate rewrote docs/plans/layering-surface-baseline.json and
sqlite-degradation-baseline.json whenever an entry no longer reproduced.
verify then saw the Git-visible content change mid-run and voided the
result as checkout_moved_during_run, which failed the hosted quick gate on
every branch carrying a stale entry.

Stale entries are now blocking findings naming the fix command
(devtools gate layering --prune-baselines), which is the only route that
writes. The ratchet still cannot keep a fixed violation's exemption alive.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@Sinity
Sinity enabled auto-merge (squash) September 28, 2026 01:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T01:28:23.496312Z 3f20d52 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit 75eb023 into master Sep 28, 2026
3 checks passed
@Sinity
Sinity deleted the fix/gates-read-only branch September 28, 2026 01:31
Sinity added a commit that referenced this pull request Oct 2, 2026
## Summary

Add a regression control that runs the quick verifier's real plan,
receipt and Git-content checks with a real layering subprocess against
tracked synthetic stale baselines.

## Problem

PR #5710 already shipped read-only default layering and SQLite baseline
gates. The remaining task acceptance required evidence through whole
`verify --quick`: stale entries must retain their exact cause and prune
command while candidate content remains unchanged. Direct gate tests did
not establish that integration contract.

## Solution

The new control builds a neutral tracked Git fixture with stale layering
and SQLite entries, runs the real quick entry point and layering
subprocess, and checks the failed receipt, both named stale subjects,
exact prune command, unchanged tracked bytes/fingerprint and clean
status. It explicitly stubs unrelated gate process outcomes and
host/toolchain observations. It does not claim those stubs prove all
twelve actual gates. Product gates and default baseline content are
unchanged.

## Verification

`devtools test tests/unit/devtools/test_layering_gates.py
tests/unit/devtools/test_verify.py`: managed job 6283 exited 0; 140
selected, 140 terminal, 140 passed on clean
`ac454ec0327fd037ad7fbcfd773ba057e41166ec`, same clean head at finish.

For literal acceptance, a declared `devtools verify --quick` run (6286)
executed all twelve actual gates on the owned candidate with two
explicitly prepared synthetic stale entries. Eleven gates passed. Only
layering failed, with diagnosis `gate_semantic_violation`, exactly two
stale violations, their individual subjects, and `devtools gate layering
--prune-baselines`. There was no `checkout_moved_during_run` verdict.
Expected initial dirtiness was exactly the two fixture baseline files.
Their exact bytes/hashes, head/tree/status and complete Git-visible
fingerprint were equal before and after. Restoring only the two captured
original byte snapshots recovered the original clean candidate identity
and fingerprint. Receipt: `20261002T060417Z-quick-3025813-5b415c3d`.

The first focused run passed 140 tests. The first whole quick supplement
(6278) showed unchanged tracked content and both stale causes, but also
exposed a test-only mypy error from reading an unexported imported
`gate.venv_bin`. Its receipt was retained and not accepted as the final
proof. The two-line correction imports the function from its declaring
`devtools.toolchain`; the complete owning selection and necessary whole
quick proof were then rerun.

Normal precommit hooks, changed-file ruff and `git diff --check` passed.
The normal pre-push hook ran clean `devtools verify --quick` on the
exact head and passed all twelve gates, exit 0; receipt
`20261002T060726Z-quick-3029893-86ef3d95`. Hosted checks remain the
publication gates.

## Self-review

Final pass 2 reread the entire one-file diff against current master and
applied the project and generic checklists. The coordinator
independently reviewed the source, correction and controlled proof
packet.

1. ✓ Siblings/owners: shipped layering and SQLite default/prune branches
inspected; shared actual quick caller, output, receipt and content
fingerprint are exercised together.
2. ✓ Fix itself: no product fix introduced; test calls actual quick
entry and real layering subprocess. Unrelated gate process outcomes and
host/toolchain observations explicitly stubbed.
3. ✓ Memory/limits: tiny neutral fixture tracked bytes only, no
corpus/cap/whole archive copy.
4. ✓ Cost/unit: one layering child, quick plan and one tiny Git tree; no
new recurring product work.
5. ✓ Interruption: production interruption route unchanged; child runs
through real registered gate process owner, with subprocess joined
before receipt.
6. ✓ Ordering/races: initial tracked bytes/status/fingerprint compared
after actual quick; successful hash required, only baseline stale
failure accepted. Real supplement6286 preserved fullGitvisible
fingerprint4cbf4b, twoSHA/status/head/tree; exacttwo-byte-snapshot
restore returned cleaninitial05da.
7. ✓ Failure classification: require exact stale rule tokens, both
individual stale subjects and explicit prune command; no checkout-moved
diagnosis permitted.
8. ✓ Silent outcomes: real quick plan membership asserted; only layering
can fail; no all12-real-gate claim from stubs. Declared supplement owns
literal acceptance.
9. ✓ Cleanup: tmp_path owns neutral Git/cache artifacts; no host archive
or production baseline writes. Supplement snapshots preserved before
mutation and exact restoration verified.
10. ✓ Identity/keys: actual Git content hash/checkout identity/receipt
head are exercised; no production cache or identity changes.
11. ✓ Lossless: every tracked fixture byte retained, original source
mechanisms unchanged; no default baseline edit committed.
12. ✓ Degenerate: two stale classes in one input, alongside existing
live exemption; existing direct empty/live/prune controls remain.
13. ✓ Consumers: test-only addition; no public interface/config/schema
or product consumer change.
14. ✓ Tests/stubs: restoring unconditional prune changes
bytes/fingerprint and receipt diagnosis, breaking control. Stub scope
explicit; actual layering producer executes in subprocess against
synthetic tracked Git checkout.
15. ✓ Trust: public fixture neutral, author [email protected], no
private receipts/corpus; scratch proof remains outside Git.
Devtools area ✓ explicit focused modules only, actual --quick runs
static gate plan without pytest/corpus fallback.
Generic1 ✓ remaining acceptance preserved, literal all12 proof6286
established; Generic2 ✓ both baseline families/quick owner inspected;
Generic3 ✓ no predecessor/product replacement; Generic4 ✓ exact visible
stale cause/prune command; Generic5 ✓ concrete unconditional-prune
mutation makes test red; Generic6 ✓ public data neutral, private
evidence excluded.


## Honest residuals

The regression control stubs unrelated gate outcomes; the separate
declared all-gate run supplies the literal whole-quick proof. This
test-only change preserves the already shipped #5710 mechanism. No
default baseline edits, verifier framework, exclusions, whole-checkout
copy, corpus, private archive or activation are included.
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