Vellum/docs/decisions
mithral 051169a18a Documentation, and make a fresh clone actually work
Docs
- docs/ARCHITECTURE.md: how the pieces fit and why. The request path, the six
  enforced layers, the data model, the scanner, the job queue, direct-play
  playback, and the three protocol surfaces over one application.
- docs/decisions/: seven ADRs with the alternatives that were rejected —
  SQLite-with-a-seam, direct-play-only, mark-missing-never-delete, the modular
  monolith, the one item-access chokepoint, the table-backed queue, and
  fixed-width timestamps.
- README: the layout section was stale (it predated catalog, home, scanner,
  providers, engine, probe, playback, apitoken, arch and the dto packages) and
  now lists what exists, plus links to the new docs.

Two real bugs, both found by verifying the docs instead of trusting them

1. The CLI could not run on a fresh install. `Config.Validate` created the data
   and config directories, but the CLI never called it, so `vellum user add` —
   the recovery path when you are locked out — failed with "unable to open
   database file" until the server had booted at least once. Split the directory
   creation into `Config.EnsureDirs`, call it from the CLI, and keep the media
   root check out of it: an admin command must not fail because a library is
   unmounted. The CLI tests now point DBPath inside DataDir, exactly as
   LoadConfig derives it, so they exercise the fresh-install path; removing
   EnsureDirs fails three of them.

2. A fresh clone could not build at all. `//go:embed all:dist` fails to compile
   when web/dist is absent, and web/.gitignore expected a `dist/.gitkeep` that
   was never created. Added it, so a clone builds and the server logs
   "web UI not embedded; run the frontend build to include it" — the intended
   behaviour for someone who only wants the API.

Also: the httpapi tests depended on a built frontend and FAILED rather than
skipping, so the suite was red on any fresh clone. findAsset and readAsset now
skip with a message naming the missing step. They still RUN when a bundle is
present (verified: zero skips here), so they have not been quietly disabled.

Verified from a simulated clone of tracked files only: go build exit 0, 25
packages pass, the server boots and applies all 12 migrations, and the CLI
creates a user and takes a backup. gofmt clean, vet exit 0, svelte-check 0/0.
2026-10-12 00:18:11 -04:00
..
ADR-001-sqlite-with-a-seam.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00
ADR-002-direct-play-only.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00
ADR-003-mark-missing-never-delete.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00
ADR-004-modular-monolith.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00
ADR-005-one-item-access-chokepoint.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00
ADR-006-table-backed-job-queue.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00
ADR-007-fixed-width-timestamps.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00
README.md Documentation, and make a fresh clone actually work 2026-10-12 00:18:11 -04:00

Decisions

Each record captures a decision that was expensive to reverse, the alternatives that were rejected, and the reasoning. They exist so nobody has to re-litigate a settled question — and so an agent does not "improve" something that was deliberate.

Read the ones relevant to what you are changing.

ADR Decision Rejected alternatives
001 SQLite, with a storage seam for later PostgreSQL; fixing the write lock in code instead
002 Direct play only, never transcode On-demand CPU transcode; remux; pre-transcode
003 A vanished file is marked, never deleted Delete on scan; auto-purge; keep it invisible
004 One binary with enforced package boundaries Microservices; unenforced conventions
005 One item-access chokepoint, internal/catalog Leave the duplication; a shared helper; a generic repository
006 The job queue is a table Redis or a broker; in-memory goroutines
007 Fixed-width timestamps via core.Stamp Integer nanoseconds; six/nine digits; sorting in Go

Writing a new one

Add ADR-00N-short-title.md with Status, Date, Context, Decision, Alternatives Considered (with the reason each was rejected) and Consequences. Do not delete an ADR when a decision changes — write a new one that supersedes it, so the history stays readable.

Two things make an ADR worth writing: the decision would be expensive to reverse, and a reasonable person could have chosen differently. If neither is true, a comment in the code is the right place.