GeezerVison is showing github.com — fleet kv: grants, survival archive, rebase, five-agent probe and hosted door (#13316) by dezren39 · Pull Request #15235 · developing-today/code
Conversation
dezren39
commented
Nov 25, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Refs #13316 (slices 6 to 9: acceptance 3, 4 and 6, plus the hosted kv door).
Before: fleet kv had no group databases, no survival archive and no way out of a conflict. Every central write went to the shared primary, and a session's unswept writes died with the host's disk.
After: a group database exists only when a kv_grants row authorizes it, and it takes inline bytes only. Unswept writes are checkpointed to a central survival archive and can be restored on a fresh host.
Grants (acceptance 4). The new grants module covers admission, revoke and placement, plus writes and reads that go through a provisioner.
- Unknown groups, ungranted namespaces and ungranted operations refuse fail-closed.
- With no grant, everything lands on the shared primary. No per-session database is ever provisioned.
- Over-threshold bytes addressed to a group refuse with
blob_requires_shared_primary. The check runs before the group database is touched.
Archive (acceptance 3). The new archive module checkpoints each full-identity partition's dirty set into the central kv_archive tables (migration 2), one transaction per checkpoint.
- Only inline payloads up to the effective threshold are uploaded. Larger values and working files are recorded with no bytes and reported as
protection_unavailable_needs_phase3.
- The local record moves only after the primary acknowledges the checkpoint, so a failed checkpoint stays due.
restore adopts archived rows as new local writes that sweep through CAS. Keys the store already has history for keep their local rows.
Rebase and the five-agent probe (acceptance 6). Before this, a key that lost a CAS stayed blocked_by_conflict forever, because nothing cleared the conflict mark.
sweep::rebase (and fleet kv rebase --namespace NS KEY) makes the central head the key's base, cancels the key's pending intents and queues one new intent for the overlay value. Per D007, that rebase is itself a new intent. After clear-override it queues nothing, and the key follows central.
load_probe.rs is the correctness-only fixture. It is not a latency or billing claim.
- Five agents write 1 to 10 keys per simulated minute into a seeded 10k-key namespace, with a hot set that collides. Each one sweeps and rebases.
- The probe checks that every agent drains, that each agent's final value for each key it wrote is a committed version by that agent, and that every losing body is one retrievable conflict.
- It also checks that history has no gaps and that the key count is unchanged.
- A second test polls
get every 250 ms and asserts that it never misses a version committed at least 1 s earlier, while list is always fresh.
CLI.
fleet kv backup is the same as fleet kv sync --archive.
- Plain
sync also checkpoints when the last checkpoint is over 15 minutes old. It prints a note on stderr that this is an online target, not a recovery point.
fleet kv restore --archive adopts this session's last checkpoint.
- All three refuse with
central_not_configured (exit 69) before the store is opened.
Hosted kv door (slice 8). fleet-hosted gains POST /v1/kv/v2/pipeline, so FLEET_KV_URL=https://<door>/v1/kv works without handing hosts the libSQL token.
- The Worker forwards only statements listed in
catalog.rs, mirrored as hosted-worker/src/kv-catalog.json. A Rust test fails if the two drift, and every SqlitePrimary call in tests asserts its SQL is in the catalogue.
- Owner and writer arguments must match the caller's binding, private scopes must carry the caller's
private:<hex>: prefix, and the scope must match kv_namespaces. Namespace and grant changes need the kv-admin role.
- The Worker runs migrations once per isolate. With no
KV_LIBSQL_URL the door answers 503 kv_primary_not_configured.
- Runbook:
book/operations/kv-central.md.
How: there is a new local schema v8 (kv_archive_local) and central migration 2. The new tests are central_grants_*, central_archive_*, central_sweep_rebase_*, central_five_agents_*, central_cli_backup_* and central_cli_rebase_*. docs/verbs.md is updated.
Generated by Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Important
Draft PR not reviewed
Draft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration:
reviews:
auto_review:
drafts: true
- 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.
dezren39
changed the title
fleet kv: explicit-grant group DBs and inline-only survival archive (#13316)
fleet kv: grants, survival archive, rebase and five-agent probe (#13316)
Nov 25, 2026
The central plane's only way in is POST /v1/kv/v2/pipeline on
fleet-hosted. A host's fleet kv client posts the Hrana transaction it
already builds (FLEET_KV_URL = https://<door>/v1/kv); the door forwards
it to the shared Turso primary under the Worker's own credential after
checking every statement:
- the body must be the client's exact BEGIN/statements/COMMIT/ROLLBACK
batch, and every SQL text must match an entry of the statement
catalogue (src/kv-catalog.json, generated from fleet-kv's new
catalog.rs; a Rust test keeps the copy equal, and in tests the
SqlitePrimary refuses any statement missing from the catalogue);
- owner and writer arguments must be the caller's tenancy binding id
for person and agent tokens (a kv-scoped service token is a host
daemon and is trusted inside its route scope);
- a scope must be the namespace's shared scope or the caller's own
private scope; private scope ids now carry the owner in hex
(private:<hex owner>:<hash>) so the door can check them;
- namespace definitions and grants need kv-admin;
- the door applies the catalogue's migrations itself, once per isolate.
Data-plane Turso tokens stay refused by the shared auth layer
(data_plane_credential_refused), now covered at the kv route. Health
reports kv.primary_configured; the book gains a central-plane runbook.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
dezren39
changed the title
fleet kv: grants, survival archive, rebase and five-agent probe (#13316)
fleet kv: grants, survival archive, rebase, five-agent probe and hosted door (#13316)
Nov 25, 2026
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.
|