Skip to content

feat(schema): single-source the verb:oci cache-transfer wire types - #149

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/cache-transfer-wire
Sep 23, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/cache-transfer-wire

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

Single-sources the verb:oci cache-transfer wire types in CUE. The transport (candy/plugin-oci's cache-push/cache-pull) and its charly cache push/pull operator surface (candy/plugin-cache) each hand-wrote the same peer-dispatch JSON envelope — the drift risk R3 forbids. The existing OCI wire types (#MergeRequest/#MergeReply, #ImageUserInput/#UserInfo) are CUE single-sourced here in schema/oci.cue; the cache-transfer pair joins them:

  • #CacheTransferRequest { dir, ref, insecure? } — the named cache's OCI Image Layout dir + the registry ref.
  • #CacheTransferReply { digest?, entries?, ref? } — the resolved digest, the count of entry manifests moved, the canonicalised ref.

The Go structs (spec.CacheTransferRequest / spec.CacheTransferReply) are regenerated into spec/cue_types_gen.go by task cue:gen; both plugins will consume them (their own PRs, producer→consumer order).

Files (2): schema/oci.cue (+19), spec/cue_types_gen.go (+23, generated).

How tested

spec is a contract/library module — no charly.yml project, no main/deployable target, no disposable: true entity. Per the R10 change-class matrix's merged Contract / library module row (layer-charly-check#20, 2026-09-23), the repo's own committed CI is the change-class gate: build + test + gofmt + golangci-lint green on the PR head, with the suite genuinely executing the changed path (the generator).

$ gofmt -l .            # empty
$ go build ./...        # clean
$ go test ./...         # full module green (incl. spec/ and schema/)
$ go test ./spec/ -run TestGenReproducible -v
--- PASS: TestGenReproducible (2.13s)

TestGenReproducible is the coverage that fails without the change: the generated spec/cue_types_gen.go must be a byte-identical re-run of the CUE source. Verified — a second task cue:gen produces no diff, and the two new structs appear:

$ grep -n 'type CacheTransferRequest\|type CacheTransferReply' spec/cue_types_gen.go
6946:type CacheTransferRequest struct {
6956:type CacheTransferReply struct {

Rulebook compliance

  • R0 — loaded /charly-internals:go (the schema→spec generation recipe + the CUE single-source rules) and /charly-internals:git-workflow.
  • R1 — no warning survives; gofmt/go vet/go test clean.
  • R2 — the consumer rewire (both plugins) is the named producer→consumer follow-up (plugin-oci merged the transport already; plugin-cache consumes it next); nothing parked.
  • R3 — this PR IS the R3 fix: ONE CUE source for the wire pair instead of two hand-written copies.
  • R4 / R4a — no sleeps/retries/shim.
  • R5 — additive; no removed identifier.
  • R6 — feat/cache-transfer-wire off fresh origin/main; no force-push.
  • R7 — coverage: TestGenReproducible executes the generator and fails on any drift.
  • R8 / R9 / R10 — N/A — spec builds libraries; no main/deployable target, so the module suite is the class gate (the merged Contract / library module row). The live transport bed rides plugin-oci (already merged).
  • SDD — this change IS the CUE-source mandate: the wire type is authored in schema/*.cue, generated by task cue:gen, reproducibility-gated.

Change classification

  • Change class: schema (CUE) + generated contract types (Go library).
  • Verification gate: the module's committed CI (gofmt + go vet + go test ./...) + TestGenReproducible.
  • Attribution tier: fully tested and validated.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

…CacheTransferRequest/#CacheTransferReply)

The verb:oci cache-push/cache-pull transport (candy/plugin-oci) and its
`charly cache push/pull` operator surface (candy/plugin-cache) hand-wrote the
same peer-dispatch JSON envelope in two modules — the drift risk R3 forbids. The
existing OCI wire types (#MergeRequest/#MergeReply, #ImageUserInput/#UserInfo)
are CUE single-sourced here; the cache-transfer pair joins them.

Adds #CacheTransferRequest{dir,ref,insecure?} and
#CacheTransferReply{digest?,entries?,ref?} to schema/oci.cue; regenerates
spec/cue_types_gen.go (reproducibility-gated — TestGenReproducible passes, two
consecutive gens are byte-identical).

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 4f617ea5d36ab5e2187259fcd67729954085f870 (branch: feat/cache-transfer-wire)

Security screen: PASS (no secrets/egress, no guardrail or rulebook weakening, no supply-chain edit).
Checklist: All applicable rules PASS or NA.
Placement: CORRECT — wire SHAPE belongs in spec, CUE-first; no core/sdk misplacement, no alias-file or charly/ import.
Tool-limited: I cannot re-run task cue:gen / go test. Cross-checking the pasted evidence against the diff is internally consistent — the grep lines 6946/6956 land exactly where the hunk (@@ -6938,6 +6938,29 @@) places the two structs, the CUE→Go field/JSON names match 1:1, and the CUE source and its generated *_gen.go change in the same commit (SDD). No comment thread to adjudicate (0 comments).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 23, 2026 13:05
@github-actions
github-actions Bot merged commit 28bcf5f into main Sep 23, 2026
2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 23, 2026
@aitrawog
aitrawog deleted the feat/cache-transfer-wire branch September 25, 2026 19:09
github-actions Bot pushed a commit that referenced this pull request Sep 26, 2026
#178)

Add #ContainerDiskEmitRequest/#ContainerDiskEmitReply to schema/oci.cue, the
canonical wire pair for the verb:oci container-disk-emit op (turn a guest disk
into a +gzip OCI layer at /disk/disk.img and push it). Single-sourcing it here
lets candy/plugin-oci's emit leg and its callers share ONE decoded type
instead of hand-written copies that can drift (the #149 precedent).

Additive wire types only (never authoring kinds, no #SchemaVersion bump).

Co-authored-by: Andreas Trawoeger <[email protected]>
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.

2 participants