Skip to content

feat(desktop): the theme, session, displaymanager and desktopentry kinds - #74

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/desktop-kinds
Aug 30, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/desktop-kinds

Conversation

@atrawog

@atrawog atrawog commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Four defs describing a graphical session the way init:/service: describes a supervised
process: the kind is a renderer vocabulary, the authored entity is data. One theme
entity renders into a Hyprland config, a sway config and a GTK settings file without naming
any of them
.

Def What it is
#Theme a closed colour-token palette plus the per-application files it renders into
#Session a compositor's renderer vocabulary — per-construct templates, the config path, the wayland-sessions entry
#DisplayManager the greeter: which one, which session it starts, autologin
#DesktopEntry a freedesktop .desktop file, in both its command and web-app forms

All four are flat (Structural:false): none deploys or nests a deploy member, so none
earns a DeployTraits row. Scalars, small records and inline templates — the
plugin-harness-kind shape, not the candy/substrate one.

Every file in the diff

File What it is
schema/desktop.cue new — the four defs and their supporting records
schema/desktop_test.go new — 4 corpus cases, 24 teeth, 6 closedness guards
spec/cue_types_gen.go regenerated by task cue:gen — never hand-edited

Why these are kinds and not write: steps

Every one of these could be hand-rolled as a write: with a heredoc. What a kind buys is a
validator and cross-references that a write: cannot express:

  • theme — the token vocabulary is closed, so a template naming a token the theme does
    not define is rejected at load. An undefined token renders as an empty string: a
    terminal with no background colour, a bar with an invisible accent. No build step reports
    that; it is a subtly wrong desktop rather than a failure.
  • displaymanager — session must match a session's session_desktop.id. An autologin
    naming a session file nothing installed is a black screen at boot with an empty journal,
    which is the worst failure this surface has.
  • desktopentry — categories is closed to the freedesktop registered main categories,
    because a typo there errors nowhere: the entry silently vanishes from every menu. And
    startup_wm_class / window are read by the session renderer, so one entity feeds both
    the applications menu and the compositor's window rules. That last point is the only
    thing making desktopentry worth being a kind — without it a .desktop file is a trivial
    INI and this would be write: duplication, and should be dropped.

Nothing in #Theme or #DesktopEntry names a compositor, so the same entity serves
Hyprland, sway, labwc and KDE.

Two shapes chosen against the obvious alternative

  • The 16 ANSI colours are named fields, not a list. A template then says
    {{.Token.color4}} and a missing one is a load error, not an index panic at render
    time.
  • #ThemeRender.distro is [...string], not [...#DistroID]. These are the free-form
    tags a candy's distro: list carries (box.cue does the same), not the closed
    guest-distro id a VM source is validated against. #DistroID is also @go(-) and generates
    no Go type, so a list of it emits a reference to a type that does not exist — caught by the
    build rather than guessed.

Why no #SchemaVersion bump

