Skip to content

The dev-build guard recognises the test binaries Rust 1.100's cargo builds - #219

Open
DrewBradfordXYZ wants to merge 1 commit into
AgentSystemLabs:mainfrom
DrewBradfordXYZ:dev-build-guard-cargo-1100
Open

DrewBradfordXYZ wants to merge 1 commit into
AgentSystemLabs:mainfrom
DrewBradfordXYZ:dev-build-guard-cargo-1100

Conversation

@DrewBradfordXYZ

Copy link
Copy Markdown
Contributor

CI has been red on every PR since the runners picked up Rust 1.100.0 (stable-x86_64-unknown-linux-gnu updated - rustc 1.100.0 (from rustc 1.99.1)): upgrade::tests::dev_builds_are_refused_without_force fails with "test binary should look like a cargo build". It passed on 1.99.1 at the same commit (#216's run on Nov 11).

Why

Since 1.100, cargo runs test binaries from its build-dir layout:

before: target/debug/deps/nebula-81def4ed18659372
now:    target/debug/build/nebula/81def4ed18659372/out/nebula-81def4ed18659372

dev_build() only looked at the binary's own folder, or the one above deps/, so the test binary stopped looking like a cargo build. Binaries from cargo build still land in target/release/, so nebula upgrade itself was never affected; only the test broke.

What

  • The path rule is a pure function, in_cargo_target, that accepts all three places: directly in a profile dir, in its deps/, and the <profile>/build/<package>/<hash>/out/ chain.
  • A new test, cargo_target_dirs_are_recognised, feeds it each layout plus paths it must refuse (~/.cargo/bin/nebula, /usr/local/bin/nebula, an unrelated out/ dir, a build script). It passes whichever cargo runs it.
  • What nebula upgrade refuses is unchanged.

Checked

cargo +1.100.0 fmt --check, clippy --workspace --all-targets -- -D warnings and test --workspace (1,938 passed, 0 failed) are clean on macOS, and the upgrade tests also pass on 1.97.1.

…uilds

Since Rust 1.100, cargo runs test binaries from its build-dir layout,
<target>/debug/build/<package>/<hash>/out/, not <target>/debug/deps/.
dev_build() looked only at the binary's own folder (or the one above
deps/), so under 1.100 the nebula binary's tests no longer looked like a
cargo build and dev_builds_are_refused_without_force failed. CI on every
PR went red the day the runners picked 1.100.0 up.

The path rule is now a pure function, in_cargo_target, which also
accepts the out/ ← <hash> ← <package> ← build/ ← <profile> chain. A new
test feeds it each layout and a few paths it must refuse, so it no
longer depends on which cargo runs it. What `nebula upgrade` refuses is
unchanged: a binary in <target>/release or <target>/debug.

Checked: cargo +1.100.0 fmt --check, clippy -D warnings and test
--workspace (1,938 passed) are clean, and the upgrade tests pass on
1.97.1 too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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