Repository navigation
fix(vm-box): stamp ai.opencharly.box in the VM box emitter so retention can reclaim the tag (charly#808) - #345
Conversation
… can reclaim the tag) The retention engine (candy/plugin-clean's charlyImageTags) GROUPS local images by the ai.opencharly.box label; the pod-side WriteLabels stamps it, but the VM box emitter did NOT — so every `charly vm build` box tag was invisible to retention and grew unbounded (measured: 24+ tags of one bed box; opencharly/charly#808). renderVmBoxContainerfile now writes ai.opencharly.box = spec.LeafName(ref) (the SAME value convention as WriteLabels), so a VM box tag is reclaimable by `charly clean` / the post-build prune. Assisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system)
Review — BLOCKHead SHA: Change class: Go source — Blocks
Note (non-blocking): the Comment thread is empty (0 comments) — nothing to disposition. Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…measured bug)
Live proof of the first attempt caught it: spec.LeafName splits on NAMESPACE DOTS, so
a tagged ref 'localhost/charly-check-kubevirt-vm-box:2026.279.1211' yielded the TAG
('1211'), not the repo — the label was wrong and retention still could not group.
repoLeaf() strips the tag/digest + namespace and returns the repository leaf, so
ai.opencharly.box = 'charly-check-kubevirt-vm-box'. Now 'charly box list tags
charly-check-kubevirt-vm-box' LISTS the tags and the prune reclaims them.
Assisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system)
|
STATUS Head
The live run caught a genuine bug: my first attempt used Combined proof (with Agent: |
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no guardrail/CI/branch-protection edits, no new deps or version-pin changes; Checklist: All applicable rules PASS or NA (A1–A3; R0–R10; B13–B18). Candy/ Comment disposition:
Non-blocking note: the body's Summary and R3 lines still name the superseded Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…ox build; charly#808) (#71) * fix(vm): prune old VM box tags after `charly vm build` (parity with box build) `charly box build` runs a post-build retention prune (verb:retention, BuildPrune); `charly vm build` did not, so its per-run box tags accumulated (opencharly/charly#808). pruneAfterVmBuild runs the SAME engine the SAME way (R3), best-effort warn-only. Reaches the tags once the emitted VM box carries the ai.opencharly.box retention label (opencharly/sdk#345). Assisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system) * test(vm): assert the prune REQUEST (BuildPrune scope), not just the no-op (#71 finding 2) vmBoxPruneRequestJSON is the pure half; TestVmBoxPruneRequestIsBuildPrune pins the BuildPrune scope + dir + keep_images the new prune issues (the finding was that the added test only covered the cmdExec==nil early return). Assisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system) --------- Co-authored-by: aitrawog <[email protected]>
* feat(auditkit): the append-only audit writer (§20.1, D-AUDIT-1/3/4)
The writer half of P06, against the merged contract in `spec v0.2026320.2307`
(`schema/audit.cue`, spec#344 + spec#345): `spec.AuditEvent`, `spec.AuditDetail` and
`spec.Redacted` are generated there, so this package defines NO mirror struct and restates NO shape
(D-SCH-1). What it owns is the write path.
The three D-AUDIT rows that shape the code are enforced rather than documented:
- D-AUDIT-1 — `Append(act, event)` writes exactly one record per act; a second append for the same
act fails loudly with `ErrDuplicateAct`, and the key is the ACT, so a retry carrying a fresh
timestamp is refused just the same. The contract says the same from the wire side:
`#AuditAppendInput` is `{event!: #AuditEvent}`, one required singular event.
- D-AUDIT-4 — append-only is a property of the SURFACE. A record is ONE immutable file created
`O_CREATE|O_EXCL` and never reopened for writing; there is no update, delete or truncate, and
`TestExportedSurfaceHasNoMutator` enumerates the package's exported funcs and methods from its own
source and asserts the exact set, so a new exported symbol fails until its author justifies it.
- D-AUDIT-3 — structural, not checked: `#Redacted` is `{redacted!: true}`, a bare marker with no
field a value could occupy, so the package has no `ErrSecretValue` and no name-shape rule.
`TestRedactedIsAnEmptyMarker` proves it by enumerating the type's fields (exactly one, a bool), by
showing the marker — and nothing else — is what reaches disk, and by proving that a detail which
references NO value carries no `value` key at all.
`outcome` is the contract's WORD (`ok`/`refused`/`failed`) and a failure's reason lives in
`detail[].text`, so a refused authority decision is recorded with its reason rather than dropped.
Membership in the word sets and every field shape stay the SCHEMA's: restating them in Go is the
duplication D-SCH-1 forbids. The writer refuses only the zero value of a required field, which no
CUE pass can see because the value never passes through the loader.
Records live under the state root (D-DEP-5) via `storekit.Dir(storekit.RootState)` — the contract's
ONE resolver — so `OpenDefault` never hand-builds an XDG path, and `Open(dir)` takes an injected root
so every test writes only inside `t.TempDir()` (D-STORE-8). The act id `Append` takes is the
protocol's own `call_id` — every `#Request`'s `#CallHeader` carries a 128-bit one
(`DESIGN.cue:1144`, `:1329-1334`), so `audit_append` (DESIGN.md §4.6) wires
`Append(req.Header.CallId, req.AuditAppendInput.Event)` and `#AuditAppendInput` needs no extra id
field. The dedupe key is a 128-bit digest of that id and lives in the file NAME
(`<seq>-<actkey>.json`), because the record carries no id field by design: an id pointing at another
record would sit badly with D-AUDIT-4, and the name cannot
be amended. With the key at 128 bits the only way two acts share one is a caller reusing an act id,
so `Append`'s doc states that an act id must be per invocation, never a name.
The spec pin moved from `v0.2026320.2238` to `v0.2026320.2307` in this same commit: #345 generates
`#AuditDetail.value?` as `*Redacted` (the `@go(Value,type=*Redacted)` fix for the value-vs-pointer
defect found in review), so an absent marker is now an ABSENT key rather than
`{"redacted":false}`. The test that pins it is `TestRedactedIsAnEmptyMarker`'s third case.
Tests: eight, and each fails without the implementation — reverting `auditkit.go` to the package
clause alone reproduces `undefined: auditkit.Open`, `undefined: auditkit.ErrDuplicateAct` and the
rest, which is the R7 proof. `go test`, `-race`, `go vet` and `gofmt -l` are clean, and
`go build ./...` passes for the module.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
* docs: describe the PINNED contract, not the bug it replaced (review round)
The package doc asserted as current reality that #AuditDetail.value? generates as a VALUE, not a
pointer, so an absent marker serializes as {"redacted":false}. That was the pre-.2307 behaviour: this
PR pins v0.2026320.2307, which adopted spec#345s *Redacted fix, and the package own test case (c)
asserts the OPPOSITE against that pin. The paragraph now states the pinned reality (no value key at
all when the marker is absent) and keeps the history as history, one line, because it explains why
the pin is not incidental.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
* fix: the helper doc names four fields, and sequence drops its dead return (review round)
The test helper said "the five required fields" while its literal sets four (at, event, outcome,
identity) -- target/action/namespace/revision/detail are all optional, so nothing else is required.
And sequence returned (int, int, bool) with the dash index discarded at its only call site; it is now
(int, bool), which is what the caller uses.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
* fix: satisfy the module lint gate -- prealloc, and the deprecated parser (review round)
Running golangci-lint for the first time on this module (the gate sdk declares, under the toolchain
it names) found two more findings beyond the review:
- prealloc: kinds is appended in a loop over got; it is now sized from it.
- staticcheck SA1019: TestExportedSurfaceHasNoMutator used go/parser.ParseDir, deprecated since Go
1.25 because it associates files with packages WITHOUT considering build tags. That matters here
more than usual: the test s it job is to read the package OWN source and assert the exported
surface, so a file set chosen without build tags could assert over the wrong set. It now reads and
parses the package own non-test files directly.
lint_rc=0 (0 issues). Two environment traps are documented in spec/AGENTS.md and both were hit:
export-data version 5 needs GOTOOLCHAIN=go1.26.8, and the toolchain download needs GOSUMDB set, so
only the build keeps GOSUMDB=off.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
* fix(auditkit): the second "five" too -- grep the file, not the line (review round)
Round 2 fixed the `event` helper doc from five required fields to four. This round the SAME word
survived in TestRequiredFieldsAreRefusedWhenEmpty doc comment, in the same file, because I corrected
the line the reviewer named instead of grepping the package for the claim.
grep -rn five auditkit/ is now 0. The lesson is the one this repo already states: a finding is a claim
to be re-grepped, not a line to be edited.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
---------
Co-authored-by: aitrawog <dsh-opencharly@local>
Co-authored-by: aitrawog <[email protected]>
Summary
charly vm buildemitted a VM box image tagged per run that grew unbounded on local storage (opencharly/charly#808 — measured 24+localhost/<box>:<CalVer>tags of one bed box, 741 MB / 143.7 GB of a reclaimable image store).Root cause (R1). The retention engine (
candy/plugin-clean'scharlyImageTags) groups local images by theai.opencharly.boxlabel (spec.LabelBox) — that is the keycharly clean/ the post-build prune use to elect a tag for removal. The pod-sideWriteLabelsstampsai.opencharly.box; the VM box emitter did not — it wrote onlyai.opencharly.vm.box+description. So every VM box tag was invisible to retention and accumulated forever. Confirmed live:Fix.
renderVmBoxContainerfilenow stampsai.opencharly.box = spec.LeafName(ref)— the same value convention as the pod-sideWriteLabels(sdk/deploykit/write_labels.go:42) — so a VM box tag carries the retention-group key and is reclaimable bycharly cleanand the post-build prune.How tested
Change class: Go source (
sdk/deploykit, the VM box emitter — a reusable mechanism lib).The render test now asserts the label is present (it fails without the change):
TestRenderVmBoxContainerfilePathsassertsLABEL ai.opencharly.box="my-box"in the rendered Containerfile (and that both in-image paths still render correctly).Live end-to-end proof (combined with
opencharly/plugin-vm#71— the label makes the tag visible to retention; the companion's prune reclaims it). A charly built against both PRs, on the disposablecheck-kubevirt-vm-box:Before: 27 tags, none labeled (
ai.opencharly.boxempty), invisible to retention, unbounded. After: the tag carries the label, retention lists it, and repeated builds keep the labeled set bounded (Pruned N old VM box tag(s)).Found + fixed during the live proof: the first attempt derived the label with
spec.LeafName(ref), which splits on NAMESPACE DOTS and returned the tag (1211) — the livebox list tagsstayed empty.repoLeaf()(strips tag/digest + namespace → the repository leaf) is the fix;TestRepoLeafIsTheRepoNotTheTagpins it.Rulebook compliance
/charly-internals:plugin,/charly-internals:go,/charly-internals:install-plan,/charly-internals:git-workflowloaded.ai.opencharly.boxand the engine's "no locally stored charly images").spec.LeafName+ the pod-side value convention; no new label or format.feat/branch, no force-push.sdkships no disposable bed; the emitted label is unit-asserted, and the end-to-end reclaim is witnessed byopencharly/plugin-vm#71on a live build.ollama-cloud, modeldeepseek-v4.1-flash.Change classification
sdk/deploykitVM box emitter).analysed on a live system— the missing-label behaviour was measured live; the fix is unit-asserted; the end-to-end reclaim is witnessed on the companion plugin-vm PR.Part of opencharly/charly#808 (VM box tags invisible to retention).
Agent:
umbrella-catchup· sessionses_f01e6144bffesN8qO8MaOSEPGdAssisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system)