Repository navigation
refactor: move compile-check's records into a resultstore package - #3327
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
0b87dda to
6aac1a4
Compare
The record store becomes resultstore.Store[D], opened with Open[D]. Its records, file names and helpers are unexported, so compilecheck can only use Reusable, RecordCompile, LoadBaseline, GeneratorOutputUnchanged, RecordBaseline, GeneratedDirectory and Forget. D is the caller's diagnostic type, which the store keeps without reading. The non-source key crosses as KeyDigest, which nonSourceIdentity converts to and from without copying. The package imports only the standard library. Its own tests use a stand-in diagnostic type with the caller's field order, so the golden bytes are unchanged.
Coverage is measured per package, so the store's baseline paths that the compilecheck tests used to exercise counted for nothing once the store moved. These tests cover them through the public methods: a recorded baseline comes back as recorded, a changed, removed or added generated file stops it matching, a compile result that is gone stops it being handed out, the reasons a baseline is missing, and a failed baseline write.
The store's golden record test now uses a stand-in diagnostic type, so a change to the real diagnostic's field order, names or tags went unnoticed. The store records diagnostics as it is given them, so this form is part of what earlier runs left on disk.
2e1786b to
cd104de
Compare
8c60da8
into
feature/compile-check-changed-files-check
Summary
resultstore. Everything else in compile-check reaches them only through one store type, and the compiler enforces that.User Impact
Forgetstays the single place that removes every record.Changes
Forgetremoves every kind of record, and the reasonsLoadBaselinegives.D:resultstore.Open[Diagnostic].resultstore.KeyDigest. It has the same fields as compile-check's ownnonSourceIdentity, so the two convert into each other with a plain type conversion and nothing is copied. compile-check keeps owning how the key is computed.hashFile(12 lines) and the project-relative path helper rather than sharing them through another package.resultstoreimports only the standard library.Verification
go list -deps ./internal/compilecheck/resultstore | grep -c 'internal/compilecheck$':0. Its direct imports are all standard library.git grep -Povercli/dispatcher/internal/compilecheck/*.go(not descending into subpackages) for record internals (struct names, constants, paths, internal functions, record file names): no matches.KeyDigeststops the type conversion compiling and fails the baseline golden test;LoadBaselinefails a parent test and a new store test;cli/dispatcher:golangci-lint fmt --diffis empty;go vet ./...passes;golangci-lint runand the complexity config both report 0 issues.go test ./...andgo test -race ./internal/compilecheck/...(includingresultstore) pass.cli/release-automation:go test ./...passes. The file-length check passes.ForgetandRecordCompile.