Skip to content

Add Hypothesis property-based tests for lockfile filtering invariants in discover_tracked_lockfiles #80

Description

@coderabbitai

Background

Raised during review of PR #75 (refresh stale Cargo lockfiles before publish preflight).

Problem

discover_tracked_lockfiles enforces several filtering invariants (exclude target/ paths, require adjacent Cargo.toml, restrict to git-tracked files) that are only verified by fixed-scenario unit tests. Property-based coverage would catch edge cases across generated input ranges that fixed tests miss.

Resolution

Add @hypothesis.given tests in tests/unit/test_lockfile.py that generate workspace trees with:

  • Random Cargo.lock / Cargo.toml placements at varying nesting depths
  • target/ directory subtrees at varying depths
  • Synthesised git ls-files stdout with varying combinations of tracked / untracked / target paths

Assert that all four invariants hold for every returned path:

  1. Path ends with Cargo.lock
  2. No target component in the relative path
  3. An adjacent Cargo.toml exists
  4. The path was present in the git ls-files output

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions