Skip to content

#4617 PR 8: section 3a remainder + section 5 #4611 single-DB regression pin#4629

Merged
jeremydmiller merged 1 commit into
masterfrom
feature/4617-section-3a-remainder-plus-section-5-regressions
Jun 3, 2026
Merged

#4617 PR 8: section 3a remainder + section 5 #4611 single-DB regression pin#4629
jeremydmiller merged 1 commit into
masterfrom
feature/4617-section-3a-remainder-plus-section-5-regressions

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Eighth #4617 slice — 7 new tests across three files, covering section 3a remaining items + the single-DB conjoined variant of the #4611 regression already pinned for sharded.

3a — Return-shape coverage (3 tests)

AppendWrite/append_return_shapes_under_partitioning.cs

The Append + StartStream overload matrix has multiple shapes (params object[], IEnumerable<object>, single-event-via-params-of-one). Each must route through the bulk mt_quick_append_events function and land in the owning tenant's partition. Pinned per the spec's "Return shapes" item so a future overload-resolution change or appender refactor can't silently reshape what hits the partitioned tables.

  • append_via_params_object_array_lands_in_tenants_partition
  • append_via_IEnumerable_lands_in_tenants_partition
  • append_single_event_via_params_array_of_one_lands_in_tenants_partition (boundary case)

3a — Event-metadata propagation (2 tests)

AppendWrite/event_metadata_propagation_under_partitioning.cs

Per the spec's TenantPropagation pin (#4424) and metadata-flow pin:

  • event_TenantId_equals_stream_TenantId_under_partitioning — shared fixture; pins the TenantPropagation invariant that every event's TenantId equals the stream's tenant, never null.
  • event_optional_metadata_propagation_under_partitioning — own DocumentStore because CorrelationId / CausationId / Headers / UserName columns are opt-in (MetadataConfig.* = true). Pins that all four propagate from session → each event in the bulk batch, AND that TenantId stays paired with the right tenant alongside the opt-in metadata.

Section 5 — #4611 single-DB regression pin (2 tests)

Regressions/Bug_4611_mandatory_stream_type_under_partitioning.cs

The sharded variant already lives in Sharded/sharded_tenancy_per_tenant_events.cs from PR #3. This is the single-DB conjoined variant the spec specifically calls out as missing. Own-store because UseMandatoryStreamTypeDeclaration is a store-wide flag.

Verified

Suite Before After
TenantPartitionedEventsTests net9.0 111/111 118/118
TenantPartitionedEventsTests net10.0 111/111 118/118

Subsequent PRs per the #4617 checklist

  • 3c remaining: EventProjection, FlatTableProjection, MultiStream RollUpByTenant + AcrossTenants, custom IAggregateGrouper, raw IProjection, lifecycle equivalence
  • 3d remaining: AddMartenManagedTenantsAsync(Guid[]) N-format pin, sharded one-DB-per-shard, IDynamicTenantSource lifecycle
  • 3e remaining: DeleteAllTenantDataAsync orphan-sequence leak pin, RemoveMartenManagedTenantsAsync, AssertDatabaseMatchesConfigurationAsync drift, DDL generation, PerTenantEventSequences schema-object correctness, AutoCreate matrix
  • 3f DCB partitioned coverage
  • Section 4 daemon in-depth
  • Section 5 remaining: 42P01 / 42P16 / 42P07 / MT002-rebuild regression families
  • 3a remaining: Quick vs QuickWithServerTimestamps timestamp-source, seq_id gap-after-failed-batch
  • 3b deferred items

🤖 Generated with Claude Code

…on pin

Three new files, 7 tests covering #4617 section 3a remaining items
(return-shape coverage, event-metadata propagation) plus the single-DB
conjoined variant of the #4611 regression already pinned for sharded.

## 3a — Return-shape coverage
(`AppendWrite/append_return_shapes_under_partitioning.cs`, 3 tests)

The Append + StartStream overload matrix has multiple shapes (`params
object[]`, `IEnumerable<object>`, single-event-via-params-of-one). Each must
route through the bulk `mt_quick_append_events` function and land in the
owning tenant's partition. Pinned per the spec's "Return shapes" item so a
future overload-resolution change or appender refactor can't silently
reshape what hits the partitioned tables.

  - `append_via_params_object_array_lands_in_tenants_partition`
  - `append_via_IEnumerable_lands_in_tenants_partition`
  - `append_single_event_via_params_array_of_one_lands_in_tenants_partition`
    (single-event boundary case — the loop bound at array_length(event_ids, 1))

## 3a — Event metadata propagation
(`AppendWrite/event_metadata_propagation_under_partitioning.cs`, 2 tests)

Per the spec's TenantPropagation pin (#4424) and metadata-flow pin:

  - `event_TenantId_equals_stream_TenantId_under_partitioning` — shared
    fixture; pins the TenantPropagation invariant that every event's
    `TenantId` equals the stream's tenant, never null.
  - `event_optional_metadata_propagation_under_partitioning` — its own
    DocumentStore because CorrelationId / CausationId / Headers / UserName
    metadata columns are opt-in (MetadataConfig.* = true). Pins that the
    full set propagates from session → each event in the bulk batch, AND
    that TenantId stays paired with the right tenant alongside the opt-in
    metadata.

## Section 5 — #4611 single-DB regression pin
(`Regressions/Bug_4611_mandatory_stream_type_under_partitioning.cs`, 2 tests)

The sharded variant already lives in `Sharded/sharded_tenancy_per_tenant_events.cs`
from PR #3. This is the single-DB conjoined variant the spec specifically
calls out as missing. Own-store because UseMandatoryStreamTypeDeclaration is
a store-wide flag.

  - `StartStream_with_aggregate_type_followed_by_Append_works` — Start +
    Append both succeed; mt_streams row exists with `type` = aggregate alias.
  - `untyped_StartStream_still_throws_StreamTypeMissingException` — companion
    pin: the API-level guard in EventStore.StartStream STILL fires
    synchronously for the no-type overload. PR #4613's fix didn't (and
    shouldn't) weaken this guard.

## Verified

- **net9.0**: 118/118 pass (was 111 → +7)
- **net10.0**: 118/118 pass

## Subsequent PRs per the #4617 checklist

- 3c remaining: EventProjection, FlatTableProjection, MultiStreamProjection
  RollUpByTenant + AcrossTenants / AddGlobalProjection, custom
  IAggregateGrouper + fan-out, raw IProjection, same-projection lifecycle
  equivalence.
- 3d remaining: AddMartenManagedTenantsAsync(Guid[]) N-format pin,
  sharded reuses ONE MartenDatabase per shard, IDynamicTenantSource lifecycle.
- 3e remaining: DeleteAllTenantDataAsync orphan-sequence leak pin (needs
  own-store), RemoveMartenManagedTenantsAsync, AssertDatabaseMatchesConfigurationAsync
  drift, DDL generation, PerTenantEventSequences schema-object correctness,
  AutoCreate matrix.
- 3f DCB partitioned coverage.
- Section 4 daemon in-depth.
- Section 5 remaining: 42P01 / 42P16 / 42P07 / MT002-rebuild regression families.
- 3a remaining: Quick vs QuickWithServerTimestamps timestamp-source pin,
  seq_id gap-after-failed-batch.
- 3b deferred items.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit cc97d34 into master Jun 3, 2026
8 checks passed
@jeremydmiller jeremydmiller deleted the feature/4617-section-3a-remainder-plus-section-5-regressions branch June 3, 2026 19:37
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