One compiler serves the CI, the CLI, the language server and the web editor. It reads the catalogues, the topology, the libraries of steps and procedures and the simulations of a configuration repository, checks them all, and compiles them into one typed intermediate representation (IR) that the services read. No service ever parses a source file.
What the compiler checks#
Errors are found before anything runs:
- Cross-references: measures, telecommands, enums, components, roles, targets, links, procedures called, packages and their versions.
- Types and units: inputs, arguments, expressions and conditions. Subtracting °C from volts,
or passing
300 Vwhere the range is[0 V, 60 V], is an error. - Safety: every
sendof a hazardous telecommand is preceded by its confirmation; aretryonly on steps whose telecommands do not change the on-board state; no recursion between procedures; alarm reactions send no hazardous telecommand. See Safety Rules and Maximum Duration. - Bounded durations: every wait has a literal timeout, so the maximum duration of a procedure is known before launch.
- Environment policies: draft catalogues where they are refused, links and parameters by environment, gateway constraints.
- Modes and parameters: the setter and readback of each parameter of a catalogue, the value
of each parameter of a target in each declared mode, the modes named by
configureandparam(catalogue::parameter-*,catalogue::unknown-setter,topology::unknown-mode,procedure::nothing-to-configure…). See Modes and Parameters. - Simulations: compiled against the catalogue of their platform.
Diagnostics are written for operators: a plain message, the faulty line underlined, and a suggestion when there is one.
procedure::missing-argument
× telecommand `set_voltage` needs `voltage`
╭─[packages/tvac-ops/tvac.proc:26:3]
25 │ uses dut: hsc-100
26 │ send set_voltage to psu
· ───────────────────────
27 │ send output_on to psu
╰────
help: add `with voltage = …`(The step « Unit powered » of the Test bench automation
use case, its with voltage = 12 V removed.)
A .proc file with an error only loses its faulty line: all the errors of a file are reported at
once. A warning (for instance a hazardous telecommand without verify) does not prevent the
compilation.
Checking a repository#
stellar check .stellar check compiles everything, prints the diagnostics, then lists what must be validated
again, and ends with a summary. In the Test bench automation repository, once the step
« Plateau » holds 60 s instead of 30:
To validate again (`stellar lock` records the validation):
tvac-ops: step `Plateau`: it changed
tvac-ops: procedure `TVAC cycle`: step `Plateau` changed
Checked 3 catalogues, 1 library, the topology, 3 simulations (6 steps, 2 procedures): 0 errors, 0 warnings.| Option | Meaning |
|---|---|
[REPOSITORY] | Repository root (default .) |
--locked | Also fail when steps or procedures must be validated again (CI of merge requests) |
--format human or --format json | Output format (default human) |
--config <file> | Global configuration, for the compilation parameters (STELLAR_CONFIG) |
It exits with code 1 on an error, and with --locked also on a pending validation.
JSON output#
--format json prints one JSON object per line on the standard output: first the diagnostics,
then the revalidations. Positions follow the Language Server Protocol (zero-based line, column in
UTF-16 code units), so that tools can place them in any editor.
{"severity":"warning","code":"catalogue::hazardous-without-verify","message":"hazardous telecommand `open_vent_valve` has no verification","help":"add `verify: [echo]` or a condition on measures, so that its effect is checked","file":"packages/tvac-chamber/catalogue.yaml","range":{"start":{"line":84,"character":8},"end":{"line":84,"character":88}}}
{"library":"tvac-ops","name":"Plateau","reasons":["it changed","catalogue `tvac-chamber@1.0.0` changed"],"revalidate":"step"}
{"library":"tvac-ops","name":"TVAC cycle","reasons":["catalogue `tvac-chamber@1.0.0` changed","step `Plateau` changed"],"revalidate":"procedure"}(The first lines, once the verification of open_vent_valve is also removed from the
tvac-chamber catalogue; every step and procedure using that catalogue follows.)
| Field | Meaning |
|---|---|
severity | error or warning |
code | Stable code of the diagnostic |
message, help | Message and suggestion (help omitted when none) |
file | File, relative to the repository |
range | Primary location: start and end, each {line, character} |
related | Other labelled locations of the same file: {range, message} |
revalidate | step or procedure, for a revalidation line |
library, name, reasons | Library, name, and why it must be validated again |
Compilation parameters#
Two values of the global configuration are part of what is compiled and validated, so the CI must use the same values as the deployment:
| Key | Default | Effect |
|---|---|---|
executor.default_retry | {times: 1, every: 2s} | Retry policy of eligible steps that declare none; counts in maximum durations |
derived.max_window | 1h | Longest window of temporal derived functions |
Pass the file with --config or STELLAR_CONFIG; the defaults apply without it.
The snapshot#
stellar compile produces the snapshot: the whole compiled configuration.
stellar compile . # writes <hash>.ir
stellar compile . --output snapshot.ir
stellar compile . --publish nats://nats.example:4222 \
--nats-credentials ci.creds --nats-ca ca.pem| Option | Meaning |
|---|---|
--output <file> | File to write the encoded snapshot to (default <hash>.ir in the current directory) |
--publish <NATS_URL> | Store the snapshot in the store of published configurations (stellar_ir) of this message bus and make it the current configuration |
--nats-credentials <file> | Credentials for the message bus (STELLAR_NATS_CREDENTIALS) |
--nats-ca <file> | CA the server is checked against: TLS only (STELLAR_NATS_CA) |
--nats-cert <file>, --nats-key <file> | Client certificate and key, for mTLS (STELLAR_NATS_CERT, STELLAR_NATS_KEY) |
--config <file> | Global configuration |
It prints the hash on the standard output and refuses to write anything when there is an error. On the Payload integration repository:
Snapshot eda5d00ae4ff37c4de47bd54732dfc5f7c168b87a1f16a8b3b8f6b6bacfb7d4a written to `eda5d00ae4ff37c4de47bd54732dfc5f7c168b87a1f16a8b3b8f6b6bacfb7d4a.ir`.
eda5d00ae4ff37c4de47bd54732dfc5f7c168b87a1f16a8b3b8f6b6bacfb7d4aContent of the IR#
- The catalogues, with the standard components added:
link(one instance per link of the target, see COP-1 and the Link Component),filesandstreamwhere declared. - The topology: environments, targets, links, parameters, connectors.
- The libraries: steps and procedures, with every reference resolved (role, component, instance, measure), durations as constants, and each call carrying its roles and inputs explicitly, implicit passing included.
The IR holds no source position and no comment: reformatting a file does not change its hash.
Hash and descriptions#
The IR is encoded with postcard and addressed by the SHA-256 of its bytes. Components check an IR against its hash when they read it.
Descriptions — the description fields of catalogues and the description "…" lines of steps and
procedures — travel beside the IR, in the snapshot (descriptions). Changing a description changes
the configuration revision, but neither the hash of a catalogue nor the lock of a step: rewording
an explanation for operators never invalidates a validated procedure, nor the binding of a driver.
Publication#
--publish connects to the message bus (NATS, see NATS and JetStream)
and does two things:
- stores the snapshot in the store of published configurations (
stellar_ir), under its hash; - points the key
currentofstellar_config, in the state store, at it:{"hash": "…", "published_at": "…", "publisher": "<$USER>"}.
stellar_config keeps the last ten pointers: to go back to a previous configuration,
publish it again.
Applying a snapshot: safe points#
The leader of the reconciler watches current, loads the snapshot and gives each target a
revision, published in stellar_readiness:
- a target held by a run (a lease in
stellar_leases) keeps its revision until the lease is released; - every other target moves to the new snapshot at once.
The components bound to a target stamp its revision on their messages (Stellar-Config header):
the driver decodes, and the compute stage calibrates, with the catalogue of the revision of the
target. A run is resolved against the current snapshot at launch and keeps the resolved IR it was
given (archived in stellar_ir) until its end, whatever is published meanwhile.
Locks and revalidation#
Each library carries a stellar.lock file next to its package.yaml, like a Cargo.lock. It
records the hash of the IR of each validated step and procedure, and those of all their
dependencies, direct or not: steps called, sub-procedures, catalogues of their roles.
packages/hsc-100-ops/stellar.lock of the Payload integration use case:
# Generated by `stellar lock`: IR hashes of the validated steps and procedures of this
# library and of their dependencies. Updating it validates them again: review it.
version: 1
catalogues:
hsc-100@1.0.0: 9f072328cdcaa10210a52f2150a89bbe4845205e977dc3b695e852efd460638f
steps:
Camera answers:
hash: 4a9b2b7fa01f5ac0dd0391f9c07801012b87d297b6d4e8793b2a30d107cce943
depends:
catalogue hsc-100@1.0.0: 9f072328cdcaa10210a52f2150a89bbe4845205e977dc3b695e852efd460638f
procedures:
Download quicklook:
hash: c6ebd6b578f347090ee95317f0c63b58e1521e483c7ce8dc49b8b8afecdcb418
depends:
catalogue hsc-100@1.0.0: 9f072328cdcaa10210a52f2150a89bbe4845205e977dc3b695e852efd460638f
First light:
hash: 2e0534265b6639d5ac0f9544697d99ab0bc46d2d0ee7903f72176ed492ec7453
depends:
catalogue hsc-100@1.0.0: 9f072328cdcaa10210a52f2150a89bbe4845205e977dc3b695e852efd460638f
step Camera answers: 4a9b2b7fa01f5ac0dd0391f9c07801012b87d297b6d4e8793b2a30d107cce943
Release cover:
hash: 315ee1e35102e7f781bd240208182b0ab666a732ef1bbbaf2e5b25d3094ee219
depends:
catalogue hsc-100@1.0.0: 9f072328cdcaa10210a52f2150a89bbe4845205e977dc3b695e852efd460638fA step or procedure must be validated again when:
| Reason printed | Meaning |
|---|---|
it was never validated | It is not in the lock |
it changed | Its own hash differs |
step `X` changed, catalogue `p@v` changed | A dependency has another hash |
it now uses … / it no longer uses … | Its dependencies changed |
Changing a shared step therefore flags every procedure that uses it, directly or through other procedures. A catalogue republished in place under the same version also changes its hash and is caught.
stellar lock rewrites the lock of every library from the current sources (it refuses to while
there are errors) and prints, for each library, up to date or what it validated. The lock diff
goes through the review of the merge request, and that approval is the validation. In CI,
stellar check --locked fails as long as a lock is not up to date. See
Libraries and Validation.
JSON Schemas#
The YAML files are validated against JSON Schemas generated from the types of the compiler; the VS Code extension installs them. Print them for other tools:
stellar schema catalogue # catalogue.yaml
stellar schema library # package.yaml
stellar schema topology # topology.yaml
stellar schema simulation # simulations/*.yamlThe same command prints the schemas of the messages exchanged on the message bus (registration,
tc-event, run-event, sample…); see NATS Contract Reference.