Seats are data the controller owns, loaded from its store (ADR 0122, phase 1) #82

Merged
jschoubben merged 1 commits from feat/seats-are-data into main 2026-09-27 14:05:40 +00:00
Owner

Implements phase 1 of ADR 0122: the seat set moves from a compiled Go slice to a table the controller owns.

  • catalogue/seats.go: defaultSeats (the shipped set — seed and fallback), a loadable working seats, UseSeats (ignores an empty load), DefaultSeats.
  • migration 0034-the-seats-are-data.sql: the seat table.
  • inventory/seats.go: Seats (read) + SeedSeats (idempotent on conflict do nothing, never overwrites an operator's row).
  • migrate seeds the table from the defaults; openInventory loads it into the working set, falling back to compiled defaults if the table is empty or unreadable — so it can never brick the controller's boot.

Behaviour-neutral: the seeded table equals the compiled defaults, so nothing changes on deploy until someone edits a row. Validated against real postgres (make test, inventory suite green).

Phase 2 (reference seats by a stable id so a rename touches no manifest or code, and the builder reads the set from the mesh) follows — that's what makes a rename a single UPDATE.

Implements phase 1 of ADR 0122: the seat set moves from a compiled Go slice to a table the controller owns. - `catalogue/seats.go`: `defaultSeats` (the shipped set — seed **and** fallback), a loadable working `seats`, `UseSeats` (ignores an empty load), `DefaultSeats`. - migration `0034-the-seats-are-data.sql`: the `seat` table. - `inventory/seats.go`: `Seats` (read) + `SeedSeats` (idempotent `on conflict do nothing`, never overwrites an operator's row). - `migrate` seeds the table from the defaults; `openInventory` loads it into the working set, **falling back to compiled defaults if the table is empty or unreadable** — so it can never brick the controller's boot. **Behaviour-neutral**: the seeded table equals the compiled defaults, so nothing changes on deploy until someone edits a row. Validated against real postgres (`make test`, inventory suite green). Phase 2 (reference seats by a stable id so a rename touches no manifest or code, and the builder reads the set from the mesh) follows — that's what makes a rename a single `UPDATE`.
jschoubben added 1 commit 2026-09-27 14:05:35 +00:00
The seat set was a Go slice compiled into the controller and referenced by
name everywhere, so changing it meant a rebuild and a freeze-prone deploy. It
is now a table: catalogue keeps the shipped set as defaultSeats (the seed and
the fallback) and a loadable working set; inventory adds the seat table
(migration 0034), Seats to read it, and SeedSeats to fill it idempotently
without overwriting an operator's edit; migrate seeds it; openInventory loads
it, and an empty or unreadable table leaves the compiled defaults in force so
it can never brick the control plane's boot.

Behaviour-neutral: the seeded table equals the defaults. Phase 2 (reference by
a stable id so a rename touches no manifest or code, and the builder reads the
set from the mesh) follows.
jschoubben merged commit ff51b329f6 into main 2026-09-27 14:05:40 +00:00
jschoubben deleted branch feat/seats-are-data 2026-09-27 14:05:40 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: novox/mesh-controller#82