fix: compile-check detects a reference the assembly definition lost
Merged
HA
4d ago+178+178+012345678901234567890123456789-24-24-01234567890123456789
Summary
uloop compile-checknow refuses withCOMPILE_CHECK_UNITY_BUILD_REQUIREDwhen an assembly definition lost a project reference since the last Unity build, instead of replaying the old reference and missing the error.
User Impact
- Before: removing a reference from an
.asmdefwas invisible; the run compiled against the reference the last build recorded and could report a clean result for code that no longer compiles. - After: the run stops with
assembly definition <A> no longer references <B>;uloop compileclears it.
Changes
- New
lostProjectReference, called last from the contract check: a project reference in the response file that the.asmdefdoes not declare is reported, except the four Unity adds on its own (UnityEngine.UI,UnityEditor.UI,UnityEngine.TestRunner,UnityEditor.TestRunner). - An
.asmdefwith a reference that cannot be resolved is not judged (its declared set is incomplete); a miss is preferred over refusing a healthy project. - A name reference now resolves only when an
.asmdefin the project declares that name. Unity rewrites the oldUnity.RenderPipelines.Lightweight.*names toUnity.RenderPipelines.Universal.*when it reads an.asmdef, so without this a healthy.asmdefusing the old name was refused with a refusal no Unity build could clear. The other callers of the resolver already skipped names the build never produced. - A gained reference is still reported before a lost one.
SKILL.mdanddocs/compile-check.md: removed the "removed reference is not detected" limitation and described the new refusal in How it works, Limitations and Troubleshooting.
Part of the detection scope ADR 0018 lists.
Verification
go test ./internal/compilecheck/ -run 'TestDetectContractDisagreement' -count=1: pass (6 new tests).cli/dispatcher:gofmt -l .empty,go vet ./...,golangci-lint run ./...0 issues,go test ./... -count=1pass.- A throwaway probe (not committed) ran the check over every assembly of this repository's own Unity project build: 102 assemblies judged, 0 refused, 10 not judged because a reference matches no
.asmdefin the project (5 before the name-resolution change). - Mutations (each reverted):
- (a) empty
unityInjectedProjectReferences→TestDetectContractDisagreementAcceptsTheReferencesUnityInjectsfails. - (b) remove the early return on an unresolved reference →
TestDetectContractDisagreementSkipsTheLostReferenceCheckWhenAReferenceGUIDIsUnresolvablefails. - (c) disable the
lostProjectReferencecall →TestDetectContractDisagreementRefusesAReferenceTheAssemblyDefinitionLostfails. - (d) resolve a name reference unconditionally again → only
TestDetectContractDisagreementSkipsTheLostReferenceCheckWhenAReferenceNamesNoAssemblyDefinitionfails in the whole package.
- (a) empty
check-skill-sizepasses;scripts/sync-tool-docs.sh --checkreports no drift.