-
Notifications
You must be signed in to change notification settings - Fork 0
docs(memory): record the write-gate deadlock and the two stores behind it #984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18365,6 +18365,22 @@ fn apply_admissions( | |
| // and `land` replays exactly that commit. Resolved lazily — one read per | ||
| // run, and none on a run the store answers or that has nothing to admit. | ||
| let mut head_message: Option<Option<String>> = None; | ||
| // AND ITS SECOND PARENT, WHERE HEAD IS A MERGE THE FORGE MINTED (CLOUD-1674 | ||
| // again, on the surface it was written for). A forge that checks a pull | ||
| // request out by its MERGE REF hands the runner a commit IT synthesised — | ||
| // parents (base, head), message `Merge <head> into <base>` — rather than the | ||
| // branch head. So the block arm above read the one commit that structurally | ||
| // cannot carry a block, and CLOUD-1674's whole "exit 0 here, exit 2 in CI" | ||
| // asymmetry survived its own fix. Measured: `batten-check` admitted a spend | ||
| // locally and refused the identical commit on the runner. | ||
| // | ||
| // `HEAD^2` AND NOT A RANGE WALK, which this function's own doc rejects for a | ||
| // reason that still holds: a walk would let an old block admit a later | ||
| // finding sharing its fingerprint. A merge's second parent is one commit, | ||
| // and on a forge-minted merge ref it is exactly the branch head `land` | ||
| // replays — the same commit the HEAD arm reads everywhere else. On a HEAD | ||
| // that is not a merge there is no such parent and nothing changes. | ||
| let mut merged_head_message: Option<Option<String>> = None; | ||
|
|
||
| let mut kept = Vec::with_capacity(findings.len()); | ||
| for finding in findings { | ||
|
|
@@ -18395,6 +18411,25 @@ fn apply_admissions( | |
| ) | ||
| }); | ||
| } | ||
| //MUTANT-SUITE crates/batten/tests/it/admission.rs | ||
| //MUTANT merge-parent-arm-removed|s@^ if admitted.is_none() {$@ if false {@|a_spent_block_on_a_merge_refs_second_parent_admits | ||
| if admitted.is_none() { | ||
| let message = merged_head_message.get_or_insert_with(|| { | ||
| git::commit_record(root, "HEAD^2") | ||
| .ok() | ||
| .map(|record| record.body) | ||
| }); | ||
| admitted = message.as_deref().and_then(|body| { | ||
| admission::admitted_by_block( | ||
| body, | ||
| &finding.rule, | ||
| class, | ||
| &finding.path, | ||
| &anchor, | ||
| &epoch, | ||
| ) | ||
| }); | ||
| } | ||
|
Comment on lines
+18414
to
+18432
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '18320,18450p' crates/batten/src/lib.rs
rg -n -C 4 'HEAD\^2|admitted_by_block|batchen-check|pull_request|GITHUB_EVENT' crates/batten/src crates/batten/tests/it
rg -n -C 4 'Admits:|admit.*commit|commit.*admit|HEAD fallback|head fallback' docs crates/batten/src/admission.rs crates/batten/tests/it/admission.rsRepository: button-inc/batten Length of output: 50376 🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- admission callers and entrypoints ---'
rg -n -C 5 'apply_admissions|admission|batten-check|check' crates/batten/src/lib.rs crates/batten/src/cli.rs .github/workflows/ci.yml crates/batten/tests/it/admission.rs | head -n 500
printf '%s\n' '--- workflow checkout and batten invocation ---'
rg -n -C 12 'actions/checkout|pull_request|batten-check|cargo run|batten check|admission|override' .github/workflows/ci.yml | head -n 400
printf '%s\n' '--- admission tests and contract text ---'
rg -n -C 8 'HEAD|parent|merge|single|commit|block|admit|admission' crates/batten/tests/it/admission.rs crates/batten/src/admission.rs crates/batten/src/lib.rs | head -n 700Repository: button-inc/batten Length of output: 50374 🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- exact apply_admissions references ---'
rg -n 'apply_admissions' crates/batten/src
printf '%s\n' '--- callers around references ---'
for line in $(rg -n 'apply_admissions' crates/batten/src | cut -d: -f2); do
start=$((line-18)); end=$((line+28))
sed -n "${start},${end}p" crates/batten/src/lib.rs
done
printf '%s\n' '--- batten-check workflow job and command references ---'
rg -n 'batten-check|HK_SKIP_STEPS|mise run verify|mise run ci' .github/workflows/ci.yml
sed -n '545,640p' .github/workflows/ci.yml
printf '%s\n' '--- focused admission integration symbols ---'
rg -n '^(fn | fn |#\[test\]|.*HEAD|.*merge|.*parent|.*block|.*admit|.*admission)' crates/batten/tests/it/admission.rs | head -n 300Repository: button-inc/batten Length of output: 47330 🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- ordinary merge test and helper ---'
sed -n '1035,1150p' crates/batten/tests/it/admission.rs
printf '%s\n' '--- shared run path around apply_admissions caller ---'
sed -n '19060,19175p' crates/batten/src/lib.rs
printf '%s\n' '--- command/task definitions for local and CI entrypoints ---'
rg -n -C 6 'batten-check|verify|enforce|Command::Check|Command::Enforce|run_rules|run\(' batten.toml mise.toml crates/batten/src/lib.rs crates/batten/src/main.rs .github/workflows/ci.yml | head -n 500Repository: button-inc/batten Length of output: 46692 Restrict 🤖 Prompt for AI Agents |
||
| match admitted { | ||
| Some(address) => output::message( | ||
| mode, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: button-inc/batten
Length of output: 7849
🏁 Script executed:
Repository: button-inc/batten
Length of output: 5007
Limit the deadlock rule to gated verification failures.
A
pendingorin_progressplan can makeverifyred whilebatten record planremains reachable. Recording the plan asdeletedis the documented exit becausedeletedis terminal. Therefore, a redverifyat HEAD withunlanded-nudgedset is not always a deadlock requiringgit reset --soft.Qualify the rule for cases where the plan is terminal and the verification failure requires a mediated write that the gate blocks. This prevents an unnecessary history reset and force push.
🤖 Prompt for AI Agents