Skip to content

v6.2: bulk generation, TimeProvider overloads, EF Core value generation#29

Merged
buvinghausen merged 1 commit into
masterfrom
v6.2/generation-ergonomics
Jun 10, 2026
Merged

v6.2: bulk generation, TimeProvider overloads, EF Core value generation#29
buvinghausen merged 1 commit into
masterfrom
v6.2/generation-ergonomics

Conversation

@buvinghausen

Copy link
Copy Markdown
Owner

Summary

SemVer minor (v6.2.0) — all changes additive. Implements the approved spec at
docs/superpowers/specs/2026-06-09-sequentialguid-v6.2-design.md.

  • Bulk generation (Fill/FillSql/NewGuids/NewSqlGuids on GuidV7 and GuidV8Time, .NET 8+ assets):
    one timestamp capture, one counter-block reservation, one RNG call per batch — ~11× faster than a
    Guid.CreateVersion7 loop and zero-alloc. Loud ArgumentOutOfRangeException when a batch would
    exceed the counter space (2^26 v7 / 2^22 v8). Block reservation mirrors Interlocked.Increment
    post-increment semantics so bulk and single-call generation interleave without slot reuse
    (regression-tested with singles on both sides of a bulk call).
  • TimeProvider overloads (.NET 8+) on every generation path, single-call and bulk.
  • EF Core value generation: four public ValueGenerator classes plus
    UseSequentialGuidValueGeneration(bool sqlServerByteOrder = false) — a model-finalizing
    convention covering Guid, SequentialGuid, and SequentialSqlGuid primary keys (composite
    keys included). Explicit configuration always wins. Includes a HasSentinel(default) pin for
    struct keys: EF 8/9 compute sentinels via Activator.CreateInstance, which invokes the structs'
    generating parameterless ctors (fixed in EF 10 via GetUninitializedObject).
  • MongoSequentialGuidGenerator gains a SequentialGuidType constructor; Instance stays v8
    (no silent behavior change). The spec's optional type parameter on RegisterMongoIdGenerator()
    was dropped — the instance already carries its type.
  • Legacy GetInt32 bias fix: mask-and-reject sampling replaces GetNonZeroBytes + double-modulo.
  • AOT smoke tests extended to bulk/TimeProvider/NodaTime; new EF Core AOT smoke project
    (public generators only — converters are internal and covered by build-time analyzers) wired
    into CI with per-exe exit-code guards. Native ILC publish verifies in CI.
  • README: "Why not Guid.CreateVersion7?" section with measured benchmark table (honest about
    per-call latency; the win is monotonicity, SQL ordering, tooling, reach, and bulk throughput).

Minor deviations from spec snippets: TimeProvider tests live in their own file; bulk sort-order
tests use inline arrays; the bulk benchmark exercises Fill rather than NewGuids (fairer
buffer-reuse comparison); test field naming follows .editorconfig over spec pseudocode.

Test plan

  • dotnet build — 0 warnings across all TFMs (warnings-as-errors)
  • dotnet test — 31,605 tests, 0 failures, all TFMs (net11/net10/net9/net8/net472)
  • Counter off-by-one regression test proven red against the bug, green after the fix
  • Managed smoke runs PASS locally; native AOT publish + run for both smoke apps in CI
  • BclComparisonBenchmarks run on Release; README table is verbatim measured output

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@buvinghausen buvinghausen merged commit fc82ce7 into master Jun 10, 2026
1 check passed
@buvinghausen buvinghausen deleted the v6.2/generation-ergonomics branch June 10, 2026 15:20
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