Repository navigation
refactor(spec)!: #55 import-purity — relocate plugin-host contract symbols from sdk root into spec slices - #11
Conversation
…mbols from sdk root into spec slices
The spec leg of the 4-leg B2 PR chain (spec → sdk → plugins → super) that dissolves the
github.com/opencharly/sdk ROOT package. The plugin-host contract symbols charly core imports
from the sdk root are relocated into new opencharly/spec slice packages so charly core can
import them from spec INSTEAD of the sdk root (the end-state import-purity gate: charly/
imports sdk/spec + the proto/plugin-API wire contract ONLY).
This leg is ADDITIVE in spec — it creates the slice packages and the symbols; the sdk root
keeps its definitions for the duration of the cutover (a thin re-export shim is the downstream
sdk leg; deleting the sdk-root definitions is a later leg). The super leg re-points the spec
gitlink to this leg's merged commit; the plugins leg re-points sdk/go.mod to this leg's merged
tag.
New fabric slices:
spec/transport — go-plugin/grpc dial + serve contract (ServedBroker, Handshake, Main,
Serve, PluginMap, Channel*, SequenceGate, ReplayBuffer, RelayChannel…),
seeded verbatim from the import-purity spike tree.
spec/exitcode — ExitCodeError + CheckFailExitCode/CheckSkippedExitCode (the 0/1/2/3
check-command convention single-sourced for host + candy).
spec/phase — lifecycle phase consts (PhaseBootstrap…PhaseRuntime) + NormalizePhase,
DISTINCT from the step-phase enum in spec/spec/ir_enums.go.
spec/ops — the whole Op* selector family (32+ consts) + ResultJSON + InvokeProviderOpts.
spec/climodel — CLISubcommand (SDK-facing authoring form) + ValidateGenerated /
DecodeGeneratedJSON / ValidateCUEValue / ValidateCUEInput (R3-shared CUE
validation primitive the sdk leg's SchemaValidator imports).
spec/exec — added to the EXISTING package exec: the in-proc reverse-channel Executor
(ExecutorFromInvoke / NewInProcExecutor / ContextWithExecutor /
ExecutorForInvoke + venue/host-step methods) + HostStepDeps +
ContextWithHostStepDeps / HostStepDepsFromCtx.
REPOINT decisions (load-bearing for the downstream legs):
- StepContract is a REPOINT, not a NEW type. sdk.StepContract (string Scope) and
spec.StepContract (typed Scope/Venue/Gate enums) are DIFFERENT types.
spec/exec.Executor.DescribeProvider returns *spec.StepContract, converting proto→spec
via spec.ScopeFromName / spec.Venue / spec.Gate. The sdk leg repoints charly's callers.
- CLIModel is a REPOINT (already in spec/spec/cue_types_gen.go); CLISubcommand is NEW.
- Phase enum is a REPOINT for the enum, NEW for the lifecycle consts.
- The whole Op* family is relocated (all 32+ consts, not just the 7 the brief listed).
Per-symbol surprises FLAGGED:
- spec/exec already existed (brief said NEW) — added to the EXISTING package (no collision:
Executor ≠ DeployExecutor).
- SchemaValidator / NewSchemaValidator / Validate / ValidateJSON are NOT in this leg (per
brief: a separate plugin-side unit, stays in sdk root for the sdk leg); the exported
ValidateCUEValue / ValidateCUEInput are the R3-shared primitive the sdk leg imports.
- No symbol here is a hand-written CUE wire type (SDD: wire types are CUE-sourced in
spec/spec). Every symbol is a contract primitive (consts, an error wrapper, a CLI
authoring struct, a context-threading helper, an Executor over the gRPC client) — NONE is
a sdk/spec/*_wire.go data-carrier struct, so no SDD hand-write exception applies.
Repo hygiene: github.com/hashicorp/go-plugin v1.8.0 added to spec/go.mod direct requires
(the spec/transport slice depends on it); go mod tidy pulled the transitive set.
Schema version: NO #SchemaVersion bump — host↔plugin contract primitives, not authored
charly.yml surfaces.
Verification (Go contract module; NO disposable bed at this leg per the R10 gate-by-change
matrix — the full runtime R10 roster runs at the SUPER leg of this B2 chain against the
assembled 4-leg tree):
GOWORK=off go build ./... ok
GOWORK=off go test ./... ok (all packages — climodel, container, exec, exitcode,
hostenv, internal/wiregen, ops, phase, proc, refs,
spec, transport)
go vet ./... ok
golangci-lint run ./... 0 issues
gofmt -l . empty
Assisted-by: Claude Code glm-5.2:cloud (fully tested and validated)
pr-validator — APPROVED ✅Change class: code/config — Go contract module ( Head: Independent gate re-run (mine, on a clean linked worktree at the PR head,
|
… leg Assisted-by: Claude Code glm-5.2:cloud (analysed on a live system)
Summary
The spec leg of the 4-leg B2 PR chain (spec → sdk → plugins → super) that dissolves the
github.com/opencharly/sdkROOT package. The plugin-host contract symbolscharly/imports from the sdk root are relocated into newopencharly/specslice packages so charly core can import them from spec INSTEAD of the sdk root — the end-state import-purity gate:charly/importssdk/spec+ the proto/plugin-API wire contract ONLY.This leg is ADDITIVE in spec — it creates the slice packages and the symbols; the sdk root keeps its definitions for the duration of the cutover (a thin re-export shim is the downstream sdk leg; deleting the sdk-root definitions is a later leg). The super leg re-points the spec gitlink to this leg's merged commit; the plugins leg re-points
sdk/go.modto this leg's merged tag.New fabric slices (the plugin-host contract surface)
spec/transporttransportServedBroker,Handshake,Main,Serve,PluginMap,Channel*,SequenceGate,ReplayBuffer,RelayChannel… (seeded verbatim from the import-purity spike tree;stdio.goalready existed)spec/exitcodeexitcodeExitCodeError+CheckFailExitCode(=2) /CheckSkippedExitCode(=3) — the 0/1/2/3 check-command convention single-sourced for host + candyspec/phasephasePhaseBootstrap…PhaseRuntime+PhaseOrder+NormalizePhase— DISTINCT from the step-phase enum inspec/spec/ir_enums.gospec/opsopsOp*selector family (32+ consts) +ResultJSON+InvokeProviderOptsspec/climodelclimodelCLISubcommand(SDK-facing authoring form) +ValidateGenerated/DecodeGeneratedJSON/ValidateCUEValue/ValidateCUEInputspec/execexec(added to the EXISTING package — no collision:Executor≠DeployExecutor)Executor+HostStepDeps+ ctx-threading helpersREPOINT decisions (load-bearing for the downstream legs)
StepContractis a REPOINT, not a NEW type.sdk.StepContract(stringScope) andspec.StepContract(typedScope/Venue/Gateenums inspec/spec/provider_carriers.go) are DIFFERENT types.spec/exec.Executor.DescribeProviderreturns*spec.StepContract, converting proto→spec viaspec.ScopeFromName/spec.Venue/spec.Gate. The sdk leg must repoint charly's callers.CLIModelis a REPOINT (already inspec/spec/cue_types_gen.go);CLISubcommandis NEW inspec/climodel.Phaseenum is a REPOINT for the enum, NEW for the lifecycle consts (spec/spec/ir_enums.gocarries a different step-phase enum).Op*family is relocated (all 32+ consts, not just the 7 the brief listed) —charly/uses ALL of them and the end-state gate requires them all out of the sdk root.Per-symbol surprises FLAGGED for the orchestrator
spec/execalready existed (the brief said NEW): addedExecutor/HostStepDepsto the EXISTING package.SchemaValidator/NewSchemaValidator/Validate/ValidateJSONare NOT in this leg (per brief: a separate plugin-side unit, stays in sdk root for the sdk leg); the exportedValidateCUEValue/ValidateCUEInputare the R3-shared primitive the sdk leg imports.spec/spec). Every symbol relocated is a contract primitive — NONE is asdk/spec/*_wire.godata-carrier struct, so no SDD hand-write exception applies.Repo hygiene
github.com/hashicorp/go-plugin v1.8.0added tospec/go.moddirect requires (thespec/transportslice depends on it);go mod tidypulled the transitive set.golangci-lint run ./...0 issues;gofmt -l .empty;go vet ./...clean.Schema version
NO
#SchemaVersionbump — host↔plugin contract primitives, not authoredcharly.ymlsurfaces.Verification (Go contract module; NO disposable bed at this leg)
Per the R10 gate-by-change-class matrix, a Go contract module's gate is the full Go test suite (the runtime R10 roster runs at the SUPER leg of this B2 chain against the assembled 4-leg tree).
Every new slice ships a test package that exercises the relocated symbols (
ResultJSON,NormalizePhase,ExitCodeError,ContextWithExecutor,SequenceGate,ValidateGenerated…) — the changed code's tests actually executed live.B2 chain
sdk/go.modto this leg's merged tag; adds thin re-export shims; repoints charly's callers to the spec slices (handles theStepContractScope string→typed repoint).git grep 'github.com/opencharly/sdk' charly/→ EMPTY) is met at the super leg, NOT this leg.Assisted-by: Claude Code glm-5.2:cloud (fully tested and validated)