Skip to content

feat(spec)!: complete the packaging contract — Packaging() accessor + CandyDir + LocalPkgBuildContext - #26

Merged
atrawog merged 4 commits into
mainfrom
feat/packagekit-sdk-followup
Aug 13, 2026
Merged

atrawog merged 4 commits into
mainfrom
feat/packagekit-sdk-followup

Conversation

@atrawog

@atrawog atrawog commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Change class

Code/config (spec contract surface — CUE schema + CandyReader interface + generated Go).

What

The Phase 0a packaging cutover (spec #25) landed the packaging: section + the localpkg download-leg IR, but the follow-up that completed the contract surface removed the deprecated LocalPkg surface before the sdk Phase 0b migration landed — breaking sdk main (e6950fa) and charly main (d2221f4f), which still consume LocalPkg()/LocalPkgFormats()/the localpkg: map. This PR makes the completion additive: the deprecated surface is restored (kept until Phase 0b migrates the consumers off it) while the new Packaging() accessor and the packaging?: #Packaging wire field are added alongside.

  • schema/candymodel.cue: the localpkg?: {[string]: string} field is restored on #CandyModel (marked Deprecated, kept until the sdk's localpkg replacement migrates the consumers off it) alongside the new packaging?: #Packaging field.
  • spec/candy_reader.go: LocalPkg(format) + LocalPkgFormats() are restored (marked Deprecated) alongside the new Packaging() accessor.
  • spec/cue_types_gen.go: regenerated via task cue:gen (re-run on the committed tree is a no-op; TestGenReproducible green). CUE-sourced per SDD.
  • CHANGELOG/2026.225.0000.md: the cutover entry (placeholder CalVer, finalized by the pr-validator at merge).

The rest of the contract completion (the CandyDir anchor on LocalPkgInstallStep, the LocalPkgBuildContext on EmitOpts) is unchanged from the prior head — this PR only restores the deprecated surface the consumers still need.

How R10-tested

The spec module has no disposable beds; the change-class gate for a schema/IR change is the module test suite + generation reproducibility. All run in the spec worktree with GOWORK=off (the charly root go.work would otherwise resolve the module root to the main checkout) and a fresh GOCACHE (a stale cache replays go list output from a sibling worktree — the same environmental issue PR #25 documented).

go build ./...:

exit=0

go test -count=1 ./... (default TMPDIR — the sweep tests create temps in $TMPDIR and SweepStaleTemps globs only /tmp/, so a non-default TMPDIR makes them fail environmentally):

?   	github.com/opencharly/spec/schemaconcat	[no test files]
ok  	github.com/opencharly/spec/spec	0.556s
?   	github.com/opencharly/spec/sshx	[no test files]
?   	github.com/opencharly/spec/testkit	[no test files]
ok  	github.com/opencharly/spec/transport	(cached)
exit=0

task cue:gen (reproducibility — second run is a no-op; git status clean after):

cue:gen: regenerated spec/{cue_types_gen.go,vocab_gen.go,version_gen.go}
exit=0

gofmt -l .:

exit=0 (empty)

go vet ./...:

exit=0

golangci-lint run ./... (GOWORK=off, fresh GOCACHE — the module's own go.mod, no workspace):

0 issues.
exit=0

Attribution tier

analysed on a live system — the changed runtime path (the spec contract surface the sdk + charly consumers compile against) ran live: the full module test suite + generation reproducibility passed with pasted output above. The complete fresh-rebuild R10 (disposable distro beds) belongs to the consumer cutovers (sdk Phase 0b, plugin Phase 0, main Phase 3), which this PR is the prerequisite for.

Harness rulebook compliance

  • R0 — Skills first: loaded /charly-internals:go + /charly-internals:plugin (SDD + schema-change recipe) before touching the CUE schema.
  • R1 — RCA every anomaly: the only failures during this PR's gate were environmental and RCA'd — the proc sweep tests fail when TMPDIR is non-default (the sweep globs only /tmp/, the tests create temps in $TMPDIR), and golangci-lint replayed a stale GOCACHE entry pointing at a sibling worktree (fresh GOCACHE + GOWORK=off → 0 issues). Neither is a code defect.
  • R2 — Finish the whole cutover: this is the Phase 0a follow-up of the four-repo cutover; the consumer phases (sdk Phase 0b, plugin Phase 0, main Phase 3) are planned and in progress. Within this repo the change is complete.
  • R3 — No duplication: the packaging: schema is defined once in schema/candy.cue; the deprecated LocalPkg surface is a single restoration, not a second copy.
  • R4 — No workarounds: no sleeps, retries, magic numbers, or environment shims in the change.
  • R4a — Fix the product first: N/A — no docs changed in this PR.
  • R5 — Delete legacy completely: the deprecated LocalPkg surface is NOT removed here — it is kept (marked Deprecated) until the sdk Phase 0b migration removes it, so the consumers keep compiling. The full pkg/ submodule + box pkg surface removal lands in the main-repo cutover (Phase 3).
  • R6 — Git safety: branch-per-change (feat/packagekit-sdk-followup), no force-push, no direct push to main; PR-only landing.
  • R7 — Prove behavior, not compilation: the IR change's runtime behavior is proven in the consumer cutovers (the sdk download leg, Phase 0b); this PR's own gate is the module test suite + cue:gen reproducibility, both green.
  • R8 — Verify emitted artifacts: N/A — the spec module emits no Containerfile/labels.
  • R9 — Binary equals source: N/A — the spec module builds no binary.
  • R10 — Fresh disposable proof: the spec module has no disposable beds; the change-class gate for a schema/IR change is the module test suite + generation reproducibility, which passed. The runtime proof (repo-based installs on disposable distro beds) lands in the consumer cutovers.
  • SDD: the CUE schema is the single source of truth; task cue:gen regenerates content-identically (TestGenReproducible green, second run a no-op).
  • Clean Architecture: the deprecated LocalPkg surface is a temporary additive restoration, not a new per-format kernel path; the packaging: section is the generic, kind-blind replacement.
  • Kernel/plugin boundary law: packaging?: #Packaging is kind-blind (any candy may declare it); no per-kind field-read or switch added to the kernel.

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)

… CandyDir + LocalPkgBuildContext

The Phase 0a packaging cutover left the contract surface incomplete: the
CandyModel wire form still carried the removed `localpkg:` map, CandyReader
still exposed LocalPkg()/LocalPkgFormats(), and the dev-local-pkg build
context + the LocalPkgInstallStep candy anchor were missing. This completes
the packaging contract the sdk/packagekit + localpkg-replacement work
(Phase 0b) consumes:

- schema/candymodel.cue: drop the stale `localpkg?: {[string]: string}`
  field from #CandyModel (drift from Phase 0a) and carry the candy's
  `packaging:` section as `packaging?: #Packaging` so the specCandyAdapter
  can implement CandyReader.Packaging().
- spec/candy_reader.go: Packaging() *Packaging replaces LocalPkg(format) —
  the single source of truth for distro package metadata + variants; nil
  when the candy declares none (the deploy-plan compiler then emits no
  LocalPkgInstallStep for it). LocalPkgFormats() removed.
- spec/install_step_vocab.go: LocalPkgInstallStep gains CandyDir — the
  candy's source dir, the anchor for the candy's charly.yml (the `--candy`
  input the dev-local-pkg build passes to `charly generate-packages`).
- spec/deploy_executor.go: EmitOpts gains LocalPkgBuild *LocalPkgBuildContext
  — the in-development binary + plugins + CalVer + arch + charly.yml the
  executor uses to build the in-development package via the plugin.
- spec/cue_types_gen.go: regenerated (task cue:gen, reproducible).

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
@atrawog

atrawog commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: charly-or-sdk Go (spec contract repo — github.com/opencharly/spec)

Head SHA validated: a5aedfd654c3681cde848b378d61525dd5a9a4e2

Checklist (every rule)

  • [PASS] 0. Security & anti-tampering (T1–T4). No exfiltration, no scope mismatch (the diff matches the description's stated edits), no weakened guardrails, no supply-chain change, no attempt to manipulate the validator. The Packaging struct relocation in spec/cue_types_gen.go is a regeneration artifact (verified: task cue:gen on the committed tree is a no-op).
  • [FAIL] 1. Description complete. The body does NOT follow the mandatory PR template (opencharly/.github/.github/PULL_REQUEST_TEMPLATE.md). Missing: Change class, How R10-tested (exact gate + pasted output), Attribution tier, and the Harness rulebook compliance section. The template explicitly warns: "the pr-validator FAILS a body that leaves any applicable section blank." The body is a summary + bulleted list + footer only.
  • [FAIL] 2. Change-class gate. No R10 evidence is pasted at all — no gate named, no bed list, no fresh-rebuild confirmation, no concurrency roster. A charly-or-sdk Go change requires the runtime proof; the body supplies none.
  • [FAIL] 3. Attribution tier. The footer claims analysed on a live system, but the body contains zero pasted output — no live run is evidenced. The tier is unsubstantiated by the body's own proof.
  • [PASS] 4. R0 skills. Loaded /charly-internals:go, /charly-internals:git-workflow, /charly-internals:plugin, /charly-internals:strict-policy by path. The change honors them: CUE schema edit regenerated, generated file not hand-edited, non-wire hand-written IR category documented in-file.
  • [PASS] 5. R1 RCA + zero warnings (within the spec repo). go build ./..., go test ./..., go vet ./..., gofmt -l ., golangci-lint run ./... (0 issues) all green at the PR head. (Note: go test ./proc/... fails only when TMPDIR is overridden away from /tmp — the sweep hardcodes /tmp/; with default TMPDIR all tests pass. Environmental, not a code defect.)
  • [FAIL] 6. R2 no out-of-scope split. The cross-repo breakage below is not addressed, and no named thematic batch is registered for the consumer migrations.
  • [PASS] 7. R3 no duplication. No repeated pattern lands in a second place; the new accessor/fields are single definitions.
  • [PASS] 8. R4 no workaround. No sleep/retry/magic-number/env-shim introduced.
  • [FAIL] 9. R5 hard cutover + grep self-test. Within the spec repo the sweep is clean (LocalPkgFormats → 0 hits; remaining LocalPkg hits are the distinct #LocalPkg install-machinery type, LocalPkgInstallStep, LocalPkgFormat, LocalPkgBuild). BUT the removed symbols are LIVE on the consumers' real main — see the blocking findings below. A producer-repo symbol removal must be checked against the consumer's main, never a sibling branch; this removal breaks both consumers.
  • [PASS] 10. R6/R8/R9. N/A for this change class (no destructive git action, no Containerfile/label emission, no deployed binary).
  • [FAIL] 11. R10. No disposable/fresh-rebuild evidence pasted; and the change cannot be validated end-to-end because the consumers do not compile against the new contract.
  • [PASS] 12. RDD / ADE / SDD. SDD verified at 100%: task cue:gen on the committed tree is a no-op (two runs, git status clean both times); spec/cue_types_gen.go is regenerated, not hand-edited; CandyModel.Packaging and the Packaging struct are CUE-sourced from #Packaging; CandyDir is CUE-sourced (schema/deploy.cue:411 → cue_types_gen.go:2834); LocalPkgInstallStep.CandyDir and LocalPkgBuildContext are hand-written on the documented spike-proven NON-wire IN-PROC IR category (install_step_vocab.go / deploy_executor.go headers), not wire types. ADE/RDD N/A (no candy authored).
  • [PASS] 13. Concurrency mandate + anti-cheat. N/A — no shared-state path touched; no idle/serial-pass cheat, no parking phrase, no dead-code-in-touched-module pass.
  • [FAIL] 14. Hard cutover — one atomic phase. The cutover is a cross-repo producer API removal whose consumer migrations do not exist. The producer change is not landable as one atomic phase without the consumers.
  • [PASS] 15. Architecture gate. placement: CORRECT — the additions (CandyReader.Packaging(), CandyModel.Packaging, LocalPkgInstallStep.CandyDir, EmitOpts.LocalPkgBuild/LocalPkgBuildContext) are contract-surface additions in the contract repo (spec), kind-agnostic, no capability leaked into a kernel. No charly/*.go staged, so the per-item trace is N/A.
  • [PASS] 16. Disposable-only autonomy. N/A — no destroy/rebuild in the evidence.
  • [PASS] 17. Clean architecture + Go gates. Re-run at the PR head: go build ./... green, go test ./... green, go vet ./... clean, gofmt -l . empty, golangci-lint run ./... = 0 issues (isolated GOLANGCI_LINT_CACHE).
  • [FAIL] 18. CHANGELOG present. No CHANGELOG/<CalVer>.md entry staged. A runtime-tier change requires one (placeholder CalVer is fine — the validator finalizes it).

Blocking findings

B1 — Cross-repo cutover breaks both consumers' main (R5 / item 9 / item 13 / item 14).
The PR removes CandyReader.LocalPkg(format), CandyReader.LocalPkgFormats(), and CandyModel.LocalPkg — all LIVE on the consumers' real main (verified against origin/main, not a sibling branch):

  • sdk repo main (e6950fa):
    • deploykit/spec_candy_adapter.go:70 — func (a *specCandyAdapter) LocalPkg(format string) string { return a.m.LocalPkg[format] } accesses the removed CandyModel.LocalPkg field → will not compile.
    • deploykit/spec_candy_adapter.go:222 — LocalPkgFormats() accesses a.m.LocalPkg → will not compile.
    • deploykit/install_build.go:204 — ref := layer.LocalPkg(fmtName) calls the removed interface method (layer is CandyModel = spec.CandyReader) → will not compile.
    • The adapter has no Packaging() method, so it no longer satisfies the new spec.CandyReader interface → will not compile.
  • charly core main (d2221f4f):
    • candy/plugin-build/pkg.go:83 — formats = lyr.LocalPkgFormats() calls the removed method → will not compile.
    • candy/plugin-build/pkg.go:97 — src := lyr.LocalPkg(format) calls the removed method → will not compile.
    • The *Candy and testCandyReader types have no Packaging() method → will not satisfy the new interface.

There are no coordinated sibling PRs in the sdk repo (zero open PRs) to migrate the consumers. Merging this PR leaves both consumers' main in a non-compiling state — a window of unverified brokenness on main, which R2 forbids. The fix: make the change additive (add Packaging() while keeping LocalPkg/LocalPkgFormats), or land the consumer migrations in the same coordinated cutover with the consumers' PRs ready and merged immediately after.

B2 — PR body does not follow the mandatory template (item 1). Missing Change class, How R10-tested (with pasted output), Attribution tier, and the Harness rulebook compliance section. The template's own warning applies: a body that leaves applicable sections blank FAILS.

B3 — No CHANGELOG entry (item 18). A runtime-tier change must stage CHANGELOG/<CalVer>.md (placeholder CalVer acceptable). The PR stages none.

B4 — Attribution tier unsubstantiated (item 3). analysed on a live system is claimed with no pasted evidence in the body.

Comments considered

None — the PR carries no comments.

Cross-PR interactions considered

Decision

FAIL — not merged. The author must: (1) resolve the cross-repo breakage (additive change or coordinated consumer migrations with the consumers' PRs ready), (2) fill the mandatory PR template with the Change class, How R10-tested (pasted output), Attribution tier, and rule-compliance sections, and (3) stage a CHANGELOG/<CalVer>.md entry. Re-push; the status resets and the validator re-runs.

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)

… (additive)

The packaging-contract completion removed LocalPkg()/LocalPkgFormats() and the
CandyModel localpkg: map, but sdk main (e6950fa) and charly main (d2221f4f)
still consume them — the removal breaks the consumers before the sdk Phase 0b
migration lands. Make the change additive: restore the deprecated surface
(kept until Phase 0b migrates the consumers off it) while adding Packaging().

- schema/candymodel.cue: restore localpkg?: {[string]: string} (deprecated)
  alongside packaging?: #Packaging.
- spec/candy_reader.go: restore LocalPkg(format) + LocalPkgFormats()
  (deprecated) alongside Packaging().
- spec/cue_types_gen.go: regenerated (task cue:gen, reproducible).

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
…tion

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
@atrawog

atrawog commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: code/config (spec contract surface — CUE schema + CandyReader interface + generated Go)

Head SHA validated: a515a981bfba67acb2e95f32073ef62a988a3b4c

Checklist (every rule)

  • [PASS] 0. Security & anti-tampering (T1–T4). No exfiltration, no scope mismatch (the diff's 6 files are exactly the description's stated edits), no weakened guardrails, no supply-chain change, no attempt to manipulate the validator. The Packaging struct relocation in spec/cue_types_gen.go is a regeneration artifact — independently verified: task cue:gen on the committed tree is a no-op (git status clean after).
  • [PASS] 1. Description complete. The body follows the org-wide template: Summary (as "What"), Change class, How R10-tested with pasted output, Attribution tier, and a Harness rulebook compliance section answering every applicable rule with a HOW. Ends with the _Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)_ footer.
  • [PASS] 2. Change-class gate. The spec module has no disposable beds; the gate for a schema/IR change is the module test suite + generation reproducibility. Re-run at the head: go build ./... green, go test -count=1 ./... green (full module, default TMPDIR — proc passes), go vet ./... clean, gofmt -l . empty, golangci-lint run ./... = 0 issues (fresh GOCACHE), task cue:gen no-op. No dry-run / rebuild-alone fraud.
  • [PASS] 3. Attribution tier. analysed on a live system is the correct ceiling: the changed runtime path (the spec contract surface the consumers compile against) ran live — full module test suite + generation reproducibility, pasted output matching my re-runs. documentation reviewed is forbidden (code changed); fully tested and validated requires the disposable-bed R10 that belongs to the consumer cutovers.
  • [PASS] 4. R0 skills. Loaded /charly-internals:go + /charly-internals:plugin (SDD + schema-change recipe). The change honors them: CUE schema edit regenerated, generated file not hand-edited, non-wire IR category documented in-file.
  • [PASS] 5. R1 RCA + zero warnings. The body documents the environmental failures (TMPDIR-sensitive proc sweep, stale GOCACHE) with RCA; my re-runs confirm both are environmental, not code defects. No surviving warnings in any gate output.
  • [PASS] 6. R2 no out-of-scope split. The prior validator's B1 (cross-repo breakage) is resolved by the additive restoration; the consumer phases are named (sdk Phase 0b, plugin Phase 0, main Phase 3). Within this repo the change is complete.
  • [PASS] 7. R3 no duplication. #Packaging is defined once (schema/candy.cue:151); the deprecated LocalPkg surface is a single restoration, not a second copy.
  • [PASS] 8. R4 no workaround. No sleeps, retries, magic numbers, or environment shims introduced.
  • [PASS] 9. R5 hard cutover + grep self-test. This PR is additive — it RESTORES the deprecated LocalPkg/LocalPkgFormats/localpkg: surface (marked Deprecated) rather than removing it. Liveness verified against the consumers' real main (not a sibling branch): sdk main (e6950fa) deploykit/spec_candy_adapter.go:70,222 + install_build.go:204; charly main candy/plugin-build/pkg.go:83,97. Both keep compiling. The only diff "removal" is the Packaging struct relocation in the generated file — a regeneration artifact.
  • [PASS] 10. R6/R8/R9. N/A — no destructive git action, no Containerfile/label emission, no deployed binary.
  • [PASS] 11. R10. The spec module has no disposable beds; the change-class gate (module test suite + generation reproducibility) passed at zero warnings. The runtime proof (repo-based installs on disposable distro beds) lands in the consumer cutovers.
  • [PASS] 12. RDD / ADE / SDD. SDD verified at 100%: task cue:gen no-op (clean tree after run) + TestGenReproducible green; spec/cue_types_gen.go regenerated, not hand-edited; CandyModel.Packaging + the Packaging struct CUE-sourced from #Packaging; InstallStepView.CandyDir CUE-sourced (schema/deploy.cue:411 → cue_types_gen.go:2839); the hand-written LocalPkgInstallStep/EmitOpts are the documented spike-proven NON-wire IN-PROC IR category (file headers). No new @go(-). RDD/ADE N/A (no candy authored, no high-risk composition assumption).
  • [PASS] 13. Concurrency mandate + anti-cheat. N/A — no shared-state path touched; no idle/serial-pass cheat, no parking phrase, no dead-code-in-touched-module pass.
  • [PASS] 14. Hard cutover — one atomic phase. The change is additive within this repo; the cross-repo coordination is explicit (consumers pin old spec versions; Phase 0b/Phase 3 migrate). The prior validator's B1 is resolved exactly as requested.
  • [PASS] 15. Architecture gate. placement: CORRECT — the additions (CandyReader.Packaging(), CandyModel.Packaging, LocalPkgInstallStep.CandyDir, EmitOpts.LocalPkgBuild/LocalPkgBuildContext) are contract-surface additions in the contract repo (spec), kind-agnostic, no capability leaked into a kernel. No charly/*.go staged, so the per-item trace is N/A.
  • [PASS] 16. Disposable-only autonomy. N/A — no destroy/rebuild in the evidence.
  • [PASS] 17. Clean architecture + Go gates. Re-run at the head: go build ./... green, go test -count=1 ./... green, go vet ./... clean, gofmt -l . empty, golangci-lint run ./... = 0 issues (isolated GOCACHE).
  • [PASS] 18. CHANGELOG present. CHANGELOG/2026.225.0000.md staged; filename matches ^\d{4}\.\d{3}\.\d{4}\.md$; H1 byte-equals # 2026.225.0000 — …; placeholder CalVer does not exist as a CHANGELOG/*.md or v* tag on main.

Comments considered

  • atrawog (prior validator verdict on head a5aedfd) — CHANGES REQUESTED with B1 (cross-repo breakage: removed LocalPkg surface live on sdk/charly main), B2 (template), B3 (no CHANGELOG), B4 (attribution unsubstantiated). Disposition: verified-non-blocking — the current head resolves each finding: the deprecated surface is restored (additive, verified against both consumers' real main), the body follows the template with pasted output, the CHANGELOG is staged, and the attribution tier is now evidenced.

Cross-PR interactions considered

Decision

PASS. The additive restoration resolves the prior validator's cross-repo breakage: the deprecated LocalPkg/LocalPkgFormats/localpkg: surface is present (marked Deprecated) so sdk main (e6950fa) and charly main keep compiling, while Packaging()/packaging?: #Packaging/CandyDir/LocalPkgBuildContext complete the contract surface the Phase 0b consumers migrate onto. All gates re-run green at the head; SDD reproducibility confirmed; CHANGELOG well-formed. Proceeding to finalize the merge-time CalVer, squash-merge, and tag.

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)

Rename the placeholder CHANGELOG/2026.225.0000.md to the merge-time
CalVer 2026.225.1800 and rewrite the H1 to match.

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)
@atrawog
atrawog merged commit 2b620ff into main Aug 13, 2026
@atrawog
atrawog deleted the feat/packagekit-sdk-followup branch August 13, 2026 18:06
@atrawog

atrawog commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — merge complete

  • Status posted: charly/pr-validator = success on a515a98 (initial) and 8092576 (post-CalVer-finalization head) — both ALLOWED.
  • CalVer finalized: CHANGELOG/2026.225.0000.md → CHANGELOG/2026.225.1800.md (H1 rewritten to match), committed as 8092576.
  • Merged: squash-merge as 2b620ff6556bb57df4fdbdff1ec07e84eb8bf56e — feat(spec)!: complete the packaging contract — Packaging() accessor + CandyDir + LocalPkgBuildContext.
  • Squash trailer proof: pre-merge parse = Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system); merged 2b620ff parse = identical.
  • Tagged: v0.2026225.1800 (spec Go-module scheme) on the merged HEAD, pushed add-only.

Assisted-by: Claude Code deepseek-v4-flash:cloud (analysed on a live system)

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