Skip to content

feat(core): milestone 6 phase 0 - deterministic seed derivation engine wiring - #32

Open
ncipollina wants to merge 2 commits into
mainfrom
feat/core-milestone-6-phase-0-derive-seed
Open

feat(core): milestone 6 phase 0 - deterministic seed derivation engine wiring#32
ncipollina wants to merge 2 commits into
mainfrom
feat/core-milestone-6-phase-0-derive-seed

Conversation

@ncipollina

Copy link
Copy Markdown
Contributor

📋 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 own IRandomSource or 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 core DeriveSeed() 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 — full Compono.Bogus package design (not yet implemented): three customization models (member-name convention provider, member-level rule sugar, whole-object Faker<T> sugar), verified coexistence with Compono.NSubstitute via 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 — new DeriveSeed(): a pure read of the node's own fork state combined with a new, distinct DeriveSeedTag (via the same Fnv1a.Combine Fork already uses). Never touches NextUInt64()'s value-state stream.
  • ICompositionContext/CompositionContext — new public int DeriveSeed(), guarded by the same _manualResolveFrames.Count == 0 check the existing descriptor-less Resolve<T>() overload uses. The 64-bit derived value is XOR-folded into an int.
  • CompositionRow — forwarding implementation, to stay a complete ICompositionContext.

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 concurrent Create<T>() calls against a shared Composer.
  • test/Compono.Tests/UniqueValueResolverTests.cs — its hand-written ICompositionContext test fake updated for the new interface member.

Docs: docs/architecture.md, docs/mvp.md, docs/public-api.md updated to mark ADR-0026/DeriveSeed() as implemented; Compono.Bogus itself 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 (the Compono.Bogus package itself) will be separate PRs.


🧪 Validation

  • Build/test status: whole-solution dotnet build (0 warnings, 0 errors) and dotnet test — 734/734 passing across both target frameworks (Compono.Tests 426/426, Compono.Generators.Tests 168/168, Compono.XunitV3.Tests 94/94, Compono.NSubstitute.Tests 46/46).
  • Manual verification performed: reviewed every ICompositionContext implementer in the codebase (CompositionContext, CompositionRow, plus a hand-written test fake) to confirm all three now implement DeriveSeed().
  • Edge cases checked: idempotency within one active request, throwing outside an active request, renaming vs. reordering a constructor parameter, and correctness under concurrent composition — all covered by 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.Bogus itself (ADR-0027, PLAN-0006 Phases 1-3) is design-only in this PR and will land in follow-up PRs, one per phase.

…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>
@github-actions github-actions Bot added the feat label Aug 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/plans/README.md Outdated
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>
@ncipollina

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 09c8bdf906

ℹ️ 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".

@safe-settings-sync safe-settings-sync Bot removed the feat label Aug 1, 2026
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.

1 participant