ci(build): enforce dotnet format so .editorconfig stops being aspirational (#301) - #307
Conversation
…fig-s-style-rules-are-enfor
…fig-s-style-rules-are-enfor # Conflicts: # FormCraft/Forms/Rendering/FieldRendererService.cs
…fig-s-style-rules-are-enfor
…fig-s-style-rules-are-enfor # Conflicts: # README.md
…fig-s-style-rules-are-enfor
…fig-s-style-rules-are-enfor
Merge held —
|
…fig-s-style-rules-are-enfor # Conflicts: # FormCraft/Forms/Validation/DynamicFormValidator.cs # README.md
Implements #301.
Closes #301.
Executing the implementation plan task-by-task; the checklist below — and the plan on the issue — are
ticked as each task lands. Opened as a draft — will be marked ready after the final task and a
code-review pass.
Plan
Formattarget that fails on the current tree#301's Global Constraints say to land this when few PRs are open — the formatting pass touches
~200 files and will conflict with every in-flight branch. That constraint governs merging, not
building, so this PR gets built now and the timing decision stays with whoever merges it. At the time
of writing there were 6 active branches; consider landing those first, then re-syncing this one.
The conflicts are trivial to resolve (take either side, re-run
dotnet format) but there will be alot of them.
What the implementation turned up
Three things the plan did not anticipate, all now documented in
CLAUDE.mdand the repo profile sothe next person does not rediscover them:
1.⚠️
dotnet formatwrites merge-conflict markers into multi-targeted source files. All threeshipping projects are
net8.0;net10.0, and a fix applied once per TFM can land as a literal<<<<<<< TODO: Unmerged change from project 'FormCraft(net10.0)'block inside the.csfile —code that does not compile. Hit twice here (
FieldRendererBase.cs, then two Fluent files). Verifymode never writes, so the CI gate itself is unaffected; it only bites when applying. Mitigations
now recorded: check
grep -rl '<<<<<<< TODO' --include='*.cs' .after any apply run, and scope with--include <file>when a whole-solution run misbehaves.2. One
dotnet formatrun does not always reach a fixpoint. After formatting afield-keywordproperty, verify still reported three
WHITESPACEdiagnostics on it; a second run cleared them. So"I formatted and the gate still fails" is not necessarily a gate bug.
3.
IDE0032now rewrites private backing fields into C# 14'sfieldkeyword — and silently dropsthe XML docs that lived on the field. On
MudBlazorFileUploadComponentBase.RequiredDescriptionIdthat deleted the
<remarks>explaining a real correctness invariant (#262 /CLAUDE.md: the hint idmust be unique per rendered instance, because item fields render one hint per row). The rewrite is
value-identical, so no test could have caught the loss. The explanation has been restored onto the
property, and this is called out in
CLAUDE.mdas a hunk type to read rather than skim.Sync with
devMerged
origin/dev(3 commits, including #291's 5,600-line Fluent UI parity work). Git merged itcleanly with no conflicts — but the merged code was written before this gate existed and brought
21 fresh violations, so it needed its own formatting pass (
style: format the Fluent UI code merged from dev…). That is the expected steady state for this branch until it lands: every re-sync willneed one.
Also verified while there: #291 correctly flipped
ValidateCollections="true"on the Fluentcontainer when it implemented collection rendering, which is the trap flagged on #278.
Follow-ups
Formattarget refuse a tree containing<<<<<<< TODOmarkers. Finding 1 above is asilent corruption that currently only a human notices; a two-line guard in the target would turn it
into a failed build. Out of scope here because the gate's job this PR is to verify formatting, not
to police the formatter.
EnforceCodeStyleInBuild=trueonce this gate has held for a few releases. The .editorconfig's style rules are enforced nowhere, so 574 violations have accumulated #301 rejectedit as the entry point (a hard build break until the last violation is fixed, plus an analyzer pass
on every incremental build). With the tree already clean, that objection is much weaker — it would
then cost one property and no diff.
implement-issue's Step 7 calls for acode-reviewpass over the branch. It was attempted threetimes and never returned findings, so this PR has not had one:
git checkout <ref> -- ., which reverted aformatting pass mid-flight (the hazard the skill itself documents). Stopped it, re-did the work,
committed before retrying.
Most likely environmental — a dozen agent sessions were running against this repo concurrently.
What stands in for it: a manual review of every non-mechanical hunk, which is where the three
findings above came from (the corruption, the deleted
<remarks>, the non-convergence). Theformatting churn is tool output that
./build.cmd Formatverifies in CI. But a second opinion on thehand-written delta —
build/Build.cs,ci.yml,FieldRendererBase.cs,FieldRendererService.cs,MudBlazorFileUploadComponentBase.cs,DemoComponentBase.cs— is genuinely missing, so please givethose a human read rather than assuming a bot already did.
Verification at the ready-flip
dotnet build -c Release— clean, zero warnings (TreatWarningsAsErrors).dotnet test -c Release— 1,561 passing, 1 skipped, 0 failing (158 Fluent / 864 core / 539 MudBlazor).dotnet format --verify-no-changes— clean.Run ./build.cmd Format: successfollowed byRun ./build.cmd Test: success—the new gate proven to work in CI, not just locally.
devtwice during the run (through fix(demo): guard every timed re-render against component disposal (#315) #323/test(ci): make the step guards match only the wiring they assert on (#302) #311); each sync needed its own formattingpass for the newly merged code, which is expected until this lands.