fix(#4966): update natural key on projection rebuild (JasperFx 2.28.1)#4970
Merged
Conversation
A natural key that CHANGES via an update event was never written to the mt_natural_key_X lookup table — only the create event's key was recorded — so FetchLatest-by-natural-key could not find the stream under its new key after a rebuild (or live inline append). Root cause and fix are in JasperFx: natural-key discovery silently skipped a two-arg static evolve method (static TDoc Apply(TEvent e, TDoc current)), so no mapping was built for the update event (#528). This bumps the JasperFx packages to 2.28.1 to pick up that fix. Includes the original reproduction test from #4967 (thanks @ytqsl); it fails on 2.28.0 ("should not be null but was") and passes on 2.28.1. Supersedes #4967. Closes #4966. Co-Authored-By: Yossi Tamari <yossi.tamari@gov.ab.ca> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XKKBPsFJ83jd2o4hyGJnj6
This was referenced Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A snapshot with a natural key that changes across events is not updated: the natural key is recorded once (from the create event) but never again when a later event changes it.
FetchLatest-by-natural-key then can't find the stream under its new key — observed after a projection rebuild in #4966, but the same gap exists on live inline append.Root cause & fix (JasperFx)
The natural-key lookup table
mt_natural_key_Xis maintained fromNaturalKeyEventMappings discovered off the aggregate's[NaturalKeySource]methods. JasperFx's discovery silently skipped a two-arg static evolve method —— because the extractor builder only knew how to invoke a one-arg static factory; the two-arg call threw while composing and was swallowed. So the update event got no mapping and its key was never upserted.
Fixed in jasperfx#528 (extractor now binds one argument per parameter: event data → the event param, a fresh default aggregate → the
TDocparam), released as JasperFx 2.28.1. This PR bumps the JasperFx packages to 2.28.1.Test
Includes the original reproduction from #4967 — thanks @ytqsl (retained as co-author). It fails on 2.28.0 (
should not be null but was) and passes on 2.28.1, verified locally against the published package.Supersedes #4967. Closes #4966.
🤖 Generated with Claude Code