Conversation
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Closed
There was a problem hiding this comment.
Pull request overview
This PR implements a comprehensive serializable metadata system for the Light.Results library. The implementation adds strongly-typed, JSON-compatible metadata support to Result and Error types, with efficient value types, pooled builders, and recursive merge capabilities.
Key Changes:
- Core metadata types (MetadataValue, MetadataObject, MetadataArray) using discriminated unions and value semantics
- ArrayPool-based builders for efficient construction with automatic cleanup
- Metadata integration into Result and Error with merge operations and strategies
- Comprehensive test suite and performance benchmarks comparing against Dictionary<string, object?>
Reviewed changes
Copilot reviewed 67 out of 76 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Light.Results/Metadata/MetadataValue.cs | Discriminated union value type supporting null, bool, int64, double, string, array, and object with NaN/Infinity rejection |
| src/Light.Results/Metadata/MetadataPayload.cs | Explicit-layout union struct for memory-efficient storage of primitives and references |
| src/Light.Results/Metadata/MetadataObject.cs | Immutable dictionary-like struct with sorted keys and lazy indexing for objects >8 entries |
| src/Light.Results/Metadata/MetadataArray.cs | Immutable array wrapper providing span access and efficient iteration |
| src/Light.Results/Metadata/MetadataObjectBuilder.cs | Pooled builder with binary search insertion maintaining sorted order |
| src/Light.Results/Metadata/MetadataArrayBuilder.cs | Pooled builder for array construction with span-based APIs |
| src/Light.Results/Metadata/MetadataObjectExtensions.cs | Merge operations with recursive object merging and configurable strategies |
| src/Light.Results/Result.cs | Adds metadata field, WithMetadata/MergeMetadata methods, metadata propagation in Map/Bind |
| src/Light.Results/Error.cs | Replaces Meta dictionary with MetadataObject, adds WithMetadata helpers |
| src/Light.Results/Errors.cs | Extracted from Result.cs to separate file |
| src/Light.Results/Unit.cs | Void-like value type for non-generic Result |
| tests/* | Comprehensive test coverage for all metadata types, builders, and integrations |
| benchmarks/* | Performance benchmarks comparing against Dictionary with generated results |
| .github/workflows/build-and-test.yml | CI/CD workflow for building, testing, and code coverage |
| global.json | Specifies .NET SDK 10.0.101 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
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.
What was implemented in this PR:
Deviations / still-open items: