Skip to content

manifest_created test races on Windows volume root C:\.perima\manifest.db #138

Open

Description

@utof

Summary

`crates/cli/tests/manifest_created.rs::manifest_db_created_after_scan` fails intermittently on `windows-latest` because nextest runs CLI test binaries in parallel and several scan-related tests share the same writable volume-root manifest at `C:\.perima\manifest.db`. Linux/macOS are unaffected (`/.perima/` is root-only; manifest write silently fails and the test takes its else-branch).

Reproduction

After commit `19d68c1` filtered the COUNT by tempdir basename, a follow-up Windows run (cdb04c0) showed:

```
thread 'manifest_db_created_after_scan' panicked at crates\cli\tests\manifest_created.rs:141:9:
assertion left == right failed: manifest must have 3 file rows for this tempdir, got 0
left: 0
right: 3
```

Run: https://github.com/utof/perima/actions/runs/24912525292/job/72957265532

Root cause

  1. `MetadataQueue` / `write_manifest` writes to `<volume_root>/.perima/manifest.db` where volume_root is the mount point of the scan target's volume.
  2. On Windows GHA runners the tempdir is under `C:\Users\runneradmin\AppData\Local\Temp\` so volume_root resolves to `C:\`. The runner user has write permission to `C:\`.
  3. Multiple CLI integration test binaries (`scan_persists`, `scan_with_volumes`, `scan_with_metadata_test`, `manifest_created`, etc.) all run `perima scan` concurrently under nextest's process-per-test isolation, all targeting different tempdirs but all writing to the SAME shared manifest at `C:\.perima\manifest.db`.
  4. The basename-filter fix in `19d68c1` (filter `manifest_files` rows by tempdir basename in `relative_path`) confirms the test's 3 rows are NOT present in the shared manifest after the scan returns success — suggesting a write race where another test binary's transaction clobbered or out-of-ordered our rows.

Workaround applied

Mark the test `#[cfg_attr(target_os = "windows", ignore)]` with a WHY block referencing this issue. Test still runs on Linux/macOS where it's already exercising the else-branch (graceful-degradation path), which is the more interesting invariant.

Real fix candidates (not in this batch)

  1. Per-test volume-root override env var (`PERIMA_MANIFEST_ROOT`?). Code change in `write_manifest` + tests adopt the env. Would isolate concurrent tests to per-test manifest paths.
  2. Test serialization for manifest-touching CLI tests (e.g., `#[serial]` macro, opt out of nextest parallelism for this group). Slower but no production code change.
  3. Run manifest_created in a single-threaded nextest profile (`--test-threads 1`). Cheap; only impacts CI wall-clock for one test.

References

Activity

  1. added
    type/chore
    area/ci
    on Apr 24, 2026
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

    area/citype/chore

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions