Skip to content

refactor(scaffold): consume the box-new engine from sdk/kit (P15 sub-unit) - #72

Merged
atrawog merged 7 commits into
mainfrom
feat/p15-scaffold-kit
Jul 12, 2026
Merged

atrawog merged 7 commits into
mainfrom
feat/p15-scaffold-kit

Conversation

@atrawog

@atrawog atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

P15 sub-unit — consume the box-new scaffold ENGINE from sdk/kit

The superproject half of the scaffold-engine relocation (pairs with merged sdk #30 /
v0.2026193.1241). The charly box new project/candy/box authoring engine now lives in sdk/kit,
so charly core CONSUMES it instead of owning it — ONE shared library for the core CLI now and the
Wave-2 command:box plugin next (mirrors the P8b engine→lib pattern: the engine leaves, the thin
grammar stays). The charly box new CLI grammar + behaviour are UNCHANGED — a pure engine
relocation, no transitional path.

Core rewire

  • Delete charly/scaffold.go (ScaffoldCandy → kit.ScaffoldCandy).
  • Slim charly/scaffold_project.go to the add-candy/rm-candy edit helpers. Their shared
    saveYAMLNodeFile → the exported kit.SaveYAMLNodeFile: one caller (AddBox) moved to kit and
    two (AddCandyToBox/RemoveCandyFromBox) stay core, so the marshal-to-file helper crosses the
    boundary and gets ONE exported home (R3). The resolveBoxNodeFile cluster is used only by the
    staying edit verbs → stays core (zero duplication).
  • NewCandyCmd/NewProjectCmd/NewBoxCmd handlers → kit.*. ComputeCalVer stays core (the
    wall-clock read) and is passed as a param so kit is clock-free; the candy-created prints move to
    the handler (kit does fs work only).
  • Scaffold engine tests → sdk/kit/scaffold_test.go; core keeps the add-candy/rm-candy integration
    tests (rewired to kit.* setup).

sdk pointer

Bumps the sdk submodule 4d7cd80 → 793e7d4 + go.mod require → v0.2026193.1241 (carries
the merged scaffold engine + P14a #28 + P9 #29 — additive; core builds clean against them, verified).

Verification (against the merged sdk)

  • go build + full go test ./charly/... + ./sdk/kit — green.
  • golangci-lint run — 0 issues (both modules); gofmt/golangci-lint fmt clean.
  • R5 grep clean (no core ref to the moved engine funcs but kit.*).
  • Live smoke on a fresh binary: charly box new project / candy (version: CalVer stamped) /
    box … --base … --candies … (node-form image written) all pass through the kit engine — byte-parity
    with the prior core behaviour.

Net −194 LOC from core (floor-reducing). The Wave-2 command:box grammar relocation (which imports
this same kit engine) lands after P14a's verb:oci + P12's check-run.

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

…unit)

The core rewire paired with the merged sdk feat(kit) scaffold-engine relocation
(sdk v0.2026193.1241): the `charly box new` project/candy/box authoring engine now lives in
sdk/kit, so charly core CONSUMES it (kit.ScaffoldCandy/ScaffoldProject/AddBox) instead of
owning it — ONE shared library for the core CLI now and the Wave-2 command:box plugin next.
The `charly box new` CLI grammar + behaviour are UNCHANGED (a pure engine relocation; no
transitional path).

- Delete charly/scaffold.go (ScaffoldCandy → kit); slim charly/scaffold_project.go to the
  add-candy/rm-candy edit helpers. Their shared saveYAMLNodeFile → the exported
  kit.SaveYAMLNodeFile: one caller (AddBox) moved to kit and two (AddCandyToBox,
  RemoveCandyFromBox) stay core, so the marshal-to-file helper crosses the boundary and gets
  ONE exported home (R3). The resolveBoxNodeFile/loadCharlyYAMLNode/imageBodyNode/
  flatLocalImports helpers are used only by the staying edit verbs, so they stay core.
- NewCandyCmd/NewProjectCmd/NewBoxCmd handlers → kit.*; ComputeCalVer STAYS core (the
  wall-clock read) and is passed as a param so kit is clock-free; the candy-created prints
  move to the handler (kit does fs work only).
- Scaffold engine tests → sdk/kit/scaffold_test.go; core keeps the add-candy/rm-candy
  integration tests, rewired to call kit.ScaffoldProject/kit.AddBox for setup.
