Skip to content

test(xtask): pin first-run --install-published CARGO_HOME isolation - #7115

Merged
EffortlessSteven merged 3 commits into
mainfrom
cursor/first-run-cargo-home-proof-f7c4
Oct 8, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
cursor/first-run-cargo-home-proof-f7c4

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Closes #6803.

Isolation already shipped in #6787 (d52764d3). This PR adds the missing proof that the timed --install-published install child receives an isolated Cargo home. Hosted cold-install measurement and the baseline commit remain #5983.

Summary

Before: run() set CARGO_HOME=<out>/cargo-home for cargo install ripr --locked, but nothing pinned that env. Deleting the entry, or passing &[] at the timed_with_envs call site, would still compile and the walk would inherit the caller cache.

After: published_install_spec is the install-step spec run() uses (cwd = temp dir; args install ripr --locked --root <out>/install-root; env CARGO_HOME=<out>/cargo-home). A unit test calls run(["--install-published", "--out", ...]) and records the timed_with_envs arguments so dropping environment forwarding fails. RUSTUP_HOME and PATH are not overridden.

The helper names <out>/cargo-home; it does not mkdir or empty it. run() calls prepare_out_dir first, so the path is absent when cargo starts. The test asserts that absence rather than inventing a second wipe. The test intercept is in first_run.rs only; xtask/src/run.rs is unchanged.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Governing issue or accepted claim: #6803 (follow-up proof for #6787; parent metric/baseline remains #5983)
Acceptance delta: a unit test fails if run() launches the install child without a CARGO_HOME override under --out.

Candidate Relationships

Candidate branch: cursor/first-run-cargo-home-proof-f7c4
Stack parent or prerequisite PR: none
Proposed replacement of PR: none

Scope

One helper extraction, a test-only launch intercept, and one unit test in xtask/src/first_run.rs.

Scope Classification

  • Docs/spec/test-only evidence package

Production delta: behavior-preserving extract of the existing --install-published install-step spec. Env, cwd, args, and --root are unchanged. Production timed_with_envs still calls capture_output_in_dir_with_envs.

Evidence/support delta: first_run::tests::the_published_install_child_gets_an_isolated_cargo_home_under_out.

Single acceptance criterion: passing &[] instead of the spec env slice into timed_with_envs from run() makes the new test fail.

