Skip to content

cs2gs: escape keyword-named packages on the namespace-split path (ADR-0170, #3610) - #3624

Merged
DavidObando merged 1 commit into
mainfrom
fix/attoken-package-escape
Aug 29, 2026
Merged

cs2gs: escape keyword-named packages on the namespace-split path (ADR-0170, #3610)#3624
DavidObando merged 1 commit into
mainfrom
fix/attoken-package-escape

Conversation

@DavidObando

Copy link
Copy Markdown
Owner

Summary

Root-causes and fixes the residual AtToken round-trip wall from the 2026-08-28 selfmig nightly (run 33217212584), pinned to Issue3461ReservedMetadataFixtures.cs.

Root cause: the repository-mode namespace-split path feeds ResolvePackageName the C# display spelling of the package (ToDisplayString()@class for namespace @class), but the resolver's namespace-symbol walk compared segments against the bare metadata name (class). The mismatch fell through to returning the raw text, so the split unit printed package @class — which gsc's parser rejects (GS0005: Unexpected token <AtToken>), failing the translator's round-trip validation. Class names were unaffected (class $defer printed correctly); only the package line missed the ADR-0170 escape.

Fix: strip a leading @ from each dotted segment before the symbol comparison, so the walk reaches the namespace symbol and the emitted-name allocator returns the G# $class escape.

Verification

  • New pinning test PackageSplit_KeywordNamespace_PrintsEscapedPackage (drives the exact pipeline shape: GetDeclaredPackages display spelling → packageFilter translator → asserts package $class, no @). All 35 Issue3461 suites green.
  • Reproduced the nightly failure locally first (repo-mode migrate of the cs2gs subtree at nightly tip 81e8685 → same translate-9dd020ef25f2 AtToken fingerprint), then re-ran with the fix: the fingerprint disappears, the emitted file reads package $class, and Cs2Gs.Tests' only remaining translate gap is the known params ReadOnlySpan<int> CS2GS-GAP.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Nng28yiBdPVdeML7mSZphs

…-0170, #3610, #3501)

The repository-mode package-split path resolves each split unit's
package through ResolvePackageName with the namespace's C# DISPLAY
spelling — ToDisplayString yields `@class` for `namespace @class` —
while the symbol walk compared against the bare metadata name
(`class`). The mismatch fell through to the raw `@` text, so the
emitted file began `package @class`, which does not round-trip-parse
(GS0005 AtToken): the Cs2Gs.Tests wall in the 2026-08-28 selfmig
nightly (run 33217212584), pinned to Issue3461ReservedMetadataFixtures.

Compare each dotted segment with its leading `@` stripped so the walk
reaches the namespace symbol and the allocator returns the ADR-0170
G# escape ($class). Verified against the real shape: a repo-mode
migrate of the cs2gs subtree at the nightly tip now emits
`package $class` and the AtToken translate fingerprint disappears
(only the known params-ReadOnlySpan gap remains for Cs2Gs.Tests).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nng28yiBdPVdeML7mSZphs
@DavidObando
DavidObando enabled auto-merge (squash) August 29, 2026 02:23
@DavidObando
DavidObando merged commit 03be1bf into main Aug 29, 2026
33 of 34 checks passed
@DavidObando
DavidObando deleted the fix/attoken-package-escape branch August 29, 2026 02:37
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