Skip to content

test(dummies): guard Any/AnyContext mirror and builder algebra parity - #277

Merged
Reefact merged 2 commits into
mainfrom
claude/issue-214-discussion-c1cpcs
Jul 21, 2026
Merged

test(dummies): guard Any/AnyContext mirror and builder algebra parity#277
Reefact merged 2 commits into
mainfrom
claude/issue-214-discussion-c1cpcs

Conversation

@Reefact

@Reefact Reefact commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Add two pure-reflection tests that guard the library's two hand-mirrored surfaces against structural drift, so the accepted duplication (Any/AnyContext and the cloned numeric/temporal builders) stays safe as new types and constraints are added.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Analyzer / diagnostic change
  • Tests
  • Documentation
  • Build / CI / tooling

Changes

  • Add Dummies.UnitTests/SurfaceParityTests.cs with two reflection-based guards:
    • Mirror parity — asserts every scalar factory on Any has an identical instance counterpart on AnyContext (same name, generic arity, parameter types, return type). Composition and collection factories are excluded by construction: they take an IAny<> operand and inherit the context through their operand sources, so they are deliberately not mirrored.
    • Algebra parity — a data-driven theory asserting each builder exposes exactly its family's constraint method set (the signed / unsigned / instant families, plus each singleton scalar builder), encoded once as an expectation table.
  • No changes to library code; no per-builder maintenance beyond the expectation table. Both guards fail with a named diff (which method, which builder) when a factory or constraint drifts on one surface but not the other.

Testing

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

All test projects pass (1411 tests, 0 failures). The two guards were verified to genuinely bite by temporarily injecting drift on each surface — an extra expected constraint name, and a removed AnyContext factory — confirming each fails with a named diff, then reverting.

Documentation

  • No documentation change required

Note: these guards are structural. The documentation-wording drift the audit noted (§4.3, e.g. AnyContext.Guid()'s doc mentioning Any.Reproducibly) is tracked separately in #219, and true per-TFM enforcement of the netstandard2.0 surface (21 vs 26 factories) depends on the multi-target test-project work in #215 — this test currently exercises the net8.0+ surface only.

Architecture decisions

  • No architectural decision in this pull request

The reflection-over-CRTP-base-class approach is the mitigation recommended by the 2026-07-20 Dummies architecture & design audit (§9.2); this PR implements it and records no new decision.

Related issues

Closes #214

🤖 Generated with Claude Code

https://claude.ai/code/session_011k7zRx6Xe2UkbBLNffx5m6


Generated by Claude Code

claude and others added 2 commits July 21, 2026 19:43
Add two pure-reflection tests over the library's hand-mirrored surfaces:

- Mirror parity: every scalar factory on Any has an identical AnyContext
  counterpart. Composition and collection factories are excluded by
  construction (they take an IAny<> operand and inherit the context
  through their operand sources).
- Algebra parity: each builder exposes exactly its family's constraint
  method set, encoded once as an expectation table.

Both are pure reflection with no per-builder maintenance beyond that
table, and both fail with a named diff when a factory or a constraint
method drifts on one surface but not the other.

Refs: #214

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011k7zRx6Xe2UkbBLNffx5m6
@Reefact
Reefact merged commit 7a9f2bb into main Jul 21, 2026
15 checks passed
@Reefact
Reefact deleted the claude/issue-214-discussion-c1cpcs branch July 21, 2026 20:02
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.

Dummies: add Any/AnyContext and constraint-algebra parity guards

2 participants