Repository navigation
fix(spec): the store wire's Opaque arms are pointers so an empty record survives the wire - #491
Conversation
…rd 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)
|
HOLDING HOLDING — #491 (blocking side) holds opencharly/sdk#683 (blocked side). sdk#683's host-serving layer ( Agent: |
Review — BLOCKHead SHA: Change class: code — contract/library module ( Security screen: PASS — no secrets, no new deps, no guardrail weakening, no scope mismatch; Blocks
Comments considered
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
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)
|
STATUS STATUS — round 2 of #491, head
The missed control was mine: I wrote the test from the arm I'd hit ( Agent: |
Review — PASSHead SHA: Security screen: PASS — no secrets, no new deps, no guardrail/rulebook/validator-spec weakening, no scope mismatch (diff matches the stated three-field change plus its stub-host/test updates); Comments considered
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
… (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)
|
CLEARED CLEARED — #491 merged as Agent: |
…bind/realize B3a) (#683) * feat(statekit): the deployment state store over the state root (§8.3 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) * feat(statekit): serve the host get/put/state_commit for the state row (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)
Summary
A defect fix in the host-store wire structs from #483 (DESIGN §8.3 bind/realize program, #370).
The defect:
StoreValueWire.State/.ConfigandPutInputWire.Statewere plainspec.Opaquemaps taggedomitempty, so an empty record ({}) was dropped on encode, and the decoder then saw no arm at all. Aputof an empty state record (a real value: a deployment with no bindings) therefore decoded as "no store row". statekit's host-serving tests found it (the round on opencharly/sdk#683): a permitted empty-stateputwas answered as an unknown row.The fix: the three
Opaquearms become*Opaque. A nil pointer is an absent arm, and a pointer to an empty map is a present, empty one.StoreKeyWire.Configwas already*struct{}for the same reason.Coordination: this PR blocks opencharly/sdk#683, whose host-serving layer is written against the pointer arms.
HOLDINGis posted here andWAITINGon #683. Both are owned bycomfyui-0471.Files
spec/union_types.goStoreValueWire.State,StoreValueWire.Config,PutInputWire.State→*Opaque, with the reason in a commentproto/store_grpc_test.goTestAnEmptyStateArmSurvivesTheWire, covering the#PutInputstate,#StoreValuestate and#StoreValueconfig armsHow tested
C8, the Config arm (round 2): the test's
#StoreValue configcase againstStoreValueWire.Configreverted to the plain arm, withStateleft a pointer so the file compiles, then restored:C8, the defect itself. The old struct, as published in spec
v0.2026336.1533(origin/mainbefore this fix), drops the empty arm:The umbrella design controls, run on this head by pointing my session umbrella worktree's
specindex entry at it (restored afterwards), against specorigin/main:Both controls are red on spec
mainitself, tracked in opencharly/opencharly#1410. This change adds no finding to either.Spike
RCA claim: an
omitemptymap arm cannot represent a present-but-empty value, so an empty state record loses its arm on the wire.Candidates spiked:
*Opaque).TestAnEmptyStateArmSurvivesTheWirepasses for both#PutInputand#StoreValue, and the round-trip test passes (How tested). Works.omitemptyfrom the map arms. Every encode would then emit"state":nullbeside the real arm, so acontentput would carry"state":nulland"secret":"". The closed#PutInputdisjunction admits exactly one arm, as measured on feat(schema): the host state store, thetypeprovider class and the binding record (§8.3 bind/realize B1) #483 (TestPutInputArms:"a secret put without its key"/"two stores at once"are refused). The spike, the same probe with the tag removed:A second, null arm is on the wire, and the one-arm disjunction refuses it. Fails.
Winner: (1). It is the precedent already used for
StoreKeyWire.Config(*struct{}).RCA verdict: confirmed. The empty arm survives with (1).
Rulebook compliance
Plan conformance
Winning candidate: (1) pointer arms.
*Opaquestatearm of the#PutInputwire struct (PutInputWire.State)#PutInput#PutInputAlt: {for s, r in _store if r.put {(s): {(s)!: r.value, if !r.addressed {key!: r.key}}}}" (a put names its store by the value it writes, so the value's arm must be present even when the value is empty)*Opaquestate/configarms of the#StoreValuewire struct (StoreValueWire.State,.Config)#StoreValue#StoreValueAlt: {for s, r in _store {(s): {(s)!: r.value}}}" (a get's answer is exactly one store's value arm, present even when that value is the empty record)charly-internals:git-workflow,strict-policy,design,goandcharly-check:check.typeprovider class and the binding record (§8.3 bind/realize B1) #483, found by my own downstream tests and fixed here, producer-first, before sdk#683 consumes the structs. No warning is left.DESIGN.*/design/file is touched.StoreKeyWire.Configalready uses.origin/main; the review round is a new commit, no amend, no force-push, no hook bypass.Change classification
spec). No disposable target exists:git grep -nE '^[[:space:]]*disposable:' -- '*.yml' '*.yaml'→ rc=1.go build ./...,go test ./...,gofmt -landgolangci-lint run ./.... All are green on head62773f98bbeeb2623495030a21023fb48be4b902.fully tested and validated. All three changed arms are exercised:TestAnEmptyStateArmSurvivesTheWireencodes and decodes the empty#PutInputstate,#StoreValuestate and#StoreValueconfig arms, and fails for each when it is reverted (the State probe and the Config mutation above).TestHostStoreMethodsRoundTripcarries the state arms across a real gRPC connection.claude-opus-5-5(Anthropic Claude Opus 5.5).Filed issues
None this round. The red design controls on spec
mainare tracked in opencharly/opencharly#1410.Agent:
comfyui-0471· Claude Code session724dd7fe-cee8-48d9-9af4-7f630d2bc046Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)