TWPA0007 (085-004): Aspire resource names — inference removed and checked#275
Merged
Conversation
…at its source The documented trap (AppHost resource name != ServiceNames constant -> null BaseAddress, only under server-side rendering) is now impossible twice over: 1. Inference REMOVED: app-host Constants were duplicating ServiceNames values under a "These MUST match" comment. They now alias ServiceNames.* directly (const-to-const). Required a compile-time foundation-contracts reference in app-host (IsAspireProjectResource=false + repo/package switch) — Aspire's project references are app-model resources, not compile references. 2. Inference CHECKED: TWPA0007 verifies every AddProject first argument (via semantic constant evaluation — literals, const refs, and aliases all resolve) against the ServiceNames constant values; silent in compilations that cannot see ServiceNames; AddYarp/AddPostgres out of scope. Proven end-to-end: sabotaging one constant in the real app-host produced TWPA0007 with the allowed-values list; reverted. 5 new Fixie tests; analyzer suite 31/31; dev build 0/0; all fast suites green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Kanban 085-004 — the last of the four split inference-removal candidates. The documented trap (AppHost resource name ≠
ServiceNamesconstant → nullBaseAddress, surfacing only under server-side rendering) is now impossible twice over:ConstantsduplicatedServiceNamesvalues under a "These MUST match" comment — they now aliasServiceNames.*directly (const-to-const), so drift cannot happen. This required giving app-host a compile-timefoundation-contractsreference (IsAspireProjectResource="false", with the standard repo/package switch) — Aspire's project references are app-model resources, not compile references.AddProjectfirst argument via semantic constant evaluation (literals, const references, and aliases all resolve) against theServiceNamesvalues, with the allowed list in the message. Silent in compilations that can't seeServiceNames;AddYarp/AddPostgres/container resources deliberately out of scope.Proven end-to-end: sabotaging one constant in the real app-host produced the diagnostic; reverted.
Verification
dev build0/0 · analyzer tests 31/31 (5 new) · sourcegen 16 · contracts 7 · web-server integration 22 · api-server integration 6This completes the 085 split: all four accepted candidates shipped, each catching or eliminating real drift (unregistered mock factory, never-traveling
UserId, PascalCase test options, duplicated resource names).🤖 Generated with Claude Code