Skip to content
Repos

templewm

Markdown 15.9 KB215 lines Opens in site

Directory Raw Download

zucht - Complete Implementation Document

  • Version: 0.1.0
  • Status: Draft (zero untracked opens; tracked assumptions in 0.2)
  • Date: 2026-10-28
  • Owner: retoor

Backfilled from AGENTS.md, masterprompt.md, prompts.md, boxes.md, host_environment.md and the research/ archive. Code wins on facts, spec wins on intent. Detailed rationale lives in boxes.md (mirror, see 0.5) and in the ADRs.

0. Document control

0.1 Conventions

  • Normative IDs: FR, SEC, OPS, NFR, D, PIN, A, TRK, DOC, G (goal), NG (non-goal). IDs are never reused once retired. Cross-reference by ID.
  • No open gaps: every item that would normally be left open is a decided default in section 9 or a tracked assumption in 0.2 (owner + verify-by + fallback).
  • Evidence tags in prose: [M] measured on the host, [S] read from a primary source, [R] recalled and unverified, [U] unknown.
  • Prose rule (owner): no em dashes anywhere in new or changed text.

0.2 Assumptions (tracked, all need fallback)

Verify-by dates are targets derived from the estimates in section 7 (start 2026-11-02); they move when the estimate is re-baselined.

ID Assumption Owner Verify by Fallback
A-01 xfwl4 renders on a VKMS device with --drm-device /dev/dri/card0 through Mesa kms_swrast (boxes.md gap G16) retoor 2026-12-02 use -device virtio-vga with QEMU VNC; if neither renders, parity evidence stays at protocol/state level and every report says so
A-02 virtme-ng boots the host kernel on a directory root filesystem exported from the OCI image (G17) retoor 2026-11-04 plain QEMU with direct kernel boot and a virtiofs or 9p root
A-03 Only xfconf, libxfce4ui, xfce4-settings, xfdesktop need source builds; panel and thunar at Arch 4.20 suffice (G2) retoor 2026-11-04 build panel and thunar from 4.21 tags too
A-04 xfwm4 4.20.0 from Arch is acceptable for the X11 box (G3) retoor 2026-11-04 build an xfwm4 4.21 tag if one exists and matters for parity
A-05 rootless podman enforces cpu, memory and pids caps through the delegated cgroup controllers (G14) retoor 2026-11-04 plain podman run flags in the Makefile instead of podman-compose
A-06 xfwl4 --backend winit nested in headless sway obtains EGL through llvmpipe (G4) retoor 2026-11-18 drop mode B; develop against the guest only
A-07 startxfce4 and xfconfd run in a container without systemd using dbus-run-session (G6) retoor 2026-11-18 start xfconfd and the session pieces explicitly from a small init script
A-08 Pointer input can be injected into the guest through QEMU-attached input devices that libinput sees (G12, G18) retoor 2026-12-02 keyboard-only parity pass; pointer gates marked NOT-TESTED
A-09 An Arch Linux Archive snapshot for the pinned date is reachable at build time (G7) retoor 2026-11-04 vendor the package list and cache the packages in a zucht-owned volume
A-10 The production baseline stays near 1 busy thread and 16 GiB RAM (host_environment.md section 9) retoor recheck at every Phase start make doctor floors (NFR-03) block builds; caps shrink

0.3 Hard global caps and floors

Cap Value Enforced at
Disk used by zucht (images, volumes, caches, VM files) 20 GiB make doctor and make build (NFR-02)
Unpacked size per runtime image 2.0 GB make build writes out/sizes.txt, fails above (NFR-01)
Builds 4 threads niced, 12 GiB RAM, 2048 pids podman flags (NFR-04)
X11 box 2 threads, 6 GiB, 1024 pids podman flags
Wayland box 2 threads, 6 GiB, 2048 pids podman flags
QEMU guest 4 vCPU, 4 GiB, in a capped systemd-run --user --scope scope properties
sccache 10 GiB SCCACHE_CACHE_SIZE
Floor: root filesystem use refuse builds above 90% used or below 30 GiB free make doctor (NFR-03)
Floor: host pressure refuse builds when cpu or memory PSI some avg10 is above 20 make doctor
Retention of out/ compare runs last 20, prune dry-run by default make prune

When a floor is hit the tool prints the reason and exits non-zero. Nothing deletes automatically.

0.4 Changelog

See CHANGELOG.md (canonical, ascending). Spec version here equals the top row there.

0.5 Mirrors

Mirror Canonical source Sync rule
boxes.md (rationale, topology, phases) this spec and docs/adr/ same commit as any change to D-IDs, PINs, caps or phases; scripts/check-spec.sh verifies every D-ID in the spec has an ADR
host_environment.md the host (measured) re-measure with its section 14; changelog row on change
docs/adr/*.md this spec (D-IDs) ADR number cited next to each D-ID

1. Goals and non-goals

  • G-01: Two reproducible boxes (X11/xfwm4 and Wayland/xfwl4) built from one pinned base, running on devplace within the caps in 0.3.
  • G-02: A side-by-side parity report with one measured row per checklist gate (research/xfce-wayland-checklist/), produced by one command.
  • G-03: xfwm4/X11 behaviour is never modified or regressed by any zucht work.
  • G-04: Every claim in the research archive that concerns runtime behaviour is re-tested in the boxes and amended forward with a changelog row.
  • NG-01: No GPU passthrough or IOMMU changes on the host.
  • NG-02: No compositor on the host's physical GPU or console.
  • NG-03: No use of the host Docker daemon.
  • NG-04: No claim that xfwl4 is a daily driver before the Phase 3 gates pass.
  • NG-05: No security hardening programme (owner decision, SEC-01).
  • NG-06: No packaging or upstream patches in this phase of the project (out of scope until Phase 3 produces a measured backlog).

2. Scope (personas, use cases)

  • Persona P1: the owner (retoor), a developer on devplace over SSH, who needs to see and compare both sessions from a browser.
  • Persona P2: a second model or human continuing the work from BUILD-TRACK.md, ADRs and code, with no chat history.
  • Use cases: UC-1 start both boxes and view them; UC-2 rebuild xfwl4 after an edit and see the result; UC-3 run the parity comparison and read the report; UC-4 stop everything and see what disk it used.

3. Requirements

Functional:

  • FR-01: make build builds the base, X11, Wayland and dev images from the pinned inputs and writes out/sizes.txt.
  • FR-02: make up starts the X11 box with a full Xfce session under xfwm4 on Xvnc, viewable through noVNC on 127.0.0.1:6080.
  • FR-03: make up starts the Wayland box (mode B: xfwl4 --backend winit in headless sway), viewable on 127.0.0.1:6081; results are labelled SMOKE.
  • FR-04: make vm boots a QEMU/KVM guest whose root is the Wayland image and runs xfwl4 --backend tty on a virtual KMS device; results are labelled PARITY.
  • FR-05: make shot writes one PNG per side; make state writes machine-readable state per side; make compare combines both with an image score and a state diff into out/index.html.
  • FR-06: Both boxes start from the same xfconf seed, resolution, font and theme set.
  • FR-07: Research is recorded under research/ per research/README.md; research/INDEX.md is updated in the same pass.

Non-functional:

  • NFR-01: Each runtime image is under 2.0 GB unpacked.
  • NFR-02: zucht uses at most 20 GiB of disk in total.
  • NFR-03: Builds are refused when the floors in 0.3 are crossed.
  • NFR-04: Every box and the guest run with the caps in 0.3.
  • NFR-05: Every zucht listening port binds 127.0.0.1 only; viewing is through an SSH tunnel.
  • NFR-06: Containers run as rootless podman, never with --userns=keep-id, never --privileged, every container has a capped /tmp tmpfs.
  • NFR-07: Builds are reproducible: base image pinned by digest, Arch packages pinned to an Archive snapshot date, Rust pinned by rust-toolchain.toml, --locked.
  • NFR-08: Destructive commands (make prune) are dry-run by default and need CONFIRM=1; they act only on zucht-labelled resources.
  • NFR-09: Builds run nice -n 19 and ionice -c3.

Operations:

  • OPS-01: make doctor is read-only and prints the next missing prerequisite.
  • OPS-02: The viewing command is ssh -L 6080:127.0.0.1:6080 -L 6081:127.0.0.1:6081 devplace and is printed by make up.
  • OPS-03: Host changes (QEMU and virtme-ng packages, retoor in group kvm) happen once, in Phase 0, with owner approval (given 2026-10-28).

Security:

  • SEC-01: Security hardening is out of scope by owner decision; free defaults (loopback binds, rootless) are kept. AI never reads, prints or moves secret values (method rule).

4. Surfaces (PG inventory)

  • PG-01: out/index.html, the local side-by-side page (two noVNC iframes with flex-wrap, latest screenshots, diff score, state diff). No other user-facing surface.

5. Architecture (pins)

  • PIN-01: Base image docker.io/library/archlinux:base, digest sha256:dfc5be7be44cf1acf3d9b3b902e3e9c8a29f97ed41e35631823cdc9c97e5d4f0 (pulled 2026-10-28, created 2026-10-27); Arch packages pinned to an Archive snapshot date chosen in Phase 0.
  • PIN-02: xfwl4 git tag xfwl4-4.21.1 (tarball xfwl4-4.21.1.tar.xz, sha256 computed at first download, then committed).
  • PIN-03: Container runtime: rootless podman 5.7.0 with crun and netavark on the host.
  • PIN-04: VM stack: Ubuntu apt qemu-system-x86 1:10.2.1+ds-1ubuntu3.3 and virtme-ng 1.40-2, KVM on the host kernel 7.0.0-38.
  • PIN-05: X11 display server: TigerVNC Xvnc (Arch tigervnc).
  • PIN-06: Remote view: noVNC served by websockify, tunnelled over SSH.
  • PIN-07: Image comparison: ImageMagick compare with -fuzz.
  • PIN-08: Orchestration: GNU Make over plain podman commands; podman-compose only if A-05 passes and a new ADR says so.
  • PIN-09: Rust toolchain in the dev image: Arch rust (1.99.1 at measurement) satisfying the xfwl4 floor 1.92.

Topology, layers and Containerfile order: boxes.md sections 4 and 5.

6. Data model, API, security, compliance, ops

  • Data: no application data. Artifacts live in out/ (screenshots, state dumps, reports, sizes.txt) and in named volumes zucht-cargo, zucht-target, zucht-sccache, zucht-out.
  • API: the Makefile targets are the interface: doctor, build, up, down, shell-x11, shell-wayland, dev, vm, shot, state, compare, logs, prune.
  • Compliance: licences of pulled components are those of the distribution packages and of xfwl4/Xfce (open source); nothing is redistributed by this project.
  • Ops: the host is shared production (host_environment.md); zucht must not degrade the mail server, TURN, web, Postgres or the other users' containers (A-10, NFR-03, NFR-04).
  • Runbooks: docs/runbooks/ is empty; index: none yet. First runbook to write: recovering a hung rootless podman (source: the repair-podman skill).

7. Estimates (person-weeks with drivers)

All values are unmeasured estimates (no build has run yet). They are recomputed after Phase 0 and Phase 1 with real timings.

Area PW (range) Driver
Phase 0: host prep, pinned images, 4 source builds of Xfce libs, cap smoke test 0.5 - 1.5 number of Xfce libs failing to build against Arch; A-02, A-03, A-05, A-09
Phase 1: X11 box, xfwl4 build, nested smoke 1 - 2 cold xfwl4 build time; A-06, A-07
Phase 2: QEMU guest on a virtual KMS device 1 - 3 A-01 and A-02 (largest uncertainty); fallback to virtio-vga costs about +1
Phase 3: parity run and report 2 - 4 number of checklist gates; Wayland state client (boxes.md G5); A-08
Phase 4: repo fixes (script, checks, doc corrections) 0.5 - 1 number of docs touched (59 research docs)
Total 5.0 - 11.5 sum of ranges

Consequence if A-01 fails and A-08 fails: Phase 2 ends at the stop condition in boxes.md and Phase 3 shrinks to protocol/state parity; the date moves by the fallback cost, scope does not silently grow.

8. Risks and mitigations

ID Risk Mitigation
R-01 Builds hurt production services on the shared host NFR-03, NFR-04, NFR-09, A-10
R-02 Disk at 86% fills during image builds 20 GiB cap, floor at 90%, owner decides on the 46.9 GB reclaimable podman images (boxes.md G20)
R-03 A hung rootless podman blocks the owner's other work NFR-06 (no keep-id, capped /tmp), repair-podman runbook to be written
R-04 xfwl4 cannot render on any virtual device (A-01) virtio-vga fallback, then stated limitation
R-05 Rolling Arch drifts between rebuilds PIN-01, A-09
R-06 Research claims overstate verification (see UPGRADE-REPORT.md) DOC-02, FR-07, G-04
R-07 Unverified subagent claims leak into decisions evidence tags; only [M] and [S] justify a D-ID

9. Decisions (D-IDs, one line + rationale each; ADR = number in docs/adr/)

  • D-01 (ADR 0002): Wayland parity evidence comes from a QEMU/KVM guest running xfwl4 --backend tty on a virtual KMS device; the host has no display, no seat and no usable GPU for this.
  • D-02 (ADR 0003): Both boxes share one base, Arch Linux; it is the only candidate meeting every xfwl4 version floor except the four source-built libs [M].
  • D-03 (ADR 0004): Both boxes use the same Xfce 4.21 library build under /opt/xfce; the only differences are window manager and display server.
  • D-04 (ADR 0005): xfwl4 is pinned to tag xfwl4-4.21.1; main is a separate later target.
  • D-05 (ADR 0006): Rootless podman only; no Docker daemon, no keep-id, no --privileged.
  • D-06 (ADR 0007): One OCI image for the Wayland side, run as a container (mode B) and exported as the guest root (mode A2).
  • D-07 (ADR 0008): Makefile over plain podman commands; compose only after A-05 passes.
  • D-08 (ADR 0009): Hard caps and floors as in 0.3, because the host is shared production.
  • D-09 (ADR 0010): View through SSH tunnels; every port binds loopback.
  • D-10 (ADR 0011): Xvnc is both test and view server for the X11 box.
  • D-11 (ADR 0012): ImageMagick compare with a fuzz factor and a region mask reports a score, never a bare pass/fail.
  • D-12 (ADR 0001): The seriousdevelopment method (rev 1.7.1) is adopted for this repository (Mode B, 2026-10-28).
  • D-13 (ADR 0013): Scope is frozen to Phases 0 to 4 in boxes.md; new ideas go to a later release unless a gate forces them; an owner override re-baselines section 7 the same day.

10. Tracking and docs

  • TRK-01: BUILD-TRACK.md is the single source of status; rows per phase and per gate drill.
  • DOC-01: Living-docs register:
Doc Owner Update trigger Max staleness
SPEC.md and mirrors retoor any D-ID, PIN, cap or phase change 0 days (same commit)
BUILD-TRACK.md retoor status change, session end, gate result 7 days
docs/adr/* retoor before merge of the decision n/a (immutable once accepted)
host_environment.md retoor host change or re-measure 90 days
research/INDEX.md retoor any new research doc 0 days
docs/runbooks/* retoor drill or incident 30 days
  • DOC-02: Verification claims in docs must name the command that produced them; structure-only checks are labelled as such.

Appendix A. Research log

Queries and sources behind the boxes work (2026-10-28):

  • Package floors vs candidates: apt-cache policy in debian:trixie-slim and pacman -Si in archlinux:base, run on devplace [M].
  • Base image sizes: podman pull of alpine, debian, fedora, archlinux [M].
  • xfwl4 tags and tarball: GitLab API tags endpoint and archive.xfce.org/src/xfce/xfwl4/4.21/ [M].
  • xfwl4 backends, flags, protocols, GPU selection: source and README at gitlab.xfce.org/xfce/xfwl4 [S].
  • Distro packaging of Xfce 4.20/4.21 and xfwl4: Repology pages (subagent, [R] for exact numbers).
  • DRM-compositor testing practice: web searches on Weston/VKMS/virtme, wlroots VKMS smoke test, rootless podman DRM compositors (no source found for the last) .
  • X11 box tooling: TigerVNC/Xvfb package pages (subagent, partly [S]); podman DX claims were not fetched and are [R].
  • Host facts: host_environment.md, section 14 commands [M].
70.1ms