Skip to content

feat(kit): the check result model lands in sdk/kit (P5-unit-2) - #17

Merged
atrawog merged 2 commits into
mainfrom
feat/kit-result-model
Jul 10, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/kit-result-model

Conversation

@atrawog

@atrawog atrawog commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Second unit of P5 (check-engine SDK-ization). The check engine's result model — the
pass/fail/skip verdict, the per-step result record, and the output formatters — now lives ONCE
in sdk/kit, so a plugin candy that runs a plan represents and formats results with the same
types the engine uses.

What moved

  • kit.Status gains a String() → "pass"/"fail"/"skip"/"unknown". It was already the
    three-valued verdict (StatusPass/StatusFail/StatusSkip) a verb returns in a kit.Result; it
    is now also the ONE enum the engine records.
  • kit.CheckResult (checkresult.go) — the engine's per-step record: a verb's verdict
    (Status/Message/CapturedValue) plus the bookkeeping a Result does not carry (Op *spec.Op,
    Verb, Elapsed, retry Attempts/TotalElapsed, DeadlineExceeded).
  • kit.StepResult — one plan step's outcome (keyword/text/origin/id + its CheckResult).
  • kit.FormatStepResults{Text,JSON,TAP,JUnit} + kit.Plural (report.go) — the check
    output reporters, moved verbatim.

The duplication this dissolves

kit.Status and charly's CheckStatus were the same three-valued enum, bridged by a
kitStatusToCheck converter in core — the exact "mirror + convert" pattern P5 exists to remove.
kit.go's own comment read "Status ... mirrors charly's CheckStatus ordering" and "charly
converts it to its internal CheckResult."
The converter is deleted (in the consuming
superproject PR); a verb's kit.Result verdict now flows into a CheckResult with no conversion.

kit.Result (the verb-author verdict — what to return) and kit.CheckResult (the engine's
record) coexist as distinct, documented concepts: a Request/Record split, not duplication.

Change class

sdk Go (pure library — this PR is purely additive; the core deletions land in the superproject
consumer). Gate: go test ./... + the consuming superproject's full concurrent bed roster + a
21-file check-live golden-output parity.

Check-coverage — the formatters had NONE in core

report_test.go adds 10 tests the reporters never had:

  • TestFormatStepResultsText — the exact text output (the format the check-live golden
    oracle compares): the PASS/FAIL/SKIP column, the N steps: … passed, … failed, … skipped summary, and singular vs plural.
  • TestRenderStep_RetryInfo — the (attempts=N, elapsed=…) suffix appears at Attempts>1 and
    is absent at 1.
  • TestFormatStepResultsTAP — TAP v13; the failing point emits exactly one diagnostic block, a
    skip is still ok.
  • TestFormatStepResultsJSON_RoundTrips — the JSON document unmarshals back to []StepResult.
  • TestFormatStepResultsJUnit — parses the XML back and checks origin→suite grouping (first-seen
    order) and per-suite tests/failures/skipped counts.
  • TestStatus_String (all four cases), TestPlural, TestStepResultCarriesOp.
ok  github.com/opencharly/sdk/kit  (all result-model tests pass)

R10 evidence — consumed by the superproject, full concurrent roster + golden parity

charly rebuilt against this working tree (replace => ../sdk), all 18 disposable beds at once:

check-group          0 541s   check-charly-vm     0 492s   check-k3s-vm      0 911s
check-k8s-deploy     0 708s   check-sidecar-pod   0 378s   check-exampledeploy 0 270s
check-structkind     0 432s   check-substrate     0 356s   check-local       0 336s
check-builder-local  0 326s   check-udev-local    0 365s   check-migrate-local 0 316s
check-feature-local  0 375s   check-agent-local   0 402s   check-doctor-local  0 297s
check-commands-local 0 306s   check-preempt-local 0 412s   check-gpu-local   0 346s

### failing beds: 0    ### orphan domains: (none)    ### orphan containers: 0

Golden parity. The 21-file check-live oracle captured before P5 began, masked for
by-design non-determinism (auto ssh ports, k8s name hashes, unordered pod listing):
21/21 identical. The result-model move is behaviour-neutral — the reporters produce the
same bytes.

Tier

fully tested and validated.

Assisted-by: Claude (fully tested and validated)

Second unit of P5 (check-engine SDK-ization). The result model - the pass/fail/skip
verdict, the per-step result record, and the output formatters - now lives ONCE in
sdk/kit, so a plugin candy that runs a plan represents and formats results with the
same types the engine uses.

Moved:
 - kit.Status gains String() -> "pass"/"fail"/"skip"/"unknown". It was already the
   three-valued verdict a verb returns in a kit.Result; it is now also the enum the
   engine records.
 - kit.CheckResult (checkresult.go): the engine's per-step record - a verb's verdict
   (Status/Message/CapturedValue) plus the bookkeeping a Result does not carry (Op
   *spec.Op, Verb, Elapsed, retry Attempts/TotalElapsed, DeadlineExceeded).
 - kit.StepResult: one plan step's outcome (keyword/text/origin/id + its CheckResult).
 - kit.FormatStepResults{Text,JSON,TAP,JUnit} + kit.Plural (report.go): the check
   output reporters, moved verbatim.

