Skip to content

Feature/implement data related logic for ranges#2

Merged
blaze6950 merged 32 commits intomainfrom
feature/implement-data-related-logic-for-ranges
Feb 3, 2026
Merged

Feature/implement data related logic for ranges#2
blaze6950 merged 32 commits intomainfrom
feature/implement-data-related-logic-for-ranges

Conversation

@blaze6950
Copy link
Owner

This pull request introduces significant improvements to the RangeData extensions, focusing on two main areas: centralized domain validation and consistent right-biased semantics for set operations. The changes enhance maintainability, correctness, and predictability of the API, while also updating documentation and project configuration to support these improvements.

Centralized domain validation and consistent right-bias:

  • Added a private static, aggressively inlined ValidateDomainEquality method to centralize and standardize runtime domain validation across all RangeData extension methods, eliminating duplicate checks and ensuring correct behavior when domains have instance-specific state.
  • Refactored all relevant extension methods (such as Intersect, Union, IsTouching, etc.) to use the centralized validation method, reducing code duplication and making error messages consistent and clear.

Set operation semantics and documentation:

  • Updated both Intersect and Union methods to consistently use right-biased semantics, meaning the right operand's (typically fresher) data is always preferred in overlaps, aligning with real-world scenarios like cache updates and time-series data.
  • Improved and expanded documentation for all affected methods, including rationale, migration guidance for the breaking change, and real-world usage examples to clarify the right-bias principle. [1] [2]

Project and CI/CD configuration:

  • Added a new GitHub Actions workflow (.github/workflows/intervals-net-data.yml) for CI/CD of the Intervals.NET.Data package, including build, test, and NuGet publishing steps.
  • Updated the solution file (Intervals.NET.sln) to include the new Data projects and benchmarks, ensuring they are built and tested as part of the solution. [1] [2] [3] [4] [5]

Supporting materials:

  • Added detailed markdown documentation files explaining the rationale, design patterns, testing considerations, and migration strategies for both the centralized validation and right-bias changes. [1] [2]

These changes collectively make the RangeData extensions more robust, maintainable, and intuitive for end-users.

Mykyta Zotov added 6 commits January 31, 2026 01:25
…factory methods for consistency

- Introduced RangeData abstraction to couple logical ranges with data sequences and domains.
- Updated RangeFactory methods to remove type parameters for cleaner usage.
- Added TryCreate method for Range with validation and error messaging.
- Enhanced Distance method in domain interfaces to ensure accurate step calculations.
- Revised tests to reflect changes in range factory methods and ensure correctness.
- Updated project metadata and CI/CD configurations for new data module.
@blaze6950 blaze6950 self-assigned this Jan 31, 2026
Copilot AI review requested due to automatic review settings January 31, 2026 01:51
@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 83.55556% with 37 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...tervals.NET.Data/Extensions/RangeDataExtensions.cs 80.15% 17 Missing and 8 partials ⚠️
src/Intervals.NET.Data/RangeData.cs 87.83% 5 Missing and 4 partials ⚠️
src/Intervals.NET/Range.cs 78.57% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces the new Intervals.NET.Data package (RangeData + extensions) and updates domains/range APIs to support centralized validation and consistent right-biased semantics, alongside CI/test/benchmark/docs updates.

Changes:

  • Added Intervals.NET.Data (RangeData core type, extension methods, enumerable helpers) plus a new test project and benchmarks.
  • Refactored range/domain APIs (e.g., centralized range-bound validation; domain Distance standardized to long) and updated affected tests.
  • Added CI workflow and expanded documentation/bench artifacts for RangeData and right-biased semantics.

Reviewed changes

Copilot reviewed 48 out of 49 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
tests/Intervals.NET.Tests/RangeStringParserTests.cs Simplifies CultureInfo usage in parsing tests.
tests/Intervals.NET.Tests/RangeFactoryTests.cs Updates factory calls to rely on type inference.
tests/Intervals.NET.Tests/RangeFactoryInterpolationTests.cs Updates factory calls to rely on type inference.
tests/Intervals.NET.Tests/RangeExtensionsTests.cs Updates factory calls to rely on type inference.
tests/Intervals.NET.Tests/Intervals.NET.Tests.csproj Adds reference to new Data project.
tests/Intervals.NET.Domain.Extensions.Tests/Variable/RangeDomainExtensionsTests.cs Updates factory calls to rely on type inference.
tests/Intervals.NET.Domain.Extensions.Tests/Fixed/RangeDomainExtensionsTests.cs Updates factory calls to rely on type inference.
tests/Intervals.NET.Domain.Default.Tests/Calendar/StandardDateTimeBusinessDaysVariableStepDomainTests.cs Fixes namespace and uses fully-qualified DateTime.
tests/Intervals.NET.Data/Extensions/RangeDataExtensionsTests.cs (Referenced in PR) Data-related tests under tests/Intervals.NET.Data.
tests/Intervals.NET.Data.Tests/RangeDataTests.cs Adds comprehensive unit tests for RangeData slicing/indexing.
tests/Intervals.NET.Data.Tests/Intervals.NET.Data.Tests.csproj New test project for Intervals.NET.Data.
tests/Intervals.NET.Data.Tests/Helpers/TestDomains.cs Adds stub domains for domain-equality and overflow testing.
tests/Intervals.NET.Data.Tests/Extensions/RangeData_EqualityAndSliceTests.cs Tests equality semantics and slicing behavior.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_TrimOverflowTests.cs Tests trim overflow guard behavior.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_IsValidEdgeTests.cs Adds edge-case validation tests for IsValid.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_DomainValidationTests.cs Tests domain equality validation behavior in extensions.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensions_AdjacencyAndValidityTests.cs Tests adjacency helpers and sequence-length validation.
tests/Intervals.NET.Data.Tests/Extensions/RangeDataExtensionsTests.cs Adds tests for RangeData set operations + trims + containment.
src/Intervals.NET/Range.cs Centralizes range bound validation and exposes IsValid.
src/Intervals.NET/Intervals.NET.csproj Bumps Intervals.NET package version.
src/Intervals.NET/Factories/RangeFactory.cs Adds TryCreate factory to avoid throwing for invalid bounds.
src/Intervals.NET.Data/RangeData.cs Adds core RangeData type with indexers/slicing/equality semantics.
src/Intervals.NET.Data/Intervals.NET.Data.csproj New Data package project metadata + references.
src/Intervals.NET.Data/Extensions/RangeDataExtensions.cs Adds right-biased union/intersect + trimming/relationship/validation helpers.
src/Intervals.NET.Data/Extensions/EnumerableExtensions.cs Adds ToRangeData helper for IEnumerable<T>.
src/Domain/Intervals.NET.Domain.Extensions/Intervals.NET.Domain.Extensions.csproj Bumps Domain.Extensions package version.
src/Domain/Intervals.NET.Domain.Default/Intervals.NET.Domain.Default.csproj Bumps Domain.Default package version.
src/Domain/Intervals.NET.Domain.Abstractions/Intervals.NET.Domain.Abstractions.csproj Bumps Domain.Abstractions package version.
src/Domain/Intervals.NET.Domain.Abstractions/IVariableStepDomain.cs Simplifies interface (inherits IRangeDomain<T> only).
src/Domain/Intervals.NET.Domain.Abstractions/IRangeDomain.cs Adds Distance(T,T) returning long.
src/Domain/Intervals.NET.Domain.Abstractions/IFixedStepDomain.cs Simplifies interface (inherits IRangeDomain<T> only).
src/Domain/Intervals.NET.Domain.Default/Calendar/StandardDateTimeBusinessDaysVariableStepDomain.cs Changes Distance return type to long.
src/Domain/Intervals.NET.Domain.Default/Calendar/StandardDateOnlyBusinessDaysVariableStepDomain.cs Changes Distance return type to long.
benchmarks/Results/Intervals.NET.Benchmarks.Benchmarks.RangeDataExtensionsBenchmarks-report-github.md Adds RangeData extensions benchmark report.
benchmarks/Results/Intervals.NET.Benchmarks.Benchmarks.RangeDataBenchmarks-report-github.md Adds RangeData benchmark report.
benchmarks/Intervals.NET.Benchmarks/Intervals.NET.Benchmarks.csproj Adds reference to Data project.
benchmarks/Intervals.NET.Benchmarks/Benchmarks/RangeDataExtensionsBenchmarks.cs Adds benchmarks for RangeData extensions.
benchmarks/Intervals.NET.Benchmarks/Benchmarks/RangeDataBenchmarks.cs Adds benchmarks for RangeData core operations.
benchmarks/Intervals.NET.Benchmarks/Benchmarks/DomainOperationsBenchmarks.cs Removes unused domain abstractions import.
benchmarks/Intervals.NET.Benchmarks/Benchmarks/ConstructionBenchmarks.cs Updates range factory calls to rely on type inference.
README.md Adds RangeData documentation section + TOC update.
RANGEDATA_ZERO_ALLOCATION_OPTIMIZATION.md Adds supporting design/optimization notes for RangeData union.
RANGEDATA_UNION_FINAL_OPTIMIZED.md Adds supporting design/optimization notes for RangeData union.
RANGEDATA_EXTENSIONS_IMPLEMENTATION.md Adds implementation write-up for RangeData extensions.
RANGEDATA_EXTENSIONS_CORRECTED.md Adds corrected behavior/invariant documentation.
RANGEDATA_CONSISTENT_RIGHT_BIAS.md Adds rationale/docs for consistent right-bias semantics.
RANGEDATA_CENTRALIZED_VALIDATION.md Adds rationale/docs for centralized domain validation.
Intervals.NET.sln Adds Data projects/tests/benchmarks + workflow + benchmark reports to solution.
.github/workflows/intervals-net-data.yml Adds CI/CD workflow for Intervals.NET.Data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Mykyta Zotov added 5 commits January 31, 2026 02:59
…validation and improved error handling

- Refine RangeData indexer to validate sub-range finiteness and containment, throwing specific exceptions for invalid cases
- Update TryGet methods to ensure points and sub-ranges are within bounds before accessing data
- Align index calculations with range inclusivity for accurate data mapping
- Improve XML documentation for IRangeDomain to clarify complexity of Distance implementations
- Update benchmarks and tests for readonly domain fields and minor cleanup
- Clarify package description and README section for RangeData usage and validation
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 52 out of 54 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 52 out of 54 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 52 out of 54 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 52 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 52 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 52 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 52 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 50 out of 52 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Mykyta Zotov added 2 commits February 3, 2026 02:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 84 out of 86 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@blaze6950 I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you.

…boundaries (#3)

* Initial plan

* Add test case demonstrating bug with empty subranges in exclusive-start parents

Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com>

* Fix bug where empty subranges with negative indices returned false instead of empty RangeData

Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: blaze6950 <32897401+blaze6950@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 84 out of 86 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blaze6950 blaze6950 merged commit 4e656eb into main Feb 3, 2026
16 checks passed
@blaze6950 blaze6950 deleted the feature/implement-data-related-logic-for-ranges branch February 3, 2026 18:44
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.

3 participants