Repository navigation
Description
What
The pb.StepContract ↔ spec.StepContract conversion is transcribed in three places, and a field added to one is silently dropped by the others:
| copy | direction | file |
|---|---|---|
| 1 | spec → pb (capability build) | sdk/schema.go (BuildCapabilitiesWithRequires) |
| 2 | pb → spec (plugin-side decode) | spec/exec/executor.go (DescribeProvider) |
| 3 | pb → spec (host-side carrier) | charly/plugin_provider_common.go (buildCapMeta) |
Why it matters (measured, not theoretical)
Adding one field (PluginPaths, the opt-in that makes the host inject the connected plugin set into a class:step's input — opencharly/charly#1131) required edits in all three. The lane updated 1 and 2 and missed 3, with this result:
- the plugin DECLARED the flag and it travelled on the wire correctly;
buildCapMetarebuilt the contract fromScope/Venue/Gate/Emitsonly, so the host readfalse;- the injection never ran, and the step refused with
the deploying charly supplied no connected plugin set (input key "plugin_paths").
Nothing failed to compile, no test failed, and every module's CI was green. The defect was found only because the consuming step refuses loudly rather than guessing (charly#1131's fill-first contract) — a quieter consumer would have shipped a silently inert capability.
The fix shipped in that cutover (plugin_provider_common.go now carries the field, with a test that pins the whole declared set), but the STRUCTURE that made the miss possible is unchanged: three transcriptions of one contract, each of which must be remembered.
What I expect
One conversion, owned by the contract module, that both sides use:
- a
spechelper that transcribespb.StepContract→spec.StepContractand its inverse (the wire struct is already inspec/proto), sosdk/schema.go,spec/exec/executor.goandcharly/plugin_provider_common.goeach CALL it instead of re-listing the fields; - a field-coverage test in
specthat fails whenpb.StepContractgains a field the conversion does not carry — the ONE control, instead of three tests that can each be forgotten; - the three call sites deleted to the call (R2/R5), in one cutover.
charly cannot import the sdk (import_purity_test.go), so the helper belongs in spec (which both import) rather than in sdk.
Filed from
The lane that hit it: opencharly/charly branch charly-plugins/leg-b (the connected-plugin-set cutover, opencharly/charly#1131), where the field is now carried by all three copies. Deliberately NOT folded into that PR: it is a separate contract-module extraction with its own gate, and the PR that found it is already a multi-repo cutover.
Agent: charly-plugins
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)
Activity