Skip to content

feat: granular test cache invalidation#56

Merged
ericodx merged 30 commits intomainfrom
granular-cache-invalidation
Apr 6, 2026
Merged

feat: granular test cache invalidation#56
ericodx merged 30 commits intomainfrom
granular-cache-invalidation

Conversation

@ericodx
Copy link
Copy Markdown
Owner

@ericodx ericodx commented Apr 6, 2026

Summary

  • Replace monolithic test file hash with per-file SHA256 hashing for granular cache invalidation
  • Add KillerTestFileResolver to map test names to file paths (XCTest and Swift Testing formats)
  • Invalidate cache entries selectively based on which test files changed, preserving valid entries
  • Extract test helpers from 19 test suites into shared TestSupport fixtures
  • Remove dead code identified by Periphery scan

Type of Change

  • feat: A new feature has been added.
  • refactor: A code change that neither fixes a bug nor adds a feature.
  • test: Addition or correction of tests.

Invariants Checklist

  • Original project is never modified — all mutations happen inside an isolated sandbox
  • xcodebuild build-for-testing runs exactly once for all schematizable mutants
  • No mutant results are lost or duplicated
  • Mutant positions (file, line, column) are accurate in all reported results
  • A cancelled task never leaves a simulator slot permanently acquired from the pool
  • schematizedContent never contains the __swiftMutationTestingID global declaration
  • Swift 6 Strict Concurrency compatible
  • Pipeline stages remain stateless pure transformations

Pipeline Impact

Which stages are affected?

  • TestExecutionStage
  • IncompatibleMutantExecutor
  • PerFileBuildFallback
  • CacheStore
  • Models / RunnerInput contract

New Types

Type Responsibility
TestFileDiff Tracks added/modified/removed test files between runs
KillerTestFileResolver Maps test names to file paths for targeted invalidation
CacheMetadata Persists per-file test hashes between runs

Invalidation Rules

Status Behavior
unviable, killedByCrash Always preserved (independent of test changes)
killed(by:) with known killer file Invalidated only if killer test file changed
killed(by:) without killer file Conservatively invalidated
survived, noCoverage, timeout Always invalidated when any test file changed

Testing

  • Unit tests added or updated
  • Tests use mock ProcessLaunching — no real xcodebuild, xcrun simctl, or xcresulttool
  • Tests use FileHelpers for any filesystem interaction (temp directories only)
  • All tests pass locally (swift test) — 615 tests, 69 suites

ericodx added 30 commits April 6, 2026 14:54
@ericodx ericodx self-assigned this Apr 6, 2026
@ericodx ericodx added the feature New feature or request label Apr 6, 2026
@ericodx ericodx changed the title Granular cache invalidation feat: granular test cache invalidation Apr 6, 2026
@ericodx ericodx added refactor Code change that neither fixes a bug nor adds a feature test Addition or correction of tests labels Apr 6, 2026
@ericodx ericodx merged commit dcad444 into main Apr 6, 2026
1 check passed
@ericodx ericodx deleted the granular-cache-invalidation branch April 6, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request refactor Code change that neither fixes a bug nor adds a feature test Addition or correction of tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant