Skip to content

Reconcile vectors with main (two-pass merge: structural + cleanup)#64

Merged
matt-edmondson merged 245 commits intovectorsfrom
reconcile/main-into-vectors
May 9, 2026
Merged

Reconcile vectors with main (two-pass merge: structural + cleanup)#64
matt-edmondson merged 245 commits intovectorsfrom
reconcile/main-into-vectors

Conversation

@matt-edmondson
Copy link
Copy Markdown
Contributor

Summary

Reconciles the vectors branch with main's parallel evolution. This is the actual content of what PR #63 was trying to do, but resolved with a coherent strategy.

The approach was the agreed two-pass plan:

Pass 1 — structural merge (commit cff3b99)

git merge origin/main produced 212 unmerged paths. Resolved as follows:

Bucket Count Resolution
Quantities (vectors deleted, main reorganised) ~110 Take vectors. The metadata-driven generator is the intended end state; main's per-domain folder reorg of soon-to-be-deleted hand-written types is dropped.
Path types (rename/rename: Semantics.Paths/Paths/... vs Semantics.Paths/...) ~50 Take main's flat layout.
scripts/ (vectors deleted, main updated) 3 Take vectors' deletion (build moved to ktsu MSBuild SDKs).
Validation attribute reorg ~7 Take vectors.
Tests / sln / global.json / csproj ~30 Per-file judgement; details in the commit message.
Directory.Packages.props (UU) 1 Manual merge: vectors' source-generator deps + main's bumped versions / new packages (Polyfill 10.5.0, ktsu.RoundTripStringJsonConverter).
Polyfills.cs vs Utilities/NetStandard20Polyfills.cs n/a Took main's PathPolyfill pattern; deleted vectors' PathHelper.

After resolving, fixed up several files that still had embedded conflict markers from git's rename/rename detection (path types using the old PathHelper.X calls).

Pass 2 — audit and clean up (commit 20b4460)

Tracked through the substantive main changes that could have been buried by the "take vectors" rule and verified they came across:

  • RoundTripStringJsonConverter integration — verified using and [JsonConverter(...)] are in SemanticString.cs; added the missing <PackageReference Include="ktsu.RoundTripStringJsonConverter" /> to Semantics.Strings.csproj.
  • Ensure.NotNull replacement of Guard — vectors already used the same pattern; no ArgumentNullException.ThrowIfNull left in source.
  • DirectoryName type + IDirectoryName + IsDirectoryNameAttribute — all came across in the merge.
  • .NET 10 upgrade — already in vectors.
  • System.Memory 4.6.3 — already in vectors.

Then deleted 8 test files imported from main that reference quantity types vectors removed (AcousticImpedance's hand-written factories, DirectionalityIndex, ReflectionCoefficient, SoundAbsorption, BootstrapUnits, the Units enum-like accessor with IsBaseUnit() / IsSI() extensions, 1.0.Meters() extension methods, etc.). The point of those tests is fine — they should be re-added against the generated types — but that work belongs in #54.

Net diff

9bd8a9e..20b4460
- pass 1 merge:    cff3b99
- pass 2 cleanup:  20b4460

vectors (38 commits, branched at faf299fa) now sits on top of all 243 main commits. PR #63 (which was attempting the same reconciliation but with merge conflicts) becomes redundant once this lands.

Test plan

  • CI builds against the merged tree.
  • Smoke-check that the generator runs and emits the same files under Semantics.Quantities/Generated/ as on vectors.
  • Spot-check Semantics.Strings/SemanticString.cs resolves RoundTripStringJsonConverterFactory after the new package reference.
  • Confirm none of the kept test files (AcousticOperatorTests, PhysicalQuantityCoreTests, CasingValidatorsTests, FirstClassAndFormatValidatorsTests, LineCountValidatorsTests, RegexMatchAttributeTests, DirectoryNameTests, PathIntegrationTests, RelativePathPropertyTests) reference any removed types.

Follow-ups (deferred, tracked separately)

🤖 Generated by Claude Code per the locked design decisions discussed in this branch.


Generated by Claude Code

matt-edmondson and others added 30 commits August 16, 2025 17:18
This commit includes the following changes:
- Refactored project files to use the new SDK format, enhancing compatibility and maintainability.
- Updated `global.json` to reflect the latest versions of `ktsu.Sdk` and `MSTest.Sdk`.
- Removed outdated package versions from `Directory.Packages.props`, streamlining dependency management.
- Enhanced GitHub Actions workflows to allow manual triggers and improved caching for SonarQube.
- Updated unit tests to use `Assert.ThrowsExactly<TException>()` for more precise exception handling.

These modifications aim to improve project organization, ensure up-to-date dependencies, and enhance testing reliability.
This commit includes the following changes:
- Removed the `FluentValidation` dependency from various validation attributes, replacing it with a native validation approach.
- Updated validation logic to return `ValidationResult` objects for success and failure cases.
- Deleted the `FluentValidationAdapter` class and its associated tests, streamlining the validation framework.
- Adjusted multiple validation attributes to ensure they function correctly without the FluentValidation integration.

These modifications aim to simplify the validation framework and enhance maintainability by reducing external dependencies.
…on logic

This commit includes the following changes:
- Updated validation attributes to use constructor parameters for initialization, improving clarity and reducing boilerplate code.
- Refactored validation logic to return `ValidationResult` objects directly, ensuring consistent success and failure handling.
- Simplified the implementation of various validation adapters, including `ContainsValidator`, `EndsWithValidator`, and others, to streamline their functionality.

These modifications aim to improve the maintainability and readability of the validation framework.
This commit includes the following changes:
- Removed obsolete validation rules and README files related to the validation framework.
- Introduced new path-related classes, including `SemanticAbsolutePath`, `SemanticDirectoryPath`, and `SemanticFilePath`, to enhance path handling capabilities.
- Updated project files to reflect the new structure and added necessary interfaces for path validation.
- Improved organization of validation attributes by moving them to a dedicated directory for better maintainability.

These modifications aim to streamline the validation framework and enhance the overall path management functionality.
This commit introduces support for creating and manipulating semantic strings using read-only spans. Key changes include:
- Added `FromReadOnlySpan` methods in `ISemanticStringFactory` and `SemanticStringFactory` for improved performance.
- Updated `SemanticString` methods to utilize read-only spans for various operations, enhancing efficiency.
- Refactored validation attributes to ensure compatibility with new span-based methods.

These modifications aim to optimize string handling and validation processes within the framework.
This commit includes the following changes:
- Added suppression warnings for specific code analysis rules related to string handling in the project file.
- Simplified the `Remove` method in `SemanticString` by removing redundant parameter names for clarity.
- Adjusted formatting for improved readability in the `MoveNext` method.

These modifications aim to enhance code quality and maintainability within the string handling framework.
…operations

This commit updates the `SemanticString` class to improve performance by using `WeakString` for various methods that handle read-only spans. Key changes include:
- Modified `IndexOf`, `LastIndexOf`, `StartsWith`, `EndsWith`, and `Contains` methods to leverage `WeakString` instead of `AsSpan()`.
- Added conditional compilation for span support based on target frameworks.

These modifications aim to enhance efficiency in string operations while maintaining compatibility across different .NET versions.
This commit introduces a new polyfill for `ArgumentNullException.ThrowIfNull` to support older .NET versions. Additionally, it refactors the namespaces of various path-related classes and interfaces to `ktsu.Semantics.Paths` for improved organization and clarity. The changes include:

- Added `ArgumentNullExceptionPolyfill` for null argument validation.
- Updated namespaces in `SemanticAbsolutePath`, `SemanticDirectoryPath`, `SemanticFilePath`, `SemanticRelativePath`, and others to reflect the new structure.
- Adjusted method implementations in path classes to utilize the new polyfill where applicable.

These modifications aim to enhance code maintainability and ensure compatibility across different .NET versions.
…atibility

This commit adds a polyfill for `ArgumentNullException.ThrowIfNull` to support older .NET versions across various path-related classes. Key changes include:

- Integrated `ArgumentNullExceptionPolyfill` in `SemanticRelativePath`, `AbsoluteDirectoryPath`, `AbsoluteFilePath`, `DirectoryPath`, `RelativeDirectoryPath`, and `RelativeFilePath` implementations.
- Updated null checks to utilize the polyfill for compatibility with .NET versions prior to 6.0.

These modifications enhance the robustness of the path handling framework while ensuring backward compatibility.
…bility

This commit updates the `AsRelative` method in the `RelativeFilePath` class to include a conditional compilation directive that utilizes `ArgumentNullExceptionPolyfill.ThrowIfNull` for .NET versions prior to 6.0. This change ensures consistent null argument validation across different framework versions, enhancing the robustness of the path handling implementation.
…tibility

This commit introduces the `System.Memory` package for .NET Standard 2.0 support and adds several polyfills to enhance path handling across different .NET versions. Key changes include:

- Added `System.Memory` package reference in `Directory.Packages.props` and project files for .NET Standard 2.0.
- Implemented polyfills for `OperatingSystem` and `Path` methods to ensure compatibility with older .NET versions.
- Updated various path-related classes to utilize the new polyfills, improving functionality and consistency in path operations.

These modifications aim to enhance the robustness and compatibility of the path handling framework across different .NET versions.
…ation for older .NET versions

This commit updates the `AbsoluteDirectoryPath`, `DirectoryPath`, and `RelativeDirectoryPath` classes to include synchronous `GetContents` methods for compatibility with .NET versions prior to 2.1. The changes ensure that directory contents can be enumerated synchronously when asynchronous methods are not available, enhancing the framework's robustness across different .NET versions. Additionally, minor adjustments were made to the `PooledStringBuilder` class for consistency in handling directory separators.
This commit makes minor formatting adjustments across several files to enhance code clarity. Changes include removing unnecessary blank lines and aligning code indentation for conditional compilation directives. These modifications aim to improve the overall maintainability of the path handling framework while ensuring consistent coding standards.
… clarity

This commit updates the `SemanticDirectoryPath` class to rename the `Contents` property to `GetContents` for improved clarity. The method now consistently handles directory content retrieval, including error handling for access and existence checks. Additionally, the `GetContents` method is implemented synchronously across relevant directory path classes, ensuring compatibility with older .NET versions. Unused asynchronous method signatures have been removed from the `IDirectoryPath` interface to streamline the API.
…ysical dimensions and update test classes to static for consistency. This improves clarity and aligns with coding standards across the project.
…bute, and StartsWithAttribute classes

This commit updates the validation logic in the `ContainsAttribute`, `EndsWithAttribute`, and `StartsWithAttribute` classes to return more informative error messages when the input value is null or empty. Instead of returning a success result, the validation now clearly indicates the expected substring, suffix, or prefix that must be present in the value, improving user feedback and clarity in validation errors.
This commit deletes several outdated files, including the derived cursor rules, .gitignore, and various history documents, to streamline the project and remove unnecessary clutter. The removal of these files helps maintain a cleaner codebase and improves overall project organization.
…hod naming and enhance error handling. The `Contents` property has been renamed to `GetContents` for clarity, and synchronous handling has been implemented to ensure compatibility with older .NET versions.
… improved performance and reliability. This change ensures that the regex operation does not hang indefinitely by setting a one-second timeout, enhancing the overall validation process.
This commit introduces two new test classes: `CasingAndContractsTests` and `RegexMatchAttributeTests`. The `CasingAndContractsTests` class validates camel case, pascal case, boolean, and contract strings, ensuring correct behavior for valid and invalid inputs. The `RegexMatchAttributeTests` class tests regex patterns for various string types, including handling invalid patterns and validating case insensitivity and multiline anchors. These additions enhance the test coverage for string semantics and validation logic.
This commit introduces two new test classes: `CasingValidatorsTests` and `LineCountValidatorsTests`. The `CasingValidatorsTests` class validates various casing formats, including upper case, lower case, title case, sentence case, snake case, kebab case, and macro case, ensuring correct behavior for valid and invalid inputs. The `LineCountValidatorsTests` class checks for exact, minimum, and maximum line counts in strings, enhancing the test coverage for string semantics and validation logic.
This commit introduces a new test class, `FirstClassAndFormatValidatorsTests`, which includes unit tests for multiple validators such as `IsDateTime`, `IsDecimal`, `IsDouble`, `IsGuid`, `IsInt32`, `IsIpAddress`, `IsTimeSpan`, `IsUri`, `IsVersion`, `HasNonWhitespaceContent`, `IsEmptyOrWhitespace`, `IsSingleLine`, and `IsMultiLine`. Each validator is tested for valid, invalid, and empty inputs, enhancing the test coverage for string semantics and validation logic.
This commit updates the Exposure class to use CoulombPerKilogram instead of Coulomb for exposure calculations. Additionally, new unit tests have been added for various nuclear quantities, including AbsorbedDose and EquivalentDose, to ensure correct conversions and calculations. The test suite now includes comprehensive checks for exposure-related functionalities, enhancing overall test coverage.
This commit adds the installation of the `dotnet-coverage` tool in the GitHub Actions workflow to facilitate code coverage collection during tests. It also updates the SonarQube scanner commands to improve coverage reporting and modifies the `Invoke-DotNetTest` function to utilize the new coverage tool. Additionally, the test project configuration is updated to show test failures and details, enhancing the overall testing and reporting capabilities.
Github Actions and others added 27 commits April 2, 2026 23:10
---
updated-dependencies:
- dependency-name: Polyfill
  dependency-version: 9.24.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: Polyfill
  dependency-version: 10.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: MSTest.Sdk
  dependency-version: 4.2.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: Polyfill
  dependency-version: 10.1.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: Polyfill
  dependency-version: 10.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: MSTest.Sdk
  dependency-version: 4.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: Polyfill
  dependency-version: 10.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
---
updated-dependencies:
- dependency-name: Polyfill
  dependency-version: 10.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Reconcile vectors with main's parallel evolution. Resolution rules:

- Quantities: take vectors. dimensions.json + source generator is the
  intended end state; main's per-domain folder reorg of soon-to-be-deleted
  hand-written types is dropped (110 conflicts).
- Path types: take main's flat layout (Semantics.Paths/{Implementations,
  Interfaces,Primitives}/...) instead of vectors' doubled
  Semantics.Paths/Paths/... (~50 conflicts via rename/rename).
- Path utility: take main's conditional-compilation PathPolyfill pattern;
  drop vectors' PathHelper duplicate (Utilities/NetStandard20Polyfills.cs).
- Validation: take vectors' attribute-per-file reorganisation under
  Semantics.Strings/Validation/Attributes/{Casing,Format,FirstClassTypes,
  Text}/ and Semantics.Paths/Validation/Attributes/Path/.
- scripts/: take vectors' deletion (build moved to ktsu MSBuild SDKs).
- Tests: take vectors where it adds coverage; take main where it improved
  assertion messages (PathUtilityTests).
- Solution: take vectors (only it includes Semantics.SourceGenerators).
- csproj files: take vectors (reflect new package layout, including
  InternalsVisibleTo and Microsoft.Bcl.AsyncInterfaces conditional refs).
- Directory.Packages.props: merge — keep vectors' source-generator deps
  (CodeBlocker, Microsoft.CodeAnalysis.*, System.Text.Json, PreciseNumber,
  Microsoft.Bcl.AsyncInterfaces) plus main's bumped versions
  (Polyfill 10.5.0) and added packages (ktsu.RoundTripStringJsonConverter).
- global.json: take main's MSTest.Sdk 4.2.2.

This is pass 1 of the two-pass reconciliation. Pass 2 audits the
substantive main commits (RoundTripStringJsonConverter integration,
Ensure.NotNull replacement of Guard, DirectoryName type, .NET 10 / SDK
adjustments) to ensure their content is applied where the resolution
rules took vectors' file.
…types

The structural merge brought in test files from main that reference
hand-written quantity classes which vectors deleted in favour of generated
types. Remove them so the tree compiles; equivalent coverage against
generated types is tracked in issue #54.

Removed:
- AcousticImpedanceTests.cs (FromRayls / FromPascalSecondsPerMeter / etc.
  not emitted by QuantitiesGenerator; per #48 only the SI base-unit factory
  is generated).
- AcousticDirectionalityIndexTests.cs (DirectionalityIndex type was
  hand-written; not in dimensions.json).
- ReflectionCoefficientTests.cs (ReflectionCoefficient and SoundAbsorption
  were hand-written; not in dimensions.json).
- SoundSpeedTests.cs (FromFeetPerSecond not emitted; static Multiply method
  not generated).
- NuclearQuantitiesTests.cs (FromGrays / FromMicrograys / FromRads /
  FromEnergyAndMass / FromMicrosieverts / Energy.FromJoules — none of these
  factory names are emitted).
- PhysicalDimensionTests.cs (uses BootstrapUnits.Meter and the old
  PhysicalDimension(baseUnit:, length:, time:) constructor; both removed).
- PhysicalDimensionExtensionsTests.cs (uses 1.0.Meters() / 1.0.Kilograms()
  extension methods that don't exist in the generator output).
- UnitExtensionsAndExceptionTests.cs (uses Units.Meter as an enum-like value
  with IsBaseUnit / IsSI / IsMetric / IsImperial extensions; vectors emits
  Units as a namespace of per-unit structs).

Also add ktsu.RoundTripStringJsonConverter PackageReference to
Semantics.Strings.csproj so SemanticString.cs's
[JsonConverter(typeof(RoundTripStringJsonConverterFactory))] resolves.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
0.0% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@matt-edmondson matt-edmondson merged commit cce26b5 into vectors May 9, 2026
4 of 5 checks passed
@matt-edmondson matt-edmondson deleted the reconcile/main-into-vectors branch May 9, 2026 10:50
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.

2 participants