Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Serves the UI and automation over a REST/JSON surface of hand-shaped HTTP handle

The read model behind the console's screens lives in `internal/readmodel`, one package of pure reads over persisted state that the handlers and the command line both call. Its endpoints are a grouped flow rollup (`GET /api/v1/flows/rollup`: one of five named groupings over the stored windows, scoped to the records a workload set reported or, asked for either endpoint, also to those it sent, aggregated in the store, bounded to a documented number of groups with the totals of the whole and a marker when truncated, and honest about the window boundaries it actually covered), a cursor-paginated list of one workload's windows (`GET /api/v1/flows`, which has no unbounded form), the evidence gaps of a workload set intersecting a range (`GET /api/v1/flows/gaps`, one named statement, bounded), the fleet and one workload in one object shape (`GET /api/v1/workloads`, `GET /api/v1/workloads/{id}`: identity, labels, mode, sync state against the latest rendered version with the instant the last snapshot was sent, and the agent's health as its heartbeats recorded it, including a credential state derived only from the stored expiry, the stored renewal error, and the clock, and whether the agent's owned firewall table is still in the host's kernel, beside when the last flow report arrived and whether one arrived within two flow windows, which tells a control channel reconnecting while telemetry still lands from a host with no contact at all), the fleet's size in total, in each sync state, and with enforcement removed (`GET /api/v1/workloads/counts`, one statement, so the counts agree and no client pages through the fleet to count it; a workload whose owned table is absent counts in `removed` and in no sync state, which stays the version its agent acknowledged; `innerwall workload counts` on the command line), and a workload's persisted rendered policy as configuration (`GET /api/v1/workloads/{id}/rendered-policy`, no counts; the console pairs it with a rollup). Peers in every flow read are what ingestion resolved and stored (ADR-0019); the read model adds only the current display name of a stored identity.

The write model is two domain packages the handlers and the command line share. `internal/policy` authors rulesets, rules, services, and address groups: admission runs there and collects every finding with a stable rule name and a path, so the surface's `400` problem and the command line's output are the same findings; every update and delete is conditioned on the version the caller last read, checked inside the write, and refused with the current version when the object has moved (the surface carries this as `If-Match`, `428` when absent, `412` when stale); the version is a stored integer every write advances by one, and the token a caller holds is compared byte-exact against its decimal form, never parsed; a rule keeps its own `created_at` across an edit of its ruleset and its `updated_at` and version move only when the rule itself changed. `internal/fleet` edits a workload's labels (versioned by content), changes the enforcement mode of a set of workloads, previews what a selector resolves to, dry-runs a hypothetical policy set, directs one workload's agent to reconnect (`POST /api/v1/workloads/{id}/resend-snapshot`, and `innerwall workload resend-snapshot` on the command line), and retires a workload (`POST /api/v1/workloads/{id}/retire`, and `innerwall workload retire`). Retirement is one way (ADR-0023). In one transaction under the render lock it stamps the registry row, which is kept so flows and gaps keep naming the identity; renders, so the workload's addresses leave every peer set and only the versions whose output changed advance; and closes an open agent silence as a stored gap. It then ends the workload's live stream: directly when the replica that retired the workload holds it, otherwise by a directive on the notification bridge, which the listener's reconnect re-sync repairs when it is lost, and in any case by the stream's next heartbeat, whose write refuses a retired workload. A retired identity is refused at renewal and at every agent call with one refusal that names no reason, and the fleet reads retired as a state of its own, outside the attention ordering. Re-enrolling the host yields a new identity. A directed reconnect is refused for an unknown workload and, with the agent's last-seen instant, for a workload whose recorded sync state is offline (an approximation of whether a stream exists, not a presence check); otherwise it publishes the directive on the notification bridge, writes nothing, and answers with the snapshot instant as it stood, which a later workload read shows advancing once the agent has reconnected. A mode change (`POST /api/v1/mode-changes`) is the one bulk operation the console's screens demand: in one transaction under the render lock it resolves its selector through the renderer's own scope match (the same resolution the preview and the scoped reads use, so a preview and the change it precedes cannot differ), refuses when the resolved count is not the one the operator expected, records the intent as the set it resolved to, flips the desired mode of exactly that set by id, and renders; the response acknowledges the recorded intent and nothing about progress, and convergence is observed on the workload reads as applied version against latest. A dry run (`POST /api/v1/policies/render-dryrun`) admits the hypothetical set as a write would, renders it against a read-only snapshot of persisted state, diffs each workload through the same delta implementation the sync stream uses, and discards everything; it reports the derived version of the state it computed against so a stale author can tell. Provisioning tokens and operator tokens are minted (secret shown once), listed (the listing prefix and metadata only; a provisioning token minted before the prefix was kept lists none), and revoked on the same surface, through the domain functions the command line's token commands call. The whole surface is described by a hand-authored OpenAPI 3.1 document, `api/openapi.yaml`, linted in CI and checked by a test against the routes the surface mounts; nothing conforms responses to it at runtime in this version.
The write model is two domain packages the handlers and the command line share. `internal/policy` authors rulesets, rules, services, and address groups: admission runs there and collects every finding with a stable rule name and a path, so the surface's `400` problem and the command line's output are the same findings; every update and delete is conditioned on the version the caller last read, checked inside the write, and refused with the current version when the object has moved (the surface carries this as `If-Match`, `428` when absent, `412` when stale); the version is a stored integer every write advances by one, and the token a caller holds is compared byte-exact against its decimal form, never parsed; a rule keeps its own `created_at` across an edit of its ruleset and its `updated_at` and version move only when the rule itself changed. `internal/fleet` edits a workload's labels (versioned by content), changes the enforcement mode of a set of workloads, previews what a selector resolves to, dry-runs a hypothetical policy set, directs one workload's agent to reconnect (`POST /api/v1/workloads/{id}/resend-snapshot`, and `innerwall workload resend-snapshot` on the command line), and retires a workload (`POST /api/v1/workloads/{id}/retire`, and `innerwall workload retire`). Retirement is one way (ADR-0023). In one transaction under the render lock it stamps the registry row, which is kept so flows and gaps keep naming the identity; renders, so the workload's addresses leave every peer set and only the versions whose output changed advance; and closes an open agent silence as a stored gap. It then ends the workload's live stream: directly when the replica that retired the workload holds it, otherwise by a directive on the notification bridge, which the listener's reconnect re-sync repairs when it is lost, and in any case by the stream's next heartbeat, whose write refuses a retired workload. A retired identity is refused at renewal and at every agent call with one refusal that names no reason, and the fleet reads retired as a state of its own, outside the attention ordering. Re-enrolling the host yields a new identity. A directed reconnect is refused for an unknown workload and, with the agent's last-seen instant, for a workload whose recorded sync state is offline (an approximation of whether a stream exists, not a presence check); otherwise it publishes the directive on the notification bridge, writes nothing, and answers with the snapshot instant as it stood, which a later workload read shows advancing once the agent has reconnected. A mode change (`POST /api/v1/mode-changes`) is the one bulk operation the console's screens demand: in one transaction under the render lock it resolves its selector through the renderer's own scope match (the same resolution the preview and the scoped reads use, so a preview and the change it precedes cannot differ), refuses when the resolved count is not the one the operator expected, records the intent as the set it resolved to, flips the desired mode of exactly that set by id, and renders; the response acknowledges the recorded intent and nothing about progress, and convergence is observed on the workload reads as applied version against latest. It checks nothing about evidence: a change to enforced is applied as asked, the operation's description and `innerwall workload set-mode`'s help say so, and the console is where the evidence is weighed (ADR-0001 as amended). A dry run (`POST /api/v1/policies/render-dryrun`) admits the hypothetical set as a write would, renders it against a read-only snapshot of persisted state, diffs each workload through the same delta implementation the sync stream uses, and discards everything; it reports the derived version of the state it computed against so a stale author can tell. Provisioning tokens and operator tokens are minted (secret shown once), listed (the listing prefix and metadata only; a provisioning token minted before the prefix was kept lists none), and revoked on the same surface, through the domain functions the command line's token commands call. The whole surface is described by a hand-authored OpenAPI 3.1 document, `api/openapi.yaml`, linted in CI and checked by a test against the routes the surface mounts; nothing conforms responses to it at runtime in this version.

### 4.2 Agent gateway

Expand Down Expand Up @@ -152,7 +152,7 @@ Surfaces, in product order:

1. **Flow map** — the live dependency graph (ReactFlow), aggregated by label group rather than per-host, because a thousand-node hairball is not visibility. Drill-down expands groups to workloads to flows.
2. **Policy editor** — live edits with conditional writes and every admission finding shown in place, and a dry run that shows each workload's rendered change before anything is written.
3. **Simulation review** — a ruleset's would-block traffic from the workloads simulating it: "these seventeen real connections from the last week would have been denied," with the verdict, the evidence gaps, and the promotion to enforcement, which asks for an explicit acknowledgment when the verdict is not safe.
3. **Simulation review** — a ruleset's would-block traffic from the workloads simulating it: "these seventeen real connections from the last week would have been denied," with the verdict, the evidence gaps, and the promotion to enforcement, which asks for an explicit acknowledgment when the verdict is not safe; a scope with no traffic recorded in simulation in the range is not safe, since no drops observed proves nothing when nothing was observed.
4. **Workload inventory** — registry, labels, agent health, desired-vs-actual ruleset version, and mode changes; a change to enforced from here carries the review's verdict for each workload it would move and asks for the same explicit acknowledgment when any is not safe or never simulated.
5. **Enrollment** — generate scoped, expiring, pre-labeled provisioning tokens with the copy-paste enroll command. Deliberately polished: it is the first thirty seconds of every evaluation.

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Notable changes to Innerwall, newest first. Versions follow semantic versioning;

## Unreleased

- **A scope with no observed traffic is not safe to enforce** (#257). The simulation review called a scope safe when every workload in it simulated on its latest policy with no evidence gap and nothing that would be dropped, even when no traffic at all was recorded in simulation in the range: a workload switched to simulation a moment ago read "Safe to enforce", with only a caveat ("No flows were stored in this range; no observed traffic stands behind this verdict"), and promoting it, or enforcing it from the fleet's **Change mode for selected…** or the workload page's **change…**, asked for no acknowledgment. No traffic recorded in simulation in the range is now a failing condition of its own, in place of that caveat: "No traffic was recorded in simulation in this range — no observed traffic stands behind this verdict". The headline reads "Not safe to enforce yet" with "Nothing was observed in simulation in this range, so the review cannot show what enforcing would drop.", the would-block view no longer shows its all-clear for a scope where nothing was observed, and enforcing takes the acknowledgment at the review's promotion and in both mode-change dialogs, as any other failing condition does. The condition judges the scope as a whole: any traffic recorded on any of its workloads, however little, satisfies it. It says that nothing was observed, not why, and sets no minimum time in simulation. Console only. ADR-0001 takes a dated amendment.
- **`innerwall workload set-mode` and `POST /api/v1/mode-changes` say they are unguarded** (#256). Both accept a change to enforced with no evidence check and no acknowledgment, by decision; the command's usage and help and the operation's description in `api/openapi.yaml` now say so, and name the simulation review in the console as where the evidence is weighed. No behavior changes. A server-side evidence guard stays on the roadmap.
- **A sync stream whose open is not recorded is ended, not served** (#264). When a replica registers a stream, it records the stream's open and names the stream on the workload's record, and the stream's offline mark is written only while the record names it (#109). When that write failed, the control plane logged `recording stream open` and served the stream anyway: the record went on naming an earlier stream, so the stream's acknowledgments and heartbeats still landed and the workload could read synced, but when the stream ended its offline mark found another stream's name and wrote nothing. The workload read as connected with no stream until its agent next connected, and for a host gone for good, indefinitely. The stream is now ended with `Unavailable` (`recording stream open`, naming nothing of the database's error) before anything is sent on it, and the control plane logs `recording stream open; ending the stream so its agent redials` at error level; the agent redials with its ordinary backoff onto a stream the record names. The failed stream's end is written by the same conditioned mark as any stream's, so the record keeps what the previous stream's end wrote, or reads offline when it named no stream or the open had landed after all. An open that finds the workload unknown or retired is answered as the Hello is: `PermissionDenied`, or the opaque refusal. Nothing in the agent, the wire contract, or the schema changes.
- **A stream's snapshot stamp is written before its handler returns** (#260). After each snapshot it sent, the goroutine that sends on a sync stream stamped `last_snapshot_sent_at` itself, and the stream's handler did not wait for it, while shutdown waits only for handlers before it closes the store: a snapshot sent in the last moments before a stop could still have its stamp in flight, which failed with `closed pool` (logged as `recording snapshot sent`) and lost the instant. The handler now writes the stamp, and on its way out waits for the sending goroutine, stamps a snapshot sent before the stream ended, and only then records the stream's end, so the instant never lands after the offline mark. The stamp and the offline mark share the five seconds the mark had alone, so a stop still takes at most fifteen seconds. A send that cannot finish because the agent has stopped reading is waited for at most five seconds, logged as `sync stream writer still in a send at the handler's exit; it ends with the stream` at warning level, and fails when the handler returns; outside a stop, such a stream's handler can take up to ten seconds to return. Nothing in the agent, the wire contract, or the schema changes.
- **Design package v4** (INN-174). The console is restyled: neutral grounds with one surface, one selected fill and one control fill; two border roles; selection drawn neutral, with green kept for primary buttons, focus rings and the allowed status; status shown by glyph and word with no fill; Inter for UI text and Manrope for headings, self-hosted beside their licenses, replacing DM Sans. Three structural changes: a full-width header above the sidebar and the screen; the flow map edge to edge under one toolbar strip, with its details in a floating sheet; and **Promote to enforced…** neutral while the verdict is unsafe. Routes, strings, columns, states and API calls are unchanged. The package is recorded in [`docs/design/`](docs/design/PACKAGE.md), locked 2026-11-27. Console only.
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Each of these is a decision or a named gap in the record; none is implied to exi

**Security and identity**
- Duplicate-identity (cloned image) detection on connect, with forced re-enrollment (ADR-0004 as amended).
- A server-side evidence guard on mode changes, refusing an unacknowledged promotion at the domain layer; today the gate lives in the console (ADR-0001 as amended).
- A server-side evidence guard on mode changes, refusing an unacknowledged promotion at the domain layer; today the gate lives in the console, and the command line and the surface say they are unguarded ([#256](https://github.com/innerwall-dev/innerwall/issues/256), ADR-0001 as amended).
- The signing tripwire: an authenticity envelope for rendered policy before it transits anything but the mutually authenticated sync stream (ADR-0012, ADR-0018).

**Agent**
Expand Down
5 changes: 5 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,11 @@ paths:
The response acknowledges the recorded intent and says nothing about
convergence, which is observed on the workload reads as applied
version against latest.

A change to enforced is not checked against any evidence and asks
for no acknowledgment: the simulation review in the console is where
the evidence is weighed, and this operation applies the mode as
asked.
requestBody:
required: true
description: The selection, the mode to reach, and the expected size of the selection.
Expand Down
Loading
Loading