Purely additive optional defs with nothing to migrate — the same shape as the iso VmSource
arm (#71) and #DiskLayout (#72). Every bump recorded in version.cue is an authored
wire-key change or removal.

How tested

$ go test -count=1 -v -run 'TestTheme|TestSession|TestDisplayManager|TestDesktopEntry|TestDesktopKinds' ./schema/
--- PASS: TestTheme_OmarchyCorpus (0.01s)
--- PASS: TestTheme_MinimalIsValid (0.01s)
--- PASS: TestTheme_Teeth (0.08s)
--- PASS: TestSession_HyprlandCorpus (0.01s)
--- PASS: TestSession_PartialTemplateSetIsValid (0.01s)
--- PASS: TestSession_Teeth (0.10s)
--- PASS: TestDisplayManager_Corpus (0.01s)
--- PASS: TestDisplayManager_Teeth (0.05s)
--- PASS: TestDesktopEntry_Corpus (0.02s)
--- PASS: TestDesktopEntry_Teeth (0.07s)
--- PASS: TestDesktopKinds_AreDefinedAndClosed (0.09s)
ok  	github.com/opencharly/spec/schema	0.482s

41 assertions across 11 tests, unified against the shipped schema via
schemaconcat.ConcatSchema(schema.FS, …) — the same bytes charly loads.

The corpus cases are real. The theme is a bundled Omarchy palette with the per-app files
the distribution actually renders; the session is Hyprland as Omarchy ships it (Lua syntax,
assembly model, uwsm start hyprland.desktop); the displaymanager is the sddm autologin an
Omarchy machine boots into; the desktop entries are both shapes — the shipped
dua i / command and the browser --app= web-app form.

The teeth are the reason the defs are closed. A sample:

Rejected Why it matters
accent: "blue" a colour name is not a hex colour
#fff / #ffffffff short form and alpha have no portable spelling across consuming formats
accnt: "#123456" an unknown token is a typo — and the exact one the load-time check exists to catch
categories: ["Utilities"] unregistered: the entry silently vanishes from every menu
session: "Hyprland Session" not a slug, so the cross-check against session_desktop.id could never match
window: {size: "large"} cannot become a window rule
a #Session with no compositor / no config_path_template nothing to start, nowhere to render

TestDesktopKinds_AreDefinedAndClosed asserts all six structs reject an unknown field —
without that, every "unknown field is a typo" case above would pass for the wrong reason.

One correction worth recording. The teeth initially used unifyDef (structural
validation) and four required-field cases passed when they should have failed: a structural
unify accepts a #Theme with no token, since the field is merely not yet concrete. They
now use unifyDefFinal, and the genuinely-required fields carry the ! marker in the schema
— the test was not weakened to match the schema, the schema was corrected to match the
intent.

The helpers are reused from box_init_test.go rather than re-declared: one helper, one
concatenation contract.

$ go test -count=1 -timeout 900s ./...
EXIT=0    (18 packages ok, 0 failed)
$ gofmt -l .

Rulebook compliance

  • R0 — skills first. /charly-internals:git-workflow; plugin-harness-kind's
    skill/hook/marketplace defs were read as the flat-kind precedent before a fifth surface was
    added.
  • R1 — RCA every anomaly. Three surfaced, each root-caused rather than patched around.
    (a) cue:gen failed with expected label or ':' — schema files carry no package
    clause; the concatenator adds it, and mine had one. (b) The build then failed with
    undefined: DistroID — #DistroID is @go(-), so a generated struct cannot reference it.
    (c) Four teeth passed when they should have failed, traced to structural vs FINAL
    validation, fixed in the schema by marking the fields required.
  • R2 — finish the whole cutover. Four defs, their supporting records, the generated Go
    and the tests land together.
  • R3 — no duplication. #ThemeRender is reused by #Session.extra_file and
    #DisplayManager.config rather than copied three times; the test helpers come from the
    existing file.
  • R4 — no workarounds. The required-field problem was fixed by marking the fields
    required, not by loosening the assertion.
  • R5 — delete legacy completely. N/A — new defs; nothing removed or renamed.
  • R6 — preserve user work and Git safety. Feature branch off current main, PR-only, no
    force-push, no direct push to main, no hook bypass.
  • R7 — prove behavior, not compilation. The tests unify real authored bodies against the
    shipped schema and assert both acceptance and rejection. A def that only compiled would
    prove nothing.
  • R8 — preserve emitted artifacts. The generated Go is committed as generated.
  • R9 — binary equals source. task cue:gen from this worktree; tests -count=1.
  • R10 — fresh disposable proof. N/A — a schema repo has no bed; its gate is the corpus-and-teeth suite on the final tree. The consumer is plugin-desktop-kind, whose
    provider serves these words out-of-process — the next unit, named rather than deferred.
  • ADE — spec-is-the-test. Every claim the doc comments make is asserted: the closedness,
    the required fields, the registered categories, the slug shapes, the hex format.
  • RDD — prove high-risk assumptions before editing. The corpus values are read off a real
    Omarchy 4.0.1 image — the bundled theme tokens, the Hyprland session exec line, the shipped
    Disk Usage desktop entry — not invented.
  • SDD — schema-driven design. CUE first, task cue:gen second, no hand-written wire type.
  • Concurrency mandate. N/A — no roster.

Change classification

  • Change class: additive CUE schema + regenerated Go types. No behaviour change on its own.
  • Verification gate: go test -count=1 ./schema/... (41 assertions) and the full spec
    suite (18 ok, 0 fail).
  • Attribution tier: fully tested and validated — every def is exercised in both directions
    against the shipped schema, with corpus values taken from a real Omarchy image.

Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)

