Skip to content

fix(sdk): carry a check verb's CapturedValue on the out-of-process wire (R3) - #355

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/c9-capturedvalue-producer
Oct 7, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/c9-capturedvalue-producer

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

ServeCheckVerb is the OUT-OF-PROCESS placement of a host-coupled kit check verb. Its Invoke ended with:

res := s.kv.RunVerb(ctx, cc, &op)
return ResultJSON(kitStatusWire(res.Status), res.Message)

so a probe's CapturedValue — the parsed body of an HTTP probe, the matched fields of a log scan, the row a SQL check read — was dropped on its way to the host, while the in-process path already carried it (charly/checkverb_result.go's checkResultFromVerb, 0c62bc1c). The gap bit exactly the family spec/ops/ops.go:224's own prose names as the field's purpose: the out-of-process probes (cdp/kube/appium/adb/wl/…). opencharly/charly#780.

The reply is now built in one place, checkVerbReply: it encodes the verdict's JSON-encoded capture as the wire's raw captured_value (the operator-ruled shape for #780 — JSON-encoded in both directions) and reports a non-JSON stash as a FAIL naming the cause, rather than emitting a corrupt captured_value or dropping it silently (R1). A verdict that captured nothing stays byte-identical to the pre-extension wire (the field's omitempty), asserted directly.

Files (2): checkverb.go (the reply is built by checkVerbReply + capturedWireValue), checkverb_test.go (new).

Refs opencharly/charly#780 — Refs opencharly/spec#194 (the contract's own doc for the field, whose spec leg is #203).

Why the guard sits where every consumer's bytes cross

checkverb_test.go never re-declares the wire shape: it carries the reply across the protobuf hop go-plugin's gRPC channel performs and decodes it with the contract module's own decoder, ops.ParseResultJSONFull — so the assertion is about the bytes that cross (R3: one declaration per wire surface; the decoder lives in spec/ops). Five tests: the capture survives and is a JSON document; the empty capture is byte-identical to ResultJSON; a non-JSON stash is a loud FAIL; the status mapping survives with a capture; and the captureless builder's drop is pinned as its own test, so a future revert of checkVerbReply fails visibly instead of quietly restoring the defect.

How tested

Module gate (sdk/AGENTS.md = exactly CI's steps), all on this head:

$ git rev-parse HEAD
d7549d3ed2a525b58d00aa63fff5699dd050af00

$ gofmt -l .
$ echo "exit=$?"
exit=0
$ go build ./...
$ echo "exit=$?"
exit=0
$ go vet ./...
$ echo "exit=$?"
exit=0
$ go test -count=1 ./...
ok  	github.com/opencharly/sdk	0.174s
ok  	github.com/opencharly/sdk/agentkit	0.559s
ok  	github.com/opencharly/sdk/buildkit	0.010s
ok  	github.com/opencharly/sdk/candywalk	0.008s
ok  	github.com/opencharly/sdk/charlylib	0.011s
ok  	github.com/opencharly/sdk/checkkit	0.006s
ok  	github.com/opencharly/sdk/deploykit	4.007s
ok  	github.com/opencharly/sdk/enginekit	0.006s
ok  	github.com/opencharly/sdk/kit	10.782s
ok  	github.com/opencharly/sdk/llmkit	0.470s
ok  	github.com/opencharly/sdk/loaderkit	0.947s
ok  	github.com/opencharly/sdk/packagekit	0.026s
ok  	github.com/opencharly/sdk/vmshared	0.120s
ok  	github.com/opencharly/sdk/workflowkit	0.012s
exit=0
$ for a in amd64 arm64 arm 386; do GOOS=linux GOARCH=$a CGO_ENABLED=0 go build ./... || exit 1; echo "$a ok"; done
amd64 ok
arm64 ok
arm ok
386 ok
$ golangci-lint fmt --diff
$ echo "exit=$?"
exit=0
$ golangci-lint run ./...
0 issues.
exit=0

The new tests on the PRE-FIX tree. In a detached origin/main worktree (f95b899), the committed guard is copied in and run:

$ git worktree add .worktrees/wire-types/sdk-prefix --detach origin/main
HEAD is now at f95b899 docs: add CHANGELOG 0.2026280.1341 for PR #351
$ cp .worktrees/wire-types/sdk/checkverb_test.go .worktrees/wire-types/sdk-prefix/
$ cd .worktrees/wire-types/sdk-prefix && go test -count=1 -run 'TestCheckVerbReply' ./
./checkverb_test.go:49:16: undefined: checkVerbReply
./checkverb_test.go:84:20: undefined: checkVerbReply
./checkverb_test.go:101:16: undefined: checkVerbReply
./checkverb_test.go:135:17: undefined: checkVerbReply
FAIL	github.com/opencharly/sdk [build failed]
FAIL
[exit: 1]

That is the honest form of the pre-fix result for this particular seam: the guard's subject (checkVerbReply) is the change, so on pre-fix the guard cannot build. The behavioural pre-fix failure — the one that matters — is demonstrated live below, on the same tree pair, through charly's own transport.

Live, OUT-OF-PROCESS, A/B on the real producer path (the cluster's R10 leg). A throwaway bed module (a real kit check verb whose RunVerb returns a PASS verdict carrying {"bytes":67,"path":"/tmp/screencap.png"}, replace github.com/opencharly/sdk => the sdk worktree under test) is host-built and spawned as a separate process and driven through charly's real LocalTransport (go-plugin gRPC + live GRPCBroker) → grpcProvider.InvokeWithExecutor. Bed files are discarded; only this answer lands.

# ARM 1 — the sdk worktree under test (d7549d3ed2a525b58d00aa63fff5699dd050af00)
$ cd <charly worktree> && go test -count=1 -run TestBedWireProbeCapturedValueOutOfProcess -v ./charly/
=== RUN   TestBedWireProbeCapturedValueOutOfProcess
    zz_bed_wireprobe_test.go:61: raw wire from the out-of-process plugin: {"status":"pass","message":"bed wire probe: captured the probe's payload","captured_value":{"bytes":67,"path":"/tmp/screencap.png"}}
    zz_bed_wireprobe_test.go:76: captured value crossed the out-of-process wire: {"bytes":67,"path":"/tmp/screencap.png"}
--- PASS: TestBedWireProbeCapturedValueOutOfProcess (0.70s)
ok  	github.com/opencharly/charly/charly	1.818s
[exit: 0]

# ARM 2 — the SAME bed plugin, same host, built against PRE-FIX sdk origin/main (f95b899)
$ go test -count=1 -run TestBedWireProbePreFixDropsTheCapture -v ./charly/
=== RUN   TestBedWireProbePreFixDropsTheCapture
    zz_bed_wireprobe_prefix_test.go:61: raw wire from the out-of-process plugin: {"status":"pass","message":"bed wire probe: captured the probe's payload"}
    zz_bed_wireprobe_prefix_test.go:71: DROPPED: the out-of-process wire carried no captured_value: {"status":"pass","message":"bed wire probe: captured the probe's payload"}
--- FAIL: TestBedWireProbePreFixDropsTheCapture (0.97s)
FAIL	github.com/opencharly/charly/charly	2.046s
[exit: 1]

Arm 2 is a real failure of the real code path on pre-fix origin/main; arm 1 is the same path on the change. The only difference between the arms is which sdk the plugin binary links.

RDD, before the fix was written (throwaway, in-package, at the real producer/consumer seam — verdict → the exact ResultJSON call the producer then made → proto.Marshal/Unmarshal(pb.InvokeReply) → ops.ParseResultJSONFull), with a positive control through ops.ResultJSONCaptured proving the instrument sensitive:

$ GOTMPDIR=~/.cache/go-tmp go test -count=1 -run 'TestSpike' -v ./
=== RUN   TestSpikeCapturedValueSurvivesOutOfProcessWire
    spike_capturedvalue_wire_test.go:63: producer wire bytes: {"status":"pass","message":"wl: screencap wrote 67 bytes"}
    spike_capturedvalue_wire_test.go:72: DROPPED: the out-of-process wire carries status="pass" message="wl: screencap wrote 67 bytes" but NO captured_value; the verb's verdict carried {"bytes":67,"path":"/tmp/screencap.png"}.
--- FAIL: TestSpikeCapturedValueSurvivesOutOfProcessWire (0.00s)
=== RUN   TestSpikeControlCapturedBuilderRoundTrips
    spike_capturedvalue_wire_test.go:105: control: captured builder round-trips: {"bytes":67}
--- PASS: TestSpikeControlCapturedBuilderRoundTrips (0.00s)
FAIL
FAIL	github.com/opencharly/sdk	0.003s
[exit: 1]

What this PR does not claim: the live out-of-process arm was run against a BED plugin, because no shipping candy produces a capture yet — the corpus's first real producer is a separate feature, not this wire. The consumer half (charly decoding through ops.ParseResultJSONFull, deleting its hand-rolled pluginCheckResult) is the next leg of this same cutover, producer-first.

Rulebook compliance

  • R0 — loaded /charly-internals:go (SDD: generated vs hand-written, the module gates), /charly-internals:plugin (the provider model, dual placement, ServeCheckVerb's out-of-process shape) and /charly-internals:git-workflow + its pre-validator self-audit for this step.
  • R1 — the defect was re-derived from origin/main with an executable instrument before the edit (the spike above), and the new failure mode this change introduces — a non-JSON stash — fails LOUD rather than silently; no warning survives.
  • R2 — the whole wire is fixed in one place; the in-process sibling was already fixed (0c62bc1c) and is re-verified by the reply tests; the consumer sibling is named and scheduled (the charly leg of this cutover), never "pre-existing"/"unrelated".
  • R3 — the reply is built ONCE (checkVerbReply); the test decodes with the contract module's own decoder instead of re-declaring the shape; kit.Result/spec.CheckVerbResult remain the single declaration of the verdict.
  • R4 — no sleeps, retries, or fallbacks; the non-JSON case is an explicit error, not a silent drop.
  • R4a — no documented command changes; the field is an internal contract type. The operator-facing surface (a check's --format json / ledger value) starts carrying the value once the consumer leg lands.
  • R5 — no identifier is deleted here; the sweep for the sibling claim (capture:/capture_extract:/ScenarioContext.Captures) is owned by the charly leg, where the one surviving orphaned docstring lives (charly/checkspec_test.go).
  • R6 — feat/c9-capturedvalue-producer off fresh origin/main (f95b899), no force-push, no rebase; tree clean after the commit; no submodule's tracked checkout edited. The bed plugin module lives under the umbrella's gitignored .worktrees/wire-types/ and is not part of any repo.
  • R7 — coverage that fails without the change: the live pre-fix arm (exit 1, above) plus the mechanism-pinning test; the changed path itself was executed live out-of-process.
  • R7a — the live arm crosses the real go-plugin process/transport boundary (a spawned plugin binary + GRPCBroker), never a mock of it.
  • R8 — the artifact validated is the wire payload the host receives, read through the contract's own decoder.
  • R9 — every run used worktree-local builds; the plugin binary under test was built by charly's own buildPluginBinary from the bed module pinned by replace to this sdk worktree.
  • R10 — fresh rebuild + live run: the bed plugin was host-built and exec'd for BOTH arms on the final tree of each, with the changed path (the reply wire) exercised end to end.

Change classification

  • Change class: code — library/module change in the plugin SDK (github.com/opencharly/sdk) plus new Go tests. Not docs-only.
  • Verification gate: the module's own CI steps (gofmt / go build / go vet / go test ./... / golangci-lint / the cross-compile matrix) on the final tree, plus the live out-of-process A/B above with the pre-fix arm red.
  • Attribution tier: fully tested and validated.

Agent: wire-types · session 80a2525e-6107-4143-94c4-795f317c71d3
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

…re (R3)

opencharly/charly#780, producer half. ServeCheckVerb's Invoke returned the
captureless builder, so a host-coupled probe's CapturedValue -- the parsed body
of an HTTP probe, the matched fields of a log scan, the row a SQL check read --
was dropped on its way to the host, while the in-process path already carried it
(charly's checkResultFromVerb, 0c62bc1c). The gap bit the OUT-OF-PROCESS probe
family (cdp/kube/appium/adb/wl/...), exactly the family spec/ops's own prose names
as the field's purpose.

The reply is now built in ONE place, checkVerbReply: it encodes the verdict's
JSON-encoded capture as the wire's raw `captured_value` (the operator-ruled shape
for #780 -- JSON-encoded in both directions) and reports a NON-JSON stash as a FAIL
naming the cause instead of emitting a corrupt wire or dropping it silently. A
verdict that captured nothing stays byte-identical to the pre-extension wire (the
field's omitempty), asserted directly.

checkverb_test.go drives the reply through the protobuf carrier go-plugin's gRPC
channel performs and decodes it with the contract module's OWN decoder
(ops.ParseResultJSONFull), so the assertion is about the bytes that cross, never
about a shape re-declared here (R3). The captureless builder's drop is pinned as a
test of its own, so a future revert of checkVerbReply fails visibly.

Refs opencharly/charly#780
Refs opencharly/spec#194

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: d7549d3ed2a525b58d00aa63fff5699dd050af00 (branch: feat/c9-capturedvalue-producer)

Change class: code — sdk library change + new Go tests (not docs-only).
Security screen: PASS (T1–T4: no rulebook/validator edits, no embedded directives, no scope mismatch, no secrets/egress, no weakened guardrails, no new deps).
Checklist: All applicable rules PASS or NA. Body is complete and ends with the required Assisted-by: line; the fully tested and validated tier is justified by the live out-of-process A/B where the changed checkVerbReply path executed (arm 1 green, arm 2 red on pre-fix origin/main). Committed test decodes via the contract's own ops.ParseResultJSONFull (R3, one declaration). No dead code in the touched file (ResultJSON remains the error-path builder). One atomic commit (R15). Cross-repo consumer leg is named (charly#780), not a vague deferral. The pasted pre-fix undefined: checkVerbReply errors at lines 49/84/101/135 match the 4 call sites in the added test file exactly — evidence is internally consistent and honest about the pre-fix compile-fail.

Comment thread: empty (0 comments) — nothing to disposition.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 7, 2026 21:32
@github-actions
github-actions Bot merged commit d89a6fa into main Oct 7, 2026
6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 7, 2026
aitrawog added a commit to opencharly/charly that referenced this pull request Oct 7, 2026
Answering the org validator's two B18 findings on #825. Both
premises are contradicted by the committed tree, and the diff now shows it:

- `plugin_grpc_test.go` DID import `github.com/opencharly/spec/spec` — two import
  groups below the hunk's context (the file's own last group). No behaviour
  changes here: the import moves into the group the diff displays, so the
  evidence the finding asked for is visible in the hunk itself.
- `plugin_appium_external_test.go` needed no change at all: it imports `spec`
  (line 13) and still uses `encoding/json` four times (lines 88, 122, 127).

Closes #780
Refs opencharly/sdk#355
Refs opencharly/spec#194

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
github-actions Bot pushed a commit to opencharly/charly that referenced this pull request Oct 7, 2026
…ture included (#825)

* fix(charly): decode a verb provider's reply through the contract, capture included

#780, consumer half. The host kept its OWN declaration of the
out-of-process verb reply — `pluginCheckResult{status,message}` — and decoded the
provider's JSON with it, so the producer's CapturedValue never reached the
CheckResult the check run carries and the ledger records. The producer half is
merged in the SDK (opencharly/sdk#355, tag v0.2026280.2133): ServeCheckVerb now
encodes the verdict's JSON-encoded capture as the wire's raw captured_value.

charly now decodes through the contract module's OWN decoder,
ops.ParseResultJSONFull, and threads the decoded value into
CheckResult.CapturedValue — the out-of-process twin of checkResultFromVerb, which
already maps the in-process verdict. `pluginCheckResult` is deleted, so no surface
can re-declare the wire; a malformed reply is a FAIL naming the verb and an
unrecognised status is a FAIL, exactly as the hand-rolled switch had it.

The same cutover sweeps every reference to the deleted shape: four test files now
assert through the production seam (plugin_grpc / plugin_external /
plugin_appium_external / the checkcontext e2e dispatch), and checkspec_test.go
loses an orphaned docstring describing the long-deleted
capture_extract:/capture: matchers and the ScenarioContext.Captures stash they fed
(spec#194's claim, same claim-keyed family).

The sdk pin moves v0.2026280.1251 -> v0.2026280.2133 (the tag minted for that
merge) — the producer's consumer-pin step, in this same landing. It is an
INDIRECT require: charly's compiled-in plugin candies import the SDK, so this is
the SDK the assembled binary's plugins build against.

Closes #780
Refs opencharly/sdk#355
Refs opencharly/spec#194

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

* style(charly): group the spec import beside ops in plugin_grpc_test

Answering the org validator's two B18 findings on #825. Both
premises are contradicted by the committed tree, and the diff now shows it:

- `plugin_grpc_test.go` DID import `github.com/opencharly/spec/spec` — two import
  groups below the hunk's context (the file's own last group). No behaviour
  changes here: the import moves into the group the diff displays, so the
  evidence the finding asked for is visible in the hunk itself.
- `plugin_appium_external_test.go` needed no change at all: it imports `spec`
  (line 13) and still uses `encoding/json` four times (lines 88, 122, 127).

Closes #780
Refs opencharly/sdk#355
Refs opencharly/spec#194

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant