test(startup): build the host composition in CI, not only when somebody runs it - #388
Merged
Conversation
…er runs it src/Host/Dev/Program.cs carries the claim that it notices "if someone breaks AddCalloraHost or the order these have to run in". That held for compile errors only. A missing registration compiles cleanly and fails at builder.Build() — and nothing in CI ever made that call. A service registered by hand in a test host and absent from the real composition therefore came through the suite green and would have taken down the dev stack at startup. AddCalloraHost sets ValidateScopes and ValidateOnBuild, so the build itself says something: every registered dependency is checked for resolvability and for a scoped service captured by a singleton. And that is where it stops — measured, not assumed. Remove PluginSelfService from the composition and the host still builds: a service registered nowhere is not validated either, and a controller's [FromServices] parameter resolves only when it is called. Hence the second test naming the tenant-level services explicitly. Whatever is consumed only through [FromServices] has to be listed there or nothing covers it. The comment in the test says so, so the next person does not read more into the first one than it delivers. The Program.cs comment is corrected in the same move, and points at the test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iSX3geDv7PNRmiusRr1xd
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.
Found while checking whether the three merged PRs (#385, #386, #387) actually hold up outside the test hosts.
The gap
src/Host/Dev/Program.cscarries this claim:That held for compile errors only. A missing DI registration compiles cleanly and fails at
builder.Build()— and nothing in CI ever made that call.AddCalloraHosthad exactly one caller in the repository, and it runs when a person presses F5.So a service registered by hand in a test host and absent from the real composition came through the suite green and would have taken down the dev stack at startup. That is precisely the shape of the last three PRs:
WorkspaceReach,PluginSelfServiceandITenantPluginDelegationStoreare registered manually in every test host that uses them.What the gate covers
AddCalloraHostsetsValidateScopesandValidateOnBuild, so the build itself says something: every registered dependency is checked for resolvability and for a scoped service captured by a singleton.And that is where it stops — measured, not assumed. Remove
PluginSelfServicefrom the composition and the host still builds: a service registered nowhere is not validated either, and a controller's[FromServices]parameter resolves only when it is called. Only the second test — the one naming the tenant-level services — goes red.I had written the opposite in the test comment first ("covers everything that comes later, nobody has to extend it"). The experiment showed it was wrong, and the comment now says what actually holds: whatever is consumed only through
[FromServices]has to be listed explicitly or nothing covers it.Also
The
Program.cscomment is corrected in the same move and points at the test, so the two stay in step — the test makes the same calls in the same order, and a composition that drifts from it would be testing something nobody ships.