Repository navigation
refactor(sdk)!: #55 import-purity — BuildCLIModel re-export shim to spec/clireflect - #116
Conversation
…pec/clireflect The sdk leg of the clireflect mini-B2 (spec → sdk → plugins → super) that dissolves the sdk ROOT package's last fabric-primitive holdout. The Kong→CLIModel reflection mechanism was relocated upstream into the new kong-bearing spec/clireflect slice (merged spec v0.2026214.434, PR opencharly/spec#12). sdk/climodel.go's 5 function DEFINITIONS are replaced by a one-line re-export `var BuildCLIModel = clireflect.BuildCLIModel`, mirroring the standing sdk re-export-shim convention (validate.go's ValidateGenerated/DecodeGeneratedJSON). The 4 helpers had zero external callers (whole-tree verified) and are not re-exported — spec/clireflect owns the single implementation. candy/plugin-agent (3 call sites) compiles unchanged through the shim; charly/cli_model_cmd.go repoints directly in the downstream super leg (the step-1 import-purity gate — charly core off sdk ROOT). BuildCLIModel is a shared fabric primitive (charly core + candy/plugin-agent), so by the fabric-vs-capability rule it lives in a spec/<slice>, not charly-only (R3) and not the sdk root (the step-1 gate). spec/clireflect is a SEPARATE slice from spec/climodel (cuelang-bearing) so kong is contained to the slice that needs it (Rule 2): consumers needing only CUE validation never pull kong, and consumers needing only CLI reflection never pull cuelang. go.mod: require github.com/opencharly/spec v0.2026213.2047 → v0.2026214.434. Verification: GOWORK=off go build/vet/test ./... -count=1 ok (all 8 packages, serial + concurrent); golangci-lint 0 issues; gofmt empty — against the real merged spec tag v0.2026214.434. Contract module: no disposable bed this leg; the runtime R10 roster runs at the super leg against the assembled 4-leg tree. The exported KongLeafToCLILeaf (no external callers, verified) is removed from the sdk root public surface → the ! marker. Assisted-by: Claude Code glm-5.2:cloud (analysed on a live system)
pr-validator — APPROVED ✅Change class: Go contract module (sdk re-export shim) — code/config class, NO disposable check bed this leg (R10 gate-by-change-class: the runtime R10 roster runs at the SUPER leg of this 4-leg B2 chain, against the assembled tree). Honest attribution tier: Head SHA: Checklist (every rule — re-derived independently, author claims trusted nothing)
Comments considered: none — the PR carried no comments at validation time. Cross-PR interactions considered: Decision: PASS. The sdk leg of the clireflect mini-B2 is in full compliance: the Assisted-by: Claude Code glm-5.2 (analysed on a live system) |
Assisted-by: Claude Code glm-5.2:cloud (analysed on a live system)
Assisted-by: Claude Code glm-5.2:cloud (analysed on a live system)
pr-validator — merge completed ✅Status posted: Merge: CalVer finalized: Tag: Post-merge main verified: CHANGELOG H1 Producer-first B2 chain: spec ( Assisted-by: Claude Code glm-5.2 (analysed on a live system) |
…all-or-nothing load validation (#236) * feat(cutover-c3): the stage-grouped + concurrent bed-member walk (kit) + all-or-nothing load validation Cutover C tasks 5-7. kit.RunPlanStaged is the canonical stage-grouped, member-concurrent bed walk; RunPlan now delegates to it (one canonical engine): - stages (first-seen order across members, recorded from authored order at load) dominate `parallel:`; within a stage, steps on DIFFERENT members run as INDEPENDENT Runner instances CONCURRENTLY (A4 — never share one Runner); same-member steps keep authored order. - without stages: today's sequential per-member walk, plus whole-member-plan concurrency when `parallel: true`. - result collection is concurrency-safe: per-member slices, ONE mutex serializing every shared-summary append (the A4 fix), venue-keyed deterministic final order. - drain semantics: a member step failure never stops other members — stage WaitGroup barriers drain every member before the next stage starts; per-member verdicts land in the results. loaderkit.ValidateCheckBeds gains the task-4 load invariant: stage authoring is ALL-OR-NOTHING per bed (the root plus the whole uniform member tree must all carry `stage:` or none may) — the walk can then rely on unambiguous grouping. Stage names dot-free is CUE-enforced on #Op (spec #116). Tests: kit/planrun_staged_test.go (stage first-seen order, same-member authored order, concurrent independent runners via barrier handshake, stage drain on member failure, parallel whole-member plans, deterministic venue-keyed order, RunPlan delegation, unstaged-step survival); loaderkit/validate_check_beds_stage_test.go (all-or-nothing + hook-in). Spec re-pin: github.com/opencharly/spec v0.2026250.709 -> v0.2026250.903 (the stage:/parallel: schema, spec #116). * fix(cutover-c3): remove leftover DEBUG printlns + assert the first-seen stage order in the grouped test B18/R1 validator findings on sdk #236: - planrun_staged.go: two leftover `println("DEBUG …")` calls in runStagedGroups emitted debug output on every staged bed run from concurrent member goroutines; removed (zero-warning mandate). - planrun_staged_test.go TestRunPlanStaged_StageGroupsFirstSeenOrder: the never-invoked `idx` closure is deleted and the test now asserts the actual first-seen stage order (a2 before a1 — s2 first-seen before s1), instead of only the result count.
Summary
The sdk leg of the clireflect mini-B2 (the 4-leg chain spec → sdk → plugins → super) that dissolves the
github.com/opencharly/sdkROOT package's last fabric-primitive holdout — theBuildCLIModelKong→CLIModel reflection mechanism.The upstream spec leg (opencharly/spec#12, merged
bedcec95/ tagv0.2026214.434) relocatedBuildCLIModel+ its 4 helpers verbatim into the NEW kong-bearingspec/clireflectslice. This sdk leg replaces thesdk/climodel.goDEFINITION with a one-line re-export shim so every candy call site compiles UNCHANGED; the downstream super leg re-pointscharly/cli_model_cmd.godirectly toclireflect.BuildCLIModel(the step-1 import-purity gate — charly core off the sdk ROOT).What lands
sdk/climodel.go— the 5 function definitions (BuildCLIModel,KongLeafToCLILeaf,kongValueToCLIArg,sanitizeCLIPropName,cliJSONType) DELETED; replaced byvar BuildCLIModel = clireflect.BuildCLIModel(importinggithub.com/opencharly/spec/clireflect). Mirrors the standing sdk re-export-shim convention (sdk/validate.go'svar ValidateGenerated = climodel.ValidateGenerated/var DecodeGeneratedJSON = climodel.DecodeGeneratedJSON): the single implementation lives in aspec/<slice>, the sdk ROOT keeps avar X = <slice>.Xre-export so candy call sites compile unchanged. The 4 helpers had ZERO external callers beyondBuildCLIModel(whole-tree verified acrosscharly/,sdk/,candy/,box/) and are NOT re-exported —spec/clireflectowns the single implementation.go.mod/go.sum—require github.com/opencharly/specbumpedv0.2026213.2047→v0.2026214.434. No other dep moves (thealecthomas/kongdirect require stays — the shim's re-exported signature still carrieskong.Option).Why spec/clireflect is a separate slice from spec/climodel (Rule 2)
BuildCLIModelis a SHARED mechanism used by BOTH charly core (host CLI) AND a command plugin (candy/plugin-agent), so by the fabric-vs-capability decision rule it is a FABRIC PRIMITIVE → it lives in aspec/<slice>, not charly-only (R3 duplication) and not the sdk root (the step-1 gate). It does NOT go intospec/climodel(cuelang-bearing) because two ofspec/climodel's consumers (plugin_grpc.go,plugin_provider_common.go) do NOT use kong — merging it there would forcealecthomas/kongon everyspec/climodelconsumer, violating Rule 2 (each heavy third-party dep lives ONLY in the slice that needs it). The newspec/clireflectslice contains kong; consumers needing only CUE validation never pull kong, and consumers needing only CLI reflection never pull cuelang. Go module-graph pruning + package granularity enforce this at build time.REPOINT decisions (load-bearing for the downstream legs)
BuildCLIModelis a RE-EXPORT for the candy caller (candy/plugin-agent/plugin.go:213,220,224— 3 call sites ofsdk.BuildCLIModel) → compile UNCHANGED, resolve through the shim toclireflect.BuildCLIModel. The super leg re-points the charly caller (charly/cli_model_cmd.go:55) directly toclireflect.BuildCLIModel(step-1 import-purity gate).KongLeafToCLILeafneeds NO shim — no external callers beyondBuildCLIModel(verified). The exportedKongLeafToCLILeafis removed from the sdk root public surface → the!marker.spec/climodel,charly/, orcandy/(the plugins leg is a no-op — the shim keeps candy compiling unchanged).Verification (the gate I ran, pasted)
All gates green against the real merged spec tag
v0.2026214.434(no tempreplace— the published tag). Zero warnings. Contract module: no disposable check bed this leg (per R10 gate-by-change-class — the runtime R10 roster runs at the super leg against the assembled 4-leg tree). Attribution:analysed on a live system(the livego test/build ran against the fresh published spec tag).Schema version
NO
#SchemaVersionbump: the changed surface is a Go re-export shim, not an authoredcharly.ymlsurface.task cue:genis a NO-OP (no.cueschema touched).spec.CLIModel/CLILeaf/CLIArgare GENERATED inspec/cue_types_gen.go— no hand-written wire type, no@go(-)added (SDD holds).Producer-first B2 chain
spec (merged
v0.2026214.434, PR opencharly/spec#12) → this sdk leg → superproject charly (the super leg repointscharly/cli_model_cmd.go→clireflect.BuildCLIModel+climodel.ValidateGenerated, bumps gitlinks, retidies candies on the new spec tag, runs the check-pod canary).Assisted-by: Claude Code glm-5.2:cloud (analysed on a live system)