SIGN IN SIGN UP

fix(builtins): gate release-only extraction helpers behind cfg(any(not(debug_assertions), test)) (#1165)

`cargo build` (debug profile) emits four `dead_code` warnings:

```
warning: constant `COMPLETE_MARKER` is never used
warning: function `extract_aspect_builtins` is never used
warning: function `write_and_publish` is never used
warning: function `evict_stale_dir` is never used
```

The embedded-builtins extraction path in
`crates/aspect-cli/src/builtins/mod.rs` is gated on
`#[cfg(not(debug_assertions))]` — debug builds skip extraction and point
straight at the source tree — but the helpers it calls
(`extract_aspect_builtins`, `write_and_publish`, `evict_stale_dir`) and
the `COMPLETE_MARKER` constant carry no cfg, so in debug they appear
unreachable to the compiler.

Adding `#[cfg(not(debug_assertions))]` alone would break `cargo test`,
since the test module exercises these helpers in any profile. Gating on
`cfg(any(not(debug_assertions), test))` keeps them available in release
builds (the real consumer) and under `cargo test` (regardless of
profile), while letting the debug binary drop them.

`Path` from `std::path` is now only referenced by the gated helpers, so
its import is gated the same way; `PathBuf` is used by both cfg branches
of `expand_builtins` and stays unconditional.

---

### Changes are visible to end-users: no

### Test plan

- `cargo build` — was 4 warnings, now 0.
- `cargo build --release` — was 0 warnings, still 0.
- `cargo test --package aspect-cli builtins::tests` — all 7 tests still
pass.
- `cargo test --workspace` — full suite passes.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
G
Greg Magolan committed
d7270e1e910307b85aa63bbcefa30a50da5d3f1b
Parent: a77c84a
Committed by GitHub <noreply@github.com> on 5/30/2026, 6:12:33 AM