feat(dummies): add MultipleOf, WithScale and WithGranularity constraints - #298
Merged
Merged
Conversation
Constrain scalars to a regular grid, drawn constructively in one pass: MultipleOf on the integers, WithScale on decimal (a 10^-n value lattice), and WithGranularity on the temporals. The grid composes with the existing bounds, exclusions and allow-list, feeds the cardinality hint, and conflicts eagerly when a range holds no grid point; it is declared once and withheld from the binary floating-point types (no exact base-ten grid). This replaces the As(x => x * k) workaround that distorted the declared range and dropped the value out of the constraint algebra, and removes the tick-precision serialization surprise for temporal dummies. Implemented as a shared "step" dimension in the ordinal, wide (128-bit) and decimal interval engines. Splits the SurfaceParityTests algebra families accordingly, updates the netstandard2.0 and net8.0 public API, documents the constraints in the Dummies readme, and proposes ADR-0035. Refs: #226 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JpQ9768mubATEjedfdAZus
4 tasks
Reefact
added a commit
that referenced
this pull request
Jul 26, 2026
ADR-0036 ("Draw lattice-constrained scalars on the grid") records the
decision behind the MultipleOf/WithScale/WithGranularity constraints that
shipped in #298. The maintainer accepts the decision; the Date stays
2026-07-26, the day it took effect.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JpQ9768mubATEjedfdAZus
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
Add a constructive lattice constraint to the
Dummiesscalar generators so a value can be drawn on a grid:MultipleOfon the integers,WithScaleondecimal, andWithGranularityon the temporals. It removes theAs(x => x * k)workaround (which distorted the declared range and dropped the value out of the constraint algebra) and the tick-precision serialization surprise for temporal dummies.Type of change
Changes
OrdinalIntervalSpec,WideIntervalSpec,DecimalIntervalSpec) — drawn constructively in one pass, composing with bounds, exclusions, theOneOfallow-list, the cardinality hint and eager conflict detection; declared once per generator.MultipleOf(<native type>)on every integer builder (SByte→Int64,Byte→UInt64, andInt128/UInt128on net8.0). Deliberately withheld from the binary floats (no exact base-ten grid).WithScale(int)onAnyDecimal— a value lattice (a multiple of10⁻ⁿ), documented as such, not a padded-representation contract.WithGranularity(TimeSpan)onAnyTimeSpan/AnyDateTime/AnyDateTimeOffset(andAnyTimeOnlyon net8.0).SurfaceParityTestsalgebra families to match (integer / decimal / floating-point / TimeSpan / instant-with-granularity); behavioural + conflict tests inAnyLatticeConstraintTests.Testing
dotnet build FirstClassErrors.slndotnet test FirstClassErrors.slnFirstClassErrors.Analyzers.UnitTests)Documentation
doc/updatedREADME.fr.mdcounterpart); ADR-0036 ships EN + FR.Architecture decisions
Proposed: ADR-0036Related issues
Refs #226
🤖 Generated with Claude Code
https://claude.ai/code/session_01JpQ9768mubATEjedfdAZus
Generated by Claude Code