ci: fail the build when a project is missing from CritterCab.slnx#36
Merged
Conversation
CI restores, builds, and tests CritterCab.slnx explicitly — the slnx enumerates each project with no glob, making it the single source of truth for what CI sees. A *.Tests.csproj added to disk but not hand- added to the slnx would silently never run, and the check would still go green. That trap is inert today (one service, two projects) but armed to fire the moment the second service (Telemetry) lands with its own test project. This adds a pre-build guard that fails CI with a clear error if any *.csproj on disk is absent from the slnx, keeping test discovery omission-proof as new services are added. Guard logic verified locally: passes for the current two projects and flags a simulated forgotten Telemetry service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a pre-build CI guard that fails the workflow if any
*.csprojon disk is absent fromCritterCab.slnx, closing a silent test-discovery hole before the second service lands.The risk this closes
CI runs
dotnet restore/build/testagainstCritterCab.slnx, which enumerates each project with an explicit<Project Path=…/>— no glob. That makes the slnx the single source of truth for what CI sees. A*.Tests.csprojadded to disk but not hand-added to the slnx would silently never run, and the check would still go green.The trap is inert today (one service, two projects) but armed to fire the moment the next roadmap build — the Telemetry service — lands with its own
*.Tests.csproj. Nobody would notice from a passing check.What changed
A single new step in
.github/workflows/dotnet.yml, placed right afterCheckout(beforeSetup .NET, so it fails at the cheapest possible point):*.csprojon disk and asserts each appears inCritterCab.slnx.::error::annotation naming the offending project and exits non-zero.This keeps the efficient single-pass slnx restore/build/test exactly as-is (chosen over the glob-driven-test alternative to preserve one source of truth shared by the IDE and CI, and to give a clear actionable failure rather than a confusing
--no-buildassembly-not-found error). It also catches any project drift, not just test projects — a new service's main project missing from the slnx is flagged too.Verification
Guard logic exercised locally before commit:
0, no false positives.CritterCab.Telemetry+.Telemetry.Testsnot in slnx): both flagged, exits1.No code or
.csprojtouched, so the build/test baseline (build 0/0, test 11/11) is unaffected; this PR's own CI run exercises the new guard end-to-end in its real environment.Deferred (intentionally out of scope)
Kept tightly scoped to the prioritized discovery-guard risk. Two cheap polish items from the investigation are left for separate follow-ups:
TreatWarningsAsErrors(a durable behavior change) and surfacing the.trxin the PR checks step-summary (DX papercut).