Skip to content

refactor(dummies): contextualize replay hints in generation failures#272

Merged
Reefact merged 4 commits into
mainfrom
claude/issue-211-discussion-loj6gu
Jul 21, 2026
Merged

refactor(dummies): contextualize replay hints in generation failures#272
Reefact merged 4 commits into
mainfrom
claude/issue-211-discussion-loj6gu

Conversation

@Reefact

@Reefact Reefact commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Refactor error messages in generation failures to provide context-aware replay hints. When a generation fails under Any.Reproducibly(...), the hint directs users to that API; when it fails under Any.WithSeed(...), the hint clarifies that the context already replays deterministically. This eliminates misleading diagnostics that suggested inapplicable replay instructions.

Closes #211

Type of change

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

Changes

  • Introduce RandomSource.ReplayHint(int seed) abstract method to generate context-appropriate replay guidance
  • Implement ReplayHint in AmbientRandomSource (points to Any.Reproducibly(seed, ...))
  • Implement ReplayHint in FixedRandomSource (clarifies deterministic replay via Any.WithSeed(seed))
  • Update ContinuousIntervalSpec.Generate() and DecimalIntervalSpec.Generate() to accept RandomSource instead of Random and int seed, enabling access to context-aware hints
  • Update AnyDouble, AnyDecimal, AnyHalf, and AnySingle to pass _source directly to interval specs
  • Update AnyDerivation.Invoke() to use source.ReplayHint() for consistent messaging
  • Update CollectionState.Exhausted() to use source.ReplayHint() instead of hardcoded replay instruction
  • Update AnyGenerationException.Seed documentation to clarify the distinction between ambient and fixed contexts
  • Add two new unit tests validating correct replay hints under Any.Reproducibly(...) and Any.WithSeed(...) contexts
  • Update existing test assertion in ContinuousExclusionNudgeTests to verify the hint names Any.WithSeed, not the inapplicable Any.Reproducibly

Testing

  • dotnet build FirstClassErrors.sln
  • dotnet test FirstClassErrors.sln

Architecture decisions

  • No architectural decision in this pull request

https://claude.ai/code/session_01TypdikCpEjgECvwuwpkrJD

claude and others added 4 commits July 21, 2026 15:53
Generation-failure messages hardcoded the ambient "reproduce this run
with Any.Reproducibly(seed, ...)" instruction even when the failing
generator drew from an Any.WithSeed(...) fixed context, which ignores the
ambient scope Any.Reproducibly pins — so the printed instruction did not
reproduce the run. In a library whose signature strength is diagnostic
honesty, that is a confidently misleading hint.

Give RandomSource an internal ReplayHint(seed): the ambient source points
at Any.Reproducibly(seed, ...); a fixed Any.WithSeed(seed) context names
itself and states that it already replays deterministically. Route every
failure-message site through it — Combine/As (AnyDerivation.Invoke),
distinct-collection exhaustion (CollectionState.Exhausted), and the
continuous/decimal interval specs — and remove the dead "seed is not
null" guard in Exhausted (SeededRandom.Seed is a non-nullable int).

Clarify the AnyGenerationException.Seed doc, which likewise asserted the
ambient instruction unconditionally. Add composition tests for the
ambient and fixed-context hints and correct the interval-spec exhaustion
test, which asserted the inapplicable Any.Reproducibly hint on a
WithSeed(...) source.

Refs: #211
@Reefact
Reefact merged commit 84e3ebb into main Jul 21, 2026
15 checks passed
@Reefact
Reefact deleted the claude/issue-211-discussion-loj6gu branch July 21, 2026 18:53
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: seed report is wrong or inapplicable for fixed-context and mixed-source compositions

2 participants