Skip to content

perf: selective FileWatcher invalidation, expand ProjectTokenSummary tests#115

Merged
KyleNesium merged 1 commit intomainfrom
feat/v1.9.0-tests-and-filewatcher
Mar 14, 2026
Merged

perf: selective FileWatcher invalidation, expand ProjectTokenSummary tests#115
KyleNesium merged 1 commit intomainfrom
feat/v1.9.0-tests-and-filewatcher

Conversation

@KyleNesium
Copy link
Owner

Summary

  • Selective FileWatcher cache invalidation: stats-cache watcher only invalidates StatsCacheReader, JSONL watcher only invalidates SessionLogReader. Avoids unnecessary JSONL re-scans when only stats-cache changed (and vice versa). Fallback timer still invalidates both as a safe catch-all.
  • ProjectTokenSummary tests: expanded from 1 → 7 tests covering zero tokens, Identifiable id, lastPathComponent display name, Other project for missing cwd, stored cost value, and large token overflow guard.

Test plan

  • Build and run locally — verify no regressions in data refresh
  • Modify stats-cache manually → confirm token data updates without JSONL re-scan
  • New JSONL entry → confirm session data updates without stats-cache re-read
  • Run swift test — all 7 ProjectTokenSummary tests pass

…mmary tests

- FileWatcher now invalidates only the relevant reader cache per event
  source: stats-cache changes → StatsCacheReader only, JSONL changes →
  SessionLogReader only. Fallback timer still invalidates both.
  Avoids unnecessary JSONL re-scans when only stats-cache changed.
- ProjectTokenSummary tests expanded from 1 → 7: zero tokens, id as
  Identifiable, lastPathComponent display name, Other project for
  missing cwd, stored cost, large token counts (overflow guard).
- DATA_LAYER.md updated to document selective invalidation.
@KyleNesium KyleNesium merged commit fc46a18 into main Mar 14, 2026
1 check passed
@KyleNesium KyleNesium deleted the feat/v1.9.0-tests-and-filewatcher branch March 14, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant