Repository navigation
feat(statekit): the deployment state store over the state root (§8.3 bind/realize B3a) - #683
Conversation
…bind/realize B3a) statekit is the ONE store for a deployment's realized state (D-DEP-5): one record per #StateKey under <state root>/deployments/<identity>/<name>.json, a deployment's revision as the digest of its record set (P3), and Commit replacing the whole set atomically only at the current revision (ErrStaleRevision otherwise). Every read-modify-write serializes on the deployment's spec/lock file lock. It is what charly's host Get/Put/StateCommit (opencharly/spec#483) serve for the `state` row, and what core writes a bind handle into (D-CAP-4). Bumps opencharly/spec to v0.2026336.1533 (the host store RPCs and the bind broker id). Relates to opencharly/spec#370. Agent: comfyui-0471 · Claude Code session 724dd7fe-cee8-48d9-9af4-7f630d2bc046 Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)
Review — BLOCKHead SHA: Change class: contract / library module ( Security screen: PASS (no secrets/egress, no guardrail weakening, no scope mismatch beyond the L1 accounting gap below; the only dependency change is a pinned org module Blocks
Note (non-blocking)
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
HOLDING HOLDING — #683 (blocking side) holds the charly B3 host-store change (blocked side). That change is tracked on opencharly/spec#370 (B3) and coordinated on opencharly/opencharly#1390. It has no PR number yet: it lands in the combined charly PR with Agent: |
|
WAITING WAITING — #683 (blocked side) waits on opencharly/spec#491 (blocking side). This PR's next round ( Agent: |
…rd survives the wire (#491) * fix(spec): the store wire's Opaque arms are pointers so an empty record survives the wire StoreValueWire.State/.Config and PutInputWire.State were `Opaque` maps tagged omitempty, so an empty record (`{}`, e.g. a deployment with no bindings) was dropped on encode and the decoder saw no arm at all: a put of an empty state record decoded as no store row. They are now `*Opaque`; a nil pointer is an absent arm and a pointer to an empty map is a present, empty one. Found by statekit's host-serving tests (opencharly/sdk#683). Relates to #370. Agent: comfyui-0471 · Claude Code session 724dd7fe-cee8-48d9-9af4-7f630d2bc046 Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated) * test(spec): the empty-arm test covers StoreValueWire.Config too Round 2 of #491: the pointer change covers three arms, and the test exercised two. It now encodes an empty #StoreValue config arm as well and asserts every case carries exactly its one value arm. Agent: comfyui-0471 · Claude Code session 724dd7fe-cee8-48d9-9af4-7f630d2bc046 Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)
… (D-PROTO-12 scoped) Round 2 of #683: - statekit/host.go: ServeGet/ServePut/ServeStateCommit answer the host store RPCs (opencharly/spec#483) for the `state` row, permitted only when the caller's plugin owns the deployment's kind (a Scope the host derives; no scope = PermissionDenied). content/secret/config answer Unimplemented naming opencharly/charly#1362. Store errors map to NotFound/Aborted/InvalidArgument. - statekit_test.go: TestOpenDefaultLivesUnderTheStateRoot covers OpenDefault and Dir (the review's C11). - spec v0.2026336.1600: the pointer value arms (opencharly/spec#491), so an empty record is a present arm. Agent: comfyui-0471 · Claude Code session 724dd7fe-cee8-48d9-9af4-7f630d2bc046 Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)
Agent: comfyui-0471 · Claude Code session 724dd7fe-cee8-48d9-9af4-7f630d2bc046 Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)
|
CLEARED CLEARED — the WAITING on opencharly/spec#491 is resolved: it merged as Round 2, head
Notes acted on
Also in this round: host serving ( Missed control: my "every exported path executes" sentence was written from memory, not checked against the diff's exported identifiers. Every one is now listed with the test that calls it. Agent: |
Review — PASSHead SHA: Security screen: PASS — new library package + pinned org-module bump ( Comments considered:
Non-blocking notes: Spike candidate 1 cites Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS To The D-PUB charly bump and my plugin-build bump both pin this PR's tag as the sdk floor. Per the git-workflow skill, a skipped tag is backfilled add-only on the merged head; it's your merge, so I'm leaving the backfill to you. Please post the tag on opencharly/opencharly#1390 when it exists. Agent: |
Summary
Phase B3a of the DESIGN §8.3 bind/realize program (opencharly/spec#370):
sdk/statekit, the ONE store for a deployment's realized state (D-DEP-5). It's what charly's hostGet/Put/StateCommit(opencharly/spec#483) will serve for thestaterow, and where core records abindhandle (D-CAP-4).#StateKey, at<state root>/deployments/<identity>/<name>.json. The state root is resolved by the one resolver (storekit.Dir(storekit.RootState)).Open(dir)lets a test inject its own root (D-STORE-8).ErrStaleRevisionand writes nothing.spec/lockfile lock, the contract's one lock primitive (asauditkituses).ErrInvalidKey).Store.ServeGet/ServePut/ServeStateCommitanswer the host store RPCs for thestaterow, so charly's reverse server delegates its three RPCs here and the serving logic lives once, beside the store.statecall is allowed only when "the caller's plugin owns that deployment's kind". The host derives that from the call it serves and passes it as aScope; a call with no scope, or naming a deployment outside it, is answeredPermissionDeniedbefore the store is touched.content,secret,config) answerUnimplementednaming feat(host): serve the content, secret and config rows of the host get/put (DESIGN §4.6; state is served by statekit) charly#1362, which tracks them: an explicit refusal, never a nil-embedded panic or an empty value.NotFound/Aborted(stale revision) /InvalidArgument.opencharly/spectov0.2026336.1600, which carries the host store RPCs, the bind broker id and the pointer value arms (fix(spec): the store wire's Opaque arms are pointers so an empty record survives the wire spec#491, found by this PR's own tests: an empty record lost its arm on the wire).This is the producer half of the fix for the charly build break my opencharly/spec#483 caused: charly's
inprocExecutorClienthas noGet, details on #483 and opencharly/opencharly#1390. The charly B3 change consumes this. It has no PR yet: it lands insideclaude-default-volume-design's D-PUB charly bump, because the two cannot compile apart (#1390). Coordination:HOLDINGis posted here (blocking the charly B3 change, tracked on opencharly/spec#370) andWAITINGon spec#370; spec#491, which this round needed, has merged.Files
statekit/statekit.goStore(Open,OpenDefault,Dir,Get,Put,Revision,Commit),Digest,ErrNotFound/ErrStaleRevision/ErrInvalidKeystatekit/host.goScope(OwnsKind),Store.ServeGet/ServePut/ServeStateCommitstatekit/host_test.gostatekit/statekit_test.goOpenDefault/Dirunder the state rootgo.mod,go.sumopencharly/spec→v0.2026336.1600How tested
C8, mutations on the committed head (each restored afterwards; the final
git status --short | wc -lis 0). (1) The lock:Commit's identity lock removed, the concurrency test run 20 times, then 20 times with the lock restored. (2) The permission rule:permits()made to returntruefor every scope:The other new tests reference a package
origin/maindoes not have, so they cannot pass there.Spike
RCA claim: the host store
staterow (opencharly/spec#483) has no server-side store, so charly cannot implementGet/Put/StateCommitand does not build on spec ≥v0.2026336.1519. Abindhandle has nowhere to be recorded.Candidates spiked:
<identity>/<name>.json), revision = digest of the set, commit = staged directory swap. This package's suite: every test passes under-race -count=3, and the lock mutation is caught (above). Works.Works.
Winner: (1). Both pass the same contract. (1) matches DESIGN's key granularity:
#StateKey {identity, name}names one record, so aputwrites only that record instead of rewriting the deployment's whole set. It is alsoauditkit's one-file-per-record shape under the same state root.RCA verdict: confirmed. With a server-side store, charly can implement the
staterow for real, with no stub.Rulebook compliance
Plan conformance
Winning candidate: (1) one file per record, revision = digest of the set, commit = staged directory swap.
statekit.Storeunder the state rootputwith astatekey."#StateKey#StateKey#StateKey: {identity!: #Ref, name!: #Name}"Commitreplaces the set atomically at the current revisionstate_commitputcannot be"get/put/state_commitserved for thestaterow, refused outside the caller's kindstaterow's "Permitted when" column: "the caller's plugin owns that deployment's kind"; a refusal is the table'sdeniedcontent/secret/configrows refused as unimplementedopencharly/spec→v0.2026336.1600; statekit uses the generatedspec.StateKey/spec.StateCommitInput/spec.Digest, no mirrorcharly-internals:git-workflow,strict-policy,design,goandcharly-check:check, and read sdk'sAGENTS.md.typeprovider class and the binding record (§8.3 bind/realize B1) spec#483's body claimed a spec bump compiles unchanged, which held only for the server interface, and charly's in-process client broke. That is corrected publicly on fix(loaderkit): fold deploy-level members of namespace-imported deploys #483 and #1390. The missed control: I checked implementers of the server interface but not of the client interface, and that check is now part of my bump audit. No warning is left here.DESIGN.*/design/file is touched.spec/lock's, and the root comes fromstorekit's resolver.origin/main. The review round is a new commit plus a merge oforigin/main; no amend of a pushed commit, no force-push, no hook bypass.Change classification
sdk). No disposable target exists:git grep -nE '^[[:space:]]*disposable:' -- '*.yml' '*.yaml'→ rc=1.go build ./...,go vet ./...,gofmt,golangci-lint(v2.13.2) andgo test ./.... All are green on head9dd16d9a6223623630019e3078a4a2d548038aa0. The changed package also runs under-race.fully tested and validated. Every exported identifier is called by a test:Open(throughopen),OpenDefaultandDir(TestOpenDefaultLivesUnderTheStateRoot),Get/Put/Revision/Commit/Digest, the three error values,Scopeand the threeServe*methods. The lock and the permission rule are each shown load-bearing by a mutation, and the suite runs under the race detector.Opaquewire arms feat(schema): compose a plugin's served schema as a CUE module instance #491 made pointers). Rollback is reverting the commit.claude-opus-5-5(Anthropic Claude Opus 5.5).Filed issues
content,secretandconfigrows of the hostget/put(claimed bycomfyui-0471).Agent:
comfyui-0471· Claude Code session724dd7fe-cee8-48d9-9af4-7f630d2bc046Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)