fix(justdummies): qualify the Combine replay hint across mixed sources - #320
Merged
Conversation
When a composer failed inside a Combine, the replay hint promised a full
deterministic replay whenever every operand was individually reproducible —
even when the operands drew from different seeded sources. Combine reports
the first operand's source, so a mix of a WithSeed context and the ambient
source (or two different WithSeed contexts) named one seed and claimed it
replays the whole run, when it reproduces only the operands that draw from
it. The flagship promise — a run is reproducible from a reported seed — was
overstated exactly where the seed cannot deliver it.
Gate the full-replay promise on every operand drawing from the one reported
source, not merely on each being reproducible: DrawsOnlyFrom(g, source) =
IsReproducible(g) && ReferenceEquals(SourceOf(g), source). A combine whose
operands do not all share the reported source is now qualified ("not
reproducible from this seed alone"), the same wording a foreign operand
already produces. Same-ambient and single-WithSeed-context combines stay
full; the only new qualification is a genuine source mix (and, conservatively,
two separate WithSeed contexts of the same seed — safe under-promising).
Internal to the derivation plumbing; no public API change.
Refs: #319
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
When a composer failed inside a
Combine, the replay hint promised a full deterministic replay whenever every operand was individually reproducible — even when the operands drew from different seeded sources.Combinereports the first operand's source, so a mix of aWithSeedcontext and the ambient source (or two differentWithSeedcontexts) named one seed and claimed it replays the whole run, when it reproduces only the operands that draw from it. The full-replay promise now holds only when every operand draws from the one reported source.Type of change
Changes
AnyDerivation.DrawsOnlyFrom(generator, source)=IsReproducible(generator) && ReferenceEquals(SourceOf(generator), source)— the per-operand condition for a full-replay promise.Combineoverloads (2–8 arity) now computereproduciblefromDrawsOnlyFrom(operand, source)rather thanIsReproducible(operand), so a combine whose operands do not all share the reported source is qualified ("not reproducible from this seed alone"), the same wording a foreign operand already produces.Any.WithSeed(…)context stay full. The only new qualification is a genuine source mix — and, conservatively, two separateAny.WithSeed(4242)contexts of the same seed (safe under-promising of an unusual pattern).As/OrNullare single-operand and unaffected; the collection count/element source interaction is a separate audit item, out of scope here.Testing
dotnet build FirstClassErrors.sln— 0 warnings, 0 errors.dotnet test FirstClassErrors.sln— 1810 tests, 0 failures.Additionally:
CompositionTests.CombineOverMixedSeededSourcesQualifiesTheHintpins the fix (message content is the example suite's job, ADR-0040): aCombine(Any.WithSeed(4242).Int32(), Any.Int32(), …)whose composer throws must not say "already replays deterministically" and must say "not reproducible from this seed alone". Confirmed red before the fix.Any.Reproducibly(…)full hint, one sharedWithSeedcontext →Any.WithSeed(…)full hint, foreign operand → qualified.GITHUB_ACTIONS=true): 0 warnings. The public API baseline is untouched (git diff -- JustDummies/PublicAPI/empty) — the change is internal to the derivation plumbing.Documentation
doc/updatedThe behaviour realises the intent already documented on
RandomSource.PartialReplayGuidanceandIReproducibilityHint("the seed reporting must not over-promise"); no user-facing document quotes these runtime strings.Architecture decisions
Proposed: ADR-____Advisory ADR check done: this makes the existing "do not over-promise a replay" intent hold for the mixed-source case rather than establishing a new decision, so no ADR is drafted.
Related issues
Closes #319
🤖 Generated with Claude Code
Generated by Claude Code