Skip to content

TWPA0007 (085-004): Aspire resource names — inference removed and checked#275

Merged
StevenTCramer merged 1 commit into
masterfrom
dev
Jul 2, 2026
Merged

TWPA0007 (085-004): Aspire resource names — inference removed and checked#275
StevenTCramer merged 1 commit into
masterfrom
dev

Conversation

@StevenTCramer

Copy link
Copy Markdown
Contributor

Summary

Kanban 085-004 — the last of the four split inference-removal candidates. The documented trap (AppHost resource name ≠ ServiceNames constant → null BaseAddress, surfacing only under server-side rendering) is now impossible twice over:

  1. Inference removed at the source: app-host Constants duplicated ServiceNames values under a "These MUST match" comment — they now alias ServiceNames.* directly (const-to-const), so drift cannot happen. This required giving app-host a compile-time foundation-contracts reference (IsAspireProjectResource="false", with the standard repo/package switch) — Aspire's project references are app-model resources, not compile references.
  2. Checked for everyone else: TWPA0007 verifies every AddProject first argument via semantic constant evaluation (literals, const references, and aliases all resolve) against the ServiceNames values, with the allowed list in the message. Silent in compilations that can't see ServiceNames; 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 build 0/0 · analyzer tests 31/31 (5 new) · sourcegen 16 · contracts 7 · web-server integration 22 · api-server integration 6

This 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

…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>
@StevenTCramer StevenTCramer merged commit 01fa86d into master Jul 2, 2026
1 check passed
@StevenTCramer StevenTCramer deleted the dev branch July 2, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant