feat(generator): SEM002 metadata validation + refresh stale generator output#70
Merged
matt-edmondson merged 1 commit intovectorsfrom May 9, 2026
Merged
Conversation
…tor output - Adds DimensionsMetadata.Validate() and a SEM002 Roslyn diagnostic so malformed entries in dimensions.json (missing name/symbol, empty availableUnits, duplicate type names, no vector forms declared) surface in the build log instead of crashing the emit pass or dropping output silently. Pairs with the existing SEM001 (closes #60). - Adds AnalyzerReleases.Shipped/Unshipped.md so SEM001/SEM002 satisfy RS2008 analyzer release tracking; the generator project now builds clean. - Re-runs QuantitiesGenerator to refresh 132 committed .g.cs files that were stale relative to the V0 non-negativity / absolute V0-V0 subtraction work merged in #66/#68. Diff is purely the documented #50/#52 changes (Vector0Guards.EnsureNonNegative in factories; same-type T.Abs subtraction replacing the old V1-typed result). - CLAUDE.md: corrects the V0 invariant entry (constraints are enforced structurally, not yet declared in metadata), fixes the PhysicalConstants surface to match what's actually emitted (no Conversion sub-class), and lists the SEM00x diagnostics.
This was referenced May 9, 2026
Open
|
Merged
3 tasks
matt-edmondson
pushed a commit
that referenced
this pull request
May 9, 2026
…tories with SEM002 + AnalyzerReleases #70 merged into vectors while this branch was up, so re-merging brought in: - The SEM002 dimensions.json schema validation diagnostic and its invocation at the top of QuantitiesGenerator.Generate / GenerateInner. - AnalyzerReleases.Shipped.md / Unshipped.md tracking files (RS2008). - The CLAUDE.md tweaks for the V0 invariant and PhysicalConstants surface. - A regenerated Generated/ tree. Conflicts and resolutions: 1. QuantitiesGenerator.cs: SEM002 metadata.Validate() + ReportDiagnostic loop runs first, then BuildUnitMap(units) builds the unit lookup that AddUnitFactories needs for #48. Both belong; combined. 2. AnalyzerReleases.Unshipped.md: kept both SEM001 (this branch) and SEM002 (from #70) entries. 3. Semantics.Quantities/Generated/*.g.cs (~130 files): both branches regenerated. Discarded the merge attempt and re-ran the generator from scratch. Spot-checked Length: multi-unit factories (FromMeter/FromKilometer/FromCentimeter/FromFoot/FromInch/FromMile) each wrap their conversion in Vector0Guards.EnsureNonNegative, and the V0-V0 absolute subtraction operator (Length<T> operator -(Length<T>, Length<T>) => Create(T.Abs(...))) is intact. Source generator builds clean (0 warnings, 0 errors); generator runs clean against current dimensions.json (no SEM001 / SEM002 diagnostics).
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
Continues the vectors-branch cleanup. Pulls in three things:
dimensions.json. AddsDimensionsMetadata.Validate()and a new Roslyn diagnosticSEM002so malformed metadata (missingname/symbol, emptyavailableUnits, duplicate type names, no vector forms declared) is reported in the build log instead of crashing mid-emit or silently dropping output. Pairs with the existingSEM001from feat(generator): emit SEM001 diagnostic for unknown dimension references #65.AnalyzerReleases.Shipped.md/AnalyzerReleases.Unshipped.mdsoSEM001/SEM002satisfyRS2008analyzer release tracking. The source-generator project now builds clean.*.g.csfiles underSemantics.Quantities/Generated/were not re-emitted after the V0 non-negativity / absolute V0–V0 subtraction work landed in test: cover IVector*/Magnitude/Dot/Cross and semantic overload conversions #66/feat(quantities): enforce V0 non-negativity and absolute V0-V0 subtraction (closes #50, #52) #68. Re-running the generator updates each Vector0 type'sFrom{Unit}factory to callVector0Guards.EnsureNonNegativeand replaces the V1-typed subtraction operator with the documented same-typeT.Abs(a − b). Per CLAUDE.md generator output is committed source, so this needed to be in-tree.Vector0Guards) and thePhysicalConstantsexample matches the real generated surface (noConversionsub-class). Adds a SEM00x diagnostics list to the generator workflow section.Status of the rest of the open issues on the branch is summarised in follow-up comments on each issue.
Test plan
dotnet build Semantics.SourceGenerators— cleandotnet build Semantics.Quantities— generator runs cleanly, noSEM001/SEM002warnings against the currentdimensions.json, and the only diff against the committedGenerated/tree is the documented Vector0 quantities do not enforce the non-negativity invariant #50/Resolve open design decision for Vector0 subtraction #52 update.dotnet test—Semantics.Testcannot restore in this sandbox (Microsoft.NETCore.App.Host.ubuntu.24.04-x64is not in the configured feeds); existingVector0InvariantTestsalready cover the regenerated factory and operator behaviour.https://claude.ai/code/session_01Tj63Rddvs9frqLUgsjNEP5
Generated by Claude Code