Skip to content

feat(kit): the plan-execution helpers land in sdk/kit (P5-unit-3) - #18

Merged
atrawog merged 2 commits into
mainfrom
feat/kit-plan-helpers
Jul 10, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/kit-plan-helpers

Conversation

@atrawog

@atrawog atrawog commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

Third unit of P5 (check-engine SDK-ization). Three self-contained plan-execution helpers
move from charly core into sdk/kit, so a plugin candy that runs a plan shares them with the
check engine instead of re-implementing them.

  • kit/eventually.go — RunWithEventually (the eventually: retry loop) + probeWasKilled
    • killedProbeRetries/killedProbeRetryInterval. Uses the already-shared kit.SignalKillErrMarker.
  • kit/scenario.go — ScenarioContext + NewScenarioContext + AddBackground/
    SnapshotBackgrounds/ApplyToEnv (the per-plan-run capture store + ${STEP_ID} thread +
    background-PID reaper).
  • kit/checklevel.go — the acceptance-depth ladder: CheckLevel{None,Build,NoAgent,Agent},
    DefaultCheckLevel, ResolveCheckLevel, IsValidCheckLevel, CheckLevelReaches, CheckLevels.
  • Moved tests: kit/eventually_test.go, kit/checklevel_test.go.
  • CHANGELOG H1 fix to CHANGELOG/2026.191.1732.md (the P5-unit-2 entry): its H1 read
    # 2026.191.1530 after the merge-time stamp renamed the file but not the header. One line.

plan_validate.go and check_substitute.go stay in core (dual-invoked by box-validate +
the feature HostBuild seam; and bound to the core CUE loader, respectively) — only what compiles
standalone in kit moved.

Change class

charly-or-sdk Go — pure sdk library, purely additive. Cross-repo: sdk producer → the
superproject consumer (core alias rewire + the 3-file deletions + gitlink bump); sdk lands
first
, the consumer PR follows and carries the full bed roster + golden parity.

How R10-tested — exact gate, commands, and pasted output

  • The gate for this change class: a pure sdk library → go test ./... + golangci-lint +
    go vet + gofmt, plus the integration build/test of the consuming superproject against this
    sdk tree (replace => ../sdk). The full concurrent 18-bed roster + 21-file golden check-live
    parity
    is the consumer PR's gate (it exercises the moved code live); it already passed on this
    work in progress and re-runs there against the final code.
  • Disposable target(s) used: N/A (pure sdk library) for THIS PR — the disposable-bed roster
    belongs to the superproject consumer PR. No bed can fail on a library-internal move that the
    consumer has not yet wired.
  • Fresh rebuild: N/A (R9) — no binary is produced by an sdk-library change. The consumer PR
    rebuilds charly (task build:charly) and runs the roster on the fresh binary.
  • Did the CHANGED code path execute live? The moved logic is behaviour-neutral (a MOVE): the
    moved tests exercise RunWithEventually's killed-probe/deadline paths and the CheckLevel
    ladder directly, and the consumer's roster runs the retry loop + ladder live. The move is proven
    byte-equivalent to the originals (main:charly/description_eventually.go, description_capture.go,
    check_level.go) modulo the package/name renames.
  • Concurrency (shared-state changes only): N/A — no shared-state path is touched; ScenarioContext's
    mutex guarding is preserved verbatim. (The consumer roster nonetheless runs all beds concurrently.)
$ cd sdk && go test ./...
ok  github.com/opencharly/sdk
ok  github.com/opencharly/sdk/deploykit
ok  github.com/opencharly/sdk/kit
ok  github.com/opencharly/sdk/spec
ok  github.com/opencharly/sdk/vmshared

$ cd sdk && golangci-lint run ./...
0 issues.

$ cd sdk && gofmt -l kit/      # empty = clean
$ cd sdk && go vet ./kit/      # clean

# integration — the consuming superproject builds + the moved tests pass against this sdk tree:
$ go test ./charly/... -run 'CheckLevel|Eventually'
ok  github.com/opencharly/charly/charly

Attribution tier

fully tested and validated — the moved code is byte-equivalent to the originals (proven by
diff), the moved tests pass, and the consuming superproject builds + tests green against this
tree; the consumer PR carries the live 18-bed roster + golden parity that exercises the retry
loop and ladder end-to-end. The commit carries Assisted-by: Claude (fully tested and validated).

CLAUDE.md rule compliance — state HOW each is satisfied (or N/A — <reason>)

  • R0 skills: /charly-internals:go (sdk/kit source structure) + /charly-internals:plugin
    (kit is the importable host-engine surface a plugin candy shares) were loaded before the move.
  • R1 RCA + zero warnings: gate output above is zero-warning; the golangci unused findings
    the move produced in the consumer (dead plural/signalKillErrMarker aliases) were root-caused
    (their sole caller moved to kit) and removed, not suppressed.
  • R2 no out-of-scope: the unit-2 CHANGELOG H1 divergence surfaced during this cutover and is
    fixed here (one line, same repo) rather than parked; the consumer deletions are the sanctioned
    cross-repo next step, not a "follow-up".
  • R3 no duplication: the three helpers now live ONCE in kit; the check engine consumes them via
    aliases. No -host/-pod siblings.
  • R4 no workaround: the killed-probe re-attempt is a BOUNDED response to an infra INTERRUPTION
    (a signal-killed probe that produced no result), never a retry-on-flake — a probe that ran and
    failed is not retried. No sleep/magic-number added; the const/interval are moved verbatim.
  • R5 hard cutover + grep: purely additive in sdk (nothing removed here). The core deletions +
    git grep self-test are in the consumer PR; no transitional/dual-mode path exists.
  • R6 git safety: N/A — no destructive git action (a stray CHANGELOG diff was inspected before
    keeping it as the R2 fix).
  • R7 runtime gate: the runtime gate (the bed roster) is the consumer PR's; this library PR's
    gate is go test + integration build, which is the correct gate for its change class.
  • R8 artifact invariants: N/A — no Containerfile/OCI-label generation touched.
  • R9 binary == source + deps: N/A here — no binary; the consumer rebuilds + version-checks.
  • R10 disposable + coverage: the moved tests would FAIL without the moved code (the ladder
    ordering + the killed-probe semantics are asserted); the live disposable-bed proof is the
    consumer PR.
  • RDD / ADE / SDD: N/A — no .cue/schema/wire/params/generated file touched (ScenarioContext
    is process-local state, not a wire type); no candy.
  • Hard cutover: ONE atomic commit; no Phase-2/TODO; only the cleanly-movable files moved (the
    CUE-coupled and dual-invoked ones stay, documented).
  • Kernel/plugin boundary law: the move takes generic mechanism OUT of core into the shared kit
    library — it strengthens the boundary; no concrete-kind schema/switch/per-kind map added.
  • Disposable-only autonomy: N/A — no destroy/rebuild in this PR.
  • Clean architecture + Go gates: gofmt -l empty, golangci-lint 0 issues, go vet clean,
    go test ./... green (pasted above); deprecated core copies are deleted in the consumer.
  • CHANGELOG: CHANGELOG/2026.191.1600.md staged (placeholder CalVer; the pr-validator finalizes).

Assisted-by: Claude (fully tested and validated)

Third unit of P5 (check-engine SDK-ization). Three self-contained plan-execution
helpers move from charly core into sdk/kit, so a plugin candy that runs a plan
shares them with the check engine instead of re-implementing them:

 - kit.RunWithEventually (eventually.go): the eventually: retry loop + the
   killed-probe bounded re-attempt (a probe SIGKILLed by a transient host-load
   spike is re-run; a probe that ran and failed is not). Uses the already-shared
   kit.SignalKillErrMarker.
 - kit.ScenarioContext (scenario.go): the per-plan-run mutable state - the
   capture: store, the ${STEP_ID} thread, the background-PID reaper. Self-contained
   (sync only).
 - the acceptance-depth ladder (checklevel.go): CheckLevel{None,Build,NoAgent,Agent},
   DefaultCheckLevel, ResolveCheckLevel, IsValidCheckLevel, CheckLevelReaches,
   CheckLevels.

plan_validate.go and check_substitute.go deliberately STAY in core: the former is
invoked by both charly box validate and the charly feature HostBuild seam (its own
header documents this); the latter is bound to the core CUE loader
(decodeEntityViaCUE).

Tests move with the code: eventually_test.go (the killed-probe retry semantics -
killed-on-every-attempt fails loudly after the cap; a ran-and-failed probe is not
retried) and checklevel_test.go (the ladder ordering + default + validity,
load-bearing for how deep every bed runs). The core ExtractMetadata label
round-trip stayed in core (it exercises the OCI label surface, not the ladder).

Also (R2, in-repo): CHANGELOG/2026.191.1732.md (the P5-unit-2 entry) carried an H1
of "# 2026.191.1530" - the merge-time CalVer stamp renamed the file to 1732 but
left the placeholder H1. Corrected to match its filename and tag.

Assisted-by: Claude (fully tested and validated)
@atrawog

atrawog commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: charly/sdk Go — pure library, purely additive (core deletions land in the superproject consumer PR)

I re-derived everything independently from the diff, the repo, and superproject history — I did not take the body's word for anything.

The code and behaviour are compliant — the single blocker is the PR body

Item 1 — description completeness: FAIL (sole blocker). The body does not follow the mandatory org PR template (opencharly/.github/.github/PULL_REQUEST_TEMPLATE.md). Two mandatory sections are absent:

  1. "How R10-tested — exact gate, commands, and pasted output" — the body names the gate ("go test ./... + the consumer roster") but pastes no gate output at all. The template header itself lists "pastes no R10 output" as a FAIL condition, and item 1 requires pasted output (not a promise). It also lacks the disposable-target line (mark N/A (pure library) + reason), the R9/fresh-rebuild line, and the "did the changed code path execute live?" line.
  2. "CLAUDE.md rule compliance" (R0–R10 + pillars, one-line HOW each) — entirely missing. The template header lists "leaves any applicable section blank" as a FAIL condition.

The burden is on the PR to supply this evidence in the template; I had to reconstruct all of it myself. Please fill both sections and re-push (append a fix commit in place — do not close/recreate). When you write the "How R10-tested" block, base the fully tested and validated tier on this PR's own gate (the go test/lint output + byte-equivalence to production) — not on the consumer roster that is not yet opened (that would read as "will test later").

Everything else PASSES (independently verified)

# Item Verdict
0 Security / anti-tampering (T1–T4) PASS — 7 files exactly matching the description; no secrets/exfiltration/network/eval; no guardrail/hook/branch-protection edits; no new deps/pins; no injection directive in body
2 Change-class gate vs evidence PASS — I re-ran go test ./... (green), gofmt -l (clean), go vet (clean), golangci-lint ./... (0 issues), + superproject go test ./charly/... -run 'CheckLevel|Eventually' (ok)
3 Attribution tier PASS — fully tested and validated is accurate for a behaviour-preserving move of byte-identical production code + green moved tests; matches P5-unit-1/2 precedent
4–9 R0–R5 PASS — skills honored; zero warnings; no R2 split (core deletion is a genuinely-separable cross-repo next cutover); no duplication within sdk; killed-probe retry is bounded infra-interruption re-run, explicitly not retry-on-flake (R4); purely additive, no transitional path (R5)
10 R6/R8/R9 N/A — source-only library
11 R10 coverage PASS — moved tests would FAIL without the code (they drive the retry-loop call counts + ladder ranks); verified green
12 RDD / ADE / SDD PASS — SDD N/A (no schema/*.cue, no *_gen.go, no *_wire.go, no *.proto, no params struct; ScenarioContext is process-local runtime state, not a wire type)
13 Concurrency PASS — no shared-state defect introduced; ScenarioContext.mu guards Backgrounds/Results
14 Hard cutover PASS — ONE atomic commit; no Phase-2/TODO
15 Kernel/plugin boundary PASS — move goes from core → sdk/kit, strengthening the boundary
17 Clean architecture + Go gates PASS — gofmt/vet clean, golangci-lint 0 issues, tests green
18 CHANGELOG PASS — CHANGELOG/2026.191.1600.md staged

Behaviour preservation (the core of the review): eventually.go / scenario.go / checklevel.go are byte-equivalent to charly/description_eventually.go / description_capture.go / check_level.go except the expected renames (main→kit, runWithEventually→RunWithEventually, TestPass/Fail→StatusPass/Fail, plural→Plural, signalKillErrMarker→SignalKillErrMarker, *Op→*spec.Op) plus benign comment reflow and two doc-accuracy fixes (a detached doc comment re-attached; the stale "Captures +" removed from scenario.go's mu comment — there is no Captures field). The retry logic, deadline clamp, PASS-first/FAIL-last semantics, killed-probe re-attempt, const values, and ladder ranks are identical. Moved tests are byte-identical to their originals; all four killed-probe subtests and three ladder tests are intact, non-tautological, and pass. TestExtractMetadata_CheckLevel correctly stayed in core (OCI-label machinery). plan_validate.go (dual-invoked by box-validate + the feature HostBuild seam) and check_substitute.go:290 (decodeEntityViaCUE) are genuinely core-coupled — the scoping is honest. The CHANGELOG/2026.191.1732.md H1 fix is a genuine 1530→1732 divergence correction.

Decision: CHANGES REQUESTED. The change itself is a clean, behaviour-preserving, security-clean move and all substantive gates are green — the only thing blocking merge is the incomplete PR body. Fill the mandatory "How R10-tested" (with pasted go test/lint output; bed marked N/A (pure library)) and "CLAUDE.md rule compliance" template sections, then push a fix commit to this branch — the status resets and I re-run. PR left open; not merged.

Assisted-by: Claude (analysed on a live system)

@atrawog

atrawog commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅ (re-validation after body-fill)

Supersedes the prior CHANGES-REQUESTED verdict. The two previously-missing org-template sections (How R10-tested with pasted gate output, and the CLAUDE.md rule compliance R0–R10 block) are now filled with real evidence, and I independently re-ran every substantive check.

Change class: charly/sdk Go — pure sdk library, purely additive; cross-repo producer (sdk lands first, superproject consumer PR follows).

Checklist

  • [PASS] 0. Security/anti-tampering — 7 files, Go + markdown only; go.mod untouched (no new deps / supply-chain), no network/secrets/eval/obfuscation; diff matches description (no scope mismatch); no manipulation directives in the body.
  • [PASS] 1. Description complete — every applicable template section supplies evidence, not bare ticks or promises.
  • [PASS] 2. Change-class gate — a pure sdk library emits no binary and has no bed of its own; the honest gate is go test+lint+go vet+gofmt plus the consumer integration build. The live 18-bed roster is correctly the consumer PR's gate (the documented cross-repo landing pattern), not falsely claimed here.
  • [PASS] 3. Attribution tier fully tested and validated — HONEST for this class and not inflated: the move is byte-equivalent (no new behavioral branch), the moved unit tests execute the actual logic (I re-ran -count=1, green), and the consumer superproject builds + tests live-green against this exact sdk tree (I reproduced it). Matches the fresh-validated precedent of the identical unit-2.
  • [PASS] 4. R0 skills honored.
  • [PASS] 5. R1 zero warnings — golangci-lint 0 issues, go vet clean.
  • [PASS] 6. R2 no out-of-scope split — the 2026.191.1732 H1 divergence is a genuine in-repo fix (origin/main read # 2026.191.1530).
  • [PASS] 7. R3 — helpers live once in kit; no -host/-pod siblings.
  • [PASS] 8. R4 — the bounded killed-probe re-attempt is infra-interruption handling (a ran-and-failed probe is NOT retried), not retry-on-flake; the const/interval moved verbatim, no new magic number.
  • [PASS] 9. R5 — purely additive in sdk; the core deletions + grep self-test belong to the consumer PR; no transitional/dual-mode path.
  • [PASS] 10. R6/R8/R9 — N/A (no destructive git action; no Containerfile/label generation; no binary).
  • [PASS] 11. R10 — no disposable bed exists for the isolated library; the moved tests would FAIL without the moved code (killed-probe semantics + ladder ordering asserted).
  • [PASS] 12. SDD/ADE/RDD — N/A: no .cue/generated/wire/params/candy touched. ScenarioContext is in-process plan-run state (carries a sync.Mutex), not a host↔plugin wire type, so it is correctly hand-written.
  • [PASS] 13. Concurrency — N/A: no shared-state path touched; ScenarioContext's mutex guarding is preserved verbatim.
  • [PASS] 14. Hard cutover — ONE atomic commit; no Phase-2/TODO left in scope.
  • [PASS] 15. Kernel/plugin boundary — the move takes generic mechanism OUT of core into the shared kit library; it strengthens the boundary; no concrete-kind schema/switch/per-kind map added.
  • [PASS] 16. Disposable-only autonomy — N/A.
  • [PASS] 17. Clean architecture + Go gates — gofmt -l empty, golangci-lint run ./... = 0 issues, go vet clean, go test ./... green.
  • [PASS] 18. CHANGELOG — CHANGELOG/2026.191.1600.md staged (placeholder; I finalize the merge-time CalVer).

Byte-equivalence (my code-only normalized diff vs origin/main)

  • kit/checklevel.go vs charly/check_level.go — IDENTICAL (package rename + comment reflow).
  • kit/scenario.go vs charly/description_capture.go — IDENTICAL code (import-block form only; a stale mu comment referencing a non-existent field was corrected).
  • kit/eventually.go vs charly/description_eventually.go — IDENTICAL modulo the allowed renames (main→kit, runWithEventually→RunWithEventually, TestPass/Fail→StatusPass/Fail, signalKillErrMarker→SignalKillErrMarker, plural→Plural [kit.Plural is byte-identical], *Op→*spec.Op, +spec import, local plural func dropped for the shared one). No change to the retry loop, deadline clamp, or ladder ranks.

Decision: Genuine PASS. The move is provably behavior-neutral, all sdk gates are green, the moved tests are real and non-tautological, the consumer integrates live-green against this tree, and the body honestly discloses that the live bed roster is the consumer PR's gate. Finalizing the merge-time CalVer and merging.

Assisted-by: Claude (analysed on a live system)

The pr-validator stamps the merge-time version: CHANGELOG/2026.191.1600.md
(author placeholder) -> CHANGELOG/2026.191.1837.md, H1 aligned to the filename
and the release tag v0.2026191.1837.

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01W8GPhuyWWs5XwJyJYtCaxE
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