Problem
Any.Combine(...) propagates the first non-null operand source for failure reporting (Any.cs:446, and the same pattern at :476, :509, :546, :587, :634, :686, plus DictionaryOf at :793, :815). When operands carry different sources, the reported seed is wrong or the replay instruction does not apply:
Any.Combine(Any.WithSeed(1).Int32(), Any.WithSeed(2).Int32(), throwingComposer).Generate();
// -> "The arbitrary values were seeded with 1; reproduce this run with Any.Reproducibly(1, ...)."
Two things are wrong here. First, the second operand drew under seed 2, which is never reported. Second, the instruction is inapplicable: Any.Reproducibly(seed, …) pins the ambient source, but both operands draw from FixedRandomSource (RandomSource.cs:97-112), which ignores the ambient AsyncLocal entirely — following the instruction changes nothing (the WithSeed contexts already replay by themselves). Mixing an ambient operand with a context operand reports only the ambient seed and drops the context's.
(Related dead code: in CollectionState.Exhausted (CollectionState.cs:246-254) the seed is not null guard is unreachable — SeededRandom.Seed is a non-nullable int and the source is never null on that path — so that message always appends the replay instruction unconditionally. See also the foreign-generator exhaustion-message issue.)
Impact
A confidently misleading diagnostic in the library whose signature strength is diagnostic honesty. A user who follows the reported instruction after a Combine over seeded contexts gets no reproduction and may conclude reproducibility is broken. The case is an edge (mixing seeded contexts inside one composition is unusual), hence not critical, but the failure mode directly undermines the trust the seed-reporting machinery exists to build.
Direction
Make the source kind produce the replay hint rather than assuming ambient. For example, give RandomSource an internal string ReplayHint(int seed):
AmbientRandomSource → "reproduce this run with Any.Reproducibly({seed}, ...)";
FixedRandomSource → "this generator draws from Any.WithSeed({seed}), which already replays deterministically".
In Combine, collect the distinct non-null sources instead of taking the first; when more than one distinct source is involved, either report each or state that the composition mixes independent seeds.
Acceptance criteria
- A
Combine over two Any.WithSeed(...) operands that throws reports a hint that actually reproduces the run (or names both seeds), not an inapplicable Any.Reproducibly instruction.
- A
Combine mixing an ambient operand and a WithSeed operand does not silently drop either seed's provenance.
- The dead
seed is not null guard in CollectionState.Exhausted is removed or made reachable.
- Tests cover fixed-only, ambient-only, and mixed-source composition failures.
Context
Surfaced by the 2026-07-20 architecture & design audit of the standalone Dummies library (doc/handwritten/for-maintainers/audit/2026-07-20-dummies-architecture-and-design-audit.md, §7.3(b); branch claude/dummies-architecture-audit-cru5aq).
Filed from the Claude Code session that produced the 2026-07-20 Dummies architecture & design audit: https://claude.ai/code/session_01GvrWFVoG74xiys3oyEft1G
Problem
Any.Combine(...)propagates the first non-null operand source for failure reporting (Any.cs:446, and the same pattern at:476, :509, :546, :587, :634, :686, plusDictionaryOfat:793, :815). When operands carry different sources, the reported seed is wrong or the replay instruction does not apply:Two things are wrong here. First, the second operand drew under seed
2, which is never reported. Second, the instruction is inapplicable:Any.Reproducibly(seed, …)pins the ambient source, but both operands draw fromFixedRandomSource(RandomSource.cs:97-112), which ignores the ambientAsyncLocalentirely — following the instruction changes nothing (theWithSeedcontexts already replay by themselves). Mixing an ambient operand with a context operand reports only the ambient seed and drops the context's.(Related dead code: in
CollectionState.Exhausted(CollectionState.cs:246-254) theseed is not nullguard is unreachable —SeededRandom.Seedis a non-nullableintand the source is never null on that path — so that message always appends the replay instruction unconditionally. See also the foreign-generator exhaustion-message issue.)Impact
A confidently misleading diagnostic in the library whose signature strength is diagnostic honesty. A user who follows the reported instruction after a
Combineover seeded contexts gets no reproduction and may conclude reproducibility is broken. The case is an edge (mixing seeded contexts inside one composition is unusual), hence not critical, but the failure mode directly undermines the trust the seed-reporting machinery exists to build.Direction
Make the source kind produce the replay hint rather than assuming ambient. For example, give
RandomSourcean internalstring ReplayHint(int seed):AmbientRandomSource→"reproduce this run with Any.Reproducibly({seed}, ...)";FixedRandomSource→"this generator draws from Any.WithSeed({seed}), which already replays deterministically".In
Combine, collect the distinct non-null sources instead of taking the first; when more than one distinct source is involved, either report each or state that the composition mixes independent seeds.Acceptance criteria
Combineover twoAny.WithSeed(...)operands that throws reports a hint that actually reproduces the run (or names both seeds), not an inapplicableAny.Reproduciblyinstruction.Combinemixing an ambient operand and aWithSeedoperand does not silently drop either seed's provenance.seed is not nullguard inCollectionState.Exhaustedis removed or made reachable.Context
Surfaced by the 2026-07-20 architecture & design audit of the standalone
Dummieslibrary (doc/handwritten/for-maintainers/audit/2026-07-20-dummies-architecture-and-design-audit.md, §7.3(b); branchclaude/dummies-architecture-audit-cru5aq).Filed from the Claude Code session that produced the 2026-07-20 Dummies architecture & design audit: https://claude.ai/code/session_01GvrWFVoG74xiys3oyEft1G