Four defs describing a graphical session the way init:/service: describes
a supervised process: the KIND is a renderer VOCABULARY, the authored
entity is DATA. One theme entity renders into a Hyprland config, a sway
config and a GTK settings file without naming any of them.

All four are FLAT (Structural:false): none deploys or nests a deploy
member, so none earns a DeployTraits row. Scalars, small records and
inline templates -- the plugin-harness-kind shape, not candy/substrate.

WHY KINDS AND NOT `write:` STEPS. Each could be a write: with a heredoc.
What a kind buys is a validator and cross-references a write: cannot
express:

  - theme: the token vocabulary is CLOSED, so a template naming a token
    the theme does not define is rejected at load. An undefined token
    renders as an EMPTY STRING -- a terminal with no background, a bar
    with an invisible accent -- which no build step reports.
  - displaymanager: `session` must match a session's session_desktop.id.
    An autologin naming a session file nothing installed is a black
    screen at boot with an empty journal.
  - desktopentry: categories is closed to the freedesktop registered
    MAIN categories, because a typo there errors nowhere -- the entry
    just silently vanishes from every menu. And startup_wm_class/window
    are read BY the session renderer, so one entity feeds both the
    applications menu and the compositor's window rules. That last point
    is the ONLY thing that makes desktopentry worth being a kind; without
    it a .desktop file is a trivial INI and this would be write:
    duplication.

Nothing in #Theme or #DesktopEntry names a compositor, so the same
entity serves Hyprland, sway, labwc and KDE.

Two shapes chosen against the obvious alternative:

  - the 16 ANSI colours are named fields, not a list, so a template says
    {{.Token.color4}} and a missing one is a load error rather than an
    index panic at render time.
  - #ThemeRender.distro is [...string], not [...#DistroID]: these are
    the free-form TAGS a candy's distro: list carries (box.cue does the
    same), not the closed guest-distro id a VM source is validated
    against. #DistroID is also @go(-) and generates no Go type, so a list
    of it emits a reference to a type that does not exist -- caught by
    the build, not guessed.

No #SchemaVersion bump: purely additive optional defs with nothing to
migrate, the same shape as the iso VmSource arm and #DiskLayout.

Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 25030cae294f355c0aae05b85fa8dabc5008e1b4

Security screen: PASS — no scope mismatch (all 3 files accounted for in the body), no secrets/exfiltration, no weakened guardrails, no new dependencies, no embedded directives.

