CLI: replay the report of unchanged files - #56
Conversation
🏎️ Benchmark Comparison
Full output |
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a correctness-sensitive caching layer that can silently replay stale validation reports, and the new cache read/write paths have no direct test coverage despite the sibling cache being thoroughly tested.
Pull request overview
This PR adds a CLI-level report cache to validate-gts. On each run it caches every file's deduplicated html-validate report on disk under node_modules/.cache/html-validate-ember/report/, keyed by the file's content, the resolved .htmlvalidate.json config, html-validate's version, the tsconfig (via Glint), and the HVE_* environment switches. On a cache hit the file is not re-validated; the stored report feeds the same counters and formatter output. It is the CLI counterpart of the transform cache (#55) and reuses the same invalidation machinery (PLUGIN_VERSION, PLUGIN_SOURCE_SHA, HVE_NO_CACHE=1 bypass).
Changes:
- Adds a
reportdisk cache (reportCacheKey,readReportCache,writeReportCache,CachedReport) tolib/cache.ts, mirroring the existing per-path glint/transform cache pattern. - Refactors the per-file loop in
run.tsto a sharedrecordReporthelper and consults/writes the report cache aroundvalidateFile, keeping counters and formatter output identical on hits and misses.
File summaries
| File | Description |
|---|---|
lib/cache.ts |
Appends the report cache: key derivation and path-keyed read/write with PLUGIN_VERSION/PLUGIN_SOURCE_SHA staleness checks. |
run.ts |
Computes a per-file report key, replays cached reports through a new recordReport helper, and writes reports on misses. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
`validate-gts` caches each file's deduplicated html-validate report, keyed by the file's content, the resolved configuration, html-validate's version, the tsconfig and the environment switches (under `.../html-validate-ember/report/`). An unchanged file is not validated again; its report is replayed into the same counters and output. Console app (838 files), warm run: 3.3 s -> 0.3 s. Output identical to an uncached run; `HVE_NO_CACHE=1` bypasses it like the other caches. Cowritten by Claude
The key carries the backend kind from `backendKindFor` (as the transform cache does since #55) instead of the raw `HVE_TS_BACKEND`. Round-trip, miss-on-any-input-change and one-entry-per-path tests. Cowritten by Claude
e5b5e7b to
c16edf4
Compare
validate-gtsnow caches each file's deduplicated html-validate report undernode_modules/.cache/html-validate-ember/report/, keyed by the file's content, the resolved.htmlvalidate.jsonconfiguration, html-validate's version, the tsconfig (through Glint) and the environment switches. On a hit the file is not validated: its stored report feeds the same counters and the same formatter output.HVE_NO_CACHE=1bypasses it like the Glint and transform caches; the plugin-source hash invalidates it on every plugin change.This is the CLI-level counterpart of #55: #55 skips the template work when html-validate still runs (editor hosts, html-validate's own CLI); this skips html-validate itself when
validate-gtsruns. Together a warm run costs process start-up.Verified: two consecutive runs over
examples/produce byte-identical stdout (elapsed line excluded), 79 files / 26 with errors / 38 errors on both. Both test lanes 291 + 1 expected fail (the tests drivevalidateFiledirectly, so they are unaffected by design).Measured: example app (838 files) warm run 3.3 s → 0.3 s; bench warm run −48 %, one cached file −32 %.
Same cross-file caveat as the other caches: a consumer's report keys on the consumer's content, so a change in an imported component's template is not seen until the consumer changes or the plugin version does. Independent of #54 and #55 in code (touches
run.tsand appends tolib/cache.ts).Cowritten by Claude