Skip to content

ci(admission): bind the queued merge commit to the live PR head by tree (#4836) - #11149

Merged
EffortlessSteven merged 2 commits into
mainfrom
claude/8082-queued-g-tree-binding
Oct 30, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
claude/8082-queued-g-tree-binding

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

  • Resolve queued PR in routed-rust.yml now binds the merge-queue commit G to the live PR head H by content: G's tree must equal git merge-tree --write-tree <base> <head>. The commit-date comparison is removed.
  • Adds an executable harness for that step (real Git objects, stubbed read-only gh), including a guard-removal control for the documented counterexample.

Swarm / Source Boundary

No release, signing, publishing, ruleset, permission or secret surface is touched.

Source-of-truth Links

Proposal: #4984 (native queue cutover), #8082 (reference caller, split by comment 6274349288)
Spec: n/a
ADR: n/a
Plan item: docs/MERGE_FLOW.md "Subject and trust" row
Governing issue or accepted claim: #4836 (claim comment: #4836 (comment); defect demonstrated in #4836 (comment))
Acceptance delta (one sentence): The admission job's queued-commit-to-live-head binding stops depending on the queue ref suffix and commit dates and instead refuses any queued tree that is not the live head merged onto the group base.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): claude/8082-queued-g-tree-binding
Stack parent or prerequisite PR (if any): none; branched from main 280822b23f.
Proposed replacement of PR (if any; not yet accepted): none. Not a rival to Draft #8082 (reference, not edited) or #8172.
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a

All-state search found no equivalent implementation: no open or merged PR touches the Resolve queued PR timestamp predicate (main still carries pushed_at < queued_at).

Scope

  • .github/workflows/routed-rust.yml: one step (Resolve queued PR); no trigger, permission, job-graph, label or required-context change.
  • xtask/tests/routed_queue_resolution.rs (new): runs the extracted production step.
  • tools/repo-policy/src/lib.rs, tools/repo-policy/src/workflow_tests.rs, xtask/src/tests.rs: the two source pins that required the timestamp snippet now pin the PR-ref and tree comparisons (same mutation-test shape).
  • docs/CI.md, policy/process_allowlist.txt, changelog.d/4836-queued-commit-tree-binding.md.

Scope Classification

  • One architectural seam

Production delta:

  • In the merge_group branch only: complete shallow history (git fetch --unshallow), fetch refs/pull/<n>/head and require it equal the API-read head, then require merge-tree(base, head) tree == G^{tree}. Existing checks (ref names live head or base; one parent == base; subject ends (#n)) are unchanged and still run first.

Evidence/support delta:

  • 6 executable cases over real commits (base moved past the merge base): accept with ref naming head and naming base; refuse different live head predating G (the Oct 23 counterexample, with a control showing the same inputs are admitted once the tree comparison is removed); refuse extra content in G; refuse a moved/unfetchable PR ref; refuse a conflicting head; existing batch/parent/subject/ref refusals still fire.
  • Premise check outside the fixtures: for the 60 most recent first-parent squash merges on main, git merge-tree --write-tree <squash parent> <PR head> equals the squash commit's tree in 60/60.

Single acceptance criterion:

  • A queued commit whose tree is not the live head merged onto the group base is refused.

Non-goals:

Support-tier Impact

  • changes a README, release, docs, CLI, JSON, editor, CI, or package claim

Claim/proof notes:

  • docs/CI.md merge-queue section now says the tree binds G to the head live at admission, not to the head a reviewer judged ready, and that the squash-tree premise is validated on past squash merges and fixtures, not on a native queue entry.

Policy Impact

  • CI lane
  • process/network

Ledger or exception notes:

  • policy/process_allowlist.txt: two entries for the new test (local git + bash only; no network).

Proof

cargo xtask precommit                                   # exit 0 (all checks listed pass, incl. check-workflows, check-process-policy)
cargo test --locked -p xtask --test routed_queue_resolution --test routed_dispatch_result --test pr_readiness_workflow_contract   # 6 + 9 + 20 passed
cargo test --locked -p repo-policy --lib routed_rust    # 6 passed
cargo test --locked -p xtask --bin xtask routed_rust    # 10 passed

Result, failures, or skipped proof:

  • Local only; no hosted run, no native merge-group event, no workflow dispatch. The new test is #[cfg(unix)] (the step runs on ubuntu-latest).
  • A first precommit attempt failed with ENOSPC (disk full from concurrent builds); it was rerun after freeing space and passed. That was infrastructure, not source.
  • Not run against the old workflow end to end: the old step also reads commit dates through extra gh api calls the stub does not model, so a RED run would fail for the wrong reason. The in-test guard-removal control is the discriminator instead.

Claim Boundary

May claim: a queued commit that is not exactly the live head merged onto the base is refused by the admission job, tested against real Git objects.

Must not claim: the binding holds on a native queue entry (unobserved; ruleset has no merge_queue rule), that the live head is the one reviewed, atomicity with the protected merge, or that GitHub's queue squash always equals merge-tree. The check fails closed if it does not, which would block (not wrongly admit) a queued entry.

Rollback

Revert this commit. The timestamp predicate and its two source pins return. No settings, label, ruleset or required-context change to undo.

Spec-Test-Code Traceability

  • Spec: docs/MERGE_FLOW.md (subject and trust), docs/CI.md (merge queue request)
  • Tests: xtask/tests/routed_queue_resolution.rs; repo-policy/xtask routed_rust_ready_event_matrix_withholds_draft_and_label_context
  • Code: .github/workflows/routed-rust.yml Resolve queued PR
  • Golden outputs: none
  • Metrics: none
  • ADR/learning: none

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

  • LEM impact: admission job on merge_group events gains one unshallow fetch of history plus one PR-ref fetch (detect-docs-only already does a full-history checkout on the same events). No effect on label/main/manual runs.
  • Workflows touched: routed-rust.yml (merge_group branch of one step)
  • Branch protection impact: none
  • Failure mode caught: queued commit not equal to the live head merged on the base (different head, tampered content, conflict, moved PR ref).
  • Cheaper signal considered: commit dates / ref suffix (the removed predicate; demonstrably insufficient).
  • Required lanes affected: Ripr Rust Small Result via admission, merge_group only.
  • Advisory lanes affected: none
  • On-demand/release lanes affected: none
  • Labels that alter behavior: none
  • Artifact families affected: none
  • Rollback path: revert the commit; no settings change.

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • New non-Rust programming files are allowlisted with owner, surface, and reason.
  • New generated, dependency, process-spawn, or network surfaces are allowlisted with owner and reason.
  • Errors are reported with actionable context.
  • Public JSON/schema changes are documented.

Gates

  • cargo fmt --check (inside precommit)
  • cargo xtask check-workflows
  • cargo xtask check-process-policy
  • cargo xtask check-covered-by
  • cargo xtask check-file-policy
  • Full-workspace gates not run locally; fixed-candidate qualification belongs to the late request.

Generated by Claude Code

…ee (#4836)

Resolve queued PR accepted a base-suffixed queue ref when the live PR head's
commit date preceded the queued commit. The ref names the base and dates are
not content, so a different head H2 older than G was admitted (executed
counterexample, #4836 comment 6370396130).

The step now requires the queued tree to equal `git merge-tree --write-tree
<base> <head>`, with the head fetched from refs/pull/<n>/head and required to
equal the head read from the API; history is completed first because the queue
checkout is depth 1. A different head, extra content, a merge conflict, a moved
PR ref or a failed fetch refuses. The premise (GitHub's squash tree equals that
merge) held for 60/60 recent squash merges to main.

xtask/tests/routed_queue_resolution.rs extracts the production step and runs it
over real Git objects behind a stubbed gh, including a guard-removal control
for the counterexample. The two source pins that required the timestamp snippet
now pin the PR-ref and tree comparisons in repo-policy and xtask.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013kSch2opYors8Yb2NR1ZMd
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 148 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 11794718-0a8d-4529-86bf-4a17550bce84
Commits

Reviewing files that changed from the base of the PR and between e39370d and c9396f7.

Files selected for processing: 8
  • .github/workflows/routed-rust.yml
  • changelog.d/4836-queued-commit-tree-binding.md
  • docs/CI.md
  • policy/process_allowlist.txt
  • tools/repo-policy/src/lib.rs
  • tools/repo-policy/src/workflow_tests.rs
  • xtask/src/tests.rs
  • xtask/tests/routed_queue_resolution.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the routed admission process to bind a merge-queue commit to the live PR head by comparing their trees (using git merge-tree) instead of relying on commit-date comparisons. This prevents issues with different heads, extra content, merge conflicts, or moved PR refs. The PR includes updated documentation, policy allowlist updates, and a comprehensive integration test suite in xtask/tests/routed_queue_resolution.rs. Feedback on the test suite suggests making the workflow step parser more robust by splitting on a generic step prefix rather than a hardcoded step name.

Comment thread xtask/tests/routed_queue_resolution.rs Resolved

Copy link
Copy Markdown
Member Author

Independent exact-head review of 2cd3285: REVIEW_READY, no blocking findings. Inspected the full diff, every error path of the new step (fetch, unshallow, merge-tree conflict, empty or multi-line output, quoting), that the test runs the production step text, and the guard-removal control. Local proof only; the tests were not re-run by the reviewer. Applying merge-ready for the required hosted check.

Optional follow-ups, deliberately not in this push (they would reset CI): narrow git fetch --unshallow to the needed objects, make the conflict test use the printed merge-tree OID so it isolates exit-status handling, and make the step extraction split on a generic step prefix (Gemini nit). Tracked for the next push to this file.


Generated by Claude Code

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verification questions

  • Confirm a repository-wide route scan for other timestamp-based queue bindings or duplicate merge-tree helpers was not evidenced by the supplied sibling-path packet.
  • Confirm the workflow extractor depends on the next step being named exactly 'Admit exact candidate'; this is the already-raised low-priority fragility.
  • Confirm the executable harness extracts the production step by requiring the exact following step name, Admit exact candidate; inserting or renaming that adjacent step makes the test fail before exercising admission behavior.
  • Confirm the conflict fixture uses the base tree rather than a conflict-produced tree, so it does not establish that merge-tree reports a conflict or exercise conflict-output handling.
  • Confirm the production route fetches refs/pull//head, requires it to equal the API live head, computes merge-tree(base,head), and compares its first output line with the queued commit tree.
  • Confirm the implementation assumes git merge-tree --write-tree is available and emits a tree OID as its first output line, but no minimum Git version or alternate parser is specified.

Refuted

  • The changed workflow needs a fresh blocker for the exact-next-step parser coupling.; refuted because: The seeded Gemini comment already identifies this exact concern, and it is a low-priority harness robustness issue rather than a correctness failure in the production binding.
  • The step extractor is a new blocker because it names a downstream workflow step.; refuted because: This is a real low-priority maintainability concern but was already raised in the seeded thread and does not undermine the current oracle's ability to exercise the production step; it is recorded as a duplicate rather than re-posted.
  • The tree-binding change should reuse or retain the old timestamp mechanism.; refuted because: The old timestamp comparison cannot identify the live reviewed head and the PR removes it in favor of a content invariant; retaining it would add API calls without strengthening the required binding.
  • The test suite merely pattern-matches workflow text rather than exercising the changed admission route.; refuted because: xtask/tests/routed_queue_resolution.rs extracts the checked-in shell, runs it against real commits and a stubbed read-only gh, and covers acceptance and multiple fail-closed refusals.

Evidence gaps

  • The harness executes the checked-in shell, but native merge_group admission was not observed and the premise that GitHub's squash tree equals merge-tree remains only fixture/history evidence.
  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review (fresh-context reviewer, head 2cd3285): REVIEW_READY — no blocking defect found in the admission change; the hosted head is green (Rust gates success, all four workspace test shards success) and the new executable harness for the changed merge_group branch ran green in that phase.

Inspected:

  • Head 2cd3285f9698449a0fb209c678ebe2509661f20e (re-read via gh pr view --json headRefOid,isDraft,state immediately before posting; draft=false; base e39370d2df076a0e3ca764c51e7bcebbd3fc5044; 8 files, +557/-27).
  • The complete diff of all eight files: .github/workflows/routed-rust.yml (the Resolve queued PR step), xtask/tests/routed_queue_resolution.rs (new, 520 lines), tools/repo-policy/src/lib.rs, tools/repo-policy/src/workflow_tests.rs, xtask/src/tests.rs, docs/CI.md, policy/process_allowlist.txt, changelog.d/4836-queued-commit-tree-binding.md.
  • The production shell at the head read line by line (routed-rust.yml:246-294) and traced under the step's own set -euo pipefail (line 259), in the admission job context (runs-on ubuntu-latest, timeout-minutes: 10, permissions: contents: read + pull-requests: read, depth-1 actions/checkout@v6 at line 193 plus a second checkout at path: .admission-trusted with persist-credentials: false).
  • The fetch/compare chain traced end to end: shallow detection -> git fetch --no-tags --unshallow origin -> git fetch --no-tags origin refs/pull/<n>/head -> git rev-parse FETCH_HEAD -> git merge-tree --write-tree <base> <head> -> ${merged%%$'\n'*} compared with git rev-parse "${GROUP_HEAD_SHA}^{tree}". The errexit semantics check out: the command substitution is the left operand of &&, so errexit is suppressed and the || refusal branch runs; a merge conflict makes git merge-tree --write-tree exit non-zero, which lands in that same refusal branch, so both the conflict path and the tree-mismatch path fail closed. The PR-ref fetch and its equality check precede the merge-tree call, so $head is a local object before it is used as a merge input.
  • The PR body's cost claim checked against source: detect-docs-only does use fetch-depth: 0 (routed-rust.yml:114-116), so a full-history checkout does already run on the same events.
  • docs/CI.md at the head against the step: each refusal the doc claims (different head, extra content, merge conflict, moved PR ref, missing history) maps to a distinct refusal path in the step, and the doc's non-claim - that the tree binds the head GitHub reports live at admission, not the head a reviewer judged ready, and that the premise is checked only on past squash merges and local fixtures - matches the PR body's Claim Boundary. The doc does not overclaim.
  • docs/MERGE_FLOW.md checked for contradiction: the "Subject and trust" row (line 120) asks for "actual G identity", and lines 95-98 already require binding G to its base and actual tree, so the change is consistent with the governing plan rather than at odds with it. docs/PR_AUTOMATION.md was also checked; its merge-tree mention is about reading a PR merge ref and does not bear on admission.
  • Hosted proof at the head, re-read after the test phase completed: Ripr Rust Small on GitHub Hosted / Rust gates success; Rust tests shard 1/2/3/4 of 4 all success; Admit PR Candidate success; Detect Docs-Only Surface success; Rust-only feature lane success; windows-advisory-subset success; ub-review success; overall commit status success. Ripr Docs Gate skipped is correct rather than a gap: its condition (routed-rust.yml:409) requires detect-docs-only.outputs.docs_only == 'true', and this PR changes a workflow and Rust sources.
  • Which shard actually ran the new tests: downloaded the four ripr-rust-small-github-nextest-shard-N-1 artifacts from workflow run 41061864061 and read the retained list-N.txt partition lists. Shard 1 lists xtask::routed_queue_resolution batch_wrong_parent_and_wrong_subject_still_refuse_before_the_tree_is_read and ... queued_squash_of_a_different_head_is_refused_even_when_it_predates_the_queue_commit; shard 2 lists ... head_that_conflicts_with_the_base_cannot_bind_any_queued_tree and ... queued_squash_of_the_live_head_is_accepted_whether_the_ref_names_head_or_base. rust-test-shards.yml runs cargo nextest run --workspace --profile ci --partition count:N/4 and its verify job proves the four partitions are a disjoint cover of the workspace list, so the remaining two new cases sit in shards 3 and 4, both of which completed success. The new tests are therefore in the hosted required phase and green, not merely asserted locally.
  • Prior evidence read and classified rather than re-raised: the EffortlessSteven issue comment of 2026-10-30T13:16:25Z (REVIEW_READY on this same head, with three optional follow-ups), the CodeRabbit review and inline findings, and the gemini-code-assist inline finding.

Blocking:

  • None found.

Non-blocking:

  • NEW (oracle granularity; evidence gap worth recording): the positive fixture is self-referential for the tree computation. World::squash builds the expected queued commit with git merge-tree --write-tree base head - the same command the production step uses to compute the candidate tree - so the acceptance case proves the end-to-end plumbing and the absence of a false refusal, but it cannot falsify the premise that GitHub's squash tree equals merge-tree(base, head). The discriminating cases are not circular (a different head and a tampered tree produce genuinely different trees), so the guard's bite is still proven; it is specifically the positive case that is self-referential. The only evidence for the premise is the 60/60 past-squash check reported in the PR body: a repository-wide search for merge-tree returns only documentation and unrelated source (docs/CI.md, docs/PR_AUTOMATION.md, docs/SOURCE_PROMOTION_PREFLIGHT.md, docs/specs/RIPR-SPEC-0148-source-promotion-preflight.md, plans/4510-candidate-harness.md, xtask/src/command.rs, xtask/src/reports/source_promotion.rs, xtask/tests/rust_gate_merge_ref_check.rs, .github/workflows/rust-gates.yml, policy/doc-artifacts.toml), and no premise receipt is retained in-tree. The failure direction is fail-closed - if the premise were false, admission would refuse every queue entry rather than admit a wrong one - and docs/CI.md already states the boundary. Recording it so the first native queue transaction treats the premise as observed for the first time rather than assumed from the fixtures.
  • NEW (operational, unmeasured): the new git fetch --no-tags --unshallow origin runs inside the admission job, which has timeout-minutes: 10 (routed-rust.yml:171) and a depth-1 checkout (line 193). The PR body states the cost; this pass did not measure it. The full-history fetch the PR body compares against is real but lives in a different job with its own 10-minute budget (detect-docs-only, lines 109-116), so the two do not share a clock. If the unshallow ever becomes the slow part of admission, the failure mode is a timed-out job - a blocked queue, not a wrong admission.
  • CORROBORATES (a review-bot question, answered from source; no action needed): the "no minimum Git version" question. git merge-tree --write-tree requires Git >= 2.38 and nothing in the repository pins a Git version. The only execution environment for this step is the admission job on ubuntu-latest (routed-rust.yml:170), whose image carries Git >= 2.43, and the new harness is #[cfg(unix)] on the same platform class; the self-hosted routes (CPX42/CX43/CX53) are downstream rust-gates.yml calls and never run this job. Recorded as answered rather than blocking, with the residual risk being a future runner-image change rather than a defect at this head.
  • CORROBORATES (a review-bot finding, non-blocking): the source pins in tools/repo-policy/src/lib.rs, tools/repo-policy/src/workflow_tests.rs and xtask/src/tests.rs now require [ "$fetched" = "$head" ] and the tree comparison. They are genuine mutation pins - each is removed from the workflow and the contract is expected to go red - but they pin the comparison, not the git merge-tree --write-tree "$GROUP_BASE_SHA" "$head" invocation that produces merged. Replacing that invocation with, for example, git rev-parse "$head^{tree}" would leave the pins green while weakening the binding to "G's tree equals the head's tree". The new executable harness would catch that, because the honest case would stop being admitted, so the two mechanisms cover each other. Recording the split so the pins are not read as covering more than they do.
  • ALREADY_DISPOSED (raised by the prior EffortlessSteven comment and independently by the review bots; not re-raised as new): the conflict fixture uses the base tree rather than a conflict-produced tree, so head_that_conflicts_with_the_base_cannot_bind_any_queued_tree cannot distinguish "merge-tree reported a conflict" from "the tree did not match"; and the step extraction couples to the literal step names Resolve queued PR / Admit exact candidate.
  • NON-BLOCKING (pre-existing, unchanged here): the step still does not establish that the admitted head is the head a reviewer judged ready, and the read of the live head and the later protected merge are not atomic. Both are stated as non-goals in the PR body and disclosed in docs/CI.md; the tree binding strengthens the G-to-H link without touching the reviewed-head question.

Not run:

  • No local Rust toolchain on this host: cargo/rustc are absent from PATH, so build and test execution could not be performed locally; all Rust proof below is hosted CI plus source reading.
  • No local execution of the new harness. The six new cases are verified only through the hosted nextest --workspace phase; the PR body's own local receipts (cargo xtask precommit, cargo test --locked -p xtask --test routed_queue_resolution, cargo test --locked -p repo-policy --lib routed_rust, cargo test --locked -p xtask --bin xtask routed_rust) were not re-run here.
  • The changed merge_group branch was not executed by hosted CI. The Admit PR Candidate lane on a pull_request event takes the if [ "$EVENT_NAME" = "merge_group" ] false path (line 261), so the green Admit PR Candidate check does not exercise the new tree binding at all. The only hosted proof of that branch is the new xtask harness described above, which is green.
  • The 60/60 past-squash premise check was not re-run here; that claim is taken as reported in the PR body, not independently reproduced.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 2cd3285f9698449a0fb209c678ebe2509661f20e.

…tree case (#8082)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013kSch2opYors8Yb2NR1ZMd

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm the public admission route now derives the queued tree from the API-reported live head after fetching and validating refs/pull//head.
  • Confirm the executable harness exercises the checked-in workflow shell rather than a duplicated admission implementation.
  • Confirm the evidence does not establish that other admission or queue-binding routes have no timestamp-based or duplicate merge-tree logic.
  • Check sibling-path scan coverage before treating the fix as complete; a narrow no-match scan is not proof that no siblings exist.

Refuted

  • The workflow harness introduces a memory-safety or ownership defect at the native seam.; refuted because: The changed Rust code uses owned values and standard process/filesystem APIs; no unsafe code, raw pointers, aliasing, or unbounded ownership transfer is introduced in the diff.
  • The workflow or Rust harness has an active-view lifetime hazard caused by resizing, detaching, transferring, or observing a stale length of a mutable backing store.; refuted because: No ArrayBuffer, TypedArray, shared-memory region, unsafe slice, or mutable buffer-length snapshot appears in the changed surfaces. Git and API values are materialized as owned strings/collections, and the shell compares complete textual values.
  • A JS-backed worker/async/GC/detach/transfer boundary could make the fetched PR head stale or use-after-free.; refuted because: No JavaScript, callback, async task, shared memory, GC-managed object, detach operation, or ownership-transfer API appears in the changed path. Bash captures command output as strings and compares them; Rust test subprocesses communicate through environment variables, files, and process exit status.
  • A reusable merge-tree helper or wider production abstraction is required for this change.; refuted because: The changed seam is one admission step; the PR adds a focused executable harness and updates existing source pins. Introducing a shared helper would enlarge scope without a demonstrated second consumer.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven merged commit 1d7915e into main Oct 30, 2026
54 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/8082-queued-g-tree-binding branch October 30, 2026 15:25

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review (fresh-context reviewer, head c9396f7): REVIEW_READY — head movement reviewed as a delta: the only change since the head I cleared is one test-only commit that implements the two findings I recorded, and the hosted head is green (Rust gates success, all four workspace test shards success, zero red lanes).

Inspected:

  • Head c9396f753be1b005671428a9e66430980363b077 (re-read via gh pr view --json headRefOid,isDraft,state immediately before posting; not a draft; base e39370d2df076a0e3ca764c51e7bcebbd3fc5044; 8 files, +571/-27). Head movement during this pass: my earlier review of this PR was bound to 2cd3285f9698449a0fb209c678ebe2509661f20e and reached REVIEW_READY on the production change. The head has since moved by exactly one commit, c9396f75 "test(admission): generic next-step split and discriminating conflict-tree case (#8082)", which touches only xtask/tests/routed_queue_resolution.rs (+25/-11). No production line, workflow line, source-pin line or doc line changed in the delta, so the production conclusions from the earlier review stand unchanged; the delta was reviewed on its own terms below.
  • The delta patch in full. Two changes:
    (a) resolve_shell now splits the extracted step body on "\n - name:" instead of the literal " - name: Admit exact candidate\n". This removes the coupling to one specific downstream step name - the gemini-code-assist inline nit, which the earlier review recorded as ALREADY_DISPOSED-and-acknowledged - while still requiring that a following step exists (ok_or("missing step after Resolve queued PR")), so a truncated workflow still fails loudly rather than silently extracting the wrong block.
    (b) head_that_conflicts_with_the_base_cannot_bind_any_queued_tree was rewritten. It now runs git merge-tree --write-tree <base> <conflicting head> itself, asserts the exit status is exactly 1, reads the first stdout line as the tree OID, and queues exactly that tree as the queued commit. The previous version queued the base's tree with the comment "its tree is arbitrary because no clean merge exists to compare with", so it could not distinguish "merge-tree reported a conflict" from "the tree simply did not match" - the finding the earlier EffortlessSteven comment and the review bots both raised.
  • Why the rewritten conflict case is a genuine strengthening, traced against the production shell. git merge-tree --write-tree prints the conflicted tree OID on its first stdout line and then exits 1. The production step computes merged="$(git merge-tree --write-tree "$GROUP_BASE_SHA" "$head")" && [ "${merged%%$'\n'*}" = "$(git rev-parse "${GROUP_HEAD_SHA}^{tree}")" ] || { ...; exit 1; }. Because the command substitution is the left operand of &&, errexit is suppressed and the || refusal branch runs; the step therefore refuses on the exit status, not on a tree mismatch. With the queued tree now set to merge-tree's own output, a step that ignored the exit status would compare the tree to itself, match, and admit the entry - so the test would fail. The refusal is now reachable only through the exit-status handling, which is exactly what the test claims to pin. The case also self-checks output.status.code() != Some(1) and returns an error rather than proceeding, so a future git change that stops reporting a conflict would fail the test instead of silently weakening it.
  • Hosted proof at the head, re-read after the test phase completed: Ripr Rust Small on GitHub Hosted / Rust gates success; Rust tests shard 1/2/3/4 of 4 all success; Rust-only feature lane success on one run and skipped on the other; windows-advisory-subset success on one run and skipped on the other; Admit PR Candidate success; Detect Docs-Only Surface success; Ripr Rust Small Result success; Route Ripr Rust Small success; Report conflicting merge-ready request success; ub-review success; build and inspect Linux x64 wheel, clean pip install and useful Python journey, clean uv install and useful Python journey, workflow policy and wheel applicability all success. Zero red lanes. The Rust test shards verify job - which re-lists the partition to prove the four shards are a disjoint cover of the workspace list - was still running when this was written; it is a bookkeeping job over the shard lists, and all four shards it covers completed successfully.
  • Which shards own the changed file, established from the retained partition artifacts of an earlier run of this PR rather than assumed: shard 1 lists xtask::routed_queue_resolution batch_wrong_parent_and_wrong_subject_still_refuse_before_the_tree_is_read and ... queued_squash_of_a_different_head_is_refused_even_when_it_predates_the_queue_commit; shard 2 lists ... head_that_conflicts_with_the_base_cannot_bind_any_queued_tree and ... queued_squash_of_the_live_head_is_accepted_whether_the_ref_names_head_or_base. rust-test-shards.yml runs cargo nextest run --workspace --profile ci --partition count:N/4, so the xtask integration test is in the hosted required phase, and the rewritten conflict case in shard 2 completed successfully at this head.
  • Prior evidence on this PR, read and classified rather than re-raised: the EffortlessSteven issue comment of 2026-10-30T13:16:25Z (REVIEW_READY on the earlier head with three optional follow-ups), the CodeRabbit review and inline findings, and the gemini-code-assist inline finding about the hardcoded step name.

Blocking:

  • None found.

Non-blocking:

  • RESOLVED (the step-name coupling, previously recorded as ALREADY_DISPOSED and now implemented). resolve_shell no longer names Admit exact candidate; it splits on the generic "\n - name:". The step it extracts - Resolve queued PR - is still named explicitly, which is correct: that is the step under test, so the harness must find it deliberately.
  • RESOLVED (the conflict fixture's inability to isolate exit-status handling). The case now derives the queued tree from merge-tree's own conflicted output and asserts the exit status is 1, so the refusal it observes can only come from the step honouring that status. This is the one substantive gap the earlier review recorded, and it is now closed at the source rather than by a comment.
  • UNCHANGED from the earlier review, and still the largest open item on this candidate: the merge-tree(base, head) premise has no retained receipt. The positive fixture remains self-referential for the tree computation - World::squash builds the expected queued commit with git merge-tree --write-tree base head, the same command the production step uses - so the fixtures prove the plumbing and the absence of a false refusal, but cannot falsify the premise that GitHub's squash tree equals merge-tree(base, head). The only evidence is the 60/60 past-squash check reported in the PR body; a repository-wide search for merge-tree --write-tree finds it only in the workflow and the new test, so nothing is retained in-tree. The failure direction is fail-closed (a false premise refuses every queue entry rather than admitting a wrong one) and docs/CI.md states the boundary, so this remains a recorded gap for the first native queue transaction rather than a defect in this PR.
  • UNCHANGED: the source pins cover the comparison, not the invocation. tools/repo-policy/src/lib.rs, workflow_tests.rs and xtask/src/tests.rs now require [ "$fetched" = "$head" ] and the tree comparison, but not the git merge-tree --write-tree "$GROUP_BASE_SHA" "$head" invocation that produces merged. Replacing that invocation with git rev-parse "$head^{tree}" would leave the pins green while weakening the binding. The executable harness covers it - the honest case would stop being admitted - so the two mechanisms cover each other, but the split is worth stating so the pins are not read as covering more than they do.
  • UNCHANGED: the Git version floor is implicit. git merge-tree --write-tree needs Git >= 2.38 and nothing in the repository pins a version. The only execution environment for this step is the admission job on ubuntu-latest (routed-rust.yml:170), whose image carries Git >= 2.43, and the harness is #[cfg(unix)] on the same platform class; the self-hosted routes run downstream and never execute this job. Answered for this head, with the residual risk being a future runner-image change.
  • NEW (minor, in the delta): the rewritten case calls git_command(...).args([...]).output() and reads output.stdout, discarding stderr. On a conflicting merge git also writes conflict information to stdout after the tree OID, so stdout is the right stream to read and the tree is correctly taken from the first line - but if a future git moved the tree OID off the first stdout line, the case would queue a non-OID string and fail in commit_tree rather than at the point of misparsing. That is a loud failure, not a silent one, so no action is needed; noting it only because the first-line assumption is now load-bearing.

Not run:

  • No local Rust toolchain on this host: cargo/rustc are absent from PATH, so build and test execution could not be performed locally; all Rust proof below is hosted CI plus source reading.
  • The xtask integration test was not executed locally. Its hosted execution at this head is covered by the green nextest --workspace phase: all four Rust test shards completed successfully, including shard 2, which owns the rewritten conflict case.
  • The PR body's local receipts (cargo xtask precommit, cargo test --locked -p xtask --test routed_queue_resolution, cargo test --locked -p repo-policy --lib routed_rust, cargo test --locked -p xtask --bin xtask routed_rust) were not re-run here.
  • The 60/60 past-squash premise check was not re-run here; that claim is taken as reported in the PR body, not independently reproduced.

Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head c9396f753be1b005671428a9e66430980363b077. Not an approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants