Skip to content

feat(dummies): add MultipleOf, WithScale and WithGranularity constraints - #298

Merged
Reefact merged 1 commit into
mainfrom
claude/multipleof-withscale-validation-61u7w4
Jul 26, 2026
Merged

feat(dummies): add MultipleOf, WithScale and WithGranularity constraints#298
Reefact merged 1 commit into
mainfrom
claude/multipleof-withscale-validation-61u7w4

Conversation

@Reefact

@Reefact Reefact commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

Add a constructive lattice constraint to the Dummies scalar generators so a value can be drawn on a grid: MultipleOf on the integers, WithScale on decimal, and WithGranularity on the temporals. It removes the As(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

  • New feature
  • Tests
  • Documentation

Changes

  • Add a shared step/lattice dimension to the ordinal, wide (128-bit) and decimal interval engines (OrdinalIntervalSpec, WideIntervalSpec, DecimalIntervalSpec) — drawn constructively in one pass, composing with bounds, exclusions, the OneOf allow-list, the cardinality hint and eager conflict detection; declared once per generator.
  • MultipleOf(<native type>) on every integer builder (SByteInt64, ByteUInt64, and Int128/UInt128 on net8.0). Deliberately withheld from the binary floats (no exact base-ten grid).
  • WithScale(int) on AnyDecimal — a value lattice (a multiple of 10⁻ⁿ), documented as such, not a padded-representation contract.
  • WithGranularity(TimeSpan) on AnyTimeSpan/AnyDateTime/AnyDateTimeOffset (and AnyTimeOnly on net8.0).
  • Split the SurfaceParityTests algebra families to match (integer / decimal / floating-point / TimeSpan / instant-with-granularity); behavioural + conflict tests in AnyLatticeConstraintTests.
  • Public API entries for both TFMs; Dummies readme updated.

Testing

  • dotnet build FirstClassErrors.sln
  • dotnet test FirstClassErrors.sln
  • Analyzer tests pass (FirstClassErrors.Analyzers.UnitTests)

Documentation

  • Public API / error documentation updated
  • README / doc/ updated
  • French translation — n/a: the Dummies NuGet readme is English-only (no README.fr.md counterpart); ADR-0036 ships EN + FR.

Architecture decisions

  • New decision recorded — ADR drafted as Proposed: ADR-0036

Related issues

Refs #226

🤖 Generated with Claude Code

https://claude.ai/code/session_01JpQ9768mubATEjedfdAZus


Generated by Claude Code

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
@Reefact
Reefact merged commit 45503bf into main Jul 26, 2026
16 checks passed
@Reefact
Reefact deleted the claude/multipleof-withscale-validation-61u7w4 branch July 26, 2026 12:27
@Reefact Reefact mentioned this pull request Jul 26, 2026
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
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