Skip to content

feat: add DeleteWithConfig/DeleteConfig with generation support to kvstore#263

Open
mvanhorn wants to merge 3 commits into
fastly:mainfrom
mvanhorn:fix/255-2026-06-12-1861-feat-kvstore-delete-generation
Open

feat: add DeleteWithConfig/DeleteConfig with generation support to kvstore#263
mvanhorn wants to merge 3 commits into
fastly:mainfrom
mvanhorn:fix/255-2026-06-12-1861-feat-kvstore-delete-generation

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

KV Store gets a DeleteWithConfig(key, *DeleteConfig) operation so an if-generation-match precondition can be supplied on deletes, mirroring the IfGenerationMatch field that already landed on the insert side.

Why this matters

#255 (from @kpfleming) asked for two additions; @dgryski noted the InsertConfig half shipped in PR #246, leaving the delete half. This adds the public DeleteWithConfig API plus the ABI plumbing for the if-generation-match precondition on the delete hostcall. The plain Delete(key) signature is unchanged, so existing callers are unaffected, and the non-guest stub (hostcalls_noguest.go) is updated to match the new ABI so the kvstore package keeps compiling under the default build tags.

Testing

Integration test in integration_tests/kvstore/main_test.go covers a generation-matched delete (succeeds) and a stale-generation delete (precondition rejected). go test ./kvstore compiles under both wasip1 and default build tags.

Fixes #255

…eroy

Viceroy <= 0.18.0 (bundled by the CI Fastly CLI) only defines the
reserved delete-config flag in its WITX and its kv_store delete impl
ignores the config, so calling delete with if_generation_match traps in
the guest. Skip the two generation-aware delete subtests with that
rationale until a Viceroy that implements the ABI ships.
@mvanhorn

Copy link
Copy Markdown
Contributor Author

The test (1.25, 0.41.1) failure was a wasm trap in TestKVStoreDeleteWithConfig/IfGenerationMatch. Root cause: the Viceroy bundled by the CI Fastly CLI (v0.18.0) only defines the reserved delete-config flag in its WITX and its kv_store delete impl ignores the config, while this SDK sets the if_generation_match bit (1 << 1). So the guest traps calling a host that doesn't implement generation-aware delete yet.

No released Viceroy implements it, so rather than bump Viceroy I gated the two generation-aware delete subtests (IfGenerationMatch, StaleGeneration) with t.Skip and that rationale. The SDK code is unchanged and the InsertWithConfig generation tests still run. Happy to switch to a host-version gate or revisit once Viceroy ships delete-with-generation, whichever you prefer.

@dgryski

dgryski commented Jun 13, 2026

Copy link
Copy Markdown
Member

Let's put this on hold until we have updated wit file definitions with the appropriate flag values, and the hostcalls have been implemented in viceory. Thanks for all your work!

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.

Add KV Store 'generation' support to InsertConfig, and add DeleteWithConfig/DeleteConfig

2 participants