Skip to content

feat(schema): #Packaging systemd units + config file, and the layered config-stack merge wrapper - #112

Merged
github-actions[bot] merged 3 commits into
mainfrom
feat/mcp-systemd-packaging
Sep 7, 2026
Merged

github-actions[bot] merged 3 commits into
mainfrom
feat/mcp-systemd-packaging

Conversation

@atrawog

@atrawog atrawog commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two coupled changes from the systemd-units + /etc/charly config plan (plan/charly-mcp-systemd-config.md, §3.2 + §3.5), plus one in-tree test-robustness fix the validator's R1/R2 gate surfaced:

  1. Schema (§3.2) — #Packaging gains two fields (after formats:):

    • systemd?: [...#PackagingSystemdUnit] — non-autostarting systemd units shipped in the package (system + user scope), rendered to /usr/lib/systemd/{system,user}/<name>.service, NEVER enabled at install.
    • config?: #PackagingConfig — a system-wide project charly.yml shipped in the package (e.g. /etc/charly/charly.yml) carrying the plugin config the systemd MCP server uses.
      Two new CLOSED sub-shapes: #PackagingSystemdUnit (name/scope/exec/description?/restart?/after?/wants?/environment?/working_directory?) and #PackagingConfig (path/version/description/plugins?).
      Regenerated via task cue:gen: Packaging gains Systemd []*PackagingSystemdUnit + Config *PackagingConfig; the two new Go types exist in spec/cue_types_gen.go.
  2. Merge wrapper (§3.5) — merge.MergeConfigStack(system, user, project, systemDir, userDir, projectDir) merges the layered config stack (system → user → project) into one spec.UnifiedFile, LATER files winning (project > user > system). Reuses MergeUnified (dst-wins) with the later file as dst — no new merge logic (R3). Each layer's Discover specs are pre-anchored to its own dir via spec.AnchorScanSpecs before merging (so MergeUnified's srcDir re-anchoring is a no-op); each layer is copied before merging (caller files never mutated); nil layers are skipped.

  3. In-tree proc test fix (R1/R2) — proc/temphold_test.go altTempRoot required a checkout NOT under /tmp (its premise: a temp root the sweeper's hardcoded "/tmp" glob does not cover). A worktree under /tmp broke that premise and the two HonoursTMPDIR tests failed. Fixed in-tree: altTempRoot now falls back to /var/tmp (still outside the hardcoded "/tmp" glob) when the package dir is under /tmp — the premise holds from any checkout location. Full suite is green from the /tmp worktree.

How tested

task cue:gen (first run, exit 0):

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

task cue:gen (second run, reproducibility — no diff on the second run):

EXIT=0
 M schema/candy.cue
 M spec/cue_types_gen.go
?? merge/merge_stack.go
?? merge/merge_stack_test.go

go test -count=1 ./merge/... ./spec/... ./schema/... (exit 0):

ok  github.com/opencharly/spec/merge  0.003s
ok  github.com/opencharly/spec/spec   0.323s
ok  github.com/opencharly/spec/schema 1.024s

go test -count=1 ./... (FULL suite, from the /tmp worktree — exit 0, no failures):

ok  github.com/opencharly/spec/proc  0.759s
... (all packages ok, EXIT 0)

The proc tests that previously failed from the /tmp worktree now pass in-tree (the altTempRoot /var/tmp fallback, commit 8f646f2).

Rulebook compliance

  • R0 (skills first): git-workflow + go/SDD skills loaded before implementation; the schema work follows the SDD mandate (CUE source → task cue:gen).
  • R1 (RCA every anomaly): the proc test failures were RCA'd — root cause: altTempRoot's premise requires a checkout outside /tmp, broken by the /tmp worktree; fixed in-tree (fallback to /var/tmp), full suite green. No forbidden framing.
  • R2 (finish the whole cutover): the proc location-robustness fix is IN this PR (no deferred follow-up, no hidden batch); the schema + merge wrapper are complete.
  • R3 (no duplication): MergeConfigStack is a thin wrapper over the existing MergeUnified — no new merge logic.
  • R4 (no workarounds): no sleeps/retries/hand-pins/suppressions; the proc fix is a real in-tree fix, not a suppression or fallback branch.
  • R4a (fix the product first): N/A — no documentation changed in this PR.
  • R5 (delete legacy): N/A — additive schema fields + a new pure function; no legacy path removed.
  • R6 (git safety): worktree created from origin/main; no force-push, no direct push to main; the feat/ branch lands via PR.
  • R7 (prove behavior, not compilation): cue:gen idempotency verified (two runs, no diff); the merge wrapper has tests that fail without the later-wins behavior; full suite green.
  • R8 (preserve emitted artifacts): the generated cue_types_gen.go is validated at the generated boundary (reproducible regeneration, no diff on the second run).
  • R9 (binary equals source): N/A — no binary built in this PR (schema + pure Go function).
  • R10 (fresh disposable proof): all verification ran from the committed worktree tree; the change class is code/config — the gate is go test + cue:gen (no runtime bed applies to a pure schema/merge change).
  • RDD: N/A — no high-risk runtime assumption; the change is additive schema + a pure merge function.
  • ADE: N/A — no candy plan changed.
  • SDD: schema additions authored in CUE (schema/candy.cue) and generated via task cue:gen — no hand-transcribed wire structs; clean regeneration is a no-op (verified).
  • Clean Architecture: the merge wrapper lives in the existing merge package (reuses MergeUnified); no misplaced behavior.
  • Kernel/plugin boundary: N/A — spec contract module; no kernel/plugin placement.
  • Disposable-Only Autonomy: N/A — no autonomous mutation of targets.
  • Hard Cutover: N/A — additive change, no cutover.
  • Post-Execution Policies: PR-only landing, feat/ branch, validator-gated; no self-merge.
  • AI Attribution: footer present below.

Change classification

  • Change class: code/config (additive schema fields + new pure merge function + test-robustness fix; no breaking change; #Packaging stays CLOSED with only optional additions).
  • Verification gate: task cue:gen idempotent + full go test ./... green on the final committed tree (from the worktree).
  • Attribution tier: fully tested and validated (cue:gen idempotent + full suite green on the final tree).

Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)

… config-stack merge wrapper

Adds the systemd: (list of #PackagingSystemdUnit) and config: (#PackagingConfig) fields to the #Packaging shape (candy.cue) plus the two closed sub-shapes, regenerated via task cue:gen (Packaging gains Systemd []*PackagingSystemdUnit + Config *PackagingConfig). Adds merge.MergeConfigStack: merges the layered config stack (system -> user -> project) into one spec.UnifiedFile, later files winning (project > user > system), reusing MergeUnified (dst-wins) with the later file as dst. Each layer is pre-anchored to its own dir (spec.AnchorScanSpecs) and copied before merging (caller files never mutated); nil layers are skipped. Tests: later-wins per node, nil-layer skipping, per-layer discover anchoring, version later-wins.
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 1b0a3531e1f00e34d9787e5c9b53e309ac42acfe

Change class: code/config (Go + CUE schema — additive #Packaging fields, new merge.MergeConfigStack + tests).

Security screen: PASS — no scope mismatch (all 4 files accounted for in the body), no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives.

Blocks

  1. A1 — incomplete rulebook-compliance section. The body's "Rulebook compliance" block answers only R3, R4, R6, R7, R10. A1 requires EVERY applicable rule answered with a one-line HOW (or N/A — <reason>). R0, R1, R2, R5, R8, R9, R11–R18 are not addressed at all. Add the missing per-rule dispositions.

  2. R1/R2 — forbidden framing for the full-suite failure. The body's own go test ./... output shows proc's TestSweepStaleTemps_HonoursTMPDIR and TestOpenedFilesByAnyProcess_HonoursTMPDIR FAILING. The body dismisses this as "a worktree-location artifact, not a code failure; proc is untouched by this change" and labels it "environmental." This is exactly the forbidden-framing catalog: "environmental" (R1) and "out of scope / untouched by this change" (R2) with no NAMED thematic batch. Per B5, a surviving failure in the gate output is a BLOCK; per B6/R2, an issue surfaced while the cutover is open must be fixed in-tree or routed to a named batch. The control run from the main checkout does not cure the R2 split — the failure must be fixed in-tree or routed to a named batch.

  3. A3 — inflated attribution tier. The body claims "fully tested and validated" while its own full-suite run (go test ./...) is NOT green (proc failures). The tier is not justified by the pasted evidence; at most this is partial validation of the affected packages. Downgrade the tier to match the evidence (and resolve block 2).

Placement: CORRECT — merge.MergeConfigStack belongs in the existing merge package (reuses MergeUnified, no new core/sdk/candy misplacement); schema additions are correctly in schema/candy.cue with the generated spec/cue_types_gen.go in the same commit (SDD CUE-source mandate satisfied).

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 8f646f21f9fc (branch: feat/schema)

Change class: code/config (Go + CUE schema + test)

Security screen: PASS — no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives. (The unaccounted proc/temphold_test.go file is a test-only change; folded into A1 below, not a T3 scope-mismatch.)

Blocks

  1. A1 — body does not account for proc/temphold_test.go. The diff touches 5 files (merge/merge_stack.go, merge/merge_stack_test.go, proc/temphold_test.go, schema/candy.cue, spec/cue_types_gen.go), but the Summary accounts only for the schema + merge changes. The second commit 8f646f21f9fc modifies proc/temphold_test.go (altTempRoot falls back to /var/tmp when the checkout lives under /tmp) and the body never mentions it. Add it to the summary.

  2. Body-truthfulness (rule 4) — the body's "How tested" contradicts the CURRENT diff. The body states "proc is untouched by this change" and describes the full-suite proc failures as unresolved "environmental" artifacts. But the current head 8f646f21f9fc DOES touch proc/temphold_test.go — the very fix for those failures. The body's evidence describes head 1b0a3531e1f0, not the current head. Re-run the full suite on the current head and paste the post-fix output; update the body to reflect the in-tree fix instead of the stale "environmental / untouched" framing.

  3. A1 — incomplete rulebook-compliance section. The body still answers only R3, R4, R6, R7, R10. R0, R1, R2, R5, R8, R9, R11–R18 are unaddressed. Add a one-line HOW (or N/A — <reason>) for every applicable rule.

  4. A3 — inflated attribution tier. "fully tested and validated" is not justified by the body's own pasted evidence: the full-suite run shows proc failures and no post-fix run is shown. Downgrade the tier to match the evidence, or supply the post-fix green full-suite run on the current head.

Placement: CORRECT — merge.MergeConfigStack belongs in the existing merge package (reuses MergeUnified, no new core/sdk/candy misplacement); schema additions are correctly in schema/candy.cue with the generated spec/cue_types_gen.go in the same commit (SDD CUE-source mandate satisfied).

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 43a1be56ebaa5f85e6031e701e18be31efef4bda (branch: feat/schema)

Security screen: PASS — no scope mismatch (all 5 files accounted for in the body), no secrets/exfiltration, no weakened guardrails, no supply-chain changes, no embedded directives.

Checklist: All applicable rules PASS or NA.

Comments considered:

  • github-actions[bot] @ 1b0a353 (3 blocks: incomplete rulebook, forbidden framing for proc failures, inflated tier) — stale-superseded: current body now answers every applicable rule, RCA's the proc failure in-tree (altTempRoot /var/tmp fallback), and shows a green full suite justifying the tier.
  • github-actions[bot] @ 8f646f2 (4 blocks: unaccounted proc file, body-truthfulness contradiction, incomplete rulebook, inflated tier) — stale-superseded: current body accounts for proc/temphold_test.go, drops the stale "environmental/untouched" framing, has a full rulebook section, and pastes a green full-suite run on the current head.

Placement: CORRECT — merge.MergeConfigStack reuses MergeUnified in the existing merge package (no new merge logic, R3); schema additions are CUE-source in schema/candy.cue with the generated spec/cue_types_gen.go in the same commit (SDD mandate satisfied, generated types match the CUE defs).

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 7, 2026 06:31
@github-actions
github-actions Bot merged commit 6ec072c into main Sep 7, 2026
2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 7, 2026
@aitrawog
aitrawog deleted the feat/mcp-systemd-packaging branch September 25, 2026 19:09
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