Skip to content

fix(csharp): shared DecimalWire and MetaNetValidation helpers carry the auto-generated marker - #461

Merged
dmealing merged 2 commits into
mainfrom
fm/mo-csharp-helper-marker-460
Oct 25, 2026
Merged

dmealing merged 2 commits into
mainfrom
fm/mo-csharp-helper-marker-460

Conversation

@dmealing

@dmealing dmealing commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • EntityGenerator now emits // <auto-generated/> as the first line of the DecimalWire and MetaNetValidation helper files. Previously these were the only emitted files without the marker, so runs with no GenStateDir wrote them once and then refused to overwrite them on later runs. The helpers now regenerate. The marker is the only change to their text.
  • The DecimalWire runtime source and the two committed helper copies in MetaObjects.IntegrationTests/Generated/ carry the same marker line.
  • Adds DecimalWireTests coverage: one test asserts the marker is on the first line of every shared helper, and one test runs codegen twice with no state dir and asserts the second run rewrites all four helper files without a "refusing to overwrite" warning.
  • CHANGELOG.md gets a Fixed entry (C#: DecimalWire and MetaNetValidation helpers lack <auto-generated/>, so a runner without GenStateDir never regenerates them #460). It notes that a helper copy already on disk has no marker, so existing DecimalWire*.g.cs and MetaNetValidation*.g.cs files must be deleted once before regenerating.
Validation

Risk Assessment

✅ Low: A one-line comment marker is added to two helper templates, and the fixed CHANGELOG upgrade note now tells adopters to delete the stale helpers before regenerating. The new tests run the real runner and would fail without the fix.

Testing

I drove the real C# codegen runner against a two-namespace model with no state dir. The helper files get the marker, and a rerun overwrites hand-edited helpers in both namespaces with no refusal warning. The two new tests fail on the pre-fix generator and pass with the fix. The C# Codegen, Cli, Render and Conformance suites all pass. The TypeScript suite did not finish within the time limit, but the change doesn't touch TypeScript. The CHANGELOG text now tells adopters to delete the existing helper files and then regenerate, as the review round 1 decision requested. The CHANGELOG wording was not driven live; it is untested.

  • Live validation: ✅ go - 3 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Emitted DecimalWire and MetaNetValidation helpers start with // <auto-generated/> on line one in every namespace ✅ pass live Shared_helpers_carry_the_generated_marker_on_their_first_line passes. It failed when run against the pre-fix generator.
A second CodegenRunner.Run with no GenStateDir overwrites a stale (hand-edited) helper in every namespace, with no 'refusing to overwrite' warning ✅ pass live Rerun_without_a_state_dir_rewrites_the_helpers_in_every_namespace passes. Against the pre-fix generator it failed with 'refusing to overwrite hand-written file: MetaNetVa…/DecimalWi…'.
CHANGELOG upgrade instruction is accurate: delete the existing helper files, then regenerate ⏸️ untested no Prior run only read the CHANGELOG.md diff and checked the wording. The delete-then-regenerate steps were not executed against the product, so no live result exists.
The marker change breaks nothing else: the other C# suites still pass ✅ pass live dotnet test passes for Codegen, Cli, Render and Conformance. The updated IntegrationTests generated copies were not run, since they need Testcontainers.

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ CHANGELOG.md:25 - CHANGELOG says "Regenerate once", but that does not recover an existing deployment. A pre-fix helper on disk has no // &lt;auto-generated/&gt; marker. With no GenStateDir, CodegenRunner.WriteOne (CodegenRunner.cs:193) still logs refusing to overwrite hand-written file and keeps the stale copy. The first run after upgrading therefore changes nothing. The adopter must delete the two helper files, or add the marker by hand, before the fix takes effect. This is exactly the population the issue describes. The code fix is sound and a migration path is out of scope. Only the upgrade instruction is wrong, so reword it to say to delete DecimalWire*.g.cs and MetaNetValidation*.g.cs and then regenerate.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Emitted DecimalWire and MetaNetValidation helpers start with // <auto-generated/> on line one in every namespace ✅ pass live Shared_helpers_carry_the_generated_marker_on_their_first_line passes. It failed when run against the pre-fix generator.
A second CodegenRunner.Run with no GenStateDir overwrites a stale (hand-edited) helper in every namespace, with no 'refusing to overwrite' warning ✅ pass live Rerun_without_a_state_dir_rewrites_the_helpers_in_every_namespace passes. Against the pre-fix generator it failed with 'refusing to overwrite hand-written file: MetaNetVa…/DecimalWi…'.
CHANGELOG upgrade instruction is accurate: delete the existing helper files, then regenerate ⏸️ untested no Prior run only read the CHANGELOG.md diff and checked the wording. The delete-then-regenerate steps were not executed against the product, so no live result exists.
The marker change breaks nothing else: the other C# suites still pass ✅ pass live dotnet test passes for Codegen, Cli, Render and Conformance. The updated IntegrationTests generated copies were not run, since they need Testcontainers.
  • scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains
  • dotnet test MetaObjects.Codegen.Tests --filter DecimalWireTests (112 passed)
  • Temporarily restored the pre-fix EntityGenerator.cs and ran the two new tests: both failed, one on the missing marker and one with refusing to overwrite hand-written file. I then restored the file with git checkout.
  • dotnet test for MetaObjects.Codegen.Tests (1009 passed, 1 skipped), MetaObjects.Cli.Tests (309), MetaObjects.Render.Tests (332) and MetaObjects.Conformance.Tests (2078)
  • cd server/typescript &amp;&amp; bun test timed out before reporting, so it gave no result. The change is C#-only, and the baseline scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains had already passed.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Closes #460

@dmealing
dmealing merged commit 27c0679 into main Oct 25, 2026
1 check passed
@dmealing
dmealing deleted the fm/mo-csharp-helper-marker-460 branch October 25, 2026 19:00
dmealing added a commit that referenced this pull request Oct 26, 2026
All four registries publish 1.1.3 / 8.1.3: report list routes change served output in every
port (#465) and the C# generators change (#461). Maven stays one major ahead (npm major + 7).
Regenerates the site payload.
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.

C#: DecimalWire and MetaNetValidation helpers lack <auto-generated/>, so a runner without GenStateDir never regenerates them

1 participant