desktop/src-tauri: cargo test --release fails to compile (dev-only migration symbols referenced from unconditional tests)
- Dominant language
- Rust
- Stars
- 32.7k
- Forks
- 4.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 253
Description
## Summary
`cargo test --release` does not compile in `desktop/src-tauri`. The test build fails with `E0425: cannot find function copy_agent_keys_between_stores in module super` (and the same for `DEV_MIGRATION_MARKER`).
Debug builds are unaffected, so nothing in CI catches it.
## Cause
`managed_agents/storage.rs` gates both items on debug builds:
```rust
// storage.rs:494
const DEV_MIGRATION_MARKER: &str = "_dev_migration_v1";
// storage.rs:514-515
#[cfg(debug_assertions)]
fn copy_agent_keys_between_stores(...)
```
`managed_agents/storage_tests.rs` references them unconditionally (`super::DEV_MIGRATION_MARKER` at lines 541, 582, 608, and the function in the tests around them). Under `--release`, `debug_assertions` is off, the definitions vanish, and the test module no longer resolves them.
## Scope
Present on `main` (`076081bfc`), not introduced by any in-flight branch — I hit it while trying to take a release-profile measurement on #6024 and ran it as a control on an unmodified tree before blaming my own change.
The practical consequence is that **no one can run this crate's test suite under `--release`**, which is exactly the profile you want for any performance measurement. I worked around it with `--config profile.test.opt-level=2`, which keeps `debug_assertions` on — usable, but it means optimized measurements of this crate are systematically conservative and nobody can easily check a real release build.
## Fix
Gate the dependent tests to match their subject — `#[cfg(all(test, debug_assertions))]` on the tests that use the dev-only migration path — or drop the `#[cfg(debug_assertions)]` from the function and marker if they are meant to be reachable in release.
Contributor guide
Research direction
Start by running `cargo test --release` in `desktop/src-tauri` to reproduce the missing-symbol errors. Inspect `managed_agents/storage.rs` around lines 494 and 514-515, then compare the dependent tests in `managed_agents/storage_tests.rs` around lines 541, 582, and 608. Done means the crate's release-profile test suite compiles and runs without the unresolved symbols.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100