Templates
PartialA template is an example you clone to start a standard, a component, a system or a set of locations, then own what you get. Templates ship inside the binary as a menu, never as data: nothing is inserted until somebody picks one, and what they pick lands as ordinary rows. Nothing points back at the template: creating from one is one-time, with no inheritance and no back-pointer, so a template can be rewritten in any release without migrating a single install (#827). To use one, see Start from a template.
Copy, not pin
Section titled “Copy, not pin”A template is a starting point an instance copies and then forgets, so it can change freely, because no instance is watching (ADR-0071). The live relationships are elsewhere, and they are not templates:
| The shape of a… | is its… | and the relationship is |
|---|---|---|
| component | product, naming its driver | a pointer, component.product_id |
| system | standard | conformance, with live inheritance |
Creating from a template applies a template to a row, once. Conformance applies a standard to a system, continuously: a standard’s contract default resolves for every conforming system until that system binds its own value. How to reach and read a class of device is not a template’s job either: that is the driver’s spec (ADR-0827).
This removes the shipped-defaults problem. A vendor-updated row either overwrites operator edits or freezes the defaults; a pinned version means persuading every install to re-point. When the thing the release updates and the thing the operator owns are never the same object, a template change needs no migration.
The four kinds
Section titled “The four kinds”- Standard template: a standard’s attributes, its system slots (accepted types, pinned products, quorum, capacity, choices) and its property and metric contract lines. “Start from a meeting room” yields the slots the room needs filled, not only a name.
- Component template: a product, a driver attach preset (every driver input except the address, secret inputs as references) and declared property values.
- System template: a standard (a standard template by name, or an existing standard), a component template or product per slot, and declared system property values.
- Location template: a nested tree of locations, each naming a location type, an optional label, and optional nested locations and system templates.
A location type is not a template kind: it is an official row an operator reshapes through the catalog fork (ADR-0106). A location template only builds a subtree whose types its parents allow, with no logic keyed on any particular type.
How a template ships
Section titled “How a template ships”Templates are authored as kind-tagged YAML in the repo and embedded into the binary (internal/template),
like the seed files; the difference is the loader. A seed inserts rows unasked; a template inserts
nothing. The loader exposes a read-only catalog, validated at load: an unknown field, a slot naming half a
choice, a system template leaving a slot unfilled or answering a choice two ways, or a component preset
setting the address is refused, naming the template.
A build test dry-runs every template against the seeded catalogs: each product, type, driver input, property, metric and location type a template names must exist, and each nested location’s type must allow its parent’s. A template naming a row a release withdrew fails the build, not an operator.
There is no template versioning: a template is addressed by its name and replaced by the next release. The standards boot seed is retired (#1324): a fresh install starts with no standards, and the catalog offers them. What this release ships, rendered from the catalog itself:
| Template | Kind | What it creates |
|---|---|---|
auditorium (Auditorium) | standard_template | a standard, with 11 slots |
classroom (Classroom) | standard_template | a standard, with 3 slots |
digital-sign (Digital Sign) | standard_template | a standard, with 2 slots |
divisible-conference (Divisible Conference) | standard_template | a standard, with 16 slots |
ds55 (Digital Sign 55) | standard_template | a standard, a variant of digital-sign, with 2 slots |
ds75 (Digital Sign 75) | standard_template | a standard, a variant of digital-sign, with 2 slots |
huddle-room (Huddle Room) | standard_template | a standard, with 7 slots |
meeting-room (Meeting Room) | standard_template | a standard, with 4 slots |
mr55 (Meeting Room 55) | standard_template | a standard, a variant of meeting-room, with 4 slots |
mr65 (Meeting Room 65) | standard_template | a standard, a variant of meeting-room, with 4 slots |
mr75 (Meeting Room 75) | standard_template | a standard, a variant of meeting-room, with 4 slots |
mr86 (Meeting Room 86) | standard_template | a standard, a variant of meeting-room, with 4 slots |
mr98 (Meeting Room 98) | standard_template | a standard, a variant of meeting-room, with 4 slots |
training-room (Training Room) | standard_template | a standard, with 14 slots |
ds55-system (Digital Sign 55, staffed) | system_template | a system on ds55, filling panel with boreal-edge-55 player with boreal-cast-m1 |
mr55-system (Meeting Room 55, staffed) | system_template | a system on mr55, filling main-display with boreal-edge-55 scheduling-panel with newtron-slate-5 touch-control with newtron-panel-7 video-bar with kestrel-vroom |
meeting-floor (A floor of meeting rooms) | location_template | floor: ds55-system room mr-1: mr55-system room mr-2: mr55-system |
boreal-cast-m1 (Boreal Cast M1 media player) | component_template | a boreal-cast-m1 component, its driver preset with port |
boreal-edge-55 (Boreal Edge 55 display) | component_template | a boreal-edge-55 component, its driver preset with port |
kestrel-vroom (Kestrel VRoom video bar) | component_template | a kestrel-vroom component, its driver preset with port tls-mode |
newtron-panel-7 (Newtron Panel 7 touch panel) | component_template | a newtron-panel-7 component, its driver preset with port |
newtron-slate-5 (Newtron Slate 5 scheduling panel) | component_template | a newtron-slate-5 component, its driver preset with port |
Reading a template
Section titled “Reading a template”GET /templates (optionally filtered by kind) and GET /templates/{template}, gated template:read,
which the viewer’s read floor grants (#1323). A catalog read has no owner and no scope injection. The CLI
is omniglass template list and omniglass template get <template>.
Creating from a template
Section titled “Creating from a template”One custom method, :createFromTemplate, creates from a template on each of the four collections, so the
one verb means one thing everywhere. Each is gated by that resource’s own create permission and turns the
template into one plan, landed through the plan primitive: every piece
is the ordinary create, checked as its own route checks it, in the caller’s own scope, with its own audit
row, in one transaction. A refused piece is answered as its own route answers it, and nothing lands.
POST /standards:createFromTemplate(standard:create): one operator-owned standard with the template’s slots, choices and contract lines, under a name the operator chooses (the template’s by default; a taken name is a 409). A variant is created only once the operator holds the standard it hangs off; otherwise a 422 names the template to create first.POST /components:createFromTemplate(component:create): one component at a location with its product and declared values. When the request’sinputscarry the address and anoutpost, its endpoint attaches through the driver with the template’s preset (which also needsendpoint:create); a secret input resolves exactly as an attach resolves it, so one the caller cannot use is refused indistinguishably from one that does not exist.POST /systems:createFromTemplate(system:create, plus the component permissions it uses): a whole system at a location, built to the standard the caller names, else the template’s own (theirs when they hold it, otherwise created from its standard template in the same write, ancestors first). A component is created for each slot, filled to its quorum and assigned, so the system’s staffing reads complete. Slots given an address inattachland attached; the rest land unattached and are listed into_attach. A standard the template cannot staff is a 422 naming the slots.POST /locations:createFromTemplate(location:create, plus the system permissions when the subtree carries systems): a subtree of locations under a parent, or as a new top. Each location’s type must be one the fleet holds and must allow its parent’s, read from the fleet’s own effectiveallowed_parent_types, a fork of a shipped type included. A missing type or a refused pairing is a 422 naming it.
A location outside the caller’s read scope is a non-disclosing 404, as is an unknown template. The CLI is
omniglass standard createFromTemplate, omniglass component createFromTemplate,
omniglass system createFromTemplate and omniglass location createFromTemplate.
Provenance lives in the audit trail only. Every row created from a template is audited as a create
whose detail names the template as from_template. There is no column and no back-pointer, which keeps
the copy severed while still answering “where did this come from”; removing a template from the catalog
leaves every row created from it reading identically.
One primitive lands a plan
Section titled “One primitive lands a plan”The simulator’s “add a simulated system” and every create from a template share one primitive in two
halves (#1325). The pure planner, internal/systemplan, staffs a standard’s slots from each slot’s
candidate products (the products the simulator serves, or the one a template names), filling each to its
quorum, capped by its capacity, and taking one alternate per choice. The planned create,
storage.CreatePlan, lands the standards to create, the locations parents first, each system with its
components, endpoints, declared values and slot assignments, in one transaction, with one health
recompute before commit (health).
In the console
Section titled “In the console”Catalog > Templates lists the catalog by kind. Each template’s blade renders what it creates (a standard’s slots and choices, a system’s slot fills, a location subtree with its systems, a component’s preset), and Start from this template opens the form that calls the matching route. The standard, system, location and component create flows each offer Start from a template, and a row a template created opens with a notice that it is the operator’s own and nothing follows the template (#1329).