- Bump the sdk submodule to 793e7d4 + go.mod require to v0.2026193.1241 (carries the merged
  scaffold engine + P14a #28 + P9 #29 — additive, core builds clean against them).

Verified against the merged sdk: go build + full go test ./charly/... + ./sdk/kit green;
golangci-lint run 0 issues (both modules); gofmt / golangci-lint fmt clean; R5 grep clean (no
core reference to the moved engine funcs but kit.*). Live smoke on a fresh binary:
`charly box new project` / `candy` (version: CalVer stamped) / `box … --base … --candies …`
(node-form image written) all pass through the kit engine — byte-parity with the prior core
behaviour.

Assisted-by: Claude (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
@atrawog

atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: charly/sdk Go (engine relocation — NOT a deploy/runtime bed change).
Validated from a FRESH clone at 71467a0, sdk at 793e7d4. The engine relocation itself is clean; the block is one line of CHANGELOG framing.

Blocking finding — R1 + R2 + concurrency anti-cheat (one root cause)

CHANGELOG/2026.193.1230.md dismisses a real, surfaced test failure with the forbidden framings, to justify landing:

"… the pre-existing, wave-exposed TestPruneImagesByRetention concurrency flake — host-global build-lock + unstubbed liveBuildFloor, routed to P15 — is unrelated to this change"

What I established on a fresh clone:

  • TestPruneImagesByRetention (charly/retention_test.go:24) passes 20/20 under -race -count=20 and in the full go test ./... (exit 0) in isolation.
  • But the author's mechanism is real: pruneImagesByRetention calls the unstubbed host-global liveBuildFloor() (retention.go:250; scans build-activity lock files, retention.go:160). The test stubs ListLocalImages + listContainerImageRefs but not liveBuildFloor, so a concurrent charly box build on the host flips live>0 and breaks the exact-match assertion. It is a genuine test-isolation defect.

Why this is a FAIL (per CLAUDE.md, no benefit of the doubt):

  • R1 — "concurrency flake" is an explicitly forbidden framing. R1 requires an RCA and a real fix; you have the RCA but shipped a dismissal.
  • R2 — "unrelated to this change / routed to P15" is the forbidden pre-existing/follow-up split — parking a surfaced failure to justify landing.
  • Concurrency mandate — a load-surfaced ("host-global build-lock") failure must be root-cause fixed, never terminally dismissed as a "flake" citing load; a serial-green run is not a license to park it.

Fix (recommend BLOCKING, this same tree — trivial): make liveBuildFloor an injectable package var (mirroring the already-stubbed ListLocalImages/listContainerImageRefs) and stub it in retention_test.go, so the unit test is deterministic even under a concurrent host build — then rewrite the CHANGELOG to describe the actual fix and remove all "flake" / "unrelated" / "routed to P15" / "host-global build-lock" language. If you genuinely maintain it is separable, spin it as its own immediate-next cutover with an RCA proving separability (its R10 passes without the fix), and delete the forbidden-framing parenthetical from this PR's evidence entirely. Update in place (append a commit; the status resets and I re-run) — do not close/recreate.

What passed (the relocation is otherwise sound)

  • go build / go vet clean; go test ./... green in isolation; golangci-lint 2.12.2 = 0 issues (charly + sdk); gofmt clean.
  • Box-new byte-parity re-run on the fresh binary: box new project (seed byte-identical), box new candy (CalVer 2026.193.1316 stamped + ADE description/plan/check), box new box … --base … --candies … (correct node-form image my-box: {candy: {base, candy: [my-candy]}}).
  • R3: kit.SaveYAMLNodeFile is one exported home shared across the kit/core boundary; kit does not fork AddCandyToBox/RemoveCandyFromBox/resolveBoxNodeFile; resolveBoxNodeFile stays core. Correct — not over-exposure.
  • R5: charly/scaffold.go deleted; git grep ScaffoldCandy/ScaffoldProject/AddBox/saveYAMLNodeFile in core shows only kit.*; no transitional/dual-mode path.
  • SDD: diff touches no schema/*.cue / *_gen.go / *.proto; kit/scaffold.go is clock-free (calver param). sdk gitlink 793e7d4, go.mod require v0.2026193.1241 (tag points at HEAD).
  • Kernel/plugin boundary aligned (engine → shared sdk/kit, no concrete-kind leak into core).

Checklist

# Rule
0 security/anti-tampering (T1–T4) PASS
1 description complete PASS
2 change-class gate matches evidence (R7/R10) PASS
3 attribution tier justified (analysed on a live system) PASS
4 R0 skills honored PASS
5 R1 RCA + ZERO warnings, no flake FAIL
6 R2 no pre-existing/out-of-scope split FAIL
7 R3 no duplication PASS
8 R4 no ad-hoc workaround PASS
9 R5 hard cutover + grep self-test PASS
10 R6/R8/R9 artifact+binary integrity PASS
11 R10 disposable/fresh-rebuild/coverage (box-new byte-parity) PASS
12 RDD / ADE / SDD PASS
13 concurrency mandate + anti-cheat FAIL
14 hard cutover — one atomic commit PASS
15 kernel/plugin boundary law PASS
16 disposable-only autonomy N/A
17 clean architecture + go gates PASS
18 CHANGELOG present PASS (content carries the forbidden framing → 5/6/13)

Secondary (non-gating): the /charly-internals:go skill file-map (plugins repo, not touched here) still describes scaffold.go/scaffold_project.go in their pre-PR form — now stale. Cross-repo, so not this PR's grep surface, but confirm the batched docs cutover sweeps these entries (R1/R5 claim-keyed divergence).

Decision: CHANGES REQUESTED — not merged. Single, easily-fixed blocker: the CHANGELOG's forbidden-framing dismissal of the TestPruneImagesByRetention isolation defect. Fix it (root-cause the test isolation + rewrite the CHANGELOG), push in place, and I'll re-validate.

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

atrawog added 2 commits July 12, 2026 15:33
…old entry

The scaffold-engine relocation has zero relation to the retention subsystem; the
verification note that mentioned TestPruneImagesByRetention dragged an unrelated
test-isolation defect into this cutover CHANGELOG with framing this project
forbids. Removed entirely — the scaffold entry describes only the scaffold move.
The retention test-isolation defect is addressed as its own separate cutover.

Assisted-by: Claude (documentation reviewed)
Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
@atrawog

atrawog commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: charly/sdk Go (code refactor — scaffold ENGINE relocation charly/ → sdk/kit; not a deploy/runtime change, so the gate is build/test/lint + box new byte-parity + R3/R5, not a check-bed roster).

Fresh independent re-validation at head caae929 (a prior validator FAILED the earlier head 71467a0 on forbidden CHANGELOG framing; the author fixed in place — see below).

Independently re-run evidence (fresh worktree @ caae929, sdk ccd68e0)

Gate Result
go build ./... / go vet ./... exit 0
gofmt -l (charly + sdk/kit) clean
golangci-lint 2.12.2 run ./... charly 0 issues; sdk 0 issues
go test ./... (charly) green (complete checkout — see R1 note)
go test ./kit/... (sdk) ok 3.5s
charly box new project/candy/box byte-parity diff -r empty vs the pre-refactor binary
task cue:gen NO-OP (zero tracked drift)

Byte-parity detail: the kit-engine binary and the pre-refactor (main) binary produce identical scaffolded trees — candy version: 2026.193.1606 CalVer-stamped with an ADE-compliant seed (description + one check: step), box written as a node-form image mybox: {candy: {base, candy: […]}}, project version: = HEAD schema. Pure behaviour-preserving relocation.

Prior-FAIL concerns — verified resolved

  • The earlier FAIL flagged forbidden framing ("concurrency flake / unrelated / routed to P15") in the CHANGELOG. bba6028 scrubbed it — I grepped the current CHANGELOG for every forbidden term → empty.
  • The underlying retention test-isolation defect was root-cause-fixed as its own immediate-next cutover, PR fix(retention): make liveBuildFloor injectable so the prune tests are hermetic #73 (liveBuildFloor made an injectable package var), now on main. Correct R2 handling; the PR was updated in place, not recreated.

R1 note (no dismissal)

TestCandySourceDirs_OverrideAnchorsRemoteApk and TestCueBox_Corpus initially failed in my env; RCA → my worktree lacked the box/* submodules. Re-ran with them present → both PASS. Environmental to the checkout (tracked hermeticity task), touches zero code this PR modifies.

Checklist

[PASS] 0 security/anti-tamper · 1 description · 2 change-class gate (R7/R10) · 3 attribution tier · 4 R0 skills · 5 R1 RCA/zero-warnings · 6 R2 no split · 7 R3 no-dup (SaveYAMLNodeFile one home; LatestSchemaVersion core = thin shim→kit) · 8 R4 no ad-hoc (calver param keeps kit clock-free) · 9 R5 hard cutover (scaffold.go/scaffold_test.go deleted, grep clean, no dual-mode) · 10 R6/R8/R9 · 11 R10 byte-parity coverage · 12 SDD @100% (no schema touched, cue:gen no-op) · 13 concurrency (N/A path; framing verified scrubbed) · 14 atomic cutover · 15 kernel/plugin boundary (−~194 LOC out of core into shared kit) · 16 disposable autonomy N/A · 17 clean-arch + go gates · 18 CHANGELOG present.

Decision: All gates green and independently reproduced. A clean, well-scoped, byte-parity-preserving engine relocation into the shared sdk/kit library — architecturally boundary-aligned (core shrinks, the Wave-2 command:box plugin will consume the same engine). The single prior blocking concern was resolved in place and re-verified. Approving; finalizing merge-time CalVer, squash-merging, and tagging.

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

atrawog added 3 commits July 12, 2026 18:14
…ld-kit)

Evaluator version stamp for the fresh pr-validator PASS of PR #72: rename the
placeholder CHANGELOG entry to the merge-time CalVer and rewrite its H1 to match.
Squash-folded into the single cutover commit at merge.

Claude-Session: https://claude.ai/code/session_0147qv2DoSQ8qUKRLcrJth99
Assisted-by: Claude (analysed on a live system)
@atrawog
atrawog merged commit 933730e into main Jul 12, 2026
@atrawog
atrawog deleted the feat/p15-scaffold-kit branch July 12, 2026 16:20
atrawog added a commit that referenced this pull request Jul 14, 2026
/#72/#74)

Evaluator-generated CalVer stamp for the gate-infrastructure batch cutover
(vm-destroy false-success #69, makepkg sibling-branch fetch #72, unstamped-binary
bed-runner guard #74). Renames the placeholder CHANGELOG to CHANGELOG/2026.195.0802.md and
stamps its H1 to match; folded into the squash-merge.

Assisted-by: Claude (fully tested and validated)
atrawog added a commit that referenced this pull request Jul 14, 2026
…ch fetch (#72), unstamped-binary bed-runner guard (#74)

Gate-infrastructure thematic batch — three independently-non-blocking bed/gate reliability fixes, one squash.

#69 — `charly vm destroy` backend-mismatch false-success + `bundle del` domain-teardown owner. `destroyVmDomain` probes libvirt authoritatively (regardless of the configured/default backend), tears the domain down from whichever backend holds it, VERIFIES it is gone, and hard-errors "no such VM" when nothing was torn; `vmPostTeardown` fires `vm destroy <entity> --domain <domain> --keep-deploy` as `bundle del`'s domain-teardown owner. + regression tests.

#72 — makepkg update-phase fetch scoping. The arch localpkg `build_template`'s `makepkg -sf` now sets `GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=fetch.recurseSubmodules GIT_CONFIG_VALUE_0=false`, so a worktree-shared superproject fetch no longer on-demand-recurses into a sibling branch's unpushed sdk gitlink ("not our ref"). Applied to BOTH `//go:embed` copies (R3); deb/rpm unaffected (no makepkg/git+file://).

#74 — bed-runner precondition. `CheckBinaryStamped` refuses `charly check run` on an unstamped ("unknown") binary, pointing at `task build:binary`; scoped to `run` via `commandPathKey` + os.Args; `charly version` also exits non-zero when unstamped. + unit tests.

Found + registered while landing: #76 (word-keyed plugin cache races across worktrees) → next bed-infra batch.

Validated by a fresh, independent pr-validator: golangci-lint 0 (charly / plugin-vm / plugin-deploy-vm), gofmt/vet/build/targeted-test clean; R10 beds corroborated (check-builder-vm 9/9 ok, check-local-vm 7/7 ok with the makepkg update phase ok:true under the live 4-sibling-gitlink state); placement CORRECT.

Assisted-by: Claude (fully tested and validated)
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