Enhance DurableStateStore TCK with OCC, serialization, and soft-delete tests#2917
Merged
pjfanning merged 5 commits intoapache:mainfrom Apr 27, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko/sessions/77803e79-3631-4111-98a8-4a1cf6f7beca Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
…e tests Builds on apache#2833 to address the gaps discussed in apache#2831: - Optimistic concurrency check on upsert (supportsUpsertWithRevisionCheck) - Roundtrip serialization via TestPayload (supportsSerialization, defaults on to match JournalSpec convention) - Deprecated single-arg deleteObject(pid) overload (supportsSoftDelete) - New required test: upsert again after deletion - preparePersistenceId cleanup hook for stateful plugins - Brief plugin-author docs subsection in persistence-journals.md mirroring the Journal/SnapshotStore TCK pattern The reference TCK against PersistenceTestKitDurableStateStore passes 6/6 required tests; all 4 optional capability flags correctly skip when off. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
He-Pin
reviewed
Apr 27, 2026
| */ | ||
|
|
||
| /* | ||
| * Copyright (C) 2014-2022 Lightbend Inc. <https://www.lightbend.com> |
Member
There was a problem hiding this comment.
it is copied from a file that has 2022 in it
Member
There was a problem hiding this comment.
but IIRC akka will update the year every year
Member
There was a problem hiding this comment.
we shouldn't update the date if we don't grab newer akka code from 2023 - this PR does not grab any 2023 akka code
Member
|
Merged, thanks |
Copilot AI
added a commit
to pjfanning/incubator-pekko-persistence-jdbc
that referenced
this pull request
Apr 28, 2026
Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko-persistence-jdbc/sessions/b8ecac9c-455d-49ad-b6c1-7397780899da Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
pjfanning
added a commit
to pjfanning/incubator-pekko-persistence-jdbc
that referenced
this pull request
Apr 28, 2026
Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko-persistence-jdbc/sessions/b8ecac9c-455d-49ad-b6c1-7397780899da Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
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.
Summary
Enhances the AI-drafted
DurableStateStoreTCK from #2833 to address the gapsdiscussed in #2831 — specifically optimistic-concurrency checks, serialization
roundtrip, and the deprecated soft-delete overload.
This PR supersedes #2833. The first three commits are @pjfanning's original
work cherry-picked unchanged; the fourth commit layers the enhancements on top.
Changes
Capability flags (
CapabilityFlags.scala)DurableStateStoreCapabilityFlagsextended with three new flags:supportsUpsertWithRevisionCheck— when on, asserts that an upsert witha stale revision is rejected and the prior state is preserved.
supportsSerialization— when on, asserts that values roundtrip throughthe configured Pekko serializer using the same
TestPayload(probe.ref)pattern as
JournalSpec. Defaults tooninDurableStateStoreSpectomatch the
JournalSpecconvention; the in-memory testkit reference TCKexplicitly overrides to
offsince the testkit holds raw refs.supportsSoftDelete— when on, asserts the deprecated single-argumentdeleteObject(persistenceId)overload deletes regardless of revision.Spec additions (
DurableStateStoreSpec.scala)accepts a fresh upsert at a higher revision after a delete.
preparePersistenceId(pid: String)hook called frombeforeEach,mirroring
JournalSpec. Plugins backed by external state (JDBC, NATS, etc.)can override this to clean residual records between tests.
timeoutpromoted toprotectedso subclasses can override for slowstores.
Reference TCK (
PersistenceTestKitDurableStateStoreTCKSpec.scala)Added an explicit
supportsSerialization = offoverride since the in-memorytestkit doesn't serialize values.
Docs (
persistence-journals.md+ doc-test files)Added a brief subsection in the
## Plugin TCKsection mirroring theJournal/Snapshot pattern, with
#durable-state-tck-scalaand#durable-state-tck-javasnippet markers.Deferred for follow-up
These ideas surfaced during this work but were deliberately scoped out:
upsertObjectisretrievable via
DurableStateStoreQuery.changes(...). Requires extending theTCK to cover the read-side query SPI.
value=Noneafter delete but not what
revisionshould be (impls differ; needs acommitter decision).
upsertObject(pid, N, sameValue, tag)forreplay safety.
DurableStateStoreBySliceQuery).DurableStateStorePagedPersistenceIdsQuery).Happy to open follow-up PRs once this lands.
Test plan
sbt scalafmtCheckAll— cleansbt persistence-tck/Test/compile docs/Test/compile— cleansbt "persistence-testkit/Test/testOnly *PersistenceTestKitDurableStateStoreTCKSpec"—6/6 required tests pass; 4 optional skip as expected (testkit doesn't enforce
OCC, doesn't serialize, has a no-op
deleteObject(pid)).Closes #2831.