Skip to content

fix(policy): bind cached build scripts to the current worktree - #7321

Merged
EffortlessSteven merged 1 commit into
mainfrom
fix/policy-runtime-worktree
Oct 11, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
fix/policy-runtime-worktree

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Scope

Fixes #7318, a focused follow-up to #7158 and #5090. Read CARGO_MANIFEST_DIR from the running build script's environment rather than baking a checkout path into its cacheable executable. Preserve absolute rerun watches, source digest, compiler identity and fail-closed receipt semantics. No dependency, workflow or guard relaxation.

Exact candidate

Published head: 19b96c3.
Tree: d5a0135bc85591090ff240abb6ee2e120e17ee23.
Parent: 56eaf73.
Independently reviewed local equivalent: 5f3380743bcd507147c684553a3d18728e086931, identical tree.
Four paths: production build.rs, actual-source worktree regression, exact count-two test process allowance and changelog fragment.

Root cause and test

Cargo can reuse a build-script executable across relocated checkouts. Its synthesized CARGO_MANIFEST_DIR is not a tracked compile-time environment dependency. The script may run in B while its env! root still points at A. The source guard correctly rejects the stale result.

Regression copies the actual production build.rs/source_identity.rs into a minimal SHA256 fixture. Build A, backdate B's distinct identity-bearing sources, then invoke B through Cargo's selected executable and freshly compiled integration harness while reusing only the fixture-owned serialized target. Verify B's source/compiler stamp and all absolute B watches. Remove only the fixture-owned selected harness output to force its rebuild without touching watched source mtimes. The retained compile-time-root mutant fails behaviorally after successful B compilation. A relative-watch mutant also fails, establishing why absolute watches must stay. Missing runtime manifest environment fails clearly.

Executed qualification

Pinned Rust 1.95.0 on Linux. All 49 package tests, all-target check, strict package Clippy, formatting and both behavioral mutants verified. Canonical process-policy passed in 156.6 s. Actual shared-target policy preflight accepted the candidate source/compiler with no cache or mtime workaround. Canonical precommit passed in 492.2 s with the exact four-path selector, complete policy checks and repo-policy/xtask all-target Clippy, no skipped commands. Native process groups settled; cumulative growth 1.74 GiB stayed within 2 GiB budget, disk at least 11.60 GiB and MemAvailable at least 3.51 GiB.

Independent reviewer /root/diagnose_shared_target_freshness inspected all changed files and consumers, real-source stimulus/oracle, bounds and cleanup, both mutants and fragment. Verified 118 retained artifact hashes, committed blobs, report digest and source stamp. No material findings. Publication identity rebind and hosted proof remain pending; this is not merge readiness.

Integration and limits

Current main's separate xtask fixture changes have no affected helper/dependency overlap. Static comparison with the reviewed routing #7304 tree retains both process registrations without conflict; it does not establish future combined-tree execution.

Normal development targets remain worktree-private. This does not promise concurrent shared-target safety, arbitrary preserved-mtime edit detection, Windows runtime qualification or a whole-CI speedup. Full local workspace check-fast was not rerun; normal required hosted qualification will establish the unavailable broad dimension. No release/deployment or protection changes. Rollback is an ordinary revert of this focused patch.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

The included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d577110f-9942-4181-a865-b0ec7cfa2406

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2e358 and 19b96c3.


📒 Files selected for processing (4)
  • changelog.d/7318-policy-runtime-worktree.md
  • policy/process_allowlist.txt
  • tools/repo-policy/build.rs
  • tools/repo-policy/tests/worktree_binding.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

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-10-11T05:13:57.105784Z 19b96c3 Draft marked ready
ℹ️ 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.

@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 one verification check before upstream.

Verification questions

  • Confirm sister files tools/repo-policy/src/source_identity.rs and the build.rs comment about stale rerun watches were not touched, but their behavior now depends on the live CARGO_MANIFEST_DIR rather than a baked path; no other build.rs or test sibling consumes a relocated env.

Evidence gaps

  • ast-grep structural scan returned ok but produced no findings/matches referencing the new 307-line test or modified build.rs; route-truth confirmation is absent from receipt.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Independent final review: REVIEW_READY

Reviewer: /root/diagnose_shared_target_freshness. Exact head 19b96c3, tree d5a0135bc85591090ff240abb6ee2e120e17ee23, parent 56eaf73. All four paths, production identity consumers, actual-source A/B regression, process containment, both behavioral mutants, scoped allowance and changelog inspected. No material findings.

The correct hashing owner is tools/repo-policy/source_identity.rs, unchanged. Absolute rerun watches, SHA256 hashing, compiler binding and fail-closed runtime guards remain intact. Only the production build-script manifest root changes to runtime lookup. Existing sibling test harnesses retain compile-time paths; the regression deliberately recompiles B's harness without changing watched source mtimes. This is not a global relocation or concurrent shared-target claim.

Required run 38114014440 succeeded. Fresh hashed evidence and logs bind checkout dcc34ad to this head and base 8a2e358. 14,267 executed tests passed plus two reported Nextest skips; two doctests passed, one ignored. All 49 helper tests passed, including the new worktree regression. Required policy, check, strict Clippy, goldens, fixtures, verdict, PR evidence and final aggregate succeeded.

The advisory review's partial workspace test and deferred focused requests are not additional complete proof. Its 900-second workspace and 300-second xtask timeouts, version-specific file cap and version-only ast-grep call are recorded separately in #5090, with existing upstream owners. They do not reveal a source defect.

Native merge-tree against current main 2190c9a exits zero and retains both routing and worktree-test allowances. That later combined tree was not executed; the exact-head hosted integration passed on its recorded basis, and inspection found no changed semantic prerequisite requiring restack. Scope remains Linux/Cargo 1.95; Windows, arbitrary preserved-mtime edits and whole-CI savings are not claimed. Normal GitHub checks and protections remain enforced.

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.

fix(policy): bind cached build scripts to the current worktree at runtime

1 participant