fix(utilities): make GetHintName encoding injective (review findings from #152) - #153
Conversation
…e cref Review findings on #152 identified two real collision classes in the hint name format: - the _N arity suffix is forgeable by an ordinary identifier, so class Result_1 and class Result<T> both produced Result_1.g.cs - namespace segments and nesting levels shared the '.' separator, so namespace A { class B { class C } } and namespace A.B { class C } both produced A.B.C.g.cs Both markers are now characters no C# identifier can contain: arity is (N) and nesting levels join with '-', making the encoding injective (Deep.Outer(1)-Middle-Inner(1).g.cs). A CSharpGeneratorDriver probe test proves Roslyn hint-name validation accepts the charset. Also qualifies the SourceProductionContext.AddSource cref introduced in #152 (ambiguous across its (string, string) / (string, SourceText) overloads). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting Summary by CodeRabbit
WalkthroughThe hint-name encoding produced by ChangesHint Name Encoding Update
Estimated code review effort: 2 (Simple) | ~10 minutes Comment |
…, qyl bumped) (#154) Full arc complete: GetHintName + cref fix merged via #152 and published as 2.2.32 (explicit version override, 2.2.31 skipped intentionally); review findings on the hint-name encoding fixed via #153 and published as 2.2.33; both versions tagged and indexed on nuget.org; qyl pins bumped in qyl#490 and qyl#492. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Summary
Both CodeRabbit findings on #152 survived adversarial verification — they are real, constructible collisions in an API documented as collision-free — so this fixes the encoding before anyone depends on the format (shipped in 2.2.32 minutes ago).
class Result_1vsclass Result<T>Result_1.g.csResult_1.g.csvsResult(1).g.csnamespace A { class B { class C } }vsnamespace A.B { class C }A.B.C.g.csA.B-C.g.csvsA.B.C.g.csThe fix: both markers —
(N)arity and-nesting separator — are characters no C# identifier or namespace segment can contain, so the mapping from declaration to hint name is injective. Example:Deep.Outer(1)-Middle-Inner(1).g.cs.Also qualifies the ambiguous
SourceProductionContext.AddSourcecref that #152 introduced (its docs now reference the(string, string)overload explicitly) — zero ambiguous-cref warnings remain.Verification
CSharpGeneratorDriverprobe generator that callsAddSource(info.GetHintName(), …)for the gnarliest name — proving Roslyn's hint-name validation accepts the(N)/-charset empirically, not by assumptionStatus: complete-and-verified. Publishes as 2.2.33 via normal auto-bump.
🤖 Generated with Claude Code