Look at a terragucci estate
Show the whole prompt
Read https://intentius.io/behold/using/terragucci/.
Ask me where the reports bucket is.
Serve this repository with `npx @intentius/behold serve . --terragucci <source>` and tell me the URL.
List the roots that carry a mark and the date on each.
Never deploy with the Deploy button, `POST /api/apply` or `POST /api/ci/dispatch`. Gate approvals stay mine as well (`/api/ops/:name/signal/:gate`, `/api/workspace/gates/approve`, `/api/operator/approve/:op/:gate`). Op runs (`/api/ops/:name/run`) and rollbacks (`/api/rollback`) are mine too. Leave `--auto-sync` off, and keep a `behold preview` or `--public` serve read-only.terragucci plans, applies and checks drift for a Terraform or OpenTofu repo in your CI, and keeps every run’s report in a bucket. behold reads those reports and draws the repo’s roots as one graph, each card marked with what the newest run found about it.
The live demo shows behold on real terragucci pipelines. It runs in a loop and is read-only.
npx @intentius/behold serve . --terragucci s3://acme-terragucci-reportsnpx @intentius/behold serve . --terragucci ./reports # an `aws s3 sync` of the prefixnpx @intentius/behold serve . --terragucci https://reports.example.comNothing new runs in your CI and nothing is hosted. behold runs on your laptop,
reads the checkout for the graph and the bucket for the verdicts, and reads no
cloud. Serve the repo’s root: its chant.workspace.json declares no members
(terragucci writes one for its gates), so behold reads the Terraform roots in
the directory.
What it reads
Section titled “What it reads”The keys from terragucci’s reports bucket, each with one GET and never with a list:
| Key | What behold takes from it |
|---|---|
index.json |
every run, newest first, and the directory of each |
<run>/report.json |
for each root, the newest tf-plan and tf-drift run that planned it, and the newest tf-apply wave that held it |
estate.json |
the counts and the waiting waves, as terragucci’s estate page shows them |
audit.jsonl |
the audit record, for the timeline, when the job writes one |
<project>/runs/<commit>/run.json |
the newest apply’s progress per resource, for apply progress |
With an s3:// source on a laptop, behold reads each key with your own
aws s3 cp <key> -, so it uses your shell’s profile and region. In a job,
where the credentials are in the environment, it signs its GETs itself. A read-only identity needs
GetObject on <prefix>/*index.json, <prefix>/*/report.json and
<prefix>/estate.json, the same policy terragucci’s estate job has.
audit.jsonl and the run views are optional reads, and they need GetObject
on <prefix>/audit.jsonl and <prefix>/*/runs/*/run.json as well. When S3
answers 403 for one of them, behold says the record is not readable with these
credentials, names the key and s3:GetObject (S3 also answers 403 for a
missing object when the identity lacks s3:ListBucket), and draws the rest of
the page as it would for an absent file. A 403 on index.json, a report or
estate.json still fails the read, with the same words.
When @intentius/terragucci is installed beside behold or in the repo, every
document is checked against the JSON Schemas it ships. Without it, behold checks
the schema id and the fields it reads, and refuses anything else with
code: "terragucci-report" and what to do. behold looks for the package on
every read, so installing or upgrading it while serve runs takes effect on
the next read (within the 30 second cache, or at once with ?fresh=1).
What a mark means
Section titled “What a mark means”A mark is what one run found, when that run finished, and where its report is:
- ⚠ drift: the newest drift check found the resource changed outside Terraform, deleted outside Terraform, or existing outside the state.
- ~ plan: the newest plan that holds the root would change the resource. The pull request is named.
- ⏸ wave: a
tf-applywave holding the resource waits for an approval and would change it once approved.
Each card’s corner says how old its newest mark is. Clicking the card lists every mark in the inspect pane, worded the way terragucci words it (“drift found 06:04 UTC, 4h ago: deleted outside Terraform”), with links to the run’s report, job, pull request and trace. The Terragucci tab lists every root: its newest drift check, plan and apply wave, or “no report” when no run holds it, which is not the same as “no changes”.
Report pages open through behold, which reads them from the same source, so a link works for a private bucket too. They are served sandboxed.
The timeline, from the audit record
Section titled “The timeline, from the audit record”When terragucci’s estate job runs terragucci audit, the top of the reports
prefix holds audit.jsonl: one line per approval, approval request and
revocation, policy override, apply, refused wave, state migration, lock
release, state export and ephemeral copy, with who, when and the evidence
(The audit trail).
behold reads it with one more GET and draws it as a Timeline lane, newest
first, under the roots in the Terragucci tab. Clicking a card shows the
entries of its root in the inspect pane (the record names roots, never a
single resource). Each entry keeps its time and its run, and links the run’s
report the same way a mark does, plus its CI job or the ledger commit on
chant/lifecycle.
An approval names no root of its own: behold gives it the roots of the
request, apply or refusal of the same wave and plan digest. A source without
audit.jsonl (the job does not run terragucci audit, or --terragucci
names one project’s directory rather than the prefix) shows the sentence
“has no audit.jsonl”, which is not the same as “nothing happened”. Every line is
checked against dist/audit.schema.json when @intentius/terragucci 0.4.7 or
newer is installed, and structurally otherwise; one bad line refuses the
record with code: "terragucci-report" and its line number.
The read-only identity needs GetObject on <prefix>/audit.jsonl too. For an
agent: GET /api/terragucci/timeline?root=<path>&limit=<n> (200 by default,
1000 at most).
The ledger’s own history
Section titled “The ledger’s own history”Under the audit record, the Timeline shows a second list labelled “ledger”:
every request, approval, policy override and revocation in the gate ledgers on
chant/lifecycle, read from the branch’s git history with chant’s gate-audit
reader. Each entry names the ledger line it came from and the commit that
added it, with that commit’s author and date. A revocation is a line a commit
removed, attributed to whoever made that commit. When the reports have no
audit.jsonl, this list is the history. It holds no applies: those are in
terragucci’s reports, not the ledger.
The branch is read from the same cache as the gates and locks below, and falls
back to your checkout’s origin/chant/lifecycle the same way. The route works
for any product that keeps its gates on chant/lifecycle:
GET /api/lifecycle/history?op=<op>&gate=<gate>&limit=<n>.
Waiting waves
Section titled “Waiting waves”A wave waiting for an approval appears as a gate card in the Terragucci tab: the roots it holds, what its kept report says it destroys or replaces, how long it has waited, and the line to run:
npx terragucci approve wave-2 --plan jcs1-sha256:2e0f…There is no approve button. An approval is a git record on chant/lifecycle,
bound to the wave’s plan digest and, under approval: sealed, signed with your
key, so it is made at your shell. Copy the line from the gate card, digest
included: --plan makes terragucci approve only the plan you looked at, and
refuse if the wave now holds a different one.
On a terragucci repo behold refuses every write (Deploy, Op runs, approvals,
pipeline dispatch, rollback, and any write route added later) with 409 and
code: "terragucci". The refusal’s remedy is the same
npx terragucci approve wave-<k> --plan <digest> line. The only writes it
still answers stay inside behold: saving the hand layout, switching the served
project, refreshing caches, and the carve walkthrough’s scratch steps. The
pipeline is the only way to apply.
Gates and locks, from chant/lifecycle
Section titled “Gates and locks, from chant/lifecycle”The reports say what a wave asked for when its run finished. The gates and
locks themselves live on the repo’s chant/lifecycle branch, and the
Terragucci tab reads them too:
- each wave’s gate from
_gates/tf-apply.jsonland_gates/tf-apply/applied.jsonl: waiting (with the approve line), approved and by whom, applied, failed, a request that expired, or refused because an approval stands for other plans. Once terragucci’s waves run on chant’s op waves, a wave can also be refused by policy (a run was denied and no override counts; the card gives the override line for each run), held on another gate such as a state migration (the card names the hook that holds it and gives that gate’s approve line), or applied with its outcome not recorded. A gate that asks a decision point giveschant workspace points answer <id>instead of an approve line. behold decides each wave with chant’s own gate decision, the one terragucci applies under: an approval a wave already applied under is spent, and underapproval: sealedan approval counts only when its seal verifies against the signers file on the default branch. A gate thatidentity.gatesin chant.workspace.json names counts only a signed approval under any mode, and when it names a class, only one from a person the role grants on the default branch put in that class. A class that a pinned package declares is read from that package as installed in your checkout, so runnpm installthere first; until it is installed at the pinned version, the card says the pin could not be read and no approval counts for that gate. Each wave is decided under the approval mode its request recorded, and the card says which. A request written by an older chant records none: that wave takes the mode read on the default branch, and the card and the lane’s legend say so. An approval that does not count is shown with the reason. A card also names who relayed an approval from chat, the pull request review it came from, and the roots the wave planned; - each locked root from
_locks/tf-apply.json: the pull request holding it, who took it, when, and whether a plan, an apply or/terragucci lockdid.
Every gate and lock names the commit of chant/lifecycle it was read from and
when that commit was made, and the tab says when behold last read the branch.
behold fetches the branch from your checkout’s origin with your own git and
credentials, into a cache of its own (<tmpdir>/behold-lifecycle-*). It never
fetches into your checkout and never moves one of its refs. When the fetch
fails (offline, or no access), the tab shows your checkout’s
origin/chant/lifecycle as of your last git fetch, and says so. A repo with
no chant/lifecycle yet shows that no gate has asked and no root is locked.
While the page is open, behold checks every 30 seconds whether the reports’
index.json changed (a conditional request: If-None-Match for a bucket or an
address, the file’s time for a directory) and fetches chant/lifecycle again,
and the page updates its marks and gate cards without a reload (every 10
seconds under --public, below). Nothing is polled when no page is open.
Change the interval, or turn it off with 0:
npx @intentius/behold serve . --terragucci s3://acme-terragucci-reports --terragucci-poll 120With an s3:// source on a laptop, the check is aws s3api head-object --if-none-match, so the identity needs GetObject on <prefix>/index.json,
which it already has. behold approves, locks and unlocks nothing: unlock is a
pull request comment, approve is the line on the gate card.
Apply progress, from the run view
Section titled “Apply progress, from the run view”A choudoufu repo’s tf-apply wave job writes its progress per resource into
the run view while it applies: each resource its plans change, done, in
flight, waiting, or not applied once its root’s apply failed, as of the job’s
last read of the estates’ records. behold reads the run view of the newest
commit index.json names an apply of
(<prefix>/<project>/runs/<commit>/run.json, one more GET) and tags each card
of the wave at its top corner, for example ▶ wave 2 in flight · 2m. The age is
that of the records read, not of the page. The tag is never a fill, and the
Terragucci tab lists each wave’s counts with the same read time.
While a wave is applying, or a resource is in flight or waiting, the 30 second
poll also asks whether that run.json changed (If-None-Match, or the file’s
time for a directory) and updates the tags without a reload. Once every
resource is done or not applied it stops asking. A source with no run view (no
reports.bucket, or a Terraform repo, whose waves write no progress) says so,
which is not the same as “nothing is applying”. The read-only identity needs
GetObject on <prefix>/*/runs/*/run.json. For an agent:
GET /api/terragucci/progress.
The counts are terragucci’s
Section titled “The counts are terragucci’s”When the source holds estate.json, the drifted, failed and waiting counts
behold shows are the estate page’s own, and the tab links estate.html. behold
never counts them again, so the two never disagree. behold owns the resource
graph: which resources, in which roots, drifted or will change.
Publish a view beside the estate page
Section titled “Publish a view beside the estate page”For a team that wants a link rather than a command, the job that already runs
terragucci estate can publish a static view to the reports bucket. terragucci
keeps <prefix>/views/ for a viewer’s files and never writes there. One more
step in that job, after terragucci estate:
npx -y @intentius/behold export . --terragucci s3://<bucket>/<prefix> --no-source \ --publish s3://<bucket>/<prefix>/views/beholdThe Terraform packages behold reads HCL with (chant’s terraform lexicon and
@cdktn/hcl2json) are dependencies of behold since #909, so the one npx
brings them. behold is built and tested on chant 0.124, and the lexicon range
it declares starts at its own chant floor: the lexicon’s peer on
@intentius/chant holds its minor, and a lexicon from another minor would
install a second chant that behold’s reader never resolves. behold’s chant reads a root whose chant.workspace.json
asks for minReader 0.108.0 or anything up to 0.124.
The step reads the reports and writes the view with the job’s own credentials
from the environment (static keys, or a role assumed with the job’s OIDC token),
so the job needs no aws CLI. Add PutObject and GetObject on
<prefix>/views/behold/* (and DeleteObject there, for the sweep below) to
the job’s policy, beside the reads terragucci estate has and GetObject on
<prefix>/*/report.json. --publish writes only under a views/<name>
directory, so a typo never puts the view’s index.html over the prefix’s own.
The view is a static folder: the same marks with the same dates, the gate
cards and their lines, and terragucci’s counts. Its report links are relative
to <prefix>/views/behold/<commit>/, so they open the bucket’s own report pages through
the same presigned link or front door as estate.html. It carries no
credential, no user name and no path of the machine that made it, and
--no-source leaves each root’s HCL out.
The upload is ordered so a reader never opens a half-written view: the
snapshots and the SPA’s files first, then manifest.json, then index.html.
Each snapshot’s name carries a hash of its contents and is uploaded with
Cache-Control: public, max-age=31536000, immutable; manifest.json,
index.html and the SPA’s other files get Cache-Control: no-cache, so a
browser or CDN asks the bucket again and finds the new manifest. Before
uploading, the step reads the previous manifest.json (one GET), and after
the new index.html it deletes the snapshots that manifest named and this
export did not write, only under <prefix>/views/behold/. That needs
DeleteObject on <prefix>/views/behold/*; without it the step prints a
warning naming s3:DeleteObject, leaves the old snapshots, and still succeeds.
Each run keeps its own view, filed under the commit it was exported from:
<prefix>/views/behold/<commit>/ the view, as above (index.html, manifest.json, snapshots/, ...)<prefix>/views/behold/history.json newest first: [{commit, at, project, generated}]<prefix>/views/behold/latest.json {commit}<prefix>/views/behold/index.html opens the commit latest.json namesThe commit is the checkout’s HEAD, or --commit <sha>. The ordering above
applies inside <commit>/; after that commit’s index.html the step rewrites
history.json (one GET of the old one, no list call), then latest.json,
then the root index.html, all no-cache. The root page is a few lines that
read latest.json and open <commit>/index.html with the link’s query and
fragment, so a link to <prefix>/views/behold/index.html keeps opening the
newest view. Inside a view, a picker beside the “static snapshot” pill reads
../history.json and opens another commit’s view, each labeled with its commit
and when it was exported. at is the commit’s own date and generated the
export’s.
--keep <n> (30 by default) is how many commits history.json holds. A commit
past it leaves history.json, and its files are deleted as that commit’s own
manifest.json names them (index.html first, manifest.json last), with the
same DeleteObject permission and the same warning as the sweep above.
Nothing outside <prefix>/views/behold/ is touched. A view published before
this layout, its files directly under views/behold/, is left where it is;
only its index.html becomes the page that opens the newest commit.
Make it a step of its own that may fail: a view that cannot be built leaves the
estate page as it was, and behold export fails rather than publishing a
picture with no marks.
Several projects in one bucket
Section titled “Several projects in one bucket”A bucket prefix can hold many repos’ runs. behold picks the project named by
the checkout’s git remote (github.com/acme/infra). If the index holds several
and none is this checkout, it asks for one:
npx @intentius/behold serve . --terragucci s3://acme-reports --terragucci-project github.com/acme/infraA control repo
Section titled “A control repo”A control repo lists its projects under projects: in terragucci.yml and
holds no Terraform root, so there is no card to mark. Serve it with the top of
the reports prefix, where terragucci estate writes estate.json:
npx @intentius/behold serve . --terragucci s3://acme-reportsbehold draws one box per project with its roots grouped by wave, a solid
arrow for each read inside a project and a dashed one for each read between
projects. It reads estate.json once, then each project’s newest run view,
<project>/runs/<commit>/run.json, once. The commit comes from estate.json:
the project’s run_view when it names one, otherwise its newest apply. A read
between projects is a root’s terraform_remote_state read of a state that a
root of another project holds, matched the same way terragucci’s estate page
matches it.
Each box shows terragucci’s counts for the project, dated by estate.json’s
generated, and the run view it was drawn from, dated by when a wave last
wrote it. Under the picture, each project lists its waiting waves with the
approve line to copy. The approve line comes from the run view, so it carries
the plan digest; run it in the project’s own checkout, because behold approves
nothing. Each project also links its index, the estate page and its run view.
When the project’s repo is checked out next to the control repo (a sibling
directory whose git remote names the project), the list shows the
behold serve <path> --terragucci <src> line that opens that repo.
A project with no run view (no apply yet, or none in the bucket) stays on the
page as a box that says “no run view”. A run view that does not match
terragucci’s run.schema.json is refused on its own project, and the other
projects still draw. A project listed in terragucci.yml that estate.json
does not list is shown as “not in estate.json”. The read needs GetObject on
<prefix>/estate.json and <prefix>/*/runs/*/run.json, and no list call.
A public view
Section titled “A public view”behold serve --public serves a read-only view to anyone who reaches it, for
a repo whose pipeline is the only thing that applies it, such as one a loop
drives through a change again and again:
npx @intentius/behold serve . --public --allow-host demo.example.com \ --terragucci s3://acme-terragucci-reportsUnder --public:
- behold builds no op runner, so no route can start an Op, an apply or any other write.
- Every method but GET, HEAD and OPTIONS is refused with 405, on every path, before any route sees it.
- Every read that runs a command or calls out with behold’s own credentials,
and isn’t part of the view, is refused with 403:
/api/ops/<name>/statusand/api/operator/*, the op tools’ reads/api/overlay, the live overlay, itsplan=1attribute-drift read included/api/graphwithenv,target,consistent,planorlive; the source graph without them still answers/api/reconcile,/api/diff,/api/diff/<node>and/api/components/compare, which read or plan the live estate/api/resources,/api/ciand/api/ci/run/api/doctorand/api/substrates, which probe the host’s tools/api/history, which runsgit log/api/workspace/gatesand/api/workspace/why/api/choudoufu/splitand/choudoufu/split(and their older names,/api/choudoufu/movesand/choudoufu/morph)/api/sql-yodeler/lifecycle
- What still answers:
/api/terragucciand everything under it (the timeline, progress, estate, lifecycle and its events), the gate history (/api/lifecycle/history) and releases (/api/lifecycle/releases), which read the samechant/lifecyclebranch; the source graph; the project summary, which offers no environment; the event stream; the lanes; and the page itself. - The page shows no control that writes or asks for a refused read, and no environment picker. A waiting wave’s approve line is still shown, as the line someone else runs.
- The
--terraguccipoll defaults to 10 seconds.--terragucci-pollstill sets it. - One project directory only, and not with
--env,--poll,--localor--auto-sync.
behold still binds 127.0.0.1. Put a proxy in front of it that forwards the
public name in Host, and pass that name with --allow-host; any other name is
refused with 421. Give the process read-only credentials: GetObject on the
reports bucket, and a read-only key for the checkout’s origin, which
chant/lifecycle is fetched from.
The kiosk
Section titled “The kiosk”/kiosk is a page that follows terragucci’s looping demo, one change across
the network, app, edge and other roots, run through the real pipeline
again and again (just demo loop in terragucci’s repo). Open
https://demo.example.com/kiosk on the host above; it works under --public
and without it, and needs --terragucci.
The demo’s driver writes demo.json beside index.json at every step, so the
kiosk reads it from the top of the --terragucci source (for the demo,
s3://demo-reports/demo), through GET /api/terragucci/demo. That read needs
GetObject on <prefix>/demo.json and nothing else, and one read is shared
by every open kiosk for 2 seconds. A demo.json that is missing, refused or
not in the demo’s format is said on the page, which waits for the next one.
When the estate has choudoufu roots, or the reports hold estate rosters
(estates.json, each entry naming its roster), the kiosk also draws a carve as it is
written. It reads each roster and each estate migration’s progress
(<project>/migrations/<name>/progress.jsonl, appended while the migration
runs) through GET /api/terragucci/carve, one GET per key, shared for 1.5
seconds while a migration runs. Zoomed out, every resource is a dot in its
estate’s box: an adoption’s stamp leaves a ring, a move flies the dot to its
new estate, and a refused move bounces back and stays lit red. While a
migration runs, Watch frames the source estate, then the estate receiving
moves, then the whole set, under a caption with a “live” badge, and Tips mark
each estate’s first landing, the first refusal and the end. With neither
choudoufu roots nor rosters the route answers live: false and the kiosk is
as described here.
The kiosk is one screen: a status bar with the narration; under it, the
pipeline’s runs the way a CI page shows them (a sidebar of recent runs with
the live one pinned on top, the selected run’s jobs in their needs order,
each job’s steps and the step that matters opened on its log, following it
while it runs); and behold’s own view of the change beside them (the same page as /, framed with
?embed=1&bare=1, so nothing in it opens or writes), and a line of facts under
it. In the bar:
- The scenario, numbered as terragucci numbers it, with the title the driver wrote. A scenario id behold doesn’t know shows the title alone.
- Under the title, the scenario’s card, always open so a screen nobody
touches reads it: three rows, “What changes”, “Watch for” and “Shows”,
from demo.json’s optional
about(changes,watchandshows, each a non-empty string). terragucci keeps the text beside each scenario, inexample-demo/scenarios/<id>/about.json. Withoutabout, or with null (the base), there is no card. - Where the cycle is: pull request, planned, merged, the waves, applied, reset. A failed step is marked; a stalled cycle marks none.
- The driver’s words for the step (
label), as written. Where a value applies without a review that showed it, the driver says so, and so does the kiosk: each read of an output known only after its upstream applies gets its own sentence. - The driver’s next action, with a countdown to
next.atwhen the driver acts on its own clock, or “when the pipeline gets there” when it waits on a run. - At a waiting wave, the wave and its roots, and what the driver runs when the
countdown ends:
chant approve tf-apply wave-<N> --actor <reviewer> --sign <reviewer key>, then a/terragucci applycomment on the pull request. The driver plays two people (terragucci#1052): an author who opens, merges and comments, and a reviewer with no hand in the change who approves with its own signing key, since only such an approval counts. The actor and key are placeholders, never a path. The wave’s digest from the run view is shown beside it, so a viewer sees which plan is approved. There is no copy button: nobody watching needs to run it. - Until the reports hold the step’s run, that it isn’t written yet.
In the framed view, which is behold’s resources view of the repo, and draws the same in the full app:
- Each root is a box. Its border and the badge on it say its wave and that wave’s state: planned (blue), applying (teal, pulsing), waiting for an approval (yellow), applied (green), failed or refused (red), not started or not in the change (outlined). A root its wave plans no change in reads “no changes” (outlined) whatever its wave does, and the kiosk leaves it out of the roots it names for an approval. The resource cards wear one neutral ground while no drift was read, so colour on this view means a wave’s state. Under a box, its facts: the plan a waiting wave approves, its changes, that it plans again once an earlier wave applies. A wave that failed leaves the waves before it green: what applied stays applied. A composed run that failed part way shows each root’s own part.
- Each read between roots is an arrow from the reader’s data block to the root it reads, dashed while it reads planned values and yellow when it reads a value unknown until its upstream applies, with what it reads written beside it.
- A caption says which run all of it comes from: the pull request’s plan before the merge, the run view from the merge on.
- The kiosk keeps the view on the cycle its narration describes with a
behold:viewmessage (run): the pull request’s plan before the merge, the cycle’s commit (demo.json’scommit) from the merge throughapplied, and nothing in flight atreset, where the caption says the states went back to the base. The loop’s own next runs (the reset’s push back to the base) never take the view while the narration is beforereset. - The kiosk brings the roots each step is about forward with a
behold:viewmessage (focus): the pull request’s roots while it is planned, then the wave that waits, applies or failed, then everything once applied. - Pointing at a card opens a popover next to it. The popover stays inside the
frame and leaves the card in view. The resources view names the resource and
its root and gives each attribute the plan changes its own line as
before -> after. Six lines show at most, and a count stands for the rest. A value known only after apply shows in the unknown colour with a note that no review shows it. Once a wave has applied the root, the popover also lists the values the state holds now. The view by wave lists the root’s resources and marks whether each one changes, stays as it is or is known after apply. Its first line counts the changes. A click keeps the popover open until a click elsewhere or Escape, and for 90 seconds at most. Nothing opens without a pointer, so a screen nobody touches looks the same. - Each root has its own colour. It shows only as a dot by the root’s name and
never as the colour of a text or a fill, since those mean a state. The dots
sit on the root’s box or card and by each wave’s job. The narration and
the facts carry them too, as do terragucci’s own log lines. The colours follow the
sorted list of roots in
terragucci.components.json, so each cycle keeps them. Pointing at any root’s name lights that root in every pane, and the same goes for a wave’s job and a box.
Under it: the pull request’s totals, its blast radius, the roots it does not touch and its cost.
The runs are the demo repo’s real pipeline runs, which the loop driver copies
from its forge into the reports bucket as they go: <prefix>/runs/index.json
(the newest runs, at most keep, each with its jobs) and
<prefix>/runs/<id>.json (one run, each job’s steps and each step’s log
tail), read through GET /api/terragucci/runs and
GET /api/terragucci/runs/<id>, shared between kiosks for 2 seconds like
demo.json. A job held at a terragucci gate is waiting and is drawn as
held at the gate, never as a failure. Step names are shown as the driver
wrote them. A viewer can open an older run in the sidebar; the kiosk goes
back to the live run 90 seconds after the last pick. --terragucci-runs <source> reads the runs from somewhere else than the reports, such as a
directory of fixtures (behold’s own are in
src/__fixtures__/terragucci-demo/).
The kiosk asks for demo.json every 3 seconds, and for the reports and the run
view when the step moves or the event stream says they did. Everything it asks
is a GET, and it shows no control.
One checkout per repo
Section titled “One checkout per repo”The demo runs each tool on its own forge repo. behold serve <dir> --repos <parent> serves every git checkout directly under <parent>, one per
request: a request with ?repo=<name> (the checkout’s directory name, or
<owner>/<name> as demo.json writes it) reads that checkout, and a request
without one reads <dir>. The kiosk asks for the repo its scenario runs on,
and a tool’s page for its tool’s repo, so each draws its own repo’s graph,
marks and popover. A name the server doesn’t serve is refused with 404; only
the names it listed at startup ever reach the filesystem.
A Terragrunt repo is drawn the same way: each unit (a directory with a
terragrunt.hcl) is a root box holding the resources of the module its
terraform { source } names, when that is a directory of .tf in the repo,
and each dependency block is a card with an arrow to the unit it reads.
behold reads those two blocks and evaluates nothing else. A unit whose module
it can’t read is one card saying so.
chant’s fan-out demo, from its own bucket
Section titled “chant’s fan-out demo, from its own bucket”chant runs its fan-out demo itself, from examples/fan-out-estate/demo in
chant’s repo, with no terragucci in it. Its driver writes two records under
one prefix: step.json at every step (chant’s demo-step/v1) and
cycles/latest.json at each reset (demo-cycle/v1). Point behold at that
prefix:
behold serve <checkout> --repos <parent> --chant-demo s3://chant-demo/fan-out-estate/chant-fanout then reads the demo from those records, through
GET /api/chant/demo (the step) and GET /api/chant/demo/cycle (the last
cycle, which the page replays between cycles). Without --terragucci,
/kiosk is the same page. The step keeps the field names the kiosk reads
from demo.json, chapter included.
Each step names chant’s report keys (reports: url, plan and apply,
each <pr>/<commit>). behold reads the stage’s pr-plan.json or
pr-apply.json (pr-report/v1) and its .events.jsonl (run-event/v1) at
those keys, for the graph’s waves and the gate. The runs pane shows one run per
stage, built from its run events: the plan, the gate and each wave as steps,
each with the events’ lines. Nothing is read from forge runs, and the
pipeline’s --report-url is not looked up in the workflow file.
--chant-report-url, when given, overrides the step’s url. The step’s
cycle_reports, every stage of the cycle so far, name the first apply’s key,
so the fix’s run shows what that apply landed even when behold started
mid-cycle.
Each record is checked against chant’s schema before it is read. A record of
another contract version (contract, or the v<n> in its $schema) is
refused, and the page says which version behold reads. So is a reports.url
that is not s3:// or https://. A step behold doesn’t know is not
refused: chant may add steps within a version, so the page shows it by its
name and lights no stop. Without
--chant-demo, every page reads terragucci’s loop as above.
Runs from chant’s run index
Section titled “Runs from chant’s run index”chant ci run --report-url <url> (chant 0.124.31 and newer) keeps a run index
at <url>/runs/index.json (ci-run-index/v1), the document
chant ci runs --report-url <url> --json prints. Give behold the same URL and
the kiosk’s runs pane reads its runs there instead of the forge’s:
behold serve <checkout> --terragucci s3://reports --ci-report-url s3://reports/chantBEHOLD_CI_REPORT_URL does the same. The URL is s3://, https://, file:// or
a directory. The pane lists the index’s runs, newest first, each with its
member, why it failed and, when the run’s record was signed, who signed it.
An apply that exited 3 (the plan moved, or a gate waits) is drawn held, not
failed, whether its report says why or only the entry’s exitCode does
(chant#4165). Opening a run reads its pr-<job>.events.jsonl under the entry’s key
as the log, the way the fan-out demo’s runs are built. A job run without
--events-json has no events file, and its log says so. A run whose forge
names it links to it.
GET /api/chant/ci/runs and GET /api/chant/ci/runs/<runId> answer them;
a run is read only by an id the index lists, and only under its own key, so
--public serves both. An index of another contract, or one written by a
chant older than 0.124.31, is refused with the reason in the pane.
A workspace can declare the URL instead, in chant.workspace.json
(chant 0.124.32 and newer, chant#4160):
{ "ci": { "reportUrl": "s3://reports/chant" } }When behold serve is pointed at that workspace without --ci-report-url,
it reads the run index at the declared URL. The flag still overrides the
declaration, and both routes’ answers carry urlFrom, flag or
declaration, to say which one named it. behold doctor lists the floor
with the rest. With neither, or on an older chant, the pane reads the forge’s
runs, as before.
On a served workspace, the panel’s Local tab runs one of these plan jobs on this machine and draws it in the same run view beside CI’s run: see Running a CI job locally.
Try it on terragucci’s example
Section titled “Try it on terragucci’s example”behold ships a reports bucket for terragucci’s own example estate, written by
terragucci’s code (example-terragucci-reports/ in behold’s repo, whose README
lists the runs). From a terragucci checkout:
npx @intentius/behold serve example --terragucci <behold>/example-terragucci-reportsIt shows a drift on staging orders’ jobs queue, two pull requests’ plans, a
failed drift check on prod payments, and wave 2 waiting with a destroy. Its
audit.jsonl gives the timeline wave 1’s apply and wave 2’s request.