Enforce Canonical Application Name conventions, add config factories#29
Merged
Conversation
Ensures future sessions explicitly load the .NET-specific agent directives from the public MCP server rather than relying on passive detection. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…28) CanonicalApplicationName now validates all four parts against the naming conventions in the reference wiki (long form: lower-case, numbers, underscores, starting with a letter; short form: 1-4 lower-case letters/numbers), instead of only checking the long-form values for null/whitespace. Add CanonicalApplicationName.FromConfiguration and ApplicationMetadata.GetApplicationMetadataFromEntryAssemblyAndConfiguration factories that read the four well-known netchris:application:* keys, centralizing logic that was previously duplicated in consumers like NetChris.AspNetCore.Server. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ge-README Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…eaking change) GetApplicationMetadataFromEntryAssembly -> GetApplicationMetadata(Assembly, ...) GetApplicationMetadataFromEntryAssemblyAndConfiguration -> GetApplicationMetadataFromConfiguration(Assembly, IConfiguration, ...) Callers now supply the assembly explicitly instead of relying on Assembly.GetEntryAssembly(), which is unreliable for test hosts and other non-standard entry points. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ationMetadata Co-Authored-By: Claude Sonnet 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
CanonicalApplicationNamenow enforces the naming conventions from the Canonical Application Name / Name part normalization wiki pages on all four parts (previously only the long-form aggregate/component were checked for null/whitespace; the short forms weren't validated at all).CanonicalApplicationName.FromConfiguration(IConfiguration), readingnetchris:application:{aggregate,aggregateShort,component,componentShort}and failing fast with a message naming the missing key.ApplicationMetadata's factory methods to take an explicitAssemblyinstead of relying onAssembly.GetEntryAssembly()(breaking change):GetApplicationMetadataFromEntryAssembly→GetApplicationMetadata(assembly, ...)GetApplicationMetadata(assembly, configuration, environmentName), composingCanonicalApplicationName.FromConfigurationwith the assembly-based factory, to centralize logic previously duplicated in consumers (e.g.NetChris.AspNetCore.Server).Microsoft.Extensions.Configuration.AbstractionstoNetChris.Core.csproj.xunit.v3.CanonicalApplicationNameandApplicationMetadata, including the configuration keys, inPackage-README.md.CLAUDE.mdagent directive intoAGENTS.md, withCLAUDE.mdpointing to it.Closes #28
Test plan
dotnet test— all 177 tests pass, including newCanonicalApplicationNameTestsand updated/addedApplicationMetadataTestscasesdotnet buildwithTreatWarningsAsErrorson both projects — clean🤖 Generated with Claude Code