Skip to content

mkRustProject: tests/fixtures/ dropped from source silently fails cargo-nextest with 'fixture missing' #2095

Backlog

Description

@gerchowl

Found while adopting devkit 1.19.2 (e934209) into an existing Rust-flake repo (nerdmachines/ee, ee#25). The repo's Rust workspace lives at crates/, with integration-test fixtures under crates/ee-route/tests/fixtures/ (cyberphone JCS vectors, pinned-input traces, zones_vectors, generated tables).

Problem

lib.mkRustProject's cleanSrc wraps crane's commonCargoSources, which filters a crate's directory down to Cargo.{toml,lock} + *.rs + *.toml. Non-Rust files under tests/fixtures/ are silently dropped from the pack's source — the pack's wellKnownConfigFiles list (deny.toml, rustfmt.toml, clippy.toml, …) only covers the repo-root tool configs, not per-crate fixture data.

Result: the pack's nextest and the build-as-check derivations compile cleanly, then at runtime every test that reads a fixture panics with its own missing: re-copy from … message. In this repo:

thread 'cyberphone_vectors_match_rfc_8785' panicked at ee-route/tests/energy.rs:783:5:
jcs fixture root "/build/source/ee-route/tests/fixtures/jcs" missing: re-copy the cyberphone vectors from <repo>/tests/fixtures/jcs/ and `git add` them; see the module docstring.

The pack documents extraSrcFiles as the seam, and setting

extraSrcFiles = [ "ee-route/tests/fixtures" ];

fixes it. So the mechanism is there — but nothing in the message trail points you at it, and a repo that follows the current docs lands on the pack with a green build and a red check it cannot explain.

Impact

Any Rust repo with integration-test fixtures (parity vectors, golden files, snapshot inputs) hits this on first adoption. If the test code happens to short-circuit on MISSING_FIXTURE instead of panicking, the pack reports GREEN with the fixture-dependent assertions silently never run — the worse failure mode.

Suggested

  • mkRustProject could default extraSrcFiles to [\"<crate>/tests/fixtures\"] and [\"<crate>/tests/data\"] per crates = [ … ] entry (opt-out, not opt-in).
  • Alternatively: document the extraSrcFiles need next to the crates arg in the module docstring, with the exact error you'll see when a fixture goes missing.
  • The L1/L4 Rust template in Rust pack: L1/L4/L7 never shipped — the pack cannot be adopted cold #1496 should ship a tests/fixtures/sample.json so an adopter trips the arg early, not at the first real check in production.

Not blocking (one-line fix once you know), but it bit on adoption and the error "fixture missing" from inside a Nix sandbox is not a place to be debugging a flake.nix.

Activity

  1. gerchowl commented on Dec 1, 2026

    @gerchowl
    ContributorAuthor

    Same failure in a second adopter (devkit 1.19.2, 2026-12-01), a private Rust workspace. The integration tests there include_str! JSON vectors from crates/<crate>/tests/vectors/*.json. mkRustProject's source filter drops them, so the nextest check can't compile the tests. A reviewer caught it before CI did.

    The workaround that works: extraSrcFiles = [ "crates/<crate>/tests/vectors" ];. Directories are accepted. Verified with nix eval .#checks.<system>.nextest.src --apply 's: builtins.attrNames (builtins.readDir "${s}/crates/<crate>/tests/vectors")'.

    +1 to making tests/** non-Rust files part of the default source, or to failing the build loudly naming the missing path instead of a confusing compile error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions