Variables, secrets, and declared values
PartialThree kinds of value are set by an operator rather than collected. They share the cascade, but differ in what they are keyed by and what lifecycle they carry:
| variable | secret | declared value | |
|---|---|---|---|
| what it is | a free named value | a credential, encrypted at rest | the state a component or system should hold |
| keyed by | its own name | its own name, shaped by a secret_type | a canonical property type |
| resolves | down the cascade | down the cascade, no system band | on one owner, over its classifier’s default |
| has an observed side | no | its validity, never its value | yes: what the device reports |
| example | poll-interval = 30, a base URL | an snmp-community, a basic-auth | video-input = hdmi1 |
To operate them, see variables, secrets and properties.
variable: a free cascaded value
Section titled “variable: a free cascaded value”A variable is a named value set at one level of the fleet and inherited below it: anything
spliced into behavior that is not a device signal and has no lifecycle. It is owned on the exclusive
arc at platform, a location, a system or a component, and resolves by scalar shadow down the
cascade.
- The name is the operator’s own, with no catalog behind it, on the ordinary entity name rule
(
newtron-ssh, nevernewtron.ssh) and unique per owner. A label rides beside it for a person to read; the cascade resolves by name alone (ADR-0119). - The type is inline: a
value_typeofstring,int,float,boolorjson, stored as jsonb and checked against the type on write. - Operators write, admins delete:
variable:create,updatesits on the operator role,deleteon admin and owner. A write at theplatformrung also needsplatform:<action>.
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
value_type | text | not null | string, int, float, bool or json; the value is validated against it |
owner_kind | text | not null | platform, location, system or component |
value | jsonb | not null | |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
component_id | uuid | FK → component.id | |
system_id | uuid | FK → system.id | |
location_id | uuid | FK → location.id | |
label | text | The friendly string a person reads; null falls back to the name, verbatim |
CHECK constraints and unique indexes on variable
-
variable_owner_arc:CHECK ((((owner_kind = 'platform'::text) AND (component_id IS NULL) AND (system_id IS NULL) AND (location_id IS NULL)) OR ((owner_kind = 'component'::text) AND (component_id IS NOT NULL) AND (system_id IS NULL) AND (location_id IS NULL)) OR ((owner_kind = 'system'::text) AND (system_id IS NOT NULL) AND (component_id IS NULL) AND (location_id IS NULL)) OR ((owner_kind = 'location'::text) AND (location_id IS NOT NULL) AND (component_id IS NULL) AND (system_id IS NULL)))) -
variable_owner_kind_check:CHECK ((owner_kind = ANY (ARRAY['platform'::text, 'component'::text, 'system'::text, 'location'::text]))) -
variable_value_type_check:CHECK ((value_type = ANY (ARRAY['string'::text, 'int'::text, 'float'::text, 'bool'::text, 'json'::text]))) -
variable_component_key_uuid:CREATE UNIQUE INDEX variable_component_key_uuid ON public.variable USING btree (name, component_id) WHERE (owner_kind = 'component'::text) -
variable_location_key_uuid:CREATE UNIQUE INDEX variable_location_key_uuid ON public.variable USING btree (name, location_id) WHERE (owner_kind = 'location'::text) -
variable_platform_name:CREATE UNIQUE INDEX variable_platform_name ON public.variable USING btree (name) WHERE (owner_kind = 'platform'::text) -
variable_system_key_uuid:CREATE UNIQUE INDEX variable_system_key_uuid ON public.variable USING btree (name, system_id) WHERE (owner_kind = 'system'::text)
secret: an encrypted cascaded value
Section titled “secret: an encrypted cascaded value”A secret is an encrypted credential set at one level of the fleet and inherited below it
(ADR-0017).
It is its own primitive, stored sealed and read back only through a masked, audited path, never a
sensitivity flag on an ordinary value. It is owned at platform, a location or a component: a
secret authenticates a session with the device itself, so it has no system band. Shared versus
per-device is just where it is owned.
Shape is a secret_type: a per-field list of {name, type, secret, origin}, so a password field
is sealed while a username beside it stays plaintext, and origin says whether the operator or the
lifecycle fills it. default_admin_sensitive seeds the create form: a device type (snmp-community,
basic-auth) defaults to operational, a platform integration type (oauth2-client) to
admin-sensitive.
Sealed at rest. Each secret field is sealed with AES-256-GCM under its own data key, wrapped by
the encryption key and stored as a {ciphertext, nonce, wrapped_dek, key_id} envelope, with
(owner, name, field) bound as additional data so a ciphertext cannot be lifted into another row.
The key comes from OMNIGLASS_ENCRYPTION_KEY, from OMNIGLASS_ENCRYPTION_KEY_FILE, or from a
warned fallback under OMNIGLASS_DATA_DIR, behind a seam a KMS can later fill. The old names
(OMNIGLASS_SECRET_KEY and its _FILE) are still read, with a warning, when neither new name is set
(ADR-0558).
Masked everywhere but an audited decrypt. Every read masks a secret field (••••••). Reading
the plaintext is secret:reveal, as an on-screen :reveal or a clipboard :copy, each recorded on
the audit log under its own verb. Naming a secret where it will be used (an
endpoint’s input, a notification target, the mail relay) takes secret:bind on it
(identity and access).
Two axes decide who reaches a secret
(ADR-0025).
Placement scope gives locality: a field tech scoped to Singapore works the device secrets under
Singapore, not one owned at platform. The per-secret admin_sensitive flag gives same-scope
sensitivity: when set, every action on that secret lifts to the :admin tier.
secretis a sensitive resource off the bare read floor: a viewer reads none, an operator holds a scopedsecret:read,reveal,bind,create,update, andadminholdssecret:>, which reaches the:admintier.- The
/secretsdirectory is scope-filtered and hides admin-sensitive rows from a caller without the admin tier; revealing, updating or deleting one without it is the non-disclosing 404. - Creating an admin-sensitive secret needs
secret:create:admin. Delete stays with admin and owner.
A platform secret may come from the environment
(ADR-2223.2).
OMNIGLASS_SECRET__<NAME> declares a platform secret named <name> (lowercased, each _ a -),
its value one JSON object {"type": "<secret type>", "fields": {...}}. The boot checks it against
the secret_type catalog as a create would and fails naming the variable, never quoting the value,
when it does not fit or collides with a stored platform secret. It is held in memory only: never
sealed, stored or audited, and changed by a restart. The directory lists it with source: env and no
fields, and a write to it is a 409 naming the variable to change instead.
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
owner_kind | text | not null | platform, location or component; never system |
value | jsonb | not null, default '{}'::jsonb | Secret fields as sealed envelopes; plaintext fields as they are |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
admin_sensitive | boolean | not null, default true | Lifts every action on this secret to the admin tier |
component_id | uuid | FK → component.id | |
system_id | uuid | FK → system.id | |
location_id | uuid | FK → location.id | |
secret_type | uuid | FK → secret_type.id, not null | The shape this secret instantiates |
label | text | The friendly string a person reads; null falls back to the name, verbatim |
CHECK constraints and unique indexes on secret
-
secret_owner_arc:CHECK ((((owner_kind = 'platform'::text) AND (component_id IS NULL) AND (system_id IS NULL) AND (location_id IS NULL)) OR ((owner_kind = 'component'::text) AND (component_id IS NOT NULL) AND (system_id IS NULL) AND (location_id IS NULL)) OR ((owner_kind = 'system'::text) AND (system_id IS NOT NULL) AND (component_id IS NULL) AND (location_id IS NULL)) OR ((owner_kind = 'location'::text) AND (location_id IS NOT NULL) AND (component_id IS NULL) AND (system_id IS NULL)))) -
secret_owner_kind_check:CHECK ((owner_kind = ANY (ARRAY['platform'::text, 'component'::text, 'location'::text]))) -
secret_component_key_uuid:CREATE UNIQUE INDEX secret_component_key_uuid ON public.secret USING btree (name, component_id) WHERE (owner_kind = 'component'::text) -
secret_location_key_uuid:CREATE UNIQUE INDEX secret_location_key_uuid ON public.secret USING btree (name, location_id) WHERE (owner_kind = 'location'::text) -
secret_platform_name:CREATE UNIQUE INDEX secret_platform_name ON public.secret USING btree (name) WHERE (owner_kind = 'platform'::text) -
secret_system_key_uuid:CREATE UNIQUE INDEX secret_system_key_uuid ON public.secret USING btree (name, system_id) WHERE (owner_kind = 'system'::text)
| Column | Type | Constraints | Notes |
|---|---|---|---|
name | text | not null | |
official | boolean | not null, default false | |
label | text | ||
schema | jsonb | not null, default '[]'::jsonb | The per-field shape: {name, type, secret, origin} |
created_at | timestamp with time zone | not null, default now() | |
default_admin_sensitive | boolean | not null, default true | The admin_sensitive default a create form starts from |
id | uuid | PK, default uuidv7() | |
namespace | text | not null, default 'local'::text |
CHECK constraints and unique indexes on secret_type
-
secret_type_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
secret_type_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
secret_type_namespace_name_key:CREATE UNIQUE INDEX secret_type_namespace_name_key ON public.secret_type USING btree (namespace, name)
Declared values: device state, keyed to a signal
Section titled “Declared values: device state, keyed to a signal”A declared value is the state an operator says a component or system should hold. It is the
declared side of a canonical signal: video-input is one key with two sides, the observed value
the device reports and the declared value an operator sets, and their gap is drift.
A declared value is a row in the property series itself, provenance = 'declared'
(ADR-0079):
an edit appends, an unset appends a tombstone, and the current value is the latest row
(properties). It
resolves on one owner, over the default its classifier’s contract declares
(declared properties),
and is written with PUT /{components,systems,locations}/{name}/properties/{property}. Each piece
has one home:
| Piece | Lives in |
|---|---|
| the signal: name and value domain | the property_type catalog |
| how a class of component reads and writes it | the driver: an emit reads it, a command binding writes it |
| the declared value | a declared row in the property series |
| the observed value | observed rows in the same series |
| drift | computed on read, never stored |
The driver is the source of truth for whether a signal is settable on a class of component: it must both read it and bind a command that writes it. A driver brings no keys of its own; it references registered ones.
Drift and reconcile
Section titled “Drift and reconcile”Drift is computed on every properties read: each row carries want (the declared value, or the
contract default), told (the last command’s intended value) and is (the observed value), and
drift is true when an observed instance disagrees with want
(reconciliation). Nothing acts on drift yet.
Storage
Section titled “Storage”variable and secret are separate tables, since a secret carries sealing and a masked read path a
variable does not; both own on the exclusive arc and are keyed for the cascade by name. A declared
value has no table of its own: it is a property
row. The physical layout is on storage.