Skip to content

test(executor): fail fast on missing rubash bin in lib-only runs (Refs #3292) - #3472

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/3292-lib-leg-build-bin-first
Nov 15, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/3292-lib-leg-build-bin-first

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

PR body — rubash #3292 (Refs-only)

Title: test(executor): fail fast on missing rubash bin in lib-only runs (Refs #3292)

Root cause

The issue2875 procsub lib cell reds deterministically on any fresh target
where neither target/debug/rubash nor CARGO_BIN_EXE_rubash exists: the
procsub child exe resolution chain falls back to the lib-test binary itself,
which rejects -c (Unrecognized option: 'c'). Three-cell measurement from
the PR #3281 captain review (CAPTAIN-VERIFY §2, rebuilt base tree 917870ff):
base no-bin = RED, base bin-built = GREEN, head bin-built = GREEN. Not a load
flake, not product behaviour — a missing build precondition.

GNU anchor

Harness-side issue; no new semantic probe. The GNU anchor is the established
three-cell measurement above (issue #3292 body cites the same evidence:
~/workspace/review-3281/CAPTAIN-VERIFY.md §2, rerun-console.log /
rerun3-console.log).

What this PR changes (A — in-repo)

  • test_rubash_binary_from_current_exe (src/executor/compound_exec.rs):
    widened from pub(in crate::executor) to pub(crate); inside the existing
    deps/ gate it now also searches the test binary's profile dir, its
    release sibling, the CARGO_TARGET_DIR debug/release dirs, and the
    debug/release dirs under each ancestor of the test binary (≤ 8 levels).
    Only a file literally named rubash / rubash.exe counts. Production
    behaviour is unchanged: the deps/ gate still returns None outside a
    test binary, so a real shell keeps falling back to current_exe().
  • src/executor/mod.rs: pub(crate) re-export of the helper.
  • src/api/consumer_tests.rs: new issue2875_require_rubash_binary()
    (#[cfg(test)]), called first in the issue2875 cell; it resolves the bin
    through the same chain as the product spawn sites and fails fast naming
    the precondition (cargo build --locked --bin rubash first) instead of
    letting the spawn fall back to the lib-test binary with a misleading -c
    error. No product spawn site is touched.

Companion change (B — outside the repo, needs captain review)

~/workspace/batch-tools/scrubbed_cargo.py (shared captain/queue harness):
a pure cargo test … --lib run now builds --bin rubash first when no
rubash binary exists under the target dir (same profile / --target /
--target-dir / --locked / --offline flags); a failed bin build stops
the run with the build's exit code. --test / --bins / --tests /
--all-targets forms are untouched. Verified functionally with a stub cargo
(5 cases: build-first, bin-exists skip, stem passthrough, build-fail stop,
--release passthrough). If the captain does not adopt (B), (A) still
stands alone: the cell's failure face changes from a misleading -c error
to a named-precondition panic.

本 PR 删除了什么

未删除任何产品行为、公开面、测试或文档。仅有的删除是 test_rubash_binary_from_current_exe
旧版单目录查找体被扩展版取代(行为为超集,deps/ 门与回退语义不变),以及
consumer_tests.rs 中一段 doc 注释从 helper 上方移回其所属的测试函数上方(纯注释移动)。

Verification status

UNVERIFIED-BY-CAPTAIN. Static legs done this round: rustfmt --check on
the three changed files (rc=0), check-marker-literals.py OK,
check-utf8-boundary-hygiene.sh clean, codegraph callers cross-checked with
scoped rg (4 product spawn sites + 1 test call site). Build/test legs are
OWED to the review round: no build slot was available this round (Simular box
disk 100% full; old server sshd banner-dead on two bounded retries; local
builds banned by the write wall; X299 direct access not yet set up). Owed:
fresh-target issue2875 cell two-sided run (no-bin → named-precondition
failure; bin-built → green), adjacent procsub stems, full lib base/head
count alignment, RUSTFLAGS="-D warnings" cargo check --locked --lib --bins.

@caomengxuan666

Copy link
Copy Markdown
Member Author

【WIN-AGENT-AUDIT】
PR #3472 第1轮 — 建议:PASS
head: 07b9cd1 base(merge-base): 3745712 文件: 3 个 +70/-5
关联 issue: #3292(状态:open,我核过的时间:2026-11-15 08:45 CST)

机制核查:

  • test_rubash_binary_from_current_exe()(src/executor/compound_exec.rs,经 src/executor/mod.rs re-export)把测试二进制旁 rubash 的查找面从单一 deps/ 扩到:测试二进制的 profile 目录、release 兄弟目录、CARGO_TARGET_DIR debug/release、祖先 debug/release,仍保留 deps/ 门。src/api/consumer_tests.rs:3505 给 issue2875 测试加显式前置 panic(找不到 rubash 二进制时 fail fast、信息指明先 cargo build --locked --bin rubash)。机制对:这是测试基建修复,不动语义;无无关改动、无 trust 类机制。

腿(逐项给数字与名字):

  • 钉自跑:无新增 tests/ stem;目标测试在 lib。cargo test --lib issue2875_input_procsub_child_runs_as_rubash_shell head @Windows(已 build --bin rubash):1 passed / 0 failed
  • fail-first(缺 bin 形态):lib-only 无 rubash.exe 时,head 在 consumer_tests.rs:3505 显式 panic「issue2875 precondition (rubash#3292): no rubash binary found … run cargo build --locked --bin rubash first」——正是本 PR 要的 fail-fast;base 在同条件下走旧 fallback 报误导性 error: Unrecognized option: 'c'(CI 红日志同款签名)
  • lib 双边:head 失败名集={issue2084_session_end_restores_host_process_state} / base 失败名集={issue2084_session_end_restores_host_process_state} / 差集=∅(1349 passed;1 failed;4 ignored,两边逐数对齐;issue2084 为本机环境基线,非本 PR)
  • -D warnings:cargo check --locked --lib --bins exit 0,0 警告
  • 卫生:rustfmt --check 三个改动文件均 rc=0;diff 非 ASCII 仅注释;无 carrier 字节
  • CI:本 head 红名仅 issue2875_input_procsub_child_runs_as_rubash_shell(Rust tests / macOS / goldens 各 1 个,签名同基线「Unrecognized option: 'c'」)——即本 PR 修的基线本身,属预期;无其他红
  • GNU 对照:无语义变更面,不适用

F 点:无

未跑/VOID 的腿:

  • 全量 lib macOS/Linux 未跑(本机 Windows);lib 双边差集 ∅ 已覆盖回归面

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.

1 participant