Repository navigation
fix: Verify SDKs read all three persistent-store tombstone shapes - #484
Merged
Merged
Conversation
jsonbailey
force-pushed
the
jb/sdk-3174/tombstones-v3
branch
from
September 28, 2026 17:59
0d2eebd to
fa66cac
Compare
jsonbailey
changed the base branch from
v3
to
jb/sdk-3174/collection-cardinality-v3
September 28, 2026 17:59
jsonbailey
force-pushed
the
jb/sdk-3174/tombstones-v3
branch
from
September 28, 2026 18:49
fa66cac to
757c6d2
Compare
Base automatically changed from
jb/sdk-3174/collection-cardinality-v3
to
v3
September 28, 2026 18:55
Stacked on the cardinality port, whose no-data-source persistence helper this reuses.
jsonbailey
force-pushed
the
jb/sdk-3174/tombstones-v3
branch
from
September 28, 2026 18:55
757c6d2 to
832cdad
Compare
jsonbailey
marked this pull request as ready for review
September 28, 2026 18:55
keelerm84
approved these changes
Sep 28, 2026
joker23
pushed a commit
that referenced
this pull request
Oct 8, 2026
🤖 I have created a release *beep* *boop* --- ## [3.2.0-alpha.11](v3.2.0-alpha.10...v3.2.0-alpha.11) (2026-10-08) ### Features * adding client side bootstrap tests ([#462](#462)) ([9c1810d](9c1810d)) * Port client-side prerequisite cycle detection tests to v3 ([#473](#473)) ([7e65a58](7e65a58)) * port client-side streaming retry contract tests to v3 ([#475](#475)) ([f968442](f968442)) ### Bug Fixes * Verify all-items reads for empty and single-item collections ([#466](#466)) ([489a780](489a780)) * Verify SDKs read all three persistent-store tombstone shapes ([#484](#484)) ([a9a0696](a9a0696)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Release 3.2.0-alpha.11** — automated version bump only: `.release-please-manifest.json`, `versionString` in `main.go`, and a new `CHANGELOG.md` section. > > The changelog documents what ships in this alpha: **new contract coverage** for client-side bootstrap, prerequisite cycle detection (ported to v3), and streaming retry behavior; plus **harness fixes** for all-items reads on empty/single-item persistent-store collections and for all three persistent-store tombstone shapes. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1a2073d. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@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.
Ports the persistent-store tombstone-shape tests from
v2(#438) tov3. Jira: SDK-3174.What the cases cover
A tombstone is the record an SDK writes to a persistent store to mark an item
deleted. Version-based conflict resolution needs it: with no record at all, a
stale out-of-order update would bring the item back.
The store already addresses the record by key -- the Redis hash field, the Consul
key, or the DynamoDB sort key -- so the key inside the JSON body is redundant.
Our SDKs write three different shapes anyway:
{"version":N,"deleted":true}(no key){"key":"<real key>","version":N,"deleted":true}"$deleted"Any SDK can be pointed at a store a different SDK wrote, so a reader has to
handle all three. Each shape gets two cases:
still be readable (one unrecognized record must not spoil the whole
collection), the deleted flag must be absent from all-flags state, and asking
for it by key must look identical to asking for a flag that was never there
(
FLAG_NOT_FOUND).nothing, so the flag must serve
not-matched. The full-object shape carriesthe evaluation context in
included, so a reader that mistakes the tombstonefor a live segment serves
matchedinstead.Each case runs for Redis, Consul and DynamoDB.
Why this is a port and not a cherry-pick
v3restructured this suite, so the wiring fromv2does not apply:t.Run("daemon mode", ...)store mode %s - no data source/- with data source, looped overdatabaseModesSetStore,SetCacheSetStoreMode(servicedef.DataStoreMode)v2hung these cases off thedaemon modesubtree. Onv3the equivalentconfiguration is "no data source": nothing but the store populates data. Rather
than reach into the
databaseModesloop, the cases sit in their own top-levelt.Run("tombstones", ...)next tot.Run("read-write", ...), matching theplacement of the sibling cardinality port in #466.
Store mode governs the write path. With no data source there is nothing to
write, so read mode is the only mode these cases need. That is also what
v2got implicitly -- its
daemonModePersistenceset no store mode, andv3defaults
StoreModetoDataStoreModeRead.All helpers the
v2file depended on exist unchanged onv3(
runWithEmptyStore,initialFlags,defaultPrefix,WriteMap,EvalAllFlagsStateMap,makeFlagToCheckSegmentMatch,pollUntilFlagValueUpdated). Only the import paths changed fromv2tov3.Overlap with #466
v2named its store configurerdaemonModePersistence, which does not fitv3's vocabulary. This branch renames it touncachedReadModePersistence,identical in name and body to the one #466 adds.
#466 has not merged yet, so both branches define it. Whichever merges second
must delete its copy -- the two helpers are byte-identical, so it is a delete,
not a reconciliation. Because they live in different files it will surface as a
duplicate-symbol build failure rather than a text conflict, so it is worth
watching for.
Red/green evidence
A/B against the Ruby SDK, which had a store wrapper that keyed its all-items
read off the key inside the record body. A keyless tombstone therefore lands
under an empty key and corrupts the collection.
Before (
items_out[item[:key].to_sym]):Both failures report the same thing -- all-flags came back as a failed read that
served nothing, so the live flag was gone too:
After (
items_out[db_key[prefix.length..].to_sym]):Redis passes on both sides. Full persistence suite on the fixed build, to
confirm the new subtree does not disturb the existing ones:
141 total, 14 skipped, 127 ran, all passed. The 14 skipped are the siblingtop-level suites excluded by the
-runfilter; nothing insidepersistent data storeskipped.Two cases cannot fail for the keying bug
Worth stating so nobody reads a green as a signal it is not:
segment by key, so nothing in those cases triggers an all-segments read --
which is the only thing this bug class affects. Confirmed above: the buggy
build passes all three segment cases and fails only the flags one.
$deletedfull-object shape. For a deleted item, a body-keyed storefiles it under
$deletedand a store-keyed one files it under the real key.Either way the deleted-filter drops it, so the result is identical. Verified
empirically against live Consul.
They are included anyway, because they are cheap guards against parse failures
and resurrection bugs, which are real and distinct defect classes. No assertion
was added to try to make them detect the keying bug.
gofmtandgo vetclean.Note
Overview
Adds a tombstones subtree to the v3 server-side persistent store harness (alongside collection cardinality), ported from v2. The suite seeds Redis, Consul, and DynamoDB with each of the three cross-SDK tombstone JSON shapes—keyless
{"version", "deleted"}, body key repeating the store key, and full objects whose inner key is"$deleted"—then runs with no data source and uncached read mode so reads come straight from the store.Flag cases assert a tombstone next to live flags does not break the collection, the deleted key is missing from all-flags state and metadata, and single-flag evaluation returns the default with
FLAG_NOT_FOUND. Segment cases use a flag that would match if the tombstone were treated as live; evaluation must stay not-matched, including when the full-object shape embeds the context inincluded.Also adds
requireFlagAbsentFromAllFlagsto guard both flag values and$flagsStateentries for deleted keys.Reviewed by Cursor Bugbot for commit 832cdad. Bugbot is set up for automated code reviews on this repo. Configure here.