chore: apply dotnet format baseline and add CI gate - #230
Merged
PatrickRitchie merged 2 commits intoAug 21, 2026
Conversation
This was referenced Aug 18, 2026
ottobolyos
added a commit
to ottobolyos/mtconnect.net
that referenced
this pull request
Aug 19, 2026
ottobolyos
added a commit
to ottobolyos/mtconnect.net
that referenced
this pull request
Aug 19, 2026
ottobolyos
added a commit
to ottobolyos/mtconnect.net
that referenced
this pull request
Aug 19, 2026
ottobolyos
force-pushed
the
chore/format-baseline
branch
2 times, most recently
from
August 21, 2026 08:34
a0e97ef to
fc32833
Compare
ottobolyos
marked this pull request as ready for review
August 21, 2026 08:41
Contributor
Author
|
@PatrickRitchie — #219 merged, promoting #230 as new queue head. Cycles ≥2 clean; CI green; ready for your review. |
ottobolyos
marked this pull request as draft
August 21, 2026 11:42
Address cycle-1 ultrareview HIGH + MEDIUM findings on the format gate: - Extend the format gate to cover the two csprojs that ship with the `dotnet new mtconnect.net-agent` template but are not members of `MTConnect.NET.sln`. Both are public-surface artifacts for downstream template consumers, so drift there is exactly the class of regression the gate exists to catch. - Set `--verbosity diagnostic` on both verify steps so CI failure logs name each offending file and rule directly, letting a contributor reproduce and fix locally without further tooling. - Correct the workflow's leading comment: the repo does not ship a root `.editorconfig`, so the gate relies on `dotnet format`'s SDK defaults; document that reality and flag `.editorconfig` + `global.json` freezing as a follow-up. - Add a `Job 0 — format` subsection to `docs/testing/workflows.md` cataloging the new gate, its scope, its `--severity warn` rationale, and its local-reproduction command. - Add a `Contributing — running the formatting gate locally` block to `README.md` pointing at the same commands the CI job runs. Whitespace baseline (`dotnet format MTConnect.NET.sln`) is unchanged.
Cycle-2 ultrareview follow-ups.
- `build/MTConnect.NET-DocsGen/RouteInventory.cs`: refactor
`CeenHandlerParameters` so `dotnet format` produces idempotent
output. The prior shape was a `new Dictionary<K, V> { [key] = new
EndpointParam[] { ... } }` object initializer with an inline nested
array initializer per key; `dotnet format` deepened the outer
dictionary + its keys by four spaces to match the collection-init
depth but left every inner `new EndpointParam[] { ... }` block at
the old outer depth, producing a visible misalignment cascade (dict
key at column 12, its `{` block at column 8). Hoist each
handler's parameter list into a dedicated `private static readonly
EndpointParam[]` field and reference the fields from the dictionary
literal — flat depth on both layers keeps `dotnet format` a
no-op on the file.
- `CONTRIBUTING.md`: new file, so GitHub's contributor-guidelines
banner surfaces on new-PR / new-issue forms. Carries the
formatting-gate local-reproduction block, the template-project
variants, and the `tools/test.sh` / `tools/test.ps1` pointers.
- `README.md`: collapse the inline Contributing subsection to a
short pointer at `CONTRIBUTING.md` so the two surfaces do not
drift out of sync.
- `.github/workflows/dotnet.yml`: split the two combined template
restore + format steps into four per-project steps so a failure
names the specific template in the Actions step-summary panel.
- `docs/testing/workflows.md`: en-dash the numeric range in the
`### Jobs 1–4` heading (was an ASCII hyphen).
ottobolyos
force-pushed
the
chore/format-baseline
branch
from
August 21, 2026 11:54
fc32833 to
bb41a02
Compare
ottobolyos
marked this pull request as ready for review
August 21, 2026 11:57
ottobolyos
added a commit
to ottobolyos/mtconnect.net
that referenced
this pull request
Aug 21, 2026
ottobolyos
added a commit
to ottobolyos/mtconnect.net
that referenced
this pull request
Aug 21, 2026
ottobolyos
added a commit
to ottobolyos/mtconnect.net
that referenced
this pull request
Aug 21, 2026
PatrickRitchie
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dotnet format MTConnect.NET.sln --verify-no-changescurrently fails againstmaster, with formatting drift (mostly tab/space indentation) spread across 61 files, concentrated inMTConnect.NET-Common,MTConnect.NET-HTTPand thebuild/tooling projects. Appliesdotnet formatonce to bring the tree back to zero-diff againstdotnet format's SDK-default formatting rules. The repo does not yet ship a root.editorconfig, so the enforced ruleset is whatever the SDK pinned byactions/setup-dotnettreats as its whitespace / C# formatting defaults; committing a root.editorconfig(plus aglobal.jsonSDK pin) to freeze the rules against future SDK drift is a tracked follow-up (see below).formatjob to.github/workflows/dotnet.ymlthat runsdotnet format MTConnect.NET.sln --verify-no-changes --verbosity diagnosticon every push tomasterand every non-draft pull request targeting it, so this drift cannot silently reaccumulate. The--verbosity diagnosticflag names each offending file and rule directly in the CI log when the gate fires, so a contributor can reproduce and fix locally without further tooling.dotnet new mtconnect.net-agenttemplate but are not members ofMTConnect.NET.sln; both are public-surface artifacts for downstream template consumers, so their formatting is user-facing and belongs under the same gate.build/MTConnect.NET-DocsGen/RouteInventory.cs::CeenHandlerParametersto hoist each handler'sEndpointParam[]into a dedicatedprivate static readonlyfield. The prior shape (an inlinenew EndpointParam[] { ... }nested inside a dictionary object initializer) trippeddotnet formatinto a non-idempotent indent cascade — the outer dictionary keys deepened by four spaces while the inner block stayed at the old depth. Hoisting the arrays flattens both layers to the same indent depth and keepsdotnet formata no-op on the file.docs/testing/workflows.md(steps,--severity warnrationale, local-reproduction command), and adds a top-levelCONTRIBUTING.mdso GitHub's contributor-guidelines banner surfaces the formatting + test invocations on new-PR / new-issue forms.dotnet buildsucceeds cleanly on the formatted tree; the whole-tree diff is whitespace / indentation only apart from the oneRouteInventory.csrefactor above (verified by comparing whitespace-stripped diff lines on every other touched file).Scope note on
--severitydotnet formatwith no--severityflag defaults towarn, which covers whitespace and style diagnostics — that is what was applied here and what the new CI job checks.--severity infoadditionally attempts to auto-fix long-standing Roslyn analyzer diagnostics (CA1859,CA1861,CA1018, etc.) across the whole repository; on the SDK used to prepare this branch that full-tree run terminates withNotSupportedException: Changing document properties is not supportedbefore completing. Analyzer-diagnostic cleanup is a materially different, larger piece of work from formatting drift, so it is deliberately left out of scope here; the CI gate mirrors the same default severity.Follow-ups (not in this PR)
.editorconfig+global.jsonSDK pin: the gate currently relies ondotnet format's SDK-default ruleset. Committing a root.editorconfigthat freezes the enforced rules, plus aglobal.jsonthat pins the SDK, would insulate the gate from future .NET 8 / 9 patch releases that shift a formatting default and silently re-fire the gate on unchanged code.formatjob needs to be added to the branch-protection required-status-check list formaster. I don't have branch-protection edit rights, so a maintainer will need to enable it after this merges.lefthook,husky, orpre-committooling installed, so a hook that runsdotnet formaton staged files before commit is left as a follow-up rather than bundled here (adding a hook framework is a separate, more invasive change deserving its own PR and review).concurrencyblock: broader CI-hygiene wins that would speed the format job (and every other job) up on cache-hit and cancel superseded runs on the same PR. Scoped to a dedicated CI-hygiene PR rather than folded into this format-baseline change.Dime review cycle 1
code-review.editorconfigvs PR-body claim), 1 LOW (out-of-sln template csprojs)8c542429— workflow comment now reflects SDK-default ruleset; template csprojs added to gate scope.security-auditsimplificationimprovement--verbosity diagnostic; missing.editorconfig), 3 LOW (README pointer; NuGet cache; workflow-levelconcurrency)--verbosity diagnosticapplied; README +CONTRIBUTING.mdpointers added)..editorconfigand CI-hygiene items TRACKED as follow-ups above.documentation-auditdocs/testing/workflows.mdmissing format-job entry), 1 MEDIUM (nodotnet formatguidance for developers)### Job 0 — formatsubsection added; README +CONTRIBUTING.mdguidance added.test-coverage-auditDime review cycle 2
code-review### Jobs 1-4heading)d7353b7b— en-dash applied.security-auditsimplificationimprovementRouteInventory.csindent cascade baked in by the format run), 2 LOW (missingCONTRIBUTING.md; template steps grouped into tworun:blocks)CeenHandlerParametersrefactored to hoist parameter arrays into named fields (dotnet formatnow idempotent on the file);CONTRIBUTING.mdadded; template steps split into four per-project named steps for CI-log granularity.documentation-audit.editorconfigclaim contradicted by the new docs)test-coverage-auditDime review cycle 3
Retro-fresh cycle at the current tip
bb41a02a(wasfc328332at cycles 1-2), triggered by the merge-train position-discipline rule requiring dime cycles at the current head, not at an earliercompleted_head_sha.code-reviewartefact/artefactsin.github/workflows/dotnet.ymlcomment block;artefacts/cataloguingin the earlier commit's message body)549b3dd9→4164ba1e) — American English mandate on committed content overrides the LOW ceiling; workflow comment lines 50, 79 now useartifact/artifacts; commit body now usesartifacts/cataloging. Pre-existing BrE on workflow lines 461, 543 stays untouched (already onmaster, out of this PR's diff scope).security-auditsimplificationREADME.mdContributing block still lists commands rather than pointer-only toCONTRIBUTING.md; four per-template restore + verify steps could collapse to two per-template combined steps)CONTRIBUTING.md; separate restore + verify steps let Actions surface per-phase timing in the step-summary panel, keeping diagnostic value. Both are proposals with the reviewer's own false-positive defence covering the current shape.improvementtimeout-minuteson the new format job / any workflow job; workflow-levelconcurrencyblock deferred), 2 LOW (fetch-depth: 1pin onactions/checkout;_ceenSummaryCacheasConcurrentDictionaryfor future concurrent callers)timeout-minutesand workflow-levelconcurrencyboth belong in the deferred CI-hygiene follow-up PR listed under "Follow-ups (not in this PR)" above (alongside NuGet cache), not folded into this format-baseline scope.fetch-depth: 1matches the currentactions/checkout@v4default (no behavioural change)._ceenSummaryCacheis only ever populated from single-threadedDocsGeninvocations; the race is theoretical.documentation-audittest-coverage-auditRouteInventory.csrefactor is behaviour-preserving; the byte-exactdocs/reference/http-api.mdassertion inDocsReferenceGenerationTests.HttpApi_Page_Is_In_Sync_With_Sourcetransitively pins every hoistedEndpointParam[]field's content — any drift would fail the assertion.Dime review cycle 4
Delta-only cycle at tip
bb41a02averifying the cycle-3 rebase-rewrite: 4 word-swaps in comments and a commit body, second commit rebased on top. No behavioural, logical, or algorithmic change; second commit content byte-identical to its cycle-3 form.code-review%G? = G. No new leaks.security-auditrun:/env:/${{ }}/ref:surface change; no secrets introduced.simplificationimprovementdocumentation-audittest-coverage-audit(Zero unfixed findings — Ready-eligible.)