Skip to content

fix: keep stable names in enum mapping exceptions - #41

Merged
AGiorgetti merged 1 commit into
developfrom
fix/codex-27-enum-diagnostics
Oct 9, 2026
Merged

AGiorgetti merged 1 commit into
developfrom
fix/codex-27-enum-diagnostics

Conversation

@AGiorgetti

@AGiorgetti AGiorgetti commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #27.

  • Carry stable source-value names separately from executable enum expressions, preserving names through nullable captures.
  • Emit escaped string literals for ArgumentOutOfRangeException.ParamName. Configured paths report the full path; root/direct members retain their source names, and collection entries retain item, Key, or Value metadata.
  • Preserve existing enum strategies, null guards, ActualValue, and single getter evaluation.
  • Add 32 generator cases and the primary reproduction to the Basic sample, clean-package consumers, all framework/language consumers, and trimmed/Native AOT consumers.

Test-first evidence

On unchanged develop 8d41533957c7b5b27943327c8b6b3eef171b4232, the expanded 31-case fixture produced 23 failures and eight passing controls, with no skips. An additional nullable tuple-field case independently failed before the fix. The Basic sample independently failed with CS8081: Expression does not have a name.

Coverage includes nullable intermediates and enum leaves, known/unknown/declared-unmatched values, flags, constructor binding, updates, patch captures, root and renamed-member names, keyword/collision parameters, sequence/dictionary names, getter exception identity, exact getter counts, C# 9, and deterministic output.

Local validation

  • Release solution build: zero warnings/errors

  • Generator: 759 passed, including all 32 new cases

  • Runtime: five passed; integration: one passed

  • All three source sample smoke runs pass

  • Generated netstandard2.0/C# 9 package source inspected: the guarded enum switch reports Child.State and uses its existing captured value

  • Independent read-only review and CRLF-aware diff checks pass

  • Available packaging suite: 216 passed / six failed / zero skipped on the first run. The task's generated consumers filled the 4.9 GB temporary filesystem.

  • Preserved only task-owned generated consumers in the larger workspace and reran the six affected cases with a workspace-local temporary directory: four passed / two infrastructure failures / zero skipped.

  • Across the full run plus focused recovery: all 220 available non-publish package cases pass, including all 12 framework/language combinations, clean-package samples, package/API checks, usage validation, and benchmark smoke. This is not a single all-green invocation.

PowerShell and clang are unavailable; 49 PowerShell-dependent cases were not run locally. Trimming and Native AOT still fail at ILLink's ComputeManagedAssemblies task-host creation with MSB4216 / Unix-domain SocketException (13). Local publish behavior is not established. No assertion, warning, dependency, prerequisite, or security setting was weakened.

Known limitation outside this fix

A separate, pre-existing null-preservation defect remains when a configured path has a nullable intermediate, a non-nullable enum leaf, and a nullable enum target. For example, change the sample's EnumPathTarget.State to OutputState? and call EnumPathMapper.Map(new EnumPathSource()).State: the expected result is null, but the current planner reaches the unknown-value exception arm.

The original runtime failing reproduction is retained in task evidence. The committed regression verifies only compilation and stable exception naming for this boundary and labels that distinction explicitly. No runtime null-preservation pass is claimed for this variant. The limitation is disclosed in the usage guide and DECISIONS.md; it is not folded into the one-bug scope.

CI and review

Ordinary exact-head CI run 37919719123 passed for 983b8cc2453d6b8664205e829c9bc7afca87f7e2.

  • Windows: 1,036 tests passed, zero failures/skips (759 generator, 271 packaging, five runtime, one integration)
  • Linux: 1,036 tests passed, zero failures/skips, with the same suite counts
  • Roslyn 4.8.0 / 4.14.0 / 5.9.0 on both operating systems: 759 generator tests passed in each of six jobs, zero failures/skips
  • Full CI packaging includes the PowerShell, trimming, and Native AOT checks unavailable locally; both platform suites pass without skips
  • All three release/publication jobs were skipped as expected for this PR

CI verification completed at the human-review checkpoint. The maintainer subsequently marked the PR ready and merged it.

Opened as a draft for human review. No agent merge, release, tag, package publication, or workflow dispatch was performed.

Prepared with OpenAI Codex.

Remote tree 0d6463137bdac5bedb49c78c6b0028299e49fa62 matches the tested local tree exactly.

Separate exception metadata from rendered enum expressions and preserve it through nullable captures without repeating source evaluation.

Fixes #27.

Co-authored-by: Codex <codex@openai.com>
@AGiorgetti
AGiorgetti marked this pull request as ready for review October 9, 2026 10:51
@AGiorgetti
AGiorgetti merged commit 14eaa97 into develop Oct 9, 2026
11 checks passed
@AGiorgetti
AGiorgetti deleted the fix/codex-27-enum-diagnostics branch October 9, 2026 10:56
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.

[P2] Use a stable diagnostic name instead of nameof on generated enum expressions

1 participant