Skip to content

feat: compile-check's record store can keep the last changed-files check - #3328

Merged
hatayama merged 2 commits into
feature/compile-check-changed-files-checkfrom
feat/compile-check-fast-check-record
Oct 15, 2026
Merged

hatayama merged 2 commits into
feature/compile-check-changed-files-checkfrom
feat/compile-check-fast-check-record

Conversation

@hatayama

@hatayama hatayama commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • compile-check's record store can now keep what the last changed-files check of an assembly reported, so a later run can report it again instead of starting the worker.
  • No behaviour changes yet: nothing writes or reads the new record. The next PR wires it into the changed-files check.

User Impact

  • None in this PR. With the follow-up, running compile-check again on the same edit answers without checking the same files a second time.

Changes

  • A fourth record per assembly, <Assembly>.fastresult.json, next to <Assembly>.result.json, at format version 1. It holds the input key, the baseline's input key, the worker build key, and what the check reported: success, diagnostics, changed files, unchecked codes, and whether generators were not rerun.
  • The store's API gains one read and one write:
    type FastCheckResult[D any] struct { Succeeded bool; Diagnostics []D; ChangedFiles, UncheckedCodes []string; GeneratorsNotRerun bool }
    func (s Store[D]) ReusableFastCheck(assembly, key string, baseline Baseline[D], workerKey string) (FastCheckResult[D], bool)
    func (s Store[D]) RecordFastCheck(assembly, key string, baseline Baseline[D], workerKey string, result FastCheckResult[D]) error
  • ReusableFastCheck hands the record back only when all three keys match and the format version is this build's. An empty input key never matches, and an unreadable record counts as no record.
  • RecordFastCheck refuses to write without an input key, a baseline or a worker build. A record under an empty key could later match another empty key. It writes through a temporary file, like the other records.
  • Forget removes the new record as well, after the other three, so no check outlives the compile it was checked against.
  • The package comment lists the fourth record and its contract.

Verification

  • New tests in resultstore:
    • the record comes back exactly as written, with every field set;
    • another input key, baseline or worker build each stops the match;
    • another format version, an unreadable record, and an empty input key each stop it too;
    • each missing key is refused and writes nothing;
    • a failed rename leaves no temporary file;
    • Forget removes the record;
    • a golden test of the recorded bytes.
  • Mutations, each restored afterwards. Each fails exactly the matching test:
    • not comparing the baseline's input key;
    • not comparing the worker build;
    • not comparing the format version;
    • not refusing an empty input key on read;
    • accepting an empty worker build on write;
    • Forget keeping the record;
    • swapping two fields of the record.
  • cli/dispatcher:
    • golangci-lint fmt --diff is empty; go vet ./... passes; golangci-lint run and the complexity config both report 0 issues.
    • go test ./... and go test -race ./internal/compilecheck/... pass.
    • Coverage with the CI exclusions: 94.23% (baseline 94.2).
  • cli/release-automation: go test ./... passes. The file-length check passes.

View guided diff

…sembly

The store can now record what a check of an assembly's changed files reported,
under the input key, the baseline and the worker build it checked with, and hand
it back only while all three are the same. A record is never written without
all three keys, is written through a temporary file, and Forget removes it with
the assembly's other records. Nothing writes it yet.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You'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 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: hatayama/unity-cli-loop/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6b8d8c18-ffd8-4f06-b312-6417512e714d
📥 Commits

Reviewing files that changed from the base of the PR and between eeb4a42 and 9b5bd6b.

📒 Files selected for processing: 1
  • cli/dispatcher/internal/compilecheck/resultstore/fast_check_test.go

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: hatayama/unity-cli-loop/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 13a42c83-a211-4536-8c08-e7dc9c3d7509
📥 Commits

Reviewing files that changed from the base of the PR and between 8c60da8 and eeb4a42.

📒 Files selected for processing: 3
  • cli/dispatcher/internal/compilecheck/resultstore/fast_check.go
  • cli/dispatcher/internal/compilecheck/resultstore/fast_check_test.go
  • cli/dispatcher/internal/compilecheck/resultstore/store.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The result store now persists changed-files check results. It reuses a result only when the format version, input key, baseline key, and worker key match. Forget also removes the fast-check record.

Changes: Reusable fast-check results

Layer / File(s) Summary
Record and validate fast-check results
cli/dispatcher/internal/compilecheck/resultstore/fast_check.go, cli/dispatcher/internal/compilecheck/resultstore/fast_check_test.go, cli/dispatcher/internal/compilecheck/resultstore/store.go
Adds versioned JSON storage for fast-check outcomes. Reuse requires matching format version and input, baseline, and worker keys. Tests cover result round-tripping, mismatches, invalid records, missing keys, and write behavior.
Remove fast-check records with assembly data
cli/dispatcher/internal/compilecheck/resultstore/store.go, cli/dispatcher/internal/compilecheck/resultstore/fast_check_test.go
Forget removes the fast-check record, ignores a missing file, and returns a wrapped error for other removal failures. A test verifies record removal.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to eeb4a

This change adds storage for the last changed-files check result, but nothing reads or writes it yet, so current behavior is unchanged. No concrete merge-blocking risk was found.

Security architecture risk: 🔵 Low · up to eeb4a

This adds stored check results without enabling reuse during normal runs. No currently reachable security regression was established, but result validity and cleanup ordering need to remain sound when reuse is connected.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated scope is local per-assembly persistence and cleanup. With no production callers of the new APIs at this head, the evidence does not establish an attacker-controlled path that uses a stored outcome to skip checking.

Trust Boundaries and Controls

  • observed — The writer refuses empty input, baseline, or worker keys. The reader checks equality of all three keys but independently rejects only an empty input key; a hand-authored record with empty baseline and worker keys could match equally empty caller values. No production caller currently exposes that transition.

Hardening Proposals

  • proposed — Before enabling production reuse, establish that callers supply a valid baseline and worker identity and that invalidation cannot race with publication or allow reuse after failed cleanup. Include rollback/re-upgrade behavior in that lifecycle contract.
Pre-merge checks: Passed 5
Passed Passed checks: 5 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: the compile-check record store can retain the last changed-files check.
Description check Passed The description directly explains the new fast-check record, APIs, matching rules, cleanup behavior, and verification.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 3 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A record that is not JSON decodes to nothing, so it was rejected by its format
version even when the decode error was ignored. A record whose version and keys
match but whose one field has the wrong type decodes partly, and only the
decode error stops it from being handed out.
@hatayama
hatayama merged commit 626c5d8 into feature/compile-check-changed-files-check Oct 15, 2026
4 checks passed
@hatayama
hatayama deleted the feat/compile-check-fast-check-record branch October 15, 2026 04:05
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