Skip to content

test: add cache safety assertions for diff operations #165

@rocketman-code

Description

@rocketman-code

Context

Parent: #160

The showstopper v0.4.0 bug (#142) was diff silently corrupting the disk cache. build_snapshot_from_working_tree() called load_graph(entry, false) — caching enabled — which wrote a reduced git-tree graph to .chainsaw.cache, overwriting the full graph. Subsequent trace/packages returned wrong results.

Expected Behavior

Tests that verify diff operations never read or write the disk cache.

Scope

  • Test: run trace (builds cache), then diff HEAD~1, then trace again — results must match
  • Test: after diff, .chainsaw.cache mtime is unchanged
  • Test: build_snapshot_from_ref() and build_snapshot_from_working_tree() don't touch cache
  • Consider a test helper that wraps cache operations with a sentinel file to detect unexpected writes
  • Consider a #[cfg(test)] assertion in load_graph that panics if called with no_cache=false during a diff context

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions