Refactor monolithic Semantics project into modular packages#63
Merged
matt-edmondson merged 243 commits intovectorsfrom May 9, 2026
Merged
Refactor monolithic Semantics project into modular packages#63matt-edmondson merged 243 commits intovectorsfrom
matt-edmondson merged 243 commits intovectorsfrom
Conversation
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.
…ests for improved clarity
…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.
Bump Polyfill from 9.18.0 to 9.22.0
--- updated-dependencies: - dependency-name: Polyfill dependency-version: 9.23.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Bump Polyfill from 9.22.0 to 9.23.0
--- 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>
Bump Polyfill from 9.23.0 to 9.24.0
--- 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>
Bump Polyfill from 9.24.0 to 10.0.0
--- 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>
Bump MSTest.Sdk from 4.1.0 to 4.2.1
--- 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>
Bump Polyfill from 10.0.0 to 10.1.1
--- 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>
Bump Polyfill from 10.1.1 to 10.3.0
--- 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>
Bump MSTest.Sdk from 4.2.1 to 4.2.2
--- 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>
Bump Polyfill from 10.3.0 to 10.4.0
--- 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>
Bump Polyfill from 10.4.0 to 10.5.0
4 tasks
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
This PR restructures the Semantics project from a single monolithic assembly into three separate, focused NuGet packages:
Semantics.Strings,Semantics.Paths, andSemantics.Quantities. This improves modularity, reduces dependencies for consumers who only need specific functionality, and establishes a cleaner architectural foundation.Key Changes
Project Structure Reorganization
.csprojfiles:Semantics.Strings.csproj,Semantics.Paths.csproj, andSemantics.Quantities.csprojSemantics.Strings/Semantics.Paths/Semantics.Quantities/AssemblyInfo.csandCompatibilitySuppressions.xmlto each packageValidation Attributes Reorganization
Semantics.Strings/Validation/Attributes/with subdirectories:Casing/- case format validators (CamelCase, PascalCase, SnakeCase, etc.)FirstClassTypes/- validators for built-in .NET typesFormat/- line count and whitespace validatorsText/- text pattern validators (regex, email, base64, etc.)Semantics.Paths/Validation/Attributes/Path/New Validation Attributes
IsKebabCaseAttribute,IsLowerCaseAttribute,IsPascalCaseAttribute,IsSnakeCaseAttribute,IsTitleCaseAttribute,IsUpperCaseAttributeHasNonWhitespaceContentAttribute,IsEmptyOrWhitespaceAttribute,IsMultiLineAttribute,IsSingleLineAttributeContainsAttribute,EndsWithAttribute,IsBase64Attribute,IsEmailAddressAttribute,PrefixAndSuffixAttribute,RegexMatchAttribute,StartsWithAttributeTest Expansion
CasingAndContractsTests.cs,CasingValidatorsTests.csFirstClassAndFormatValidatorsTests.cs,LineCountValidatorsTests.csAcousticDirectionalityIndexTests.cs,AcousticImpedanceTests.cs,AcousticOperatorTests.csNuclearQuantitiesTests.cs,PhysicalDimensionTests.cs,PhysicalQuantityCoreTests.csPaths/DirectoryNameTests.cs,Paths/PathIntegrationTests.cs,Paths/RelativePathPropertyTests.csFluentValidationAdapterTests.cs(replaced with internalValidationAdapter.cs)CI/CD Updates
.github/workflows/update-sdks.ymlfor automated SDK updates.github/workflows/dotnet.ymlwith improved build configuration.runsettingsfor coverage reportingCleanup
.cursorignoreand.cursorindexingignorefiles.gitignoreto exclude SpecStory-related filesImplementation Details
DirectoryNameprimitive typehttps://claude.ai/code/session_01HxA4AzzqEd3vdyDCFUDPSP