Repository navigation
feat(clean): declare the per-host clean: section and its store budget - #384
Merged
Merged
Conversation
D-STORE-7 bounds a named store "within a size budget", and the ceiling is a property of the MACHINE that holds the store — so it is authored in the per-host configuration (~/.config/charly/charly.yml), not in a project's `defaults:` block: a project file is shared, a host's disk is not. - `schema/clean.cue` gains `#CleanSection` and `#StoreBudget`. `bytes` is `int & >0` tagged `type=int64`: a budget is a byte count and the value this exists for (256 GiB = 274877906944) does not fit a 32-bit int, so a bare `int` would wrap silently on the `386`/`arm` cross-compile targets. `distro.cue`'s `disk_size_bytes` sets the precedent. - `#NodeDoc` recognizes the section, so an authored `clean:` block is a document DIRECTIVE rather than a node named "clean" — and it is TYPED there, unlike the older `_` siblings, because the requirement is that an undeclared key INSIDE the section is a load error: `_` would accept a typo and the retention plugin would fall back to its 32 GiB default silently. The generated `DocDirectives` list gains `clean` as a consequence. - `spec.DeployConfig` and `spec.UnifiedFile` carry `Clean *CleanSection` — the two per-host structs that already carry `cache:`, `ledger:` and `system:`. - NO default anywhere: absent stays absent (`nil`), so the one fallback lives in the plugin that enforces it. No wire field: `#RetentionRequest` is unchanged (no peer runs the store category), so the budget is resolved where the config is read. Refs: opencharly/plugin-clean#28, #383 Agent: sdk-store Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — no secrets, no network egress, no guardrail weakening, no scope/description mismatch; PR content treated as data. Placement: CORRECT — a wire/config SHAPE ( Non-blocking notes (not rulebook gaps, do not affect verdict):
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
github-actions Bot
pushed a commit
to opencharly/sdk
that referenced
this pull request
Nov 18, 2026
…one (#563) opencharly/spec#379 deleted `acme_email` from the schema on purpose, so every sdk tag at or after that merge fails to compile against the released contract (`meta.AcmeEmail undefined`). The field is retired, not deprecated: nothing sources it any more, so every sdk reference goes in the same change (R5). - kit/checkvars.go — the `ACME_EMAIL` entry in the build-time variable map is DELETED: a box's metadata can no longer carry an ACME address. Nothing in charly's own plans used the variable; the one live consumer is Traefik's OWN `${ACME_EMAIL:-…}` expansion inside a container, which reads the container's process environment, so an operator who needs it passes it as a deploy `env:` entry (a first-class surface, untouched by this change). - deploykit/deploy_file.go — the overlay→metadata copy of `overlay.AcmeEmail` is DELETED, and the schema-v4 note no longer names the field. - deploykit/capabilities.go — `"AcmeEmail"` is removed from DeployOnlyCapabilityFields (it cannot be a spec.BoxMetadata field any more), and the two comments listing it reworded. - buildkit/config_resolve.go — the resolve note reworded. - kit/checkvars_test.go — the fixture and the expected-map entry removed; the whole-map DeepEqual remains as the regression guard against a field-derived var coming back. - go.mod/go.sum — `require github.com/opencharly/spec v0.2026322.1814`, and no replace. Refs: opencharly/spec#379, opencharly/spec#384 Agent: sdk-store Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
github-actions Bot
pushed a commit
to opencharly/sdk
that referenced
this pull request
Nov 18, 2026
…y projection (#566) spec#384 declared `clean:` as a typed per-host section, and no plugin-reachable loader returned it (#565): `LoadDeployConfigViaExecutor` ends with `deploykit.ProjectDeployConfig`, which builds `DeployConfig{Provides, Deploy, Sidecar}` and drops every unnamed per-host section; `LoadHostDeployConfigViaExecutor` delegates to it and inherits the drop; and the materialize's per-document merge (`spec/merge.MergeUnified`) does not carry the sections forward either, so even the unified document yields nil. The end-to-end measurement — a document authoring a 256 GiB ceiling reporting the plugin's 32 GiB fallback in three shapes — is in the issue. `LoadHostCleanSectionViaExecutor` answers the section question directly: one per-host document, one decode, the section (or nil). It is deliberately NOT a widened deploy view — `ProjectDeployConfig` is named for the PROJECT deploy view, and teaching it to carry per-host state would make that name a lie (opencharly/spec#383 records the per-section permission gap one layer up; this is its data half). The contract is the consumer's refusal rule: an absent document, or a document with no `clean:`, answers (nil, nil) so the consumer applies its own fallback (the 32 GiB ceiling lives in the plugin, never in the contract); an unreadable document, a failed bootstrap leg or an unresolvable config path answers (nil, error), because a config that cannot be READ must never be mistaken for one that says NOTHING — that is the failure mode a missing machine-scoped knob hides behind. The decoding path is the loader's, not a second one (R2): `readConfigStack` is the very reader `LoadUnified` uses, the bootstrap phase runs in the same order it runs there, and the decode target is the same `*spec.UnifiedFile` the materialize decodes each document's reserved directives into. What is NOT reused is the walk + merge + projection chain — precisely the chain that loses the section. The tests are the contract's four arms plus the resolved-standard-path and the nil-executor arms; the PR body runs the red arm that replaces the reader's last step with the delegating projection, which is what proves they are not testing a getter. Refs: #565, opencharly/spec#384, opencharly/spec#383 Agent: sdk-store Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
github-actions Bot
pushed a commit
to opencharly/plugin-clean
that referenced
this pull request
Nov 18, 2026
… configuration (#28) (#34) * feat(clean): the store ceiling is the machine's, authored in the user configuration `clean: {store_budget: {bytes: ...}}` in ~/.config/charly/charly.yml — the per-host file D-STORE-2 makes the home for what the user sets — is now the ceiling `charly clean --store` measures against. The section and its `#StoreBudget` are declared in opencharly/spec#384 and arrive here through `deploykit.DeployConfig` (an alias of `spec.DeployConfig`), read over the reverse channel by `loaderkit.LoadDeployConfigViaExecutor`; no wire field, no resolver, no new seam. The plugin's own `#CleanPlugin.store_budget` (32 GiB) is the FALLBACK for a machine that authors nothing, and the report names which applied (`ceiling: user config` / `ceiling: plugin default`). Three states and never a sentinel: absent (nil at every level) -> 32 GiB; authored positive -> that number; UNREADABLE or authored non-positive -> REFUSE, naming the file. A parse failure must never evict a machine's builds under a ceiling it never wrote. `bytes` is `int & >0` projected as `int64`, because 256 GiB does not fit a 32-bit int and the wrap on 386/arm would be silent. Because the configuration is read over the reverse channel, `--store` now requires compiled-in placement, like `--images`/`--check`/`--deep`. Refs: #28, opencharly/spec#383 Pins: spec v0.2026322.1814, sdk v0.2026322.1827 (the pair sdk#563 was verified on) Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * docs(clean): the skill's --store placement and ceiling statements follow the code Two statements in the authored clean skill still described the pre-change world: that --store runs out-of-process (it now reads the user configuration over the reverse channel, so it needs compiled-in placement) and that the budget is not project-tunable yet (a machine authors it now). An earlier edit in this branch matched a paragraph whose wording had since changed, so it silently changed nothing — the failure mode where a fix looks applied and is not. Found by git grep, not by reading; the body's claim is now that grep's output. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * docs(clean): the candy description states the ceiling's home, and the ADE step pins it The description still said the size budget was authored in schema/clean.cue with no machine-facing home, which this branch falsified. My earlier attempt at this paragraph matched by exact text, found nothing, and changed nothing — the same silent no-op as the SKILL.md miss, caught this time by asking the diff instead of trusting the edit. The clean-store-category-present ADE step now also greps effectiveStoreBudget, budgetFromDeployConfig and the report's ceiling label, so a regression in the resolution fails the acceptance check rather than only a unit test. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * fix(clean): read the machine's ceiling through the section reader sdk#566 added The pin moves to sdk v0.2026322.1913 and the reader is LoadHostCleanSectionViaExecutor, whose contract is exactly the one this code states: absent document and absent clean: are (nil, nil) — the fallback — while an unreadable document, an unresolvable path or a failed bootstrap leg are errors. The earlier attempts are why that reader exists: LoadDeployConfigViaExecutor returns deploykit.ProjectDeployConfig, which drops every unnamed per-host section, and reading UnifiedFile.Clean directly returned nil for the same documents; both looked like an absent ceiling until the executed arm ran (opencharly/sdk#565). Also recorded in the arms: the per-host document lives at <dir>/charly.yml, so a fixture must own its DIRECTORY — pointing CHARLY_DEPLOY_CONFIG at three files in one directory tests one document three times, which is how a first version of this arm nearly read its own mistake as a bug. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * refactor(clean): the decision's own name, in the comment, the test and the ADE step budgetFromCleanSection replaced budgetFromDeployConfig when the source stopped being a DeployConfig, and three references kept the old name: the doc comment above the function, a t.Fatalf message, and the clean-store-category-present ADE grep — which matched ONLY the stale comment, so the check guarded nothing and fixing the comment would have broken it. All three now name the real symbol. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * chore: re-fire the org validator after an unreported push No content change: the push of 4df6109 did not create a validate / validate run (no check-run exists for that sha), so the branch head had no gate. This empty commit re-fires the pull_request synchronize event on the same tree — the tree at 4df6109 is what the reviewer will read. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * docs(clean): the file header names the reader the code calls store_budget.go's header still said the section 'arrives here through deploykit.DeployConfig (a type ALIAS of spec.DeployConfig)' while the same comment, forty lines down, explains that ProjectDeployConfig drops exactly that section — the pre-sdk#566 claim outliving the code by one commit. It now names spec.CleanSection and LoadHostCleanSectionViaExecutor and says why the DeployConfig route is not the one taken. Agent: clean-retention Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
D-STORE-7bounds a named store "within a size budget", and today that ceiling is a pluginconstant nobody can tune. It is a property of the machine that holds the store, so it belongs
in the per-host configuration (
~/.config/charly/charly.yml) —DESIGN.md:2483D-STORE-2: theuser configuration holds "each plugin's own section — under its own schema" — and not in a
project's
defaults:block, which is shared while a host's disk is not.This change declares that section in the contract, which is what makes it authorable at all: the
per-host document is a CLOSED schema, so an undeclared top-level key is a load error and an
undeclared key inside a declared section would be accepted and silently ignored. Both halves are
now typed.
schema/clean.cuegains#CleanSection(carryingstore_budget?: #StoreBudget) and#StoreBudget(carryingbytes: int & >0 @go(Bytes, type=int64)). The file already owns theword
clean— the retention verb's wire types — and now owns the per-host section of the samesurface too, which its header states.
int64, deliberately. A budget is a byte count and the value this exists for — 256 GiB =274877906944— does not fit a 32-bitint, so a bareintwould wrap silently on the386and
armcross-compile targets. The schema's own precedent isdistro.cue'sdisk_size_bytes: int @go(DiskSizeBytes,type=int64).#NodeDocrecognizes the section as a document directive, so an authoredclean:block isnever mis-read as a node named
clean; the generatedDocDirectiveslist gains the word as aconsequence. It is TYPED there where its older siblings are
_: the requirement is that anundeclared key inside the section is a load error, and
_would accept a typo and let theretention plugin fall back to its default in silence. The siblings are untouched.
spec.DeployConfigandspec.UnifiedFilecarryClean *CleanSection— the two hand-createdper-host structs that already carry
cache:,ledger:andsystem:.DeployConfigis notCUE-generated (it is
spec/spec/deploy_config.go), so the field is declared there;deploykit'sDeployConfigis an alias of it, which is why the sdk needs only a pin bump later.nil), so the 32 GiB fallback livesonce, in the plugin that enforces it. A CUE default would put the number in two places.
No wire field:
#RetentionRequestis unchanged — no peer runs the store category — so the budgetis resolved where the config is read, which is what
schema/clean.cue's own header already saysabout the retention engine.
Related, not filed here: opencharly/plugin-clean#28 carries the requirement (whose mechanism this
corrects from a project
defaults:field to the per-host section), and #383 tracksdelivering a plugin its own section through the host service — this change declares the section
that reader will read.
Head
5b503527d2e35ab01ccef89d145ec95579bb69a7(7 files changed, 211 insertions(+)).How tested
The repo's authoritative gate is
.github/workflows/ci.yml(build, test, gofmt,golangci-lint). Every command ran in
/home/atrawog/Sync/Atrapub/a/dsh/opencharly/.worktrees/store-budget/specunderGOWORK=off GOTOOLCHAIN=go1.26.8 GOTMPDIR=~/.cache/go-tmp TMPDIR=/tmp/cs.The regeneration is reproducible — a clean run is a NO-OP. The generated files are hashed, the
generator re-run, and the hashes re-checked:
The gate steps:
The requirement's own failure mode, before and after.
DocDirectivesis the reservedtop-level list the loader uses to tell a directive from a node — it is generated from
#NodeDoc,so its contents are the proof that the key was unrecognized before this change:
The new gate tests, on this head. They compile the SHIPPED schema through
schemaconcat(thesame concatenation the runtime gate runs) and unify a document against
#NodeDoc, then decode thesame document into both per-host structs:
The three arms that matter: the authored block passes the closed gate; an undeclared key
inside the section, a zero budget and a negative budget are all rejected (the closedness
the requirement is stated in terms of, and the
int & >0bound); and an absent section decodesto
nilrather than to a default.No default survives anywhere (R5): the field carries no CUE default marker, and the
predicate's calibration is shown beside its no-hit half:
Rulebook compliance
go,plugin,git-workflow,strict-policy,cutover-policy,check), and this repo'sAGENTS.md(including its "DESIGN.mdis the contract this module projects" section) was read before the schema was touched.schemaconcat.Concatthat does not exist, diagnosed from the tree (ConcatSchema(schema.FS, ".", nil)is the ONE concatenation) and corrected; a doc comment I had drafted cited an issue number I had not verified and was DELETED before the commit rather than shipped. No finding is unfixed and none is parked.#StoreBudget, referenced by#CleanSection, which is the single section def;bytesis the single byte field. Neither the section nor the budget is re-declared in Go — both types are generated.cue-gentask, and the regen is proven a no-op rather than assumed. No default was introduced to make a path work.clean.cueheader states what the file now owns, and the two per-host structs' comments point atschema/clean.cue #CleanSectionthe waycache:/ledger:/system:do.git status --shortwas empty before the commit and after the gates; the only paths touched are this worktree's own; no history was rewritten and nothing is force-pushed.TestCleanSectionIsClosedAndBoundedrejects the three shapes the gate would silently accept under_, andDocDirectives' 0→1 shows the recognition is the change's own effect. The emitted artifact is checked at its boundary — the generatedcue_types_gen.gois what the structs use, and the decode arms read the values back.ci.yml, and every step of it ran on the committed head with exit 0 (build, test, gofmt, golangci-lint v2.13.2 underGOTOOLCHAIN=go1.26.8), as pasted above; thecue-genreproducibility check (TestGenReproducible) is part of that run.DESIGN.md, cited by line:
DESIGN.md:2483D-STORE-2 — the user configuration holds "each plugin's own section — under its own schema";clean:is that section for the retention surface, and it is CLOSED and typed here, not an open map. (#UserConfigas a Go type does not exist yet — host service: §4.6 promises a plugin its OWN user-config section; the only reader is the whole per-host file #383 — so the section is declared on the per-host document and on the two structs that model it.)DESIGN.md:2488D-STORE-7 — "charly cleankeeps what state references and evicts the rest within a size budget"; this change makes that budget authorable, with no default in the contract so the fallback stays one number in one place.DESIGN.md:38D-LAW-4 — schema first: the shape is CUE written before any Go, and the Go is generated from it.Change classification
Schema + generated Go (
schema/*.cue,spec/cue_types_gen.go,spec/vocab_gen.go) and twohand-written per-host structs — not documentation, so
documentation reviewedis not claimed. Thetier claimed is
fully tested and validated, earned on this head by the CI steps, the reproducibleregen and the gate tests above.
Breaking change + rollback: none — the change only ADDS a closed section that previously failed
the load as an unknown key, so every existing per-host file (which cannot carry
clean:at alltoday) keeps loading unchanged; no existing field's type or wire key moves, and
#RetentionRequestis untouched. Rollback is to drop the branch.
Agent: sdk-store
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)