Non-goals: xtask/src/run.rs (#6815), scan_proc / #5461 / #5470, #5359, crates/ripr/src/output/gate/tests.rs (#6725), crates/ripr/src/agent/loop_commands.rs, xtask/src/reports/operator.rs, xtask/src/tests.rs (#7072), workflows, scoreboards.toml, hosted baseline (#5983), #6811/#7095, #6832/#6834.

Support-tier Impact

  • none

Policy Impact

  • none

Red-first evidence

  1. Temporary deletion of the CARGO_HOME entry from published_install_spec (restored): FAIL install child has no CARGO_HOME override.
  2. Codex counterexample: run() passing &[] into timed_with_envs (restored; unused envs was a warning only): FAIL install child has no CARGO_HOME override.

Both compiled; neither was a compile-error stand-in.

Proof

cargo test -p xtask --bin xtask first_run
cargo clippy -p xtask --all-targets -- -D warnings
cargo xtask precommit

On claim head 7b546e932eda69bf76287edd284ac4c1ca05ad99:

  • cargo test -p xtask --bin xtask first_run: 23 passed, 0 failed
  • cargo clippy -p xtask --all-targets -- -D warnings: pass
  • cargo xtask precommit: exit 0

On published head 1b9ec7a0ee5704b6a21a8c9d237e0151919e4bed (merge of origin/main 2c634e517 / #7112; first_run.rs unchanged):

  • cargo test -p xtask --bin xtask first_run: 23 passed, 0 failed
  • cargo xtask precommit: exit 0

Integration basis includes the already-landed inherited hostile_repos --committed pin. That file is not this claim; the PR still diffs only xtask/src/first_run.rs against current main.

Hosted required checks own merge. Re-toggled Draft → Ready on this head so Ripr Rust Small Result can run.

Claim Boundary

May claim: run() forwards CARGO_HOME under --out into timed_with_envs for --install-published, and a unit test notices if that slice is dropped.

Must not claim: runtime mutation results; that cargo-home is wiped by the helper itself; that a hosted cold install was measured; that a baseline is committed; that a spawned cargo process environment was inspected; that xtask/src/run.rs was changed.

Rollback

Revert the PR. Isolation behavior remains as shipped in #6787; only the helper extract, intercept, and pin are lost.

Spec-Test-Code Traceability

  • Tests: xtask/src/first_run.rs::tests::the_published_install_child_gets_an_isolated_cargo_home_under_out
  • Code: xtask/src/first_run.rs::published_install_spec and run() → timed_with_envs
  • Golden outputs: none
  • Metrics: none

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

CI Economics

n/a (no workflow or lane change)

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.

Exact candidate SHA: 1b9ec7a0ee5704b6a21a8c9d237e0151919e4bed

Open in Web Open in Cursor 

Extract the timed cargo-install spec so a unit test can reject an
install child that inherits the caller Cargo home.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
@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 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: dab7cc1d-c981-46c5-bb4e-85c77462a86d
📥 Commits

Reviewing files that changed from the base of the PR and between 691b70b and 7b546e9.

📒 Files selected for processing (1)
  • xtask/src/first_run.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Summary by CodeRabbit

  • Chores
    • Updated the published-install workflow to use a dedicated output directory for its install files while retaining the existing toolchain environment. No end-user-facing changes.

Walkthrough

The published-install setup now uses a specification for its working directory, locked Cargo arguments, isolated CARGO_HOME, and install root. The runner uses this specification for the timed install and binary resolution. Test-only launch interception records the configuration for validation.

Changes

Published Install Setup

Layer / File(s) Summary
Define and use the install specification
xtask/src/first_run.rs
The specification sets the working directory to the system temporary directory, uses --locked, and places the install root and CARGO_HOME under --out. The runner uses it to execute the timed install and resolve ripr.
Capture and validate the timed launch
xtask/src/first_run.rs
Test-only support records launch details and returns a synthetic successful step when a launch is intercepted. A test checks the Cargo arguments, paths, initially absent CARGO_HOME, and inherited PATH and RUSTUP_HOME.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 7b546

No merge-blocking issue is evident from the supplied change context; the PR is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #6803 requires the timed published install to use an isolated Cargo home and a test that checks the launch configuration. run() calls prepare_out_dir, then passes `CARGO_HOME=/cargo-hom…
Out of Scope Changes check ✅ Passed The diff is limited to xtask/src/first_run.rs. It extracts the existing published-install specification and adds test-only launch interception and one focused unit test. These changes support the li…
Title check ✅ Passed The title clearly identifies the test change that pins isolated CARGO_HOME behavior for the published install path.
Description check ✅ Passed The description is detailed and follows the repository template. It states the scope, acceptance criterion, proof, claim boundary, rollback, traceability, and policy impact. Some optional template fie…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the Cargo trail,
With locked-up flags and paths set right.
A fresh home waits beneath the root,
While PATH and rustup stay in sight.
The test records the launch, then hops away.

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

@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.

Author self-review on exact head 691b70b8a10ad5924d64a520d79cf7759fd7a22c (GitHub cannot REQUEST_CHANGES from the author; this COMMENT is the disposition record, not approval).

reviewed_head_sha: 691b70b8a10ad5924d64a520d79cf7759fd7a22c
integration_basis: origin/main c483d202ba83a38a38365f75dde3bd5188448be9
claim_boundary: pin that --install-published times cargo install with CARGO_HOME under --out; isolation itself landed in #6787. Hosted compare-and-baseline stays #5983.
changed_surfaces_and_semantic_owners_inspected: xtask/src/first_run.rs only. Owner is the first-run walk. Consumer is run() → timed_with_envs → capture_output_in_dir_with_envs (xtask/src/run.rs, unread for edit; env overlay is command.env, no env_remove for RUSTUP_HOME/PATH).
blocking_findings: none for source/oracle.
non_blocking_suggestions: none that belong in this PR.
refuted_or_stale_findings: none yet (no bot threads on this head).
proof_and_ci_observed:

  • red: deleting the CARGO_HOME entry from published_install_spec failed the new test with install child has no CARGO_HOME override (compiled; unused cargo_home was a warning only)
  • green: cargo test -p xtask --bin xtask first_run 23 passed; cargo xtask precommit exit 0; cargo xtask check-fast 1 file / 10 gates
  • hosted checks: not yet observed on this Ready transition
    proof_or_review_missing: required hosted checks and Ripr Rust Small Result on this SHA; no independent reviewer yet
    affected_currentness_dimensions: production implementation (extract only), test stimulus, test oracle, public claim (PR body), candidate head identity
    residual_assumptions_and_non_claims:
  • the test binds published_install_spec, which run() currently calls; it does not inspect a spawned cargo process
  • emptiness is prepare_out_dir leaving <out>/cargo-home absent, not a wipe inside the helper
  • does not measure a hosted cold install or commit a baseline
    disposition: REVIEW_INCOMPLETE until exact-head hosted checks exist; source/oracle inspection found no blocker. Re-enter after Ready CI for REVIEW_READY / merge convergence.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 7, 2026 23:28
@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 7, 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-08T00:18:50.821669Z 1b9ec7a 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 691b70b8a1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread xtask/src/first_run.rs Resolved
Drive the isolation test through run() and record timed_with_envs
arguments so dropping the env slice fails the proof.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 7, 2026 23:40
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 7, 2026 23:40

@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.

Author self-review on exact head 7b546e932eda69bf76287edd284ac4c1ca05ad99 (COMMENT is the disposition record, not approval).

reviewed_head_sha: 7b546e932eda69bf76287edd284ac4c1ca05ad99
integration_basis: origin/main c483d202ba83a38a38365f75dde3bd5188448be9
claim_boundary: pin that run() forwards CARGO_HOME under --out into timed_with_envs for --install-published. Isolation itself landed in #6787. Hosted compare-and-baseline stays #5983.
changed_surfaces_and_semantic_owners_inspected: xtask/src/first_run.rs only (published_install_spec, run(), test-only timed_with_envs intercept). xtask/src/run.rs unread for edit.
blocking_findings: none for source/oracle after the Codex P1 repair.
non_blocking_suggestions: none in this PR.
refuted_or_stale_findings: Codex P1 accepted and repaired; reply on the thread; thread resolved (PRRT_kwDOSiSx0c6qIt_s).
proof_and_ci_observed:

  • red: run() passing &[] into timed_with_envs failed with install child has no CARGO_HOME override
  • green: cargo test -p xtask --bin xtask first_run 23 passed; clippy -D warnings pass; cargo xtask precommit exit 0
  • hosted checks: not yet observed on this Ready re-toggle
    proof_or_review_missing: required hosted checks and Ripr Rust Small Result on this SHA
    affected_currentness_dimensions: test stimulus, test oracle, candidate head identity (repair after first review)
    residual_assumptions_and_non_claims:
  • intercept records timed_with_envs args and short-circuits before spawned cargo
  • emptiness is prepare_out_dir leaving <out>/cargo-home absent
  • does not measure a hosted cold install or commit a baseline
    disposition: REVIEW_INCOMPLETE until exact-head hosted checks exist; source/oracle inspection found no blocker. Re-enter after Ready CI for REVIEW_READY / merge convergence.

@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!

@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 cargo-home absence assertion depends on prepare_out_dir having just replaced --out.

Refuted

  • Box::from(slice) allocation-failure paths could regress in the new code; refuted because: Diff is a behavior-preserving extract plus test-only intercept; no Box::from(slice) or equivalent allocation-failure-sensitive code added. Objection not raised by diff or thread.
  • Asserting cargo_home.exists()==false proves cold-install isolation; refuted because: Assertion runs after run() returns but before any real cargo process is spawned (intercept short-circuits); it verifies prepare_out_dir wiped --out, not that cargo observed an absent home at process spawn.

Parked follow-ups

  • Sensor ripr failed (exit 2); cargo-test scheduled late. PR is test/extract only; isolated runtime cargo behavior is not in scope.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Hosted required-check diagnosis (not this claim)

Ripr Rust Small Result failed on 7b546e932eda69bf76287edd284ac4c1ca05ad99 because RUST_TESTS_RESULT=failure:

ripr::hostile_repos::control_bytes_in_names_and_config_never_reach_github_output_stderr_or_commands

Error: expected the escaped file name on stderr
ripr: 1 changed script file(s) (Shell) were not analyzed: s\\u{1b}]0;pwna.sh

This file is not in this PR. Reproduced on exact origin/main c483d202ba83a38a38365f75dde3bd5188448be9 with the same error (cargo test -p ripr --test hostile_repos control_bytes_in_names_and_config_never_reach_github_output_stderr_or_commands). Inherited; not folded into #6803. This PR stays one claim (xtask/src/first_run.rs only).

github-actions verification question

Confirmed: !cargo_home.exists() depends on run() calling prepare_out_dir first. The helper only names <out>/cargo-home; it does not mkdir. The test intercept short-circuits before spawned cargo, so the assertion is that prepare_out_dir left that path absent, not that cargo observed an empty home at process spawn. That limit is already in the test comment and PR claim boundary.

…o-home-proof-f7c4

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
@EffortlessSteven
EffortlessSteven marked this pull request as draft October 8, 2026 00:16
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 8, 2026 00:17
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Integration-basis update only: merged origin/main 2c634e517 (#7112) so this head includes the already-landed --committed pin for control_bytes_in_names_and_config_never_reach_github_output_stderr_or_commands.

That inherited required-check failure was reproduced on exact former base c483d202b and is not this claim. This PR still diffs only xtask/src/first_run.rs against current main. Duplicate one-file repair #7114 stayed closed.

Head is now 1b9ec7a0ee5704b6a21a8c9d237e0151919e4bed. Re-toggled Draft → Ready so Ripr Rust Small Result can run on this SHA.

@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!

@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.

Author self-review on exact head 1b9ec7a0ee5704b6a21a8c9d237e0151919e4bed (COMMENT is the disposition record, not approval).

reviewed_head_sha: 1b9ec7a0ee5704b6a21a8c9d237e0151919e4bed
integration_basis: origin/main 2c634e517f146727683c2c09e75f5e11e05133f7 (#7112 merged into this branch so the inherited hostile_repos --committed pin is on the tree; PR still diffs only xtask/src/first_run.rs)
claim_boundary: pin that run() forwards CARGO_HOME under --out into timed_with_envs for --install-published. Isolation itself landed in #6787. Hosted compare-and-baseline stays #5983.
changed_surfaces_and_semantic_owners_inspected: xtask/src/first_run.rs only (published_install_spec, run(), test-only timed_with_envs intercept). Consumer capture_output_in_dir_with_envs in xtask/src/run.rs overlays command.env and does not env_remove RUSTUP_HOME/PATH; unread for edit (#6815).
blocking_findings: none for source/oracle.
non_blocking_suggestions: none in this PR.
refuted_or_stale_findings: Codex P1 repaired on 7b546e932 and thread PRRT_kwDOSiSx0c6qIt_s resolved. github-actions cargo-home absence question answered: !exists() is prepare_out_dir, not a helper wipe. Gemini quota is missing review, not a finding. CodeRabbit docstring-coverage warning is out of scope for this extract/test pin.
proof_and_ci_observed:

  • red: deleting CARGO_HOME from the spec, and run() passing &[] into timed_with_envs, both fail install child has no CARGO_HOME override
  • green on this SHA: cargo test -p xtask --bin xtask first_run 23 passed; cargo xtask precommit exit 0
  • hosted: Ripr Rust Small on GitHub Hosted / Rust gates in progress on run 37706954296; Ripr Rust Small Result not completed yet
    proof_or_review_missing: required hosted check conclusion on this SHA
    affected_currentness_dimensions: integration basis (merge of #7112); production/test/oracle unchanged since 7b546e932
    residual_assumptions_and_non_claims:
  • intercept records timed_with_envs args and short-circuits before spawned cargo
  • emptiness is prepare_out_dir leaving <out>/cargo-home absent
  • does not measure a hosted cold install or commit a baseline
    disposition: REVIEW_INCOMPLETE until exact-head Ripr Rust Small Result succeeds; source/oracle inspection found no blocker. Re-enter for REVIEW_READY / merge convergence after that check.

@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.

Refuted

  • Box::from(slice) allocation-failure paths could regress in the new code; refuted because: Not in scope; diff is behavior-preserving extract plus test-only intercept; no Box::from(slice) or Vec::with_capacity-style allocation added to production. Objection was raised in seeded thread and refuted.
  • Asserting cargo_home.exists()==false proves cold-install isolation; refuted because: Assertion runs after run() but before any real cargo spawn; it verifies prepare_out_dir wiped --out, not that cargo observed an absent home at process spawn. Author reply + claim boundary already state this limit; red-first demonstration passes &[] at the production call site, which is the claim's acceptance criterion.
  • The helper extraction duplicates the literal env/cwd/args shape enough to drift from the production call site and silently lose the CARGO_HOME pin.; refuted because: The single production call site (line 232) is the only consumer; spec.envs() round-trips the same key/value. The new test asserts install.envs == spec.env_pairs() exactly, so any drift in helper shape is caught. No second caller exists.

Parked follow-ups

  • Intercept short-circuits before spawning cargo; assertion !cargo_home.exists() verifies prepare_out_dir wipe, not a real process env.
  • ripr sensor failed (exit 2); cargo-test scheduled late. Test/extract-only PR; runtime cargo behavior is out of scope.

Evidence gaps

  • ripr sensor failed (exit 2); cargo-test scheduled late. Test/extract-only PR; runtime cargo behavior is out of scope.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Independent verification for merge convergence (driving lane's self-review stands as the inspection record).

reviewed_head_sha: 1b9ec7a
integration_basis: merge of origin/main 2c634e5 (#7112); PR still diffs only xtask/src/first_run.rs
exact-head checks: Ripr Rust Small Result pass + full gate green on run 37706954296, headSha == PR head
threads: 1 total, 0 unresolved
claim: closes #6803 (isolation itself in #6787); #5983 stays the hosted-measurement residual

Independently read the full diff vs current origin/main (only the CARGO_HOME spec + intercept test; caught_by/verdict_reading already on main). Mutation grip confirmed by driving lane (CARGO_HOME removal and &[] passthrough both red). No new findings.

disposition: REVIEW_READY

@EffortlessSteven
EffortlessSteven merged commit b758ac9 into main Oct 8, 2026
32 of 33 checks passed
@EffortlessSteven
EffortlessSteven deleted the cursor/first-run-cargo-home-proof-f7c4 branch October 8, 2026 08:52
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.

first-run --install-published times the install with a warm Cargo cache, understating a cold install

2 participants