Skip to content

feat(cutover-c3): stage-grouped + concurrent bed-member walk (kit) + all-or-nothing load validation - #236

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/cc3-stage-parallel
Sep 7, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/cc3-stage-parallel

Conversation

@atrawog

@atrawog atrawog commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Cutover C tasks 5-7 (CC-3 wave, PR 2 of 3: spec → sdk → charly → umbrella).

The canonical stage-grouped + concurrent bed-member walk (kit/planrun_staged.go, task 5):

  • RunPlanStaged(ctx, members []MemberRun, parallel, strict) executes a bed's member plans with the CC-3 execution model; RunPlan now delegates to it (ONE canonical engine, R3).
  • When ANY step carries stage:: steps are grouped by stage and stage groups execute in FIRST-SEEN order (recorded from the authored order at load — task 4). Within a stage, steps on DIFFERENT members run as INDEPENDENT Runner instances CONCURRENTLY (A4 — never share one Runner); same-member steps keep authored order. parallel: does not interact with stages — stages dominate.
  • Without stages: today's sequential per-member walk, plus whole-member-plan concurrency when parallel: true.

Concurrency-safe result collection (task 6): per-member result slices; ONE mutex serializes every shared-summary append (the A4 fix — no races in the -race run); final order is venue-keyed deterministic (members in authored order, steps in authored order), never completion-time.

Drain semantics (task 7): a member step failure does NOT stop other members — every stage's WaitGroup barrier drains all its members before the next stage starts; per-member verdicts land in the results. Tear-down of all members on every terminal path stays the bed runner's job (plugin-check), which the drain makes safe to rely on.

Load-time all-or-nothing validation (task 4): loaderkit.ValidateCheckBeds now rejects a bed whose root + whole uniform member tree MIX staged and unstaged steps (stage authoring is all-or-nothing per bed) — the walk can then rely on unambiguous grouping. Dot-free stage names are CUE-enforced on #Op (spec #116).

Spec re-pin: github.com/opencharly/spec v0.2026250.709 → v0.2026250.903 (the stage:/parallel: schema).

How tested

$ cd sdk && go build ./...          # PASS (all packages)
$ go test ./... -count=1            # PASS (10 packages ok)
$ go test ./kit/ ./loaderkit/ -count=1 -race   # PASS (the A4 mutex audit)
$ go vet ./kit/ ./loaderkit/        # PASS
$ golangci-lint run ./kit/ ./loaderkit/   # ZERO findings in changed files

TDD coverage (kit/planrun_staged_test.go):

  • TestRunPlanStaged_StageGroupsFirstSeenOrder — stage groups in first-seen order
  • TestRunPlanStaged_SameMemberStepsKeepAuthoredOrder — within-member/stage order preserved
  • TestRunPlanStaged_MemberStepsConcurrentIndependentRunners — barrier handshake proves BOTH members entered before either finished (concurrency on INDEPENDENT runner instances, A4)
  • TestRunPlanStaged_StageDrainOnMemberFailure — member a's forced failure does NOT stop member b, next stage still runs (drain)
  • TestRunPlanStaged_ParallelWholeMemberPlans — parallel:true whole-member concurrency (barrier)
  • TestRunPlanStaged_SequentialWithoutParallel — today's sequential walk preserved
  • TestRunPlanStaged_DeterministicVenueKeyedOrder — two runs, byte-identical order
  • TestRunPlanStaged_RunPlanDelegatesStageAware — RunPlan itself groups by stage
  • TestRunPlanStaged_NoStageStepsStillRun — an unstaged step in a staged bed is never dropped

Load validation tests (loaderkit/validate_check_beds_stage_test.go): all-or-nothing across root + deploy-level/in-substrate members + recursive grandchild; hook-in through the real ValidateCheckBeds entrypoint.

Rulebook compliance

  • R3 (no duplication): RunPlan delegates to RunPlanStaged — ONE canonical walk; ValidateCheckBeds is the single load gate.
  • R1: the barrier deadlock in the first test draft was RCA'd — buffered barrier channels let a resolver self-consume its own entry; unbuffered channels enforce the proper two-phase handshake.
  • A4 (never share one Runner): the walk spawns per-member goroutines on per-member runners, proven by the barrier tests; result collection serialized under ONE mutex.

Change classification

  • Change class: feature (sdk/kit walk + loader validation; spec re-pin)
  • Verification gate: go build ./... + go test ./... + -race on the changed packages green on the final tree
  • Attribution tier: fully tested and validated

Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)

…) + 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).
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 5e7c2482de19977e3569aaca325d2b73909928e6

Change class: feature (sdk/kit walk + loader validation; spec re-pin)

Security screen: PASS — no scope mismatch, secrets, exfiltration, weakened guardrails, or supply-chain anomaly (spec bump v0.2026250.709 → v0.2026250.903 is a same-module schema bump, consistent with the body's claim).

Blocks

  1. B18 / R1 — leftover DEBUG println in production code. kit/planrun_staged.go, runStagedGroups:

    println("DEBUG staged: stages=", len(stageOrder), " members=", len(memberStageSteps))
    ...
    println("DEBUG member", mi, "stage", si, "steps", len(steps))

    These emit debug output to stderr on every staged bed run, from concurrent member goroutines. This is unambiguously leftover scaffolding that must not ship — it pollutes the gate output (R1 zero-warning mandate) and is a B18 code-quality defect. Remove both println calls.

  2. B18 / B12 — dead code + a test that does not test its claim. kit/planrun_staged_test.go, TestRunPlanStaged_StageGroupsFirstSeenOrder:

    • Defines an idx closure that is never invoked, suppressed only by _ = idx — dead scaffolding.
    • Despite its name and a comment claiming "verify via the result order instead," the test only asserts len(out) != 3; it never asserts the first-seen stage order (a2 before a1). The claimed behavior is not actually verified by this test. Remove the dead idx closure and assert the actual result order.

Placement

placement: CORRECT — the walk is a kind-blind, reusable mechanism in kit/ (sdk), and the load-time all-or-nothing validation belongs in loaderkit/. No core/sdk/candy misplacement; RunPlan delegating to RunPlanStaged is the single canonical walk (R3).

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

…en 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.
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: deba0f48ae153684b5077ceaefe6ff19d1632182

Security screen: PASS — no scope mismatch (all 7 files accounted for in the body), no secrets/exfiltration, no weakened guardrails, no supply-chain anomaly (spec bump v0.2026250.709 → v0.2026250.903 is a same-module schema bump consistent with the body's claim and the Stage field usage in the diff).
Checklist: All applicable rules PASS or NA.

Prior github-actions[bot] BLOCK findings — both re-verified against the CURRENT diff and resolved:

  • stale-superseded — DEBUG println calls in runStagedGroups are gone from the current kit/planrun_staged.go (removed by commit deba0f48).
  • stale-superseded — the dead idx closure is removed and TestRunPlanStaged_StageGroupsFirstSeenOrder now asserts the actual first-seen order (want := []string{"a2","a1","b1"}), not just len(out).

Placement: CORRECT — the walk is a kind-blind reusable mechanism in kit/ (sdk), load validation in loaderkit/; RunPlan delegating to RunPlanStaged is the single canonical walk (R3). No alias files, no new core→sdk-kit import.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 7, 2026 09:28
@github-actions
github-actions Bot merged commit 073ba79 into main Sep 7, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 7, 2026
@aitrawog
aitrawog deleted the feat/cc3-stage-parallel branch September 25, 2026 19:07
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