GeezerVison is showing github.com — fleet kv: central plane, durable sweep and libSQL pipeline client (#13316 slices 1-3) by dezren39 · Pull Request #15214 · developing-today/code
Conversation
dezren39
commented
Nov 25, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Before: the fleet kv central plane did not exist. Local writes queued sweep intents in the outbox, and nothing ever sent them anywhere.
After: fleet-kv has a central plane. A session's queued writes can be swept into it by per-key compare-and-swap, with idempotency receipts written in the same transaction, so a retransmit replays instead of applying twice or turning into a false conflict. The central plane can be an in-process SQLite primary (tests, model) or a libSQL HTTP pipeline endpoint.
This is #13316 Phase 2, slices 1-3. The CLI does not use it yet; that comes next (sync, --global, namespace cache).
How:
- Slice 1,
central: migration 0001 adds kv_namespaces, kv_heads, kv_versions, kv_conflicts, idem_receipts and kv_grants. The Pipeline trait runs a list of statements as one transaction. CAS runs in a single transaction that never branches on the client: it inserts the receipt (outcome decided from the head inside the transaction, stamped with a per-attempt nonce), then appends the conflict, version and head rows only when the receipt carries this attempt's nonce, then reads the receipt back. The same key with a different body is idempotency_key_reuse. Retries are bounded (5 attempts, jittered backoff capped at 1 s). Private scope ids are hashes of (owner, context). Namespace resolution names its registry, gives unknown_namespace when missing, and never falls back.
- Slice 2,
sweep: local schema v5 adds the host incarnation, each key's central base and local receipt copies. The sweeper holds the same local lock as clear-override from the pending check until the decision is recorded. A lost answer leaves the intent pending, and the next sweep replays it. A conflict holds that key's later intents (blocked_by_conflict). Values over the namespace threshold stay local (pending_needs_phase3).
- Slice 3,
http (default feature): each transaction is one Hrana batch (BEGIN IMMEDIATE, each step conditioned on the previous, COMMIT, ROLLBACK unless the commit ran). The URL comes from FLEET_KV_URL, with no default host, and the bearer from FLEET_KV_TOKEN_FILE. Only https is allowed, except on loopback. Refusals are typed, including data_plane_credential_refused.
Tests (cargo test -p fleet-kv central):
- a sequential-oracle property test (CAS linearity, retransmit idempotence);
- a five-writer, file-backed race (contiguous versions, conflicts equal losers);
- retransmit after the head moved, same id with a different body, scope isolation, and tombstone replay that never resurrects;
- a lost answer during sweep replays;
- clear versus sweep;
- over-threshold and unknown-namespace holds;
- CAS through a local Hrana server.
Refs #13316
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…efinitions (#13316 slice 1)
Adds the Phase 2 central module: migration 0001 for kv_namespaces,
kv_heads, kv_versions, kv_conflicts, idem_receipts and kv_grants; a
Pipeline trait whose one transaction both the libSQL primary and the
in-process SqlitePrimary run; per-key CAS that decides, records and
applies in one transaction keyed by a per-attempt nonce, so retransmits
replay and a reused key with another body is idempotency_key_reuse;
bounded jittered retries; private scope ids; namespace resolution that
never falls back across registries. central_* tests include a
sequential-oracle property test and a five-writer file-backed race.
Refs #13316
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local schema v5 adds the host incarnation, each key's central base and
local receipt copies. The sweeper takes the same local lock as
clear-override, re-checks the intent is pending, submits one CAS keyed
by (writer, host incarnation, outbox id) and only then records the
receipt, advances the base and acks. A lost answer leaves the intent
pending and the next sweep replays the recorded result. Conflicts hold
the key's later intents (blocked_by_conflict); over-threshold values
stay local (pending_needs_phase3); unknown namespaces wait.
Refs #13316
Co-Authored-By: Claude Opus 5.5 <[email protected]>
HttpPipeline sends each transaction as one Hrana batch (BEGIN
IMMEDIATE, each statement on the previous step's success, COMMIT, and
ROLLBACK unless the commit ran), so a failed step can never commit
part of a CAS. The endpoint comes from FLEET_KV_URL (no default host)
and the bearer from FLEET_KV_TOKEN_FILE; https only, except loopback.
Unreachable and 5xx/429 answers are retryable; refusals are typed,
including data_plane_credential_refused. Behind the default http
feature. Tests run CAS through a local Hrana server.
Refs #13316
Co-Authored-By: Claude Opus 5.5 <[email protected]>
coderabbitai
Bot
commented
Nov 25, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 11 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ec073f77-844f-4903-bbfa-c44cc450d580
Commits
-
Reviewing files that changed from the base of the PR and between e3aeda4 and c86d923.
Files ignored due to path filters: 1
-
pkgs/fleet/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 6
-
pkgs/fleet/crates/fleet-kv/Cargo.toml
pkgs/fleet/crates/fleet-kv/migrations/0001_central.sql
pkgs/fleet/crates/fleet-kv/src/central.rs
pkgs/fleet/crates/fleet-kv/src/http.rs
pkgs/fleet/crates/fleet-kv/src/lib.rs
pkgs/fleet/crates/fleet-kv/src/sweep.rs
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|