Repository navigation
fix(xtask): resolve the built ripr binary from cargo's artifact report (#14762) - #14766
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
No actionable comments were generated in the recent review. Summary by CodeRabbit
WalkthroughThe user-text check now locates the built Changes
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Merge Risk:
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
REPAIR_REQUIRED — head 9c0ec3f
Blocking: the new test adds two expect( calls in xtask/src/policy/user_text.rs — expect("write fixture") and expect("ripr artifact is the executable"). cargo xtask check-no-panic-family scans xtask/src including test modules, and policy/no-panic-allowlist.toml has no entry for user_text.rs, so both are unallowed panic-family findings. The PR body's Engineering Check ("No new panic, unwrap, expect, todo, or unimplemented in tests") is false. Repair: return Result<(), String> from the test and use ?/ok_or, or add exact allowlist entries with explanations.
Non-blocking:
- The Summary says "the target directory, profile and any
--targetlayout come from cargo's answer". The path does; the profile does not.let release = dir.file_name().is_some_and(|name| name == "release")still derives the profile fromcurrent_exe().parent(), so under the relocated driver it is always false and the check builds debug. For this text scan that is harmless (the runs are help/usage/check/pilot/doctor/status/repair/continue/explain/context/agent, and debug vs release does not change their text), but the claim should be corrected. - On a build failure,
--message-format=jsonputs the compiler diagnostics on stdout ascompiler-messagerecords;output.stderrcarries only the summary ("could not compile ... due to 1 previous error"). The new error path therefore reports the summary, not the diagnostic.--message-format=json-render-diagnosticswould render the diagnostic to stderr as well. - The two unit tests exercise
built_ripr_executablebut notresolve_ripr_binary; a regression that reverts the resolution todir.join("ripr.exe")would still pass both. The behavioralcargo xtask check-user-textrun is the evidence for the resolution path.
What I checked:
- Artifact parse: a real cargo build reports the lib and bin both named
ripr; the lib artifact has an emptyexecutable, so the non-empty filter selects the bin. A cached build still emits the artifact with the executable. The existinga_missing_or_foreign_artifact_is_not_the_ripr_binarytest covers the lib case. -qdoes not suppress--message-format=json; the JSON is on stdout.- The changelog fragment's
<!-- section: Internal / CI -->is a valid section.
Not checked: no crate build or Rust test run; the no-panic finding is from the policy source and the diff, not a gate run.
#14762) `check-user-text` ran through the driver harness, which copies the running xtask image into `<target-root>/ripr/drivers`. `resolve_ripr_binary` joined that directory with `ripr.exe`, so on Windows the check failed with "built ripr binary not found at .../target/ripr/drivers/ripr.exe" even though `cargo build -p ripr --bin ripr` had written `target/debug/ripr.exe`. Build with `--message-format=json` and take the executable cargo reports for the `ripr` bin. That resolves the target directory, profile and any `--target` layout from cargo's own answer instead of the running image's directory, and keeps `--ripr` as the explicit bypass. A failed build now reports cargo's stderr instead of a bare status. Unit tests cover the artifact selection and the missing/foreign cases. `cargo xtask check-user-text` now runs to completion on Windows (exit 0 with `RIPR_USER_TEXT_SCRATCH` set outside the checkout).
9c0ec3f to
87ce2a5
Compare
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Reviewed head 87ce2a5 (one commit on 09ccb6d). Source scope only; no hosted lane has run on this branch.
What I checked:
- The no-panic repair:
xtask/src/policy/user_text.rsat this head has no.expect(,.unwrap(,panic!,todo!orunimplemented!. The test is now-> Result<(), String>; the fixture write usesmap_err(...)?and the artifact lookup usesok_or_else(...)?, so the same failure the twoexpectcalls produced is returned asErrand the test harness still fails. Theassert_eq!(found, fixture)assertion is unchanged. --message-format=json-render-diagnostics: I ran a probe crate. On success, stdout still carries thecompiler-artifactrecord with the executable and stderr is empty, sobuilt_ripr_executableparses the same shape. On failure, stdout carries no artifact and stderr carries the rendered diagnostic, so the error path now reports the diagnostic rather than only the summary. The unit test parses a synthetic JSON string, so the flag change does not affect it.- The profile claim is corrected: the Summary now says the profile is not taken from cargo's answer, and the code comment explains that the relocated driver builds debug and why that is harmless for these runs.
- The coverage limit is honest: the two unit tests exercise
built_ripr_executable, notresolve_ripr_binary; the behaviouralcargo xtask check-user-textrun is the evidence for the resolution path.
Not checked: no crate build or Rust test run; the check-no-panic-family gate result is the Orchestrator's (exit 0), and I verified the source has no panic-family calls. The behavioural run is the Coder's, not repeated here.
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Reviewed head 87ce2a5 (one commit on 09ccb6d). Source scope only; no hosted lane has run on this branch.
What I checked:
- The no-panic repair:
xtask/src/policy/user_text.rsat this head has no.expect(,.unwrap(,panic!,todo!orunimplemented!. The test is now-> Result<(), String>; the fixture write usesmap_err(...)?and the artifact lookup usesok_or_else(...)?, so the same failure the twoexpectcalls produced is returned asErrand the test harness still fails. Theassert_eq!(found, fixture)assertion is unchanged. --message-format=json-render-diagnostics: I ran a probe crate. On success, stdout still carries thecompiler-artifactrecord with the executable and stderr is empty, sobuilt_ripr_executableparses the same shape. On failure, stdout carries no artifact and stderr carries the rendered diagnostic, so the error path now reports the diagnostic rather than only the summary. The unit test parses a synthetic JSON string, so the flag change does not affect it.- The profile claim is corrected: the Summary now says the profile is not taken from cargo's answer, and the code comment explains that the relocated driver builds debug and why that is harmless for these runs.
- The coverage limit is honest: the two unit tests exercise
built_ripr_executable, notresolve_ripr_binary; the behaviouralcargo xtask check-user-textrun is the evidence for the resolution path.
Not checked: no crate build or Rust test run; the check-no-panic-family gate result is the Orchestrator's (exit 0), and I verified the source has no panic-family calls. The behavioural run is the Coder's, not repeated here.
unused_result_ok is denied in the workspace lints, so the test's remove_file cleanup must bind the result with let _ rather than .ok().
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
44650f4
cargo clippy -p xtask --all-targets exits 0 at this head; the only warning is the pre-existing unused_mut at crates/ripr/src/output/doctor.rs:2182. The one-line change replaces .ok() with let _ = on the fixture cleanup, and unused_result_ok is deny in the workspace lints.
Governing issue or accepted claim: #14762
Acceptance delta (one sentence):
cargo xtask check-user-textresolves the builtriprbinary from cargo's own artifact report, so it runs from the relocated driver copy on Windows instead of failing with "built ripr binary not found".Summary
check-user-textruns through the driver harness, which copies the running xtask image into<target-root>/ripr/drivers.resolve_ripr_binaryjoined that directory withripr.exe, so on Windows the check failed before running any check:cargo build -p ripr --bin riprhad writtentarget/debug/ripr.exe. The fix builds with--message-format=json-render-diagnosticsand takes the executable cargo reports for theriprbin, so the executable path and any--targetlayout come from cargo's answer rather than the running image's directory.--riprremains the explicit bypass, and a failed build now reports the rendered compiler diagnostic rather than only cargo's summary line.The profile is not taken from cargo's answer:
--releasehas to be chosen before the build runs, so it is still inferred fromcurrent_exe().parent(). Under the relocated driver copy that is always false and the check builds debug. That is harmless for this check, whose runs are help/usage/check/pilot/doctor/status/repair/continue/explain/context/agent, and the code comment says so.Swarm / Source Boundary
ripr-swarmThis is ordinary repo-ops tooling for
ripr-swarm; it does not change release or publication surfaces.Source-of-truth Links
Proposal: #14762.
Spec: n/a; the check's contract is unchanged.
ADR: n/a.
Plan item: #14762 Windows ci-policy follow-up.
Governing issue or accepted claim: #14762.
Acceptance delta (one sentence): as above.
Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication):
ripr-coding/14762-user-text-target-dir.Stack parent or prerequisite PR (if any): none; branched from
main09ccb6d683.Proposed replacement of PR (if any; not yet accepted): none.
Acceptance retained from a replaced candidate (if any): n/a.
Accepted winner and losing candidate disposition (when decided): this is the only candidate for the bounded tooling repair.
Scope
riprexecutable fromcargo build --message-format=json-render-diagnostics.--ripras the explicit bypass and report the rendered diagnostic on a failed build.Scope Classification
Production delta:
resolve_ripr_binaryno longer joinscurrent_exe().parent()with the binary name; it reads thecompiler-artifactexecutable for theriprbin.built_ripr_executableparses the artifact report and requires the reported path to be a file.Evidence/support delta:
xtask/src/policy/user_text.rs, both fallible (Result<(), String>) so the no-panic policy holds.changelog.d/14762-user-text-target-dir.md.Single acceptance criterion:
cargo xtask check-user-textruns to completion on Windows from the relocated driver copy.Non-goals:
RIPR_USER_TEXT_SCRATCHoutside the checkout) is an environment setup, not this defect, and is left as is.Support-tier Impact
Claim/proof notes:
Policy Impact
Ledger or exception notes:
expectcalls instead of adding allowlist entries.Proof
cargo xtask check-no-panic-family cargo test -p xtask --bin xtask artifact cargo xtask check-user-text cargo fmt -p xtask --check cargo xtask check-changelog-fragments cargo xtask markdown-links git diff --checkResult, failures, or skipped proof:
cargo xtask check-no-panic-family: red at9c0ec3fdwith exactly the two findings the review named (xtask/src/policy/user_text.rs:2010:9and:2021:21, unallowedexpect), exit 1; green at this head, exit 0, "Unallowed findings: none". Same instrument, same tree, only the repair differs.cargo test -p xtask --bin xtask artifact: 143 passed, 0 failed, includingcargo_artifact_json_names_the_ripr_executableanda_missing_or_foreign_artifact_is_not_the_ripr_binary.cargo xtask check-user-textat this head: exit 0 on Windows withRIPR_USER_TEXT_SCRATCHset outside the checkout. Before the fix the same command failed with "built ripr binary not found at .../target/ripr/drivers/ripr.exe"; after the fix it reaches the report and passes.cargo fmt -p xtask --check,check-changelog-fragments,markdown-linksandgit diff --checkpass.cargo xtask ci-policydid not complete on this host within 30 minutes, so it is not claimed; the focused command is the behavioural evidence.Coverage limit: the two unit tests exercise
built_ripr_executable, notresolve_ripr_binary; a regression that reverted the resolution todir.join("ripr.exe")would still pass them. The behaviouralcargo xtask check-user-textrun is the evidence for the resolution path.Claim Boundary
What may be claimed after this PR? What must not be claimed yet?
Rollback
How can this PR be reverted safely?
Spec-Test-Code Traceability
cargo_artifact_json_names_the_ripr_executable,a_missing_or_foreign_artifact_is_not_the_ripr_binary.resolve_ripr_binary,built_ripr_executableinxtask/src/policy/user_text.rs.Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
check-user-textcommand precedes the fullci-policylane.Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
cargo xtask check-static-languagecargo xtask check-spec-format