Repository navigation
Add native celld KV through an EdgeZero store service on stock celld - #422
ChristianPavilonis wants to merge 32 commits into
Conversation
5426ea6 to
d475727
Compare
…ck celld The celld providers depended on a scoped listener compiled into a modified celld. Stock celld only exposes storage to Worker code deployed into it, so EdgeZero now ships that code: services/celld-store, a Worker plus one SQLite Durable Object per namespace, deployed with `celld deploy` onto the official release. - Each mutation applies in one SQLite transaction and records its client mutation ID. Stock celld resends a buffered Durable Object call after a pooled peer tunnel fails even when the owner already ran it; the ledger answers that resend with the first outcome. An apply-before window keeps a call held through cell recovery from applying long after the client gave up. - Responses carry a new protocol header and a store instance ID, so forked servers and reset stores fail instead of answering. - Mutations are POST /put and /delete with a fresh 128-bit ID; the client still never resends. - Remove the celld config provider and the fork-only v1 record API. - Replace the modified-celld runner and namespace isolation script with a generated-consumer proof against official celld behind a TLS proxy, and a two-node fleet proof that reproduces the resend and an owner takeover.
… tokens Review follow-ups for the store service: - A 404 counts as an absent key only when the store instance header is present. A routing 404, such as from a proxy that rewrote the path, is now malformed instead of silently reporting existing keys missing. - The Worker accepts any ASCII graphic token, including commas, and still rejects repeated Authorization headers by grammar. - The Kubernetes deploy recipe maps index.js back under src/, because ConfigMap keys cannot contain "/". - The spec no longer claims to detect a rollback to an older snapshot of the same store.
|
For the identity integration branch (#495), I pushed |
|
For the identity integration branch (#495), I pushed |
|
For the identity integration branch (#495), I pushed |
|
Review follow-up: 95359e9, scoped to #422 against #414 at 2b13a66.
The celld-config-only lint modes no longer exist. Extra single-feature lint jobs and a portable macro change are deferred. The three Wasm dependency graphs exclude celld and reqwest; Cloudflare already has Tokio through Follow-up test-only commit 47d19ae fixes a shadowing lint in the new limits regression. Local workspace tests (2,983 passed, 7 ignored), strict workspace Clippy, workspace feature compilation and the Spin Wasm check passed. |
aram356
left a comment
There was a problem hiding this comment.
PR Review
Summary
Found while reviewing the rc/identity integration branch (#495) and traced to this PR. Each finding was re-checked at this head (47d19aed); line numbers refer to it.
Requesting changes for the missing CHANGELOG entry.
Findings
Blocking
- 🔧 CHANGELOG:
## Unreleasedhas no entry for the native celld config and KV stores, or for the EdgeZero store service on stock celld. #414 added an entry for the AWS stores; this needs the same.
Non-blocking
- 🤔 After a store reset, ordinary KV writes commit but every later call reports
InstanceChanged. Seestore-celld/src/kv.rs:70. - 🤔 Port race in
native_celld_startup. Seenative_celld_startup.rs:145. - ⛏
CLAUDE.mdstill describes an "eight-crate production Cargo workspace" and does not listedgezero-store-aws(#414) oredgezero-store-celld. With both it is ten.
CI Status
- GitHub reports no checks at
47d19aed.
| .execute(method, url, body, cap, deadline, kind) | ||
| .await?; | ||
| if let Some(observed) = instance | ||
| && *self.instance.get_or_init(|| observed.clone()) != observed |
There was a problem hiding this comment.
🤔 After a store reset, ordinary KV writes commit but every call reports InstanceChanged, permanently
Ordinary KV requests carry no expected-instance header, so the service executes the write on the new instance. Only then does this check compare the response's instance with a OnceLock that never resets. The write took effect, the caller gets an error, and nothing recovers short of a restart. Either send the expected instance on ordinary writes too, so the service refuses them before committing, or document the restart requirement.
There was a problem hiding this comment.
Addressed in 7521796 with docs and a test. The service has no expected-instance precondition for ordinary KV requests at this head, so a protocol change would not fit here. The PreparationError::InstanceChanged doc comment and a new "Store resets" section in native-celld-stores.md now state three things: the handle never re-pins, every later call fails until the app restarts, and a write that returned the error may already have committed. a_write_from_a_new_instance_commits_and_later_calls_keep_failing pins that behavior so the docs stay true.
|
|
||
| impl Host { | ||
| fn spawn(root: &Path, bindings: &Path, initializer_gate: bool, supply_state: bool) -> Self { | ||
| let listener = TcpListener::bind("127.0.0.1:0").expect("reserve app address"); |
There was a problem hiding this comment.
🤔 Bind :0, release, hand to a child: the port race #519 fixed elsewhere
CI runs these tests in parallel, and no_listener() probes the released port, which another test's listener can take in the gap. Reuse the reserved_address() lock from production_hosting.rs.
There was a problem hiding this comment.
Fixed in 9adf6ea. Host::spawn now holds a bound, non-listening TcpSocket reservation under the same RESERVE_OR_SPAWN lock pattern as production_hosting.rs. Failure tests keep the port until Host drops and also assert the host never reached startup bind. The happy path releases the port just before letting the initializer finish. With that release commented out, the happy path fails with "host exited before readiness", which confirms the reservation really blocks the bind.
The workspace has ten members since edgezero-store-aws and edgezero-store-celld joined it.
A released port could be taken by a parallel test's listener before the no-listener check ran. Reuse the reservation and spawn lock from production_hosting.
Ordinary KV writes carry no expected instance, so a write can commit on the new instance and still fail; the handle keeps its first instance until restart. Pin that with a unit test.
Covers the celld-kv feature, binding settings, startup behavior, limits and the EdgeZero store service on stock celld.
|
Body findings from the review:
|
prk-Jr
left a comment
There was a problem hiding this comment.
PR Review (follow-up)
Summary
Reviewed head 3791a465 against the merge base with issue-410-native-store-providers (2b13a665). The move to stock celld with an in-repo store service is a real improvement: no fork, a pinned and attested release, a mutation ledger committed in the same transaction as the write, and a store instance header the client requires. Every blocking item from my last review and from aram356's original review is fixed in the code.
The latest four commits also address everything aram356 raised on 47d19aed: the CHANGELOG entry, the documented reset behaviour with a test for it, the port reservation and the CLAUDE.md crate list.
I'm requesting changes for one merge-readiness item, not for a defect in the provider. The branch no longer merges into its base. The base moved to f1f18b8a minutes after 47d19aed was pushed, and the resolution of one of the conflicts changes runtime behaviour (see inline).
😃 Praise
- The duplicate-delivery ledger is committed in the same SQLite transaction as the write, and it is checked before the apply-before window, so a late resend of an already-applied write still gets its first outcome (
index.js:702-711). I removed the ledger lookup as a check, anda duplicate delivery applies once and returns the first outcomefails (503 instead of 204), so the test really covers it. - The Rust and JS key contracts match exactly: 512 UTF-8 bytes, no Unicode
Cccontrols, form encoding in both directions (+decodes to a space,index.js:129), a strict UTF-8 decoder that keeps a leading BOM, and code-point order on both sides of the pagination check.
Prior findings status
My review on bb56cfe1:
- ✅ 🔧 Unguarded celld
--libsteps: every celld and axum invocation now runs throughrun_test_nonzero.shwith a sentinel per feature mode, and the mixed run requires three sentinels (test.yml:201-207). - ✅ ⛏ Bare
[limits]accepted: rejected again (native_bindings.rs:333-339), and covered by the CLI shared-rejection test. - ✅ 🤔 Isolation probes that could not fail: the script was removed along with the fork design.
- ✅ ⛏ Timeout test passed with a direct-child kill: the fixture parent now ignores SIGTERM, so only the group kill can reap the descendant (
run_native_celld_integration.test.mjs:95-118). - ✅ ⛏ Guide limits wording: the keys are listed and "setting both fails startup" is stated (
native-celld-stores.md:178-188). - ✅ ⛏ Plan doc paths: corrected, and the personal paths are gone.
aram356 on f9b0f20c (I carried these forward last time):
- ✅ 🔧 Oversized value returned 503: the local cap now returns
InvalidResource, which maps toKvError::Validation(kv.rs:125-129). The public handle test covers it. - ✅ 🔧 Dependency script passed when
cargo treefailed: fixed with|| returnand|| exit 1(check_native_store_dependency_contract.sh:35,41,62). The script passes locally. - ✅ 🔧 Generated proof ran the wrong binary: delete now runs before the coexistence build (
celld_generated_proof.rs:533-537). - ✅ 🔧 Startup suites not nonzero-guarded: fixed, see above.
- ✅ ❓ Unreleased celld API: the provider now targets stock v0.6.3, and CI checks the archive checksum and attestation.
- ✅ ❓ Query-string key decoding: the service is in the repo and decodes with form rules, matching
append_pair.
aram356 on 47d19aed:
- ✅ 🔧 CHANGELOG: added as "Native celld KV on Axum" (
CHANGELOG.md:17-37). - ✅ 🤔 A write commits, then reports
InstanceChanged: now documented on the error variant, in the guide's "Store resets" section and in the CHANGELOG, and pinned bya_write_from_a_new_instance_commits_and_later_calls_keep_failing. The behaviour itself is unchanged, which is a reasonable choice for v1. See my follow-up on the guide below. - ✅ 🤔 Port race in
native_celld_startup: the port stays bound until the host may bind it, and reservations and spawns are serialized. - ✅ ⛏ CLAUDE.md crate count: fixed.
Findings
Blocking
- 🔧 Conflicts with the updated base, and the capability check needs a real resolution: see the inline comment at
native_bindings.rs:670. In short,git merge-treeagainstf1f18b8areports conflicts in 7 files. If the base's newmissing_feature()is kept as it is, celld-only KV builds stop working. Please also move the new CHANGELOG entry next to the base's "Native AWS stores on Axum" entry when you merge.
Non-blocking
- 🤔 After a restart the app silently adopts the reset store: the guide's "fails rather than mixing" and "restart after any reset" say nothing about this (inline at
native-celld-stores.md:88). - 📝 The new CI steps have never run on GitHub: GitHub reports no runs for
3791a465or47d19aed. The last hosted run on this branch is at57fd4eab, which is before the stock-celld rewrite. So the release download, the checksum and attestation check, and the TLS proof against the official release are unproven in hosted CI. Please make sure they run green after the forward merge.
CI Status
- Hosted: GitHub reports no checks or workflow runs for
3791a465(nor for47d19aed). The last hosted runs on this branch are for57fd4eab. - Local, Rust 1.98.1, on
47d19aedwith the delta re-run on3791a465:cargo fmt --all -- --check: PASS- clippy
-D warnings: PASS foredgezero-store-celld,edgezero-adapter-axumandedgezero-cliwith--all-features. Also PASS for celld with no features and withkvonly, and for axum withnative-bindingsonly. edgezero-store-celld: all features 34 passed,kvonly 33 passed.- axum
native-bindings --lib: 26 passed. Mixedaws-stores,aws-dynamodb,celld-kv: lib 444 passed (1 ignored),native_aws_startup6 passed,native_celld_startup4 passed. edgezero-cli --all-targets: 814 passed, 6 ignored.check_native_store_dependency_contract.sh: PASS.- Node runner and fleet suites: PASS.
service.test.mjs: 17/18 passed on my local Node 24.12. The one failure is the value round-trip test: this Node'snode:sqlitebinds anArrayBufferas NULL (I reproduced that standalone). This looks like a local Node-version issue, not a PR defect, since the pinned toolchain is 24.20.
- Not run: the official-celld TLS proof (needs Linux and the release binary), the fleet proof (needs Docker), the workspace-wide test run, and the wasm checks.
| if (!bindings.config.is_empty() && !capabilities.appconfig_agent) | ||
| || (!bindings.secrets.is_empty() && !capabilities.secrets_manager) | ||
| || (!bindings.kv.is_empty() && !capabilities.dynamodb) | ||
| || bindings.kv.values().any(|binding| match binding { |
There was a problem hiding this comment.
🔧 This branch no longer merges into its base, and this check is where the resolution matters
issue-410-native-store-providers moved to f1f18b8a ("Address native AWS store review feedback") right after this head was pushed. git merge-tree against it reports content conflicts in 7 files:
.github/workflows/test.ymlnative_bindings.rsnative_stores.rsrun_options.rsedgezero-cli/src/args.rsdocs/guide/adapters/axum.mddocs/guide/native-aws-stores.md
This line is not a mechanical conflict. The base replaces this check with capabilities.missing_feature(bindings).is_some(), and NativeProviderCapabilities::missing_feature tests !bindings.kv.is_empty() && !self.dynamodb, which returns "aws-dynamodb". native_stores.rs on the base then appends enable Cargo feature aws-dynamodb`` to the startup error.
If the resolution keeps that helper as it is:
- A
celld-kvbuild withoutaws-dynamodbrejects every celld KV binding asUnsupportedProvider. That breaks the generated celld-only target this PR proves. - A build missing
celld-kvtells the operator to enable the wrong feature.
Fix: merge the base, then make missing_feature match on the actual variant, the way this line does:
} else if let Some(binding) = bindings.kv.values().find(|binding| match binding {
NativeKvBinding::DynamoDb(_) => !self.dynamodb,
NativeKvBinding::Celld(_) => !self.celld_kv,
}) {
Some(match binding {
NativeKvBinding::DynamoDb(_) => "aws-dynamodb",
NativeKvBinding::Celld(_) => "celld-kv",
})
}Then route the selection check through it, and add a celld case to capabilities_follow_actual_variants that asserts the hint. I'll re-review the resolution.
| 2. Write the policy into `vars.EDGEZERO_STORE_POLICY` as a JSON string. | ||
| 3. Run `celld deploy <dir> --bucket s3://<fleet-bucket>`. Nodes adopt the new version within `CELLD_DEPLOY_POLL_S` (default 30 seconds) without restarting. | ||
|
|
||
| Keep the template's `name`, binding and class name. celld derives each Durable Object's identity from the script and class names, so a rename reaches new, empty storage. The client notices the changed store instance and fails rather than mixing old and new data; see [store resets](#store-resets). |
There was a problem hiding this comment.
🤔 After a restart, the app adopts the reset store without any signal
The new "Store resets" section explains the running-process side well. The other side is missing. The pin lives in a per-handle OnceLock, set from the first response (kv.rs:72-76). Preparation makes no probe, and nothing persists the expected instance. So once the operator follows "restart the application after any reset", the app pins whatever instance answers first and serves from the new, empty storage with no error.
For the rename case this line describes, the client does fail rather than mix data, but only until the restart the guide then asks for. After that, an accidental rename or wrong bucket looks exactly like an empty store.
Suggestion: say so explicitly here and in "Store resets": "after a restart the app adopts the new instance; confirm the reset was intended first". Optionally plan an expected_instance binding field, sent as a request header so the service refuses before committing. That would also remove the commit-then-fail write path.
| if (body !== null && body.length > LIMITS.maxValueBytes) fail("limit_exceeded"); | ||
| const print = await fingerprint(meta, body); | ||
| const outcome = this.storage.transactionSync(() => { | ||
| const prior = this.sql |
There was a problem hiding this comment.
😃 The ledger lookup, the apply-before check and the write all run in one transactionSync, with the lookup first. A celld peer-tunnel resend that arrives after the window still gets the first outcome instead of a spurious deadline. I removed this lookup as a check, and the duplicate-delivery test fails, so the protection is really tested.
| // Only the store itself can report a key as absent or present. A 404 | ||
| // from routing, such as a proxy that rewrote the path, has no instance. | ||
| let logical_miss = missing && (method == Method::HEAD || kind.optional()); | ||
| if (success || logical_miss) && instance.is_none() { | ||
| return Err(PreparationError::Malformed); | ||
| } |
There was a problem hiding this comment.
😃 Requiring a store instance before a 404 counts as a miss closes the "routing 404 looks like an absent key" gap dhruv8sh raised earlier, for both GET and HEAD. A proxy that rewrites the path now surfaces as an error instead of an empty read.
Current state: KV on official celld, no modified build
Head
15bdeef6. This PR no longer depends on a modified celld. The scoped listener compiled into celld is gone; live KV now goes through an EdgeZero-owned store service that the official celld release runs as an ordinary application.Why. Stock celld only exposes storage to Worker code deployed into it, so EdgeZero ships that code:
services/celld-store, a Worker plus one SQLite Durable Object per namespace, deployed withcelld deploy. Spec:docs/superpowers/specs/2026-11-16-stock-celld-store-service-design.md.What changed in this update
services/celld-store/(single module,no_bundle, no npm dependencies). Every mutation applies in one SQLite transaction and records the client's mutation ID. Stock celld resends a buffered Durable Object call after a pooled peer tunnel fails, even if the owner already ran it (send_innerincrates/celld/main/peer_tunnel.rs, v0.6.3); the ledger answers that resend with the first outcome. An apply-before window stops a call held through cell recovery from applying long after the client gave up.x-edgezero-store-version: 1, a store instance header on every object response, mutations asPOST /putandPOST /deletewithx-edgezero-mutation-id. Forked servers and reset stores fail instead of answering. The client still never resends.celld-configprovider and the fork-only v1 record API (recordsfeature). Records will come back on this service through the record-contract work.For review: each namespace is one Durable Object. Every write for a namespace is serialized on one node and waits for durability, that node carries all of that namespace's traffic, a node failure pauses the namespace until takeover (10 s lease by default), and sharding later would be a storage format change.
Evidence (official celld v0.6.3, binary SHA-256
eb0a8158421b69d68dd5d28f2298a7d411dde498295833deeb1cc5ce53b7eb75, release attestation verified):node --testservice, runner and fleet-script suites: 17, 9 and 4 passed.edgezero-store-celldsettings / kv / all-features: 4 / 32 / 32 passed. Axumnative-bindingslib 25,celld-kvstartup 4, mixed AWS+celld lib/startup 442 + 5 + 4 passed.cargo clippy --workspace --all-targets --all-features -D warnings, focused feature-combo Clippy,cargo fmt --check, strict rustdoc for the changed crates, dependency isolation script.node scripts/run_native_celld_integration.mjs: generated consumer againstcelld devrunning the service behind a TLS proxy, authenticated. Binary and empty values, listing, 61-second TTL expiry, restart, rejected token.node scripts/run_celld_store_fleet_proof.mjs: RustFS 1.0.1 container, two nodes. A reply dropped after the owner ran a put made celld resend it; the client got 204 and the value applied once. kill -9 of the owner, then takeover: all acknowledged writes present.Not done here: forward merges into #439 and the rest of the stack, record endpoints on the service, Trusted Server #1537 fixture changes, new RC tags, and the #437 issue text (it still lists config).
Previous description (modified-celld design, superseded)
Current review readiness
Combined head:
1c90b246af22dad4e38899c8a12a0f81cb2c6fed. This PR includes native config snapshots, ordinary KV and optional conditional/physical record operations. Therecordsfeature remains default-off and requires the additive celld record-server extension. Ordinary KV does not acquire CAS semantics.Local checks pass on the combined tree:
Fresh hosted CI and review of the enlarged scope are pending. Existing review feedback remains open; earlier approvals and receipts do not cover the added record feature. Historical checkpoints below describe only their recorded inputs. No deployment, release-tag update or main merge is included.
Current review-stack checkpoint
Publication head:
f9b0f20c6857d2e638bcfe7bf1edaa5af5425bfb. This cleanup preserves the existing feature unit and PR identity. The additional change is the completed generated-native build correction: image-only code now follows the scaffold's existing Fastly-example selection, with no request-policy change. Its focused generator/native proof is retained; fresh per-branch hosted checks are not assumed green.Review order: #275 → #406 → #407 → #409 → #414 → #422 → #439 → #454. Draft integration checkpoint: #462. New SDK/group/codec/phase development and unrelated TS work are not prerequisites or additions to this PR. Earlier notes below retain their original tested revisions and limits; they are not a whole-tree pass for this new head.
Earlier implementation and proof notes
RC refresh checkpoint, 2026-11-10
Current head:
d475727691e2a80ca2dbb324568283f63e34a870.The five celld-only donor commits are replayed onto updated #414, without obsolete hosting or diagnostic ancestry. Config/KV source selection stays typed and feature-isolated; startup snapshots are bounded and KV preserves exact keys, prefixes, continuation and expiry rules.
Feature proof passes 38 celld cases, independent settings/config/KV suites, 478 Axum unit, 6 mixed AWS startup and 4 celld startup cases, CLI/isolation/runner checks and scoped strict Clippy. Independent provider source review found no confirmed defect. Lower namespace/CI fixes are merged and all five locked fetches pass.
Ordinary KV is not conditional create/CAS/atomic RMW or identity-allocation qualification. Optional conditional/physical records provide separate Add, Overwrite and generation-match operations without changing ordinary KV. Prepared celld KV does not prove runtime connectivity/grants, and snapshots are not atomic across documents. Production identity-allocation and fleet acceptance remain separate gates.
Draft pending fresh hosted checks and the combined RC audit. Two unchanged native default-parallel deadline misses remain recorded and unclassified; serial passes and untouched-foundation parallel passes do not clear them. No timing bound was relaxed. No deployment, main merge, security-alert dismissal or review-thread resolution occurred. Historical design/review context follows.
Summary
Changes
edgezero-store-celldedgezero-adapter-axumedgezero-cliand generated Axum manifestCloses
Closes #437.
Related to #410 and stacked on #414. This is store-provider work, not the celld HTTP runtime adapter in #421.
Dependencies and draft status
issue-410-native-store-providers, currently draft Add native AWS store providers #414.f72ae21a515859570622ac9d6ca9c19cf6870b81. Records additionally require the conditional-record server extension withx-celld-record-version: 1; the original listener does not support records. The companion celld changes are not published by this PR.Test plan
cargo test --workspace --all-targets: 2,028 passed, 6 ignored. Ignored acceptance tests listed below were explicitly selected separately.cargo clippy --workspace --all-targets --all-features -- -D warnings, with focused Clippy follow-ups for the final test-only additions.cargo fmt --all -- --checkandgit diff --check.cargo check --workspace --all-targets --features "fastly cloudflare spin".wasm32-wasip2check passed; full Fastly and Cloudflare target builds were not executed.examples/app-demofull workspace tests. Both excluded consumer lockfiles passed offline locked metadata validation; reusablefixture-axumcheck passed.edgezero serve --adapter axum. Production-runner and generated native binaries were exercised instead.All Cargo verification used offline locked dependencies after reviewed lockfile updates. The workspace test runner needed stdin closed because existing consent tests assume noninteractive CI. No test was excluded to resolve that run.
The real-service command requires an explicit modified binary and uses only disposable state and dummy credentials:
The implementation plan records the tested source/binary fingerprints and proof limits. No real AWS/fleet credentials or production deployment were used.
Checklist
CLAUDE.mdconventions.edgezero_coretypes.Owned follow-up review checkpoint
ef1d4ab59427642ef26b0a30d679a068f040157e. Source tree43174231bb50d19072f33ed7a19734b5bae8c966is byte-identical to previous headbb56cfe142965bea6c997d0d2e288e2698f8ee64.