Checklist: All applicable rules PASS or NA.

  • Change class: additive CUE schema + regenerated Go types + tests (spec repo, no bed — R10 correctly N/A with the corpus-and-teeth suite as the gate, consumer plugin-desktop-kind named).
  • A1/A3: Body accounts for every file; pasted go test output (11 tests, all PASS) and full-suite EXIT=0 are internally consistent with the diff; attribution footer present in the required form; fully tested and validated justified for a schema-only change whose defs are exercised in both directions against the shipped schema.
  • B5/R1: Three anomalies each root-caused with real fixes (no package clause in schema files; #DistroID is @go(-); structural-vs-FINAL validation), no forbidden framing.
  • B6/R2: Whole cutover lands together; consumer named, not deferred.
  • B7/R3: #ThemeRender reused across #Session.extra_file and #DisplayManager.config; test helpers reused from box_init_test.go.
  • B13/SDD: CUE source + spec/cue_types_gen.go change in the same commit; generated Go matches the CUE (required fields carry no omitempty, @go(SelectionForeground/Background) are rename tags, not the banned @go(-)); no hand-written wire types.
  • B16/Architecture: placement CORRECT — wire shapes belong in spec, CUE-first; no alias files, no new core imports of sdk kits.
  • B15: single atomic commit.

Minor non-blocking note: the body's "41 assertions" count is slightly higher than the 37 t.Fatalf/unify calls I count in the diff; the pasted test output itself is consistent and the substance is verified, so this does not affect the verdict.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 30, 2026 09:35
@github-actions
github-actions Bot merged commit 742d534 into main Aug 30, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 30, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 30, 2026
The four desktop kinds landed in #74 without @go() annotations, so
cue:gen produced snake-cased identifiers with a leading capital:
Entry_name, Browser_arg, Mime_type, Startup_wm_class, Config_path_template,
and a bare Url.

Every other def in this schema annotates, and these are types a plugin
consumer writes against directly -- the desktop-kind provider decodes into
them field by field -- so leaving them non-idiomatic makes every consumer
read wrong.

18 annotations, no shape change: the yaml/json tags and therefore the
authored wire surface are byte-identical, so nothing needs migrating and
#SchemaVersion does not move.

  entry_name           -> EntryName
  url                  -> URL
  browser_arg          -> BrowserArgs
  mime_type            -> MimeTypes
  startup_wm_class     -> StartupWMClass
  config_path_template -> ConfigPathTemplate
  *_template           -> *Template
  cursor_theme         -> CursorTheme
  icon_theme           -> IconTheme
  extra_file           -> ExtraFiles
  session_desktop      -> SessionDesktop
  theme_render         -> ThemeRender

Found while writing the plugin-desktop-kind provider against them.

Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3

Co-authored-by: atrawog <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Sep 16, 2026
…LLMParams) (#136)

Adds schema/llm.cue — the SHARED LLM contract with TWO consumers: the generic
pipeline engine's agent stages (candy/plugin-pipeline) and the `vision:` check
verb (candy/plugin-vision), which validates a screenshot by sending it to the
same endpoint. R3 puts the vocabulary in ONE place; the boundary law puts
authored CUE in this contract module. Same shape as schema/desktop.cue
(plugin-facing vocabulary in spec, generating the Go types a plugin imports).

- #LLMSpec: endpoint + connection config (base_url, model, api_key,
  organization, project, timeout, idle_timeout, max_retries, headers, params).
- #LLMParams: the general chat-completions request block (temperature, top_p,
  max_tokens, max_completion_tokens, frequency/presence_penalty, seed, stop,
  response_format, reasoning_effort, reasoning, stream_options,
  parallel_tool_calls, tool_choice, logprobs, top_logprobs, user, metadata,
  logit_bias, extra). Both CLOSED; `extra` is the one legal unknown-key path.
- #LLMResponseFormat / #LLMReasoning / #LLMStreamOptions / #LLMNamedToolChoice.

NO #SchemaVersion bump: purely additive optional defs with nothing to migrate —
the same shape as the iso VmSource arm, #DiskLayout, and the desktop kinds
(spec PR #74, which likewise added plugin-facing vocabulary without a bump).

Why the LLM defs are named #LLM* and not #ResponseFormat etc.: spec and the
plugin-pipeline mirror both compile in ONE CUE instance; a bare #ResponseFormat
would be a name that could collide with any future base def. The #LLM prefix
namespaces the shared vocabulary.

Tests (schema/llm_test.go, the desktop_test.go shape — CORPUS via unifyDef,
TEETH via unifyDefFinal): an ollama corpus block (env-referenced key, sampling +
structured output + reasoning + extra), a vision corpus block, an int literal
for a `number` param, closedness on both defs (each rejection NAMES the field),
the numeric ranges, the reasoning_effort enum (exactly ollama's accepted
high|medium|low|none), and the response_format type enum.

Verification:
  $ task cue:gen                      # GEN_EXIT=0; version_gen.go unchanged
  $ go build ./...                    # ok
  $ go test ./...                     # 18/18 packages ok (incl. TestGenReproducible)
  $ go test ./schema -run TestLLM     # ok
  $ gofmt -l . ; go vet ./...         # clean

Rulebook compliance: R1 (the one test failure was root-caused — an unquoted
hyphenated CUE key in the test fixture, fixed by quoting); R3 (one canonical LLM
vocabulary); R5 (nothing left beside it); SDD (CUE single source, generated Go
reproducible, no hand-written types).

Change classification: contract/schema (additive, no wire-key change to an
existing surface, no version bump). Verification gate: task cue:gen +
TestGenReproducible + the new schema tests. Attribution: fully tested and
validated.

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

Co-authored-by: atrawog <[email protected]>
@aitrawog
aitrawog deleted the feat/desktop-kinds 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