Skip to content

Migrate to Weasel.Core.BulkInsertMode (audit row weasel#264, Polecat side)#50

Merged
jeremydmiller merged 1 commit into
mainfrom
feature/use-weasel-bulk-insert-mode
May 11, 2026
Merged

Migrate to Weasel.Core.BulkInsertMode (audit row weasel#264, Polecat side)#50
jeremydmiller merged 1 commit into
mainfrom
feature/use-weasel-bulk-insert-mode

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Polecat-side adoption of the BulkInsertMode promotion to Weasel.Core in Weasel 9.0.0-alpha.1. Audit row: JasperFx/weasel#264 (parent JasperFx/jasperfx#218, pillar JasperFx/jasperfx#214).

Mechanical migration

  • src/Polecat/BulkInsertMode.cs deleted. Polecat's 3-value local enum (InsertsOnly, IgnoreDuplicates, OverwriteExisting) was a subset of Weasel's 4-value canonical enum; the missing fourth (OverwriteIfVersionMatches) is now visible to consumers.
  • src/Polecat/AdvancedOperations.cs picks up using Weasel.Core; and adds a switch case for OverwriteIfVersionMatches that throws NotSupportedException with a clear message linking to Implement BulkInsertMode.OverwriteIfVersionMatches #48.
  • Test files pick up using Weasel.Core;.

Foundation bump

Central package versions:

Package Old New
JasperFx 1.31.0 2.0.0-alpha.1
JasperFx.Events 1.36.0 2.0.0-alpha.1
JasperFx.Events.SourceGenerator 1.4.0 2.0.0-alpha.1
Weasel.SqlServer 8.14.1 9.0.0-alpha.1
Weasel.EntityFrameworkCore 8.14.1 9.0.0-alpha.1

JasperFx.Events 2.0 widened IInlineProjection.ApplyAsync from IReadOnlyList<StreamAction> to IEnumerable<StreamAction> — Polecat's NaturalKeyProjection and FlatTableProjection signatures updated to match.

OverwriteIfVersionMatches behavior

The actual implementation is tracked separately as #48 because it requires designing how the bulk-insert API exposes per-document expected-version metadata (Polecat doesn't have a version-discovery mechanism today). Until #48 lands, callers passing BulkInsertMode.OverwriteIfVersionMatches will get a clear NotSupportedException with a link to the issue.

Breaking change (Polecat 4)

Third-party consumers of Polecat.BulkInsertMode by full name will see a compile-time break. Will be flagged in the Polecat 4 migration guide (#46).

Test plan

  • Full solution builds clean (0 errors) on both net9.0 and net10.0.
  • Existing bulk-insert tests cover InsertsOnly, IgnoreDuplicates, OverwriteExisting (3 of 4 modes).
  • OverwriteIfVersionMatches tests land with the implementation in Implement BulkInsertMode.OverwriteIfVersionMatches #48.

🤖 Generated with Claude Code

…efs to alpha (#264)

Polecat-side adoption of the BulkInsertMode promotion to Weasel.Core
in Weasel 9.0.0-alpha.1. See the canonical audit row:
JasperFx/weasel#264 (parent JasperFx/jasperfx#218,
pillar JasperFx/jasperfx#214).

Mechanical migration
--------------------
- src/Polecat/BulkInsertMode.cs deleted. Polecat's 3-value local enum
  (InsertsOnly, IgnoreDuplicates, OverwriteExisting) was a subset of
  Weasel's 4-value canonical enum; the missing fourth value
  (OverwriteIfVersionMatches) is now exposed.
- src/Polecat/AdvancedOperations.cs picks up `using Weasel.Core;` and
  adds a switch case for OverwriteIfVersionMatches that throws
  NotSupportedException with a clear message pointing at #48.
- Test files (bulk_insert_operations.cs, bulk_insert_edge_cases.cs)
  pick up `using Weasel.Core;`.

Foundation bump
---------------
- Directory.Packages.props:
  - JasperFx                         1.31.0 → 2.0.0-alpha.1
  - JasperFx.Events                  1.36.0 → 2.0.0-alpha.1
  - JasperFx.Events.SourceGenerator   1.4.0 → 2.0.0-alpha.1
  - Weasel.SqlServer                 8.14.1 → 9.0.0-alpha.1
  - Weasel.EntityFrameworkCore       8.14.1 → 9.0.0-alpha.1
- Polecat's NaturalKeyProjection and FlatTableProjection ApplyAsync
  signatures widened to match JasperFx.Events 2.0's
  IInlineProjection.ApplyAsync (IReadOnlyList<StreamAction>
  → IEnumerable<StreamAction>).

OverwriteIfVersionMatches behavior
----------------------------------
The actual implementation is tracked separately as #48 because it
requires designing how the bulk-insert API exposes per-document
expected-version metadata (Polecat doesn't have a version-discovery
mechanism today). Until #48 lands, callers passing
BulkInsertMode.OverwriteIfVersionMatches will get a clear
NotSupportedException with a link to the issue.

Breaking change for Polecat 4: third-party consumers of
Polecat.BulkInsertMode by full name will see a compile-time break.
To be flagged in the Polecat 4 migration guide (#46).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller force-pushed the feature/use-weasel-bulk-insert-mode branch from 9b4eb53 to 7ddc7a4 Compare May 11, 2026 20:30
@jeremydmiller jeremydmiller merged commit 8a7e6c5 into main May 11, 2026
6 checks passed
@jeremydmiller jeremydmiller deleted the feature/use-weasel-bulk-insert-mode branch May 11, 2026 20:39
jeremydmiller added a commit that referenced this pull request May 11, 2026
Mirror the Marten 9 / Weasel 9 cutover pattern.

- `3.0` maintenance branch set to V3.2.1 (the last 3.x release tag).
  All subsequent 3.x patches land on `3.0`.
- `main` becomes the Polecat 4.0 development line. Existing 4.0-line
  work that already accumulated on main (PR #50 cutover-style package
  bumps to JasperFx 2.0/Weasel 9.0 alphas; PR #58 dedup adoption pass
  closing #52/#54/#55; PR #59 un-skipping the upstream-cache test on
  JasperFx 2.0.0-alpha.4) ships under the 4.0.0-alpha.1 label.

Part of the Critter Stack 2026 release wave (JasperFx/jasperfx#217).
Per-product master plan: #46. Polecat 4 + Marten 9 ship in lockstep.
jeremydmiller added a commit that referenced this pull request May 12, 2026
Closes #51. Bookkeeping tracker for the Polecat 4 migration narrative,
filed as part of the Critter Stack 2026 release wave.

## What's covered

- **Foundation pin bumps** — the JasperFx 1.x → 2.0 / JasperFx.Events
  1.x → 2.0 / Weasel 8.x → 9.0 transitive bumps, with a before/after
  table.
- **Dedup audit relocations** (jasperfx#218 / #224):
  - `Polecat.BulkInsertMode` → `Weasel.Core.BulkInsertMode`
    (PR #50, weasel#264)
  - `Polecat.Storage.CascadeAction` → `Weasel.Core.CascadeAction`
    (PR #47 / #61)
  - `Polecat.Metadata.ITenanted` now extends
    `JasperFx.MultiTenancy.IHasTenantId` (silent during Polecat 4 dev;
    documented for third-party consumers)
  - `Polecat.Exceptions.UnknownTenantException` →
    `JasperFx.MultiTenancy.UnknownTenantIdException` (with the new
    `TenantId` property surfaced)
- **Event-sourcing API changes** — `IInlineProjection.ApplyAsync`
  widening to `IEnumerable<StreamAction>` (jasperfx-events#4306),
  plus the `IJasperFxAggregateGrouper.Group` `IReadOnlyList<IEvent>`
  tightening (jasperfx#201) flagged for the rare case a Polecat
  application implements a custom grouper.
- **New behavior** — `BulkInsertWithVersionAsync` (#48 / #62, the
  optimistic-concurrency bulk-insert path), and the FlatTableProjection
  case-sensitivity fix (#49 / Weasel-side).
- **AOT/codegen posture** — Polecat 4 is `PublishAot`-supported;
  `IsAotCompatible=true` lands with the per-project AOT audit
  (jasperfx#213).
- **Dependency lockstep** — explicit pairing table; mixing major
  versions across products in this wave is unsupported.
- **No obsolete API removals** — verified via grep; the audit row in
  #51 is closed as a no-op.

## Sidebar wiring

Added a top-level "Migration Guide" entry under the existing sections
in `docs/.vitepress/config.mts`, matching the same style other top-level
docs use (Diagnostics, Schema). The page is reachable from any page
in the sidebar tree.
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