feat(core): milestone 6 phase 0 - deterministic seed derivation engine wiring - #32
feat(core): milestone 6 phase 0 - deterministic seed derivation engine wiring#32ncipollina wants to merge 2 commits into
Conversation
…e wiring Records the Milestone 6 (Bogus integration) design: ADR-0026 (core ICompositionContext.DeriveSeed() capability), ADR-0027 (Compono.Bogus package design), and PLAN-0006 tracking both. Implements ADR-0026's Phase 0 scope - DeriveSeed() gives a public provider or a registration/configuration-rule factory an on-demand, path-derived deterministic seed (reusing ADR-0012's existing FNV-1a fork-key mechanism with a distinct salt) without exposing IRandomSource or path internals, closing the one real gap Milestone 5's NSubstitute integration never needed: nothing exposed deterministic randomness to a provider/factory before this. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a6fddb31b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review (PR #32): the plans index still said Not Started even though the plan itself declares In Progress with Phase 0 Done, and this branch ships that phase. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
📋 Summary
Milestone 6 (Bogus integration) design review, plus its Phase 0 implementation. Adds
ICompositionContext.DeriveSeed()— an on-demand, path-derived deterministic seed a public provider or registration/configuration-rule factory can use for its own randomness, without exposing the engine's ownIRandomSourceor path internals. This closes the one real gap Milestone 5's NSubstitute integration never needed (no randomness involved) but Bogus genuinely does.📝 Changes
Design docs (all
Accepted):docs/adr/0026-deterministic-seed-derivation-for-providers.md— the coreDeriveSeed()mechanism: on-demand (not an eager field), reuses ADR-0012's existing FNV-1a path-hash with a distinct salt, idempotent per active request, throws outside one.docs/adr/0027-compono-bogus-package-design.md— fullCompono.Boguspackage design (not yet implemented): three customization models (member-name convention provider, member-level rule sugar, whole-objectFaker<T>sugar), verified coexistence withCompono.NSubstitutevia disjoint type claims.docs/plans/0006-milestone-6-bogus-integration.md— phase-by-phase tracker; Phase 0 done, Phases 1-3 not started.docs/adr/README.md,docs/plans/README.md— index entries.Core engine (
src/Compono):IRandomSource/RandomSource— newDeriveSeed(): a pure read of the node's own fork state combined with a new, distinctDeriveSeedTag(via the sameFnv1a.CombineForkalready uses). Never touchesNextUInt64()'s value-state stream.ICompositionContext/CompositionContext— new publicint DeriveSeed(), guarded by the same_manualResolveFrames.Count == 0check the existing descriptor-lessResolve<T>()overload uses. The 64-bit derived value is XOR-folded into anint.CompositionRow— forwarding implementation, to stay a completeICompositionContext.Tests:
test/Compono.Tests/DeriveSeedTests.cs(new, 7 tests × 2 TFMs) — same seed/path → same value; sibling requests fork independently; renaming a constructor parameter doesn't change its value, reordering does; idempotent within one active request; throws outside an active request; deterministic when called from a public provider; correct under concurrentCreate<T>()calls against a sharedComposer.test/Compono.Tests/UniqueValueResolverTests.cs— its hand-writtenICompositionContexttest fake updated for the new interface member.Docs:
docs/architecture.md,docs/mvp.md,docs/public-api.mdupdated to mark ADR-0026/DeriveSeed()as implemented;Compono.Bogusitself still correctly marked not-yet-implemented.Per this repo's own plan-phasing convention (
design-decisions.md), the design docs ship in the same PR as Phase 0's implementation — matching PLAN-0005 Phase 0's precedent. Phases 1-3 (theCompono.Boguspackage itself) will be separate PRs.🧪 Validation
dotnet build(0 warnings, 0 errors) anddotnet test— 734/734 passing across both target frameworks (Compono.Tests426/426,Compono.Generators.Tests168/168,Compono.XunitV3.Tests94/94,Compono.NSubstitute.Tests46/46).ICompositionContextimplementer in the codebase (CompositionContext,CompositionRow, plus a hand-written test fake) to confirm all three now implementDeriveSeed().DeriveSeedTests.cs.💬 Notes for Reviewers
This is a design + Phase-0-implementation PR (mirrors PLAN-0005 Phase 0's own precedent of shipping design docs and their first implementation phase together).
Compono.Bogusitself (ADR-0027, PLAN-0006 Phases 1-3) is design-only in this PR and will land in follow-up PRs, one per phase.