The duplication this dissolves: kit.Status and charly's CheckStatus were the SAME
three-valued enum, bridged by a kitStatusToCheck converter in core - the exact
"mirror + convert" pattern P5 removes (kit.go's own comment read "Status ... mirrors
charly's CheckStatus ordering" and "charly converts it to its internal CheckResult").
The converter is deleted; a verb's kit.Result verdict now flows into a CheckResult
with no conversion. kit.Result (the verb-author verdict) and kit.CheckResult (the
engine's record) coexist as distinct documented concepts - a Request/Record split.

Check-coverage - the formatters had NONE. report_test.go adds the tests the reporters
never had: the exact text output (the format the check-live golden oracle compares -
PASS/FAIL/SKIP column, the "N steps:" summary, singular/plural), the retry-info suffix
(present at Attempts>1, absent at 1), TAP v13 (the failing point emits exactly one
diagnostic block; a skip is still "ok"), a JSON round-trip, and JUnit XML (origin
grouping into suites, per-suite counts). Plus Status.String() (all four cases) and
Plural.

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

atrawog commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: sdk Go (pure, additive library MOVE — behaviour-neutral)

Independent re-derivation (trusted nothing in the PR body). Checklist:

  • [PASS] 0. Security (T1–T4) — no scope-mismatch (diff == description exactly: kit.go String(), checkresult.go, report.go, report_test.go, CHANGELOG), no secrets/exfiltration/network/eval, no guardrail or supply-chain change (no go.mod edit, imports are stdlib + existing spec), no manipulation of the validator.
  • [PASS] 1. Description — thorough and evidence-backed (summary, what-moved, R3 duplication dissolved, change-class→gate, check-coverage, R10 roster + golden parity, tier).
  • [PASS] 2. Change-class gate — sdk-Go library; gate = go test ./... + consumer bed roster + golden parity; no dry-run/rebuild-alone fraud.
  • [PASS] 3. Attribution tier — author's fully tested and validated corroborated by my source-equivalence proof + consumer integration; not inflated.
  • [PASS] 4. R0 skills — honors the SDK/kit contract (kit is the hand-written host-engine library) and the P5 SDK-ization plan.
  • [PASS] 5. R1 — zero failures/warnings anywhere in re-run evidence.
  • [PASS] 6. R2 — sdk-add-now / core-delete-next is the sanctioned cross-repo dependency ordering, not an out-of-scope split.
  • [PASS] 7. R3 — the move removes the mirror+convert duplication (kit.Status becomes the single enum; CheckStatus aliases it). Result (verb verdict) vs CheckResult (engine record, +Op/Verb/timing/retry/deadline) is a genuine Request/Record split, not duplication.
  • [PASS] 8. R4 — pure functions; no sleep/retry/magic-number/ad-hoc-podman.
  • [PASS] 9. R5 — nothing deprecated to delete within sdk (additive); no transitional/dual-mode path; the Status comment was claim-swept.
  • [PASS] 10. R6/R8/R9 — N/A for a pure library (no destructive git action / generation / binary or PKGBUILD change here).
  • [PASS] 11. R10 — check-coverage that would fail without the code (exact-output text test, TAP diagnostic-block count, JSON round-trip, JUnit grouping/counts, String() all 4, Plural); fresh rebuild green; zero warnings.
  • [PASS] 12. RDD/ADE/SDD — TestGenReproducible green; no schema/*_gen.go/proto/params touched; CheckResult/StepResult are host-side engine result-record + report types (hand-written Go consistent with the whole kit package), NOT spec/*_wire.go wire types or plugin params, so the CUE-generation mandate is not triggered.
  • [PASS] 13. Concurrency — no shared-state path touched (pure formatting/result types); concurrent-roster gate N/A; no idle/serial-pass dodge.
  • [PASS] 14. Hard cutover — ONE atomic commit; no Phase-2/TODO.
  • [PASS] 15. Kernel/plugin boundary — result model is kind-agnostic; no spec.<Kind> field-read, kind switch, or per-kind map.
  • [PASS] 16. Disposable-only autonomy — no non-disposable target touched.
  • [PASS] 17. Clean architecture + Go gates — gofmt -l kit clean; golangci-lint (v2.12.2) ./... = 0 issues; go vet ./... clean; go test ./... green (all on the exact PR-head with a clean tree).
  • [PASS] 18. CHANGELOG — staged (placeholder CalVer, finalized at merge).

Behaviour preservation — PROVEN byte-identical vs main (this is a MOVE): the report.go formatters diff -B-identical to charly/description_report.go; CheckResult/StepResult fields + every JSON tag are identical (*Op→*spec.Op, and charly.Op = vmshared.Op = spec.Op so the type is unchanged); Status.String() returns exactly pass/fail/skip/unknown like the original CheckStatus.String(); iota order StatusPass=0/StatusFail=1/StatusSkip=2 matches TestPass/TestFail/TestSkip (so the superproject's type CheckStatus = kit.Status alias is sound — it compiles in the consumer working tree). No format string, struct tag, or field order altered.

Integration (my own fresh-rebuild evidence): the full charly consumer (with the uncommitted P5 switch — CheckStatus = kit.Status, description_report.go deleted) builds ./... cleanly against this sdk head via replace => ../sdk, and charly's result-model tests pass. The golden-parity claim is a deterministic consequence of byte-identical pure formatters — the unit tests execute them live with exact-output assertions.

Decision: Genuine PASS. A pure, behaviour-preserving MOVE proven byte-equivalent at source, all Go gates green on the exact head, and the consumer integrates and tests clean against it. I did not re-run the full 18-bed roster (properly the consumer PR's gate); the behaviour claim is proven more strongly at source than a single noisy bed would show. Finalizing merge-time CalVer, squash-merging, tagging.

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

pr-validator merge-time version stamp: rename the CHANGELOG placeholder
2026.191.1530 -> 2026.191.1732 (generated at merge, not author-time). No
code change; the validated result-model move is unchanged.

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