Skip to content

the StepContract pb<->spec conversion is transcribed three times, and a field added to one is silently dropped by the others #311

Open

Description

@aitrawog

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;
  • buildCapMeta rebuilt the contract from Scope/Venue/Gate/Emits only, so the host read false;
  • 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 spec helper that transcribes pb.StepContract → spec.StepContract and its inverse (the wire struct is already in spec/proto), so sdk/schema.go, spec/exec/executor.go and charly/plugin_provider_common.go each CALL it instead of re-listing the fields;
  • a field-coverage test in spec that fails when pb.StepContract gains 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

  1. added
    category:runtime
    type:fix
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:runtimetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions