Skip to main content

Module team_stop

Module team_stop 

Source
Expand description

The team stop (kill switch) as the Cloud reports it to an engine (GET /v1/stop, acting as the person the instance is linked to).

A stopped team’s engines get 423 team_stopped from the Cloud on its writes, landings and Code sessions. Nothing here gates anything on this machine: local agent tools keep working (owner decision 19.11.). This module only reads the state for cloud status and the cloud stop commands, and keeps the last answer of the enrolled server in <data>/team-stop.json with the time it was read. cloud status reads only that file (never the Cloud): the scheduler tick and the cloud stop commands refresh it, and status names its age (age_s) and whether it is older than two pull intervals (stale).

The Cloud answers 200 {team, stopped, since, by: {id, name}, reason, generation, role, may_stop, may_release, company?: {admin}, step_up_url?}; the instance credential names the team (no org in the route). Before any call of /v1/stop the engine reads GET /v1/capabilities: a Cloud that does not announce team_stop is “not offered” and hears nothing of it; a 404 from the route reads the same (Ok(None)).

Structs§

TeamStop
The team stop as one answer of the Cloud, checked.
TeamStopRead
A kept answer of the Cloud and how old it is.

Enums§

Cached
What cloud status knows of the team stop, from the kept answer only.

Constants§

FEATURE
The features entry of a Cloud that offers the team stop.
MAX_ANSWER_BYTES
Largest answer read.
MAX_REASON_CHARS
Longest reason the Cloud keeps (and this engine sends).
PATH
The Cloud route (under /v1): GET the state, POST {reason} stops, DELETE {confirm, note?} releases.

Functions§

apply
Fill the team-stop members of cloud status --json from cached (web_origin: the web app’s origin, for the release link). Nothing for a Cloud that does not offer the stop.
below_origin
Whether url is a plain link below origin (same scheme, host and port; no whitespace or control characters).
classify
The state of a GET /v1/stop answer; None from a Cloud without the route.
decode
The checked state of a 200 answer. team and stopped are required; other members that are malformed are left out, never repaired.
fetch
GET /v1/stop with client. A 401 is an error, so the session mints a new token once and then reports it.
is_slug
Whether slug has the Cloud’s slug shape ([a-z0-9-], 1–64).
keep
Keep stop as the answer of the enrolled server just read (None: it does not offer the team stop). Fail-safe: a Cloud that stops offering it does not clear a kept stop of the team; that stop stays, of unknown age (so stale), until the Cloud answers the state again.
offered
Whether the Cloud client talks to offers the team stop: asks GET /v1/capabilities and records the answer for server (the enrolled origin), as every feature check does.
read
The team stop for cloud status: the kept answer of the enrolled server, never a call of the Cloud. None when not enrolled.
refresh_with
Ask the Cloud with session and keep its answer (the tick, and the cloud stop commands through keep). A failure keeps the last answer; a Cloud that does not announce FEATURE is asked nothing else.
refused
A refusal of /v1/stop the team stop does not name itself, in the shared mapping of every cloud call.
safe_text
The Cloud’s words, safe for a terminal: control characters become spaces, at most max characters; None when nothing is left.
session
The Cloud session of this machine for the team stop: none when [cloud] enabled = false, not connected, or the lease lapsed (as every other cloud call off the tick).