From f70aafff248b141f781ecce403cb5830623a9e29 Mon Sep 17 00:00:00 2001 From: hatayama Date: Thu, 15 Oct 2026 15:01:45 +0900 Subject: [PATCH] fix: compile-check says how to get a baseline back after a full compile with errors The fallback reason after a full compile with errors now says that the first full compile without errors records a new baseline, so an agent that sees several full compiles in a row knows when the changed-files check comes back. The skill and the compile-check doc also say that adding or removing a using directive counts as a declaration change, and that in a project that treats warnings as errors the rules listed in UncheckedCodes fail only the --full run. --- .../Editor/CliOnlyTools~/CompileCheck/Skill/SKILL.md | 6 ++++-- .../internal/compilecheck/fast_path_test.go | 2 +- .../internal/compilecheck/resultstore/baseline.go | 2 +- .../resultstore/baseline_contract_test.go | 2 +- .../internal/compilecheck/resultstore/store.go | 2 +- docs/compile-check.md | 12 ++++++++---- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Packages/src/Editor/CliOnlyTools~/CompileCheck/Skill/SKILL.md b/Packages/src/Editor/CliOnlyTools~/CompileCheck/Skill/SKILL.md index 059d47371..5652dd074 100644 --- a/Packages/src/Editor/CliOnlyTools~/CompileCheck/Skill/SKILL.md +++ b/Packages/src/Editor/CliOnlyTools~/CompileCheck/Skill/SKILL.md @@ -54,8 +54,10 @@ again: the run reports the diagnostics recorded then, errors included. `--all` c everything from scratch, which is the way out if a reused result ever looks wrong. In a large assembly whose last compile-check compile succeeded, an edit that keeps every -declaration is checked on the changed files only, in a few seconds. Such a check skips a few -assembly-wide rules, so run once with `--full` before finishing. The first body edit after a Unity +declaration is checked on the changed files only, in a few seconds. Adding or removing a using +directive counts as a declaration change. Such a check skips a few assembly-wide rules, so run once +with `--full` before finishing. When the project treats warnings as errors, a rule listed in +`UncheckedCodes`, such as CS0414, can fail that `--full` run only. The first body edit after a Unity build, after a `--full` that had errors, after a run that skipped the assembly, or after `--all` in an assembly that references another of the project is compiled in full and records what the next check compares against; `FastPathFallbacks` says why. diff --git a/cli/dispatcher/internal/compilecheck/fast_path_test.go b/cli/dispatcher/internal/compilecheck/fast_path_test.go index 452382cea..60a2b6845 100644 --- a/cli/dispatcher/internal/compilecheck/fast_path_test.go +++ b/cli/dispatcher/internal/compilecheck/fast_path_test.go @@ -150,7 +150,7 @@ func TestFailedFullCompileLeavesNoBaseline(t *testing.T) { recorder := newCachedSchedulerRecorder("Alpha", "Beta") outcome := project.run(t, recorder, false) - assertFallback(t, outcome, recorder, "no baseline: the last full compile had errors") + assertFallback(t, outcome, recorder, "no baseline: the last full compile had errors; the first full compile without errors records one") } // Verifies that a change to an input other than source contents, such as a new source, compiles in full. diff --git a/cli/dispatcher/internal/compilecheck/resultstore/baseline.go b/cli/dispatcher/internal/compilecheck/resultstore/baseline.go index 32ae1e41e..629cd7885 100644 --- a/cli/dispatcher/internal/compilecheck/resultstore/baseline.go +++ b/cli/dispatcher/internal/compilecheck/resultstore/baseline.go @@ -130,7 +130,7 @@ func (s Store[D]) missingBaselineReason(assembly string) string { return notOnRecord } if !manifest.Succeeded { - return "no baseline: the last full compile had errors" + return "no baseline: the last full compile had errors; the first full compile without errors records one" } return "no baseline: the last full compile did not record one" diff --git a/cli/dispatcher/internal/compilecheck/resultstore/baseline_contract_test.go b/cli/dispatcher/internal/compilecheck/resultstore/baseline_contract_test.go index ea841f0cd..41cb9687a 100644 --- a/cli/dispatcher/internal/compilecheck/resultstore/baseline_contract_test.go +++ b/cli/dispatcher/internal/compilecheck/resultstore/baseline_contract_test.go @@ -181,7 +181,7 @@ func TestLoadBaselineExplainsAMissingBaseline(t *testing.T) { }, "failed compile": { record: func(t *testing.T, project projectStore) { project.recordCompile(t, "input", false) }, - want: "no baseline: the last full compile had errors", + want: "no baseline: the last full compile had errors; the first full compile without errors records one", }, "successful compile": { record: func(t *testing.T, project projectStore) { project.recordCompile(t, "input", true) }, diff --git a/cli/dispatcher/internal/compilecheck/resultstore/store.go b/cli/dispatcher/internal/compilecheck/resultstore/store.go index ab0b17bdc..2de3bd030 100644 --- a/cli/dispatcher/internal/compilecheck/resultstore/store.go +++ b/cli/dispatcher/internal/compilecheck/resultstore/store.go @@ -19,7 +19,7 @@ // same key, a successful compile, and outputs that still match. Otherwise LoadBaseline says why // there is none, in one of these reasons: // "no baseline: no full compile of this assembly is on record", -// "no baseline: the last full compile had errors", +// "no baseline: the last full compile had errors; the first full compile without errors records one", // "no baseline: the last full compile did not record one", // "no baseline: it was recorded by another version of compile-check", // "baseline compile is no longer on disk". diff --git a/docs/compile-check.md b/docs/compile-check.md index 7f9895350..31e77675e 100644 --- a/docs/compile-check.md +++ b/docs/compile-check.md @@ -138,7 +138,9 @@ The check is used when all of these hold: list of source paths. - 1 to 30 of its sources changed. - Every changed file keeps its declarations: only method bodies, accessor bodies, expression - bodies, non-constant initializers outside partial types, comments, or whitespace changed. + bodies, non-constant initializers outside partial types, comments, or whitespace changed. Adding + or removing a `using` directive counts as a declaration change, because it can change what every + name in the file resolves to. The changed files are checked by a worker built once per Editor toolchain with the Editor's own dotnet and Roslyn. It reports their compiler and analyzer diagnostics, with `DiagnosticSuppressor`s @@ -155,8 +157,9 @@ Otherwise the assembly is compiled in full as before, and `FastPathFallbacks` sa - `no baseline: no full compile of this assembly is on record` (none ran yet, a later run skipped the assembly, which removes its result and baseline, or an input changed while the last full compile ran, so it left no record; `FastPathBaselineNotes` of that run says which) -- `no baseline: the last full compile had errors` (a full compile that fails drops the baseline an - earlier one left) +- `no baseline: the last full compile had errors; the first full compile without errors records one` + (a full compile that fails drops the baseline an earlier one left, and the assembly is + compiled in full until a compile succeeds) - `no baseline: the last full compile did not record one` (`FastPathBaselineNotes` of that run says why, or the assembly was compiled only because a reference changed) - `no baseline: it was recorded by another version of compile-check` @@ -205,7 +208,8 @@ What the check does not guarantee, so run `--full` before finishing: assembly, and the rules of analyzers that use Compilation, CompilationEnd, SemanticModel, or SymbolStart actions. `FastChecks[].UncheckedCodes` lists the IDs it could not run, leaving out the ones the response file already turns off (with `-nowarn` or a ruleset) and analyzer rules - that are disabled, so an assembly may list fewer than these four. + that are disabled, so an assembly may list fewer than these four. In a project that treats + warnings as errors (`-warnaserror`), these are errors that only `--full` reports. - Errors the compiler reports only while emitting, such as CS8178 and CS0656. - Source generators. The check reads the generator output saved by the last full compile and does not run them again; `FastChecks[].GeneratorsNotRerun` says so.