From d09e7eae8ea5a643acce2234e53553dc92d59b5e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 05:34:39 -0600 Subject: [PATCH 1/3] review: no observed traffic fails the verdict (#257) The 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 was recorded in simulation in the range. A workload switched to simulation a moment ago read "Safe to enforce", with only a caveat to say nothing stood behind it, and neither the promotion nor the mode-change dialogs asked for the acknowledgment. An absence of observed drops proves nothing when nothing was observed. No traffic recorded in simulation is now a failing condition of its own, "no-traffic", in place of the caveat. It fires when neither decision's peer-and-service rollup covered a window in the range: a rollup carries its covered bounds whenever it matched anything, so a truncated read is never taken for an empty one. It judges the scope as a whole, as every other condition does, and is not asked of a scope with nothing simulating, where the visibility and already-enforced conditions say no verdict exists. It states that nothing was observed, not why, and sets no minimum time in simulation. The headline's sentence for a scope with no traffic no longer says "No observed traffic would be dropped", which would be true of nothing, and the would-block view no longer shows its all-clear when nothing was observed at all. The promote dialog and both mode-change dialogs read the same composition, so each now asks for the acknowledgment. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- ui/src/routes/review/Takes.tsx | 4 +- ui/src/routes/review/model.test.ts | 160 ++++++++++++++++++++++- ui/src/routes/review/model.ts | 71 +++++++--- ui/src/routes/review/review.test.tsx | 64 +++++++++ ui/src/routes/workload/workload.test.tsx | 103 ++++++++++++++- 5 files changed, 375 insertions(+), 27 deletions(-) diff --git a/ui/src/routes/review/Takes.tsx b/ui/src/routes/review/Takes.tsx index 40cf071..cd72fe2 100644 --- a/ui/src/routes/review/Takes.tsx +++ b/ui/src/routes/review/Takes.tsx @@ -267,7 +267,9 @@ function NoRows({ simulating: number; range: RangeKey; }) { - if (filter === "would_block") { + // The clean state is for observed traffic none of which would be + // dropped; with nothing observed at all, it says that instead. + if (filter === "would_block" && all.length > 0) { return (
diff --git a/ui/src/routes/review/model.test.ts b/ui/src/routes/review/model.test.ts index 52aeb67..a88e4a3 100644 --- a/ui/src/routes/review/model.test.ts +++ b/ui/src/routes/review/model.test.ts @@ -12,6 +12,7 @@ import { chipCounts, composeVerdict, duration, + enforceEvidence, filterRows, matrixOf, partition, @@ -301,12 +302,153 @@ describe("the verdict", () => { ); }); - it("says a safe verdict rests on nothing when nothing was stored", () => { - const v = verdictOf(ready(), rollups({})); - expect(v.safe).toBe(true); - expect(v.caveats).toEqual([ - "No flows were stored in this range; no observed traffic stands behind this verdict", - ]); + describe("with no observed traffic", () => { + const noTraffic = + "No traffic was recorded in simulation in this range — no observed traffic stands behind this verdict"; + + it("fails when nothing was recorded in simulation in the range", () => { + const v = verdictOf(ready(), rollups({})); + expect(v.safe).toBe(false); + expect(v.failing).toEqual([{ id: "no-traffic", text: noTraffic }]); + expect(v.headline).toBe("Not safe to enforce yet"); + expect(v.sub).toBe( + "Nothing was observed in simulation in this range, so the review cannot show what enforcing would drop.", + ); + // The failing condition replaces the old caveat: one line, not + // both, and no "Observed for" qualification. + expect(v.caveats).toEqual([noTraffic]); + expect(v.caveats.join("\n")).not.toMatch(/No flows were stored/); + }); + + it("does not fire for one observed flow, however little", () => { + const one = rollups({ + allowed: [ps(peer.workload(api), "tcp/8443", 1, 1)], + }); + const v = verdictOf(ready(), one); + expect(v.safe).toBe(true); + expect(v.failing).toEqual([]); + expect(v.caveats).toHaveLength(1); + expect(v.caveats[0]).toMatch(/^Observed for /); + }); + + it("does not fire when only would-block traffic was recorded", () => { + const r = rollups( + { would_block: [ps(peer.workload(m1), "tcp/9100", 3, 1)] }, + { would_block: [srcDst(peer.workload(m1), c1, 3)] }, + ); + const v = verdictOf(ready(), r); + expect(v.failing.map((c) => c.id)).toEqual(["would-block"]); + }); + + it("takes a truncated read for traffic, never for none", () => { + const r = rollups( + { allowed: [ps(peer.workload(api), "tcp/8443", 400, 3)] }, + {}, + { truncated: true }, + ); + const v = verdictOf(ready(), r); + expect(v.failing.map((c) => c.id)).not.toContain("no-traffic"); + }); + + it("judges the scope as a whole: one workload's traffic is the scope's", () => { + // Five workloads, one of which saw traffic: the scope-wide + // rollups covered windows, so the condition does not fire. + const one = rollups({ + allowed: [ps(peer.workload(api), "tcp/8443", 12, 1)], + }); + const v = verdictOf(ready(5), one); + expect(v.safe).toBe(true); + }); + + it("stands beside a sync condition, each on its line", () => { + const w = ready(); + w[0].sync = { + ...w[0].sync, + state: "synced", + applied_version: 3, + latest_version: 4, + }; + const v = verdictOf(w, rollups({})); + expect(v.failing.map((c) => c.id)).toEqual(["no-traffic", "pending"]); + expect(v.caveats).toEqual([ + noTraffic, + "checkout-01 has not applied its latest policy (applied v3, rendered v4)", + ]); + expect(v.sub).toBe( + "Nothing was observed in simulation in this range, and not every workload in scope is simulating on its latest policy.", + ); + }); + + it("stands beside evidence gaps, which come first", () => { + const w = ready(); + const v = verdictOf(w, rollups({}), [gap(w[1], 600, 500)]); + expect(v.failing.map((c) => c.id)).toEqual([ + "evidence-gaps", + "no-traffic", + ]); + expect(v.sub).toBe( + "Nothing was observed in simulation in this range, and evidence is missing from part of it: traffic in it may have gone unseen.", + ); + }); + + it("states all three together", () => { + const w = ready(); + w[2].sync = { ...w[2].sync, state: "offline" }; + const v = verdictOf(w, rollups({}), [gap(w[1], 600, 500)]); + expect(v.failing.map((c) => c.id)).toEqual([ + "evidence-gaps", + "no-traffic", + "offline", + ]); + expect(v.sub).toBe( + "Nothing was observed in simulation in this range, evidence is missing from part of it, and not every workload in scope is simulating on its latest policy.", + ); + }); + + it("is not asked of a scope with nothing simulating", () => { + // Visibility traffic is recorded as observed, not as a simulated + // decision; the visibility condition already says no verdict + // exists, and claiming nothing was observed would be untrue. + const vis = ready(2).map((w) => ({ + ...w, + mode: "visibility" as const, + })); + const v = verdictOf(vis, rollups({})); + expect(v.failing.map((c) => c.id)).toEqual(["visibility"]); + expect(v.sub).toBe( + "No observed traffic would be dropped, but not every workload in scope is simulating on its latest policy.", + ); + + const enforced = ready(2).map((w) => ({ + ...w, + mode: "enforced" as const, + })); + expect(verdictOf(enforced, rollups({})).failing.map((c) => c.id)).toEqual( + ["nothing-simulating"], + ); + expect(verdictOf([], rollups({})).failing.map((c) => c.id)).toEqual([ + "no-workloads", + ]); + }); + + it("fires beside visibility when the rest of the scope simulates unobserved", () => { + const w = ready(); + w[0].mode = "visibility"; + const v = verdictOf(w, rollups({})); + expect(v.failing.map((c) => c.id)).toEqual(["no-traffic", "visibility"]); + }); + + it("makes the mode-change dialog's verdict ask for the acknowledgment", () => { + const [w] = ready(1); + const e = enforceEvidence( + [w], + [{ workload: w, verdict: verdictOf([w], rollups({})) }], + ); + expect(e.safe).toEqual([]); + expect(e.unsimulated).toEqual([]); + expect(e.notSafe.map((x) => x.workload.id)).toEqual([w.id]); + expect(e.notSafe[0].verdict.failing[0].text).toBe(noTraffic); + }); }); it("fails on would-block traffic, stated in the headline", () => { @@ -557,7 +699,11 @@ describe("the verdict", () => { }), ]); expect(v.safe).toBe(false); - expect(v.failing.map((c) => c.id)).toEqual(["evidence-gaps"]); + // Nothing was recorded either, which fails on its own line. + expect(v.failing.map((c) => c.id)).toEqual([ + "evidence-gaps", + "no-traffic", + ]); expect(v.caveats[0]).toMatch( /^Evidence incomplete for checkout-02 between .* — the agent dropped buffered windows$/, ); diff --git a/ui/src/routes/review/model.ts b/ui/src/routes/review/model.ts index f1f9b68..4e0757b 100644 --- a/ui/src/routes/review/model.ts +++ b/ui/src/routes/review/model.ts @@ -444,6 +444,7 @@ export function resolveSelection( export type ConditionId = | "would-block" | "evidence-gaps" + | "no-traffic" | "no-workloads" | "degraded" | "offline" @@ -566,14 +567,24 @@ export function gapsText( return `Evidence incomplete for ${who}: ${runs.length} gaps totalling ${offset(lost(runs))} between ${outer}${why}`; } +// noTrafficText is the condition of a scope whose simulating workloads +// recorded nothing in the range. It states that nothing was observed, +// not why: a workload that entered simulation a moment ago and one that +// is simply quiet read the same, and neither has shown what enforcing +// would drop. +export const noTrafficText = + "No traffic was recorded in simulation in this range — no observed traffic stands behind this verdict"; + // composeVerdict decides whether the scope is safe to enforce. It is // composed, never fetched: safe means no traffic in the range would be // dropped, every workload in scope simulates on the policy it was last // rendered, so the verdict speaks for all of them, and the evidence it -// rests on is whole: a workload whose agent lost evidence in the range -// may have seen traffic the review cannot show, so known loss fails the -// verdict on its own (ADR-0001). Each condition the scope fails is -// stated on its own. +// rests on is whole and not empty: a workload whose agent lost evidence +// in the range may have seen traffic the review cannot show, so known +// loss fails the verdict on its own, and an absence of drops proves +// nothing when nothing was observed, so a scope with no traffic recorded +// in simulation fails it too (ADR-0001). Each condition the scope fails +// is stated on its own. export function composeVerdict(input: VerdictInput): ReviewVerdictResult { const { rows, workloads, rollups, now } = input; const wb = rows.filter((r) => r.verdict === "would_block"); @@ -624,6 +635,18 @@ export function composeVerdict(input: VerdictInput): ReviewVerdictResult { text: "Evidence incomplete in this range: more evidence gaps were reported than one read returns", }); } + // No traffic recorded in simulation: neither decision's rollup covered + // a window in the range. A rollup carries its covered bounds whenever + // it matched anything, truncated or not, so a truncated read is never + // taken for an empty one. The scope is judged as a whole, as every + // other condition is. It is not asked of a scope with nothing + // simulating: there the visibility and already-enforced conditions say + // no verdict exists, and a visibility workload's traffic is recorded, + // only not as a simulated decision. + const observed = effFrom !== null && effTo !== null; + if (simulating > 0 && !observed) { + failing.push({ id: "no-traffic", text: noTrafficText }); + } if (workloads.length === 0) { failing.push({ id: "no-workloads", @@ -700,13 +723,11 @@ export function composeVerdict(input: VerdictInput): ReviewVerdictResult { `Only the busiest ${input.rowLimit.toLocaleString("en-US")} peer/service pairs per decision are listed; the totals count every pair`, ); } - if (safe) { - const from = earliestEffective(rollups); - const to = latestEffective(rollups); + // A safe verdict always rests on covered windows: a scope with none + // fails on the no-traffic condition. + if (safe && effFrom && effTo) { notes.push( - from && to - ? `Observed for ${duration(Date.parse(to) - Date.parse(from))} (${extent(from, to)}); a peer that connects less often than that has not been seen` - : "No flows were stored in this range; no observed traffic stands behind this verdict", + `Observed for ${duration(Date.parse(effTo) - Date.parse(effFrom))} (${extent(effFrom, effTo)}); a peer that connects less often than that has not been seen`, ); } @@ -735,14 +756,30 @@ export function composeVerdict(input: VerdictInput): ReviewVerdictResult { headline = "Not safe to enforce yet"; const incomplete = failing.some((c) => c.id === "evidence-gaps"); const unsynced = failing.some( - (c) => c.id !== "evidence-gaps" && c.id !== "would-block", + (c) => + c.id !== "evidence-gaps" && + c.id !== "would-block" && + c.id !== "no-traffic", ); - sub = - incomplete && unsynced - ? "No observed traffic would be dropped, but evidence is missing from part of this range and not every workload in scope is simulating on its latest policy." - : incomplete - ? "No observed traffic would be dropped, but evidence is missing from part of this range: traffic in it may have gone unseen." - : "No observed traffic would be dropped, but not every workload in scope is simulating on its latest policy."; + if (failing.some((c) => c.id === "no-traffic")) { + // Nothing was observed, so "no observed traffic would be + // dropped" would be true of nothing. + sub = + incomplete && unsynced + ? "Nothing was observed in simulation in this range, evidence is missing from part of it, and not every workload in scope is simulating on its latest policy." + : incomplete + ? "Nothing was observed in simulation in this range, and evidence is missing from part of it: traffic in it may have gone unseen." + : unsynced + ? "Nothing was observed in simulation in this range, and not every workload in scope is simulating on its latest policy." + : "Nothing was observed in simulation in this range, so the review cannot show what enforcing would drop."; + } else { + sub = + incomplete && unsynced + ? "No observed traffic would be dropped, but evidence is missing from part of this range and not every workload in scope is simulating on its latest policy." + : incomplete + ? "No observed traffic would be dropped, but evidence is missing from part of this range: traffic in it may have gone unseen." + : "No observed traffic would be dropped, but not every workload in scope is simulating on its latest policy."; + } } return { safe, headline, sub, failing, caveats, kpis }; } diff --git a/ui/src/routes/review/review.test.tsx b/ui/src/routes/review/review.test.tsx index 4a587bb..3bcee8b 100644 --- a/ui/src/routes/review/review.test.tsx +++ b/ui/src/routes/review/review.test.tsx @@ -80,6 +80,9 @@ const checkout = ruleset( const ledgerRs = ruleset("ledger-inbound", { app: ["ledger"] }); const retired = ruleset("retired", { app: ["old"] }, [], { enabled: false }); +const noTraffic = + "No traffic was recorded in simulation in this range — no observed traffic stands behind this verdict"; + // Each rollup the review reads, by scope, grouping, decision, and // service. function groupsFor(q: URLSearchParams): RollupGroup[] { @@ -872,6 +875,35 @@ describe("promotion", () => { ).toBeInTheDocument(); }); + it("gates the promotion of a scope with no observed traffic on the acknowledgment", async () => { + const { calls } = surface({ + rollup: (_b, q) => ({ status: 200, json: emptyRollup(q) }), + }); + const dialog = await openDialog("/simulation?ruleset=ledger-inbound"); + expect(dialog).toHaveTextContent(`Not safe to enforce yet${noTraffic}`); + const submit = within(dialog).getByRole("button", { + name: "Enforce anyway on 2 workloads", + }); + expect(submit).toHaveAttribute("aria-disabled", "true"); + await userEvent.click(submit); + expect(calls.some((x) => x.path === "/api/v1/mode-changes")).toBe(false); + await userEvent.click( + within(dialog).getByRole("checkbox", { + name: "I understand this scope is not safe to enforce yet", + }), + ); + await userEvent.click(submit); + await waitFor(() => + expect( + calls.find((x) => x.path === "/api/v1/mode-changes")?.body, + ).toEqual({ + workload_ids: ["w-l1", "w-l2"], + target_mode: "enforced", + expected_match_count: 2, + }), + ); + }); + it("leaves a safe promotion unobstructed", async () => { const { calls } = surface(); const dialog = await openDialog("/simulation?ruleset=ledger-inbound"); @@ -933,6 +965,38 @@ describe("simulation review states", () => { ); }); + it("does not call a scope with no observed traffic safe", async () => { + surface({ rollup: (_b, q) => ({ status: 200, json: emptyRollup(q) }) }); + renderApp("/simulation?ruleset=ledger-inbound"); + const b = await banner(); + expect( + await within(b).findByRole("heading", { + name: "Not safe to enforce yet", + }), + ).toBeInTheDocument(); + expect(b).toHaveTextContent( + "Nothing was observed in simulation in this range, so the review cannot show what enforcing would drop.", + ); + const caveats = within(b).getByRole("list", { name: "Caveats" }); + expect(within(caveats).getAllByRole("listitem")).toHaveLength(1); + expect(caveats).toHaveTextContent(noTraffic); + expect(caveats).not.toHaveTextContent(/No flows were stored/); + expect( + screen.getByRole("button", { name: "Promote to enforced…" }), + ).not.toHaveClass("bg-plate"); + // The would-block take has nothing to show as clean: nothing was + // observed, so it states that instead. + await userEvent.click( + screen.getByRole("button", { name: /would block 0/ }), + ); + expect(screen.queryByText("No would-block flows")).not.toBeInTheDocument(); + expect( + screen.getByText( + /No inbound flows into this scope's simulating workloads were stored in the last 24h/, + ), + ).toBeInTheDocument(); + }); + it("shows a failed read with a retry", async () => { let fail = true; surface({ diff --git a/ui/src/routes/workload/workload.test.tsx b/ui/src/routes/workload/workload.test.tsx index 05286f2..2d2fb58 100644 --- a/ui/src/routes/workload/workload.test.tsx +++ b/ui/src/routes/workload/workload.test.tsx @@ -174,6 +174,31 @@ function rollup( }; } +// observedAllowed is one allowed peer-and-service group over covered +// windows: the least traffic a review can have observed. +const observedAllowed = { + ...rollup([], 1), + effective_from: minutesAgo(120), + effective_to: minutesAgo(60), + group_by: ["peer", "service"], + groups: [ + { + keys: { + peer: { kind: "address", address: "10.0.4.9", labels: {} }, + service: { protocol: "tcp", port: 5432 }, + }, + workload_count: 1, + flow_count: 1, + connection_count: 1, + byte_count: 60, + first_seen: minutesAgo(90), + last_seen: minutesAgo(90), + }, + ], + group_count: 1, + totals: { flow_count: 1, connection_count: 1, byte_count: 60 }, +}; + function surface( opts: { workload?: () => Workload; @@ -183,6 +208,9 @@ function surface( }; extra?: Route[]; gaps?: EvidenceGap[]; + // The review's allowed peer-and-service rollup covers a window: + // traffic was recorded in simulation in the range. + observed?: boolean; } = {}, ) { return mockSurface([ @@ -254,6 +282,13 @@ function surface( ), }; } + if ( + opts.observed && + q.get("group_by") === "peer,service" && + v === "allowed" + ) { + return { status: 200, json: observedAllowed }; + } const counts: Record = { allowed: 4, would_block: 2, @@ -1016,6 +1051,7 @@ const noAddressGroups: Route = { describe("mode change from the detail", () => { it("changes this one workload by id", async () => { const { calls } = surface({ + observed: true, workload: () => ({ ...db, sync: { @@ -1048,8 +1084,9 @@ describe("mode change from the detail", () => { const dialog = await screen.findByRole("dialog", { name: "Change mode" }); expect(dialog).toHaveTextContent("this workload"); await user.click(within(dialog).getByRole("radio", { name: /Enforced/ })); - // Simulating on its latest policy with nothing the review would - // drop: the review's verdict is safe and the change is one step. + // Simulating on its latest policy, one flow observed and nothing + // the review would drop: the review's verdict is safe and the + // change is one step. expect(await within(dialog).findByTestId("evidence")).toHaveTextContent( "Safe to enforce", ); @@ -1065,6 +1102,68 @@ describe("mode change from the detail", () => { ); }); + it("holds a change to enforced of a simulating workload with no observed traffic for the acknowledgment", async () => { + const { calls } = surface({ + workload: () => ({ + ...db, + sync: { + ...db.sync, + state: "synced", + applied_version: 42, + latest_version: 42, + error: "", + }, + }), + extra: [ + noAddressGroups, + { + method: "POST", + path: "/api/v1/mode-changes", + reply: { + status: 200, + json: { + mode_change_id: "5e0c1c7e-0000-4000-8000-000000000003", + matched: 1, + desired_updated: 1, + }, + }, + }, + ], + }); + const user = userEvent.setup(); + renderApp(`/workloads/${db.id}`); + await user.click(await screen.findByRole("button", { name: "change…" })); + const dialog = await screen.findByRole("dialog", { name: "Change mode" }); + await user.click(within(dialog).getByRole("radio", { name: /Enforced/ })); + // Simulating on its latest policy, but nothing was recorded in + // simulation in the range: no observed traffic stands behind the + // verdict, so it is not safe and the change waits on the + // acknowledgment. + const block = await within(dialog).findByTestId("evidence"); + expect(block).toHaveTextContent("Not safe to enforce for 1 of 1 selected."); + expect(block).toHaveTextContent( + "No traffic was recorded in simulation in this range — no observed traffic stands behind this verdict", + ); + const confirm = within(dialog).getByRole("button", { + name: "Enforce anyway on 1 workload", + }); + await user.click(confirm); + expect(calls.some((c) => c.method === "POST")).toBe(false); + await user.click( + within(dialog).getByLabelText( + "I understand this workload is not safe to enforce yet", + ), + ); + await user.click(confirm); + await waitFor(() => + expect(calls.find((c) => c.method === "POST")?.body).toEqual({ + workload_ids: [db.id], + target_mode: "enforced", + expected_match_count: 1, + }), + ); + }); + it("holds a change to enforced of a workload that never simulated for the acknowledgment", async () => { const { calls } = surface({ workload: () => ({ ...db, mode: "visibility" }), From 9f7978c445eebd8564f115bc622019e2ed668e06 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 05:34:39 -0600 Subject: [PATCH 2/3] cli, docs: the evidence rule and the unguarded mode change (#257, #256) ADR-0001 takes a dated amendment. The evidence rule treats a range with no traffic recorded in simulation as evidence that does not support enforcement, so enforcing past it takes the acknowledgment; no minimum duration is set. The command line and the surface stay unguarded by decision and say so; the server-side evidence guard stays backlog. Decision 2 and the consequence are corrected in place. innerwall workload set-mode's usage and help, and the description of POST /mode-changes in api/openapi.yaml, state that a change to enforced is not checked against any evidence and asks for no acknowledgment, and name the simulation review as where the evidence is weighed. The console's typed client is regenerated from the document (make console-api); only its comment changes. No schema, parameter, response or behavior changes. The simulation review guide's condition table gains the no-traffic condition and its advice on a tier that shows no traffic follows it; the promotion guide, the command-line reference, ARCHITECTURE.md and the roadmap entry are brought into step, and the CHANGELOG gains both entries. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- ARCHITECTURE.md | 4 ++-- CHANGELOG.md | 2 ++ ROADMAP.md | 2 +- api/openapi.yaml | 5 +++++ cmd/innerwall/workload.go | 13 ++++++++++++- docs/adr/0001-visibility-before-enforcement.md | 5 +++-- docs/guides/promotion-and-enforcement.md | 4 ++-- docs/guides/simulation-review.md | 11 +++++++---- docs/reference/innerwall-cli.md | 2 +- ui/src/api/generated.ts | 5 +++++ 10 files changed, 40 insertions(+), 13 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 456aeca..e545998 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -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 @@ -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. diff --git a/CHANGELOG.md b/CHANGELOG.md index df50c38..453f4e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. - **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. - **Lint covers the files behind build tags** (#246). A linter analyses only the files the build constraints select, and `make lint` and CI's `lint` job ran golangci-lint with no build tags, so the development commands (`cmd/innerwall/dev.go`, tag `dev`), the console stub (`ui/embed_noconsole.go` and its test, tag `noconsole`), and the network-namespace suites (tag `netns`) were compiled and run but never linted or vetted. `make lint` now runs `scripts/lint-go.sh`, which lints the default build, what ships, and then every opt-in tag at once; CI's `lint` job makes the same two runs. The newly linted files report no findings. Files for hosts other than Linux are still not linted, since CI runs on Linux (#268). Lint and CI changes only. - **The simulation review states evidence gaps as they are stored** (#160). The review's evidence condition named every gap in the range as one interval, from the earliest start to the latest end, so gaps apart from each other read as one long loss: six agent silences of two to four minutes, sixteen minutes in all, read "the agent was not reporting between 18:44 and 19:42", and two brief source restarts an hour apart read as an hour of lost evidence. It now says what was stored. One gap reads as before. Two or three are each named ("Evidence incomplete for db-1: 2 gaps, between 13:02 and 13:04 UTC and between 14:10 and 14:12 UTC — a flow source was down"); four or more are counted, with their total length and the range they fall in ("Evidence incomplete for db-1: 6 gaps totalling 16m between 18:44 and 19:42 UTC — the agent was not reporting"). Gaps that overlap or touch, of any kind or workload, count once, and each is cut at the ends of the range the verdict judges, so the total is never longer than the range. Gaps of several kinds name each kind present, where before they named none. The verdict is unchanged: any gap in the range still fails it. The same sentence is the reason the mode-change dialog gives for a workload not safe to enforce. Console only. diff --git a/ROADMAP.md b/ROADMAP.md index 7cab480..cd3815a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -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** diff --git a/api/openapi.yaml b/api/openapi.yaml index eaf0471..afc6856 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -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. diff --git a/cmd/innerwall/workload.go b/cmd/innerwall/workload.go index 24062aa..26e26e5 100644 --- a/cmd/innerwall/workload.go +++ b/cmd/innerwall/workload.go @@ -266,14 +266,25 @@ func runWorkloadSetLabels(ctx context.Context, args []string) error { return nil } +// setModeUsage is set-mode's usage line and what it does not do. The +// command line stays the operator's unguarded tool by decision, and says +// so where it is used (ADR-0001 as amended). +const setModeUsage = "usage: innerwall workload set-mode visibility|simulation|enforced\n" + + "A change to enforced is not checked against any evidence and asks for no acknowledgment;\n" + + "the simulation review in the console is where the evidence is weighed." + func runWorkloadSetMode(ctx context.Context, args []string) error { fs := flag.NewFlagSet("innerwall workload set-mode", flag.ContinueOnError) dbURL := fs.String("database-url", "", "Postgres connection string (default $"+envDatabaseURL+")") + fs.Usage = func() { + fmt.Fprintln(fs.Output(), setModeUsage) + fs.PrintDefaults() + } if err := cli.Parse(fs, args, 2); err != nil { return err } if fs.NArg() != 2 { - return usageError("usage: innerwall workload set-mode visibility|simulation|enforced") + return usageError(setModeUsage) } id, err := identity.ParseWorkloadID(fs.Arg(0)) if err != nil { diff --git a/docs/adr/0001-visibility-before-enforcement.md b/docs/adr/0001-visibility-before-enforcement.md index ac7cc7d..6635580 100644 --- a/docs/adr/0001-visibility-before-enforcement.md +++ b/docs/adr/0001-visibility-before-enforcement.md @@ -11,7 +11,7 @@ Segmentation fails in adoption more often than in engineering. Installing a root The product workflow is **visibility → simulation → enforcement**. The platform makes that sequence the default path and surfaces the evidence each step produces; promotion to enforcement is an operator's act, and the console gates it behind an explicit acknowledgment whenever the evidence does not support it: *(Amended 2026-10-06; see Amendments.)* 1. Agents start in visibility: they collect flows and build the dependency map, and the table they own holds only an observation chain, one rule that engages the kernel's connection tracking and accepts, so no policy is evaluated and nothing is dropped (ADR-0020). *(Amended 2026-10-06 and 2026-10-08; see Amendments.)* -2. Simulation runs the exact ruleset enforcement would install on real traffic, accepting what enforcement would drop and recording it (ADR-0020), and the simulation review reports exactly which real connections would have been denied, beside any evidence gaps in the range. Policy is edited live, with no draft; a dry-run render shows what a hypothetical policy would install before it is written. *(Amended 2026-10-06; see Amendments.)* +2. Simulation runs the exact ruleset enforcement would install on real traffic, accepting what enforcement would drop and recording it (ADR-0020), and the simulation review reports exactly which real connections would have been denied, beside any evidence gaps in the range. A range in which nothing was recorded in simulation is no evidence at all: an absence of observed drops proves nothing when nothing was observed, so the review does not call it safe. Policy is edited live, with no draft; a dry-run render shows what a hypothetical policy would install before it is written. *(Amended 2026-10-06 and 2026-11-28; see Amendments.)* 3. Enforcement is opt-in per workload or label scope, never a global switch. All v1 milestones deliver visibility value standalone; enforcement is the second act. @@ -19,7 +19,7 @@ All v1 milestones deliver visibility value standalone; enforcement is the second ## Consequences - The trust barrier at install time drops to that of an observability agent. -- Every enforcement decision is offered with its evidence; "what would break" is a query, not a guess. The console refuses to enforce past an unsafe verdict or missing evidence without the operator's explicit acknowledgment, whether the change starts at the simulation review's promotion or at one of the console's mode changes. The surface and the command line accept a mode change directly, for automation, so the guarantee is the default and the evidence, not a server-side refusal; a server-side evidence guard on mode changes is recorded backlog. *(Amended 2026-10-06 and 2026-11-25; see Amendments.)* +- Every enforcement decision is offered with its evidence; "what would break" is a query, not a guess. The console refuses to enforce past an unsafe verdict, missing evidence, or a range with no observed traffic without the operator's explicit acknowledgment, whether the change starts at the simulation review's promotion or at one of the console's mode changes. The surface and the command line accept a mode change directly, for automation, and say so where they are used, so the guarantee is the default and the evidence, not a server-side refusal; a server-side evidence guard on mode changes is recorded backlog. *(Amended 2026-10-06, 2026-11-25 and 2026-11-28; see Amendments.)* - The flow pipeline and map must be production-quality from day one — they are the product, not instrumentation. - Revenue-of-attention risk: the project must resist becoming only a mapping tool; enforcement is the destination and stays on the roadmap's critical path. @@ -28,3 +28,4 @@ All v1 milestones deliver visibility value standalone; enforcement is the second - **2026-10-06 (PR #25, conformance-audit absorption; maintainer ruling).** The core discipline stands: visibility by default, simulation on the exact enforced ruleset, enforcement opt-in per workload or label scope and never a global switch. Four passages overstated the mechanism and are corrected in place. The decision said the sequence is "enforced by the platform"; what ships is visibility as every workload's starting mode, evidence surfaced at every step, and promotion operator-gated in the console behind an explicit acknowledgment when the verdict is not safe or the evidence has gaps, while the surface and the command line accept a mode change directly. Decision 1 said agents "touch nothing"; in visibility the agent installs its owned table empty, with no verdict chain. Decision 2 described policy drafts replayed against observed flows; policy is edited live with no draft, simulation is the enforced ruleset with a terminal rule that accepts and records (ADR-0020), and a dry-run render previews a hypothetical policy. The consequence that every enforcement decision is preceded by evidence is corrected to say it is offered with its evidence. A server-side evidence guard on mode changes, refusing an unacknowledged promotion at the domain layer, is recorded backlog; until it lands the console is where the gate lives, and the record says so. Maintainer ruling on PR #25: amendment, not supersession, because the platform-enforced-sequence wording overstated the mechanism while the core discipline stands. The ruling was made with the tradeoff in view: no version of the code ever refused a mode change at the domain layer, so this records what has always shipped rather than withdrawing a guarantee that existed, and the guard that would make the stronger wording true is the backlog item above. - **2026-10-08 (PR #32, issue #30).** The core discipline stands: visibility by default, simulation on the exact enforced ruleset, enforcement opt-in per workload or label scope. Decision 1 said the visibility table holds no verdict chain and nothing is evaluated, and the 2026-10-06 note above says the table is installed empty. An empty table references no connection tracking, so on a host where nothing else did, the kernel tracked nothing and visibility collected nothing. Decision 1 is corrected in place: the table holds one observation chain whose one rule engages connection tracking and accepts. No policy is evaluated and nothing is dropped, so visibility still asks of an operator only what an observability agent does. ADR-0020 carries the chain's shape and the decision that visibility logs nothing. - **2026-11-25 (issue #94).** Additive detail; the decision and the backlog item stand. The console's acknowledgment gate covered only the simulation review's promotion, while the console's other two paths to enforced, the fleet's mode change for a selection and the workload page's mode change, enforced in one step with no evidence shown. The consequence is corrected in place: the gate covers every console path to enforced. Each workload such a change would move is given the verdict the review composes for a scope of that workload alone, over the review's default range, and when any is not safe or never simulated the change counts them, names them, and waits on the same explicit acknowledgment. These paths stay the operator's deliberate way to enforce what the review would not offer. Changes to visibility or simulation only loosen and stay one step. The surface and the command line are unchanged and still accept a mode change directly; the server-side evidence guard remains the recorded backlog. +- **2026-11-28 (issues #257 and #256).** Additive detail; the decision and the backlog item stand. (a) Issue #257: the review called a scope safe when every workload in it simulated on its latest policy with no evidence gap and no would-block traffic, even when no traffic at all was recorded in simulation in the range, so a workload switched to simulation a moment ago read exactly as one with a long, clean record. An absence of observed drops proves nothing when nothing was observed. The evidence rule now treats a range in which no traffic was recorded in simulation as evidence that does not support enforcement: the scope fails the verdict on that condition, judged for the scope as a whole as every other condition is, and enforcing past it takes the same explicit acknowledgment as any other failing condition, at the review's promotion and at the console's mode changes, which compose the same verdict. The condition says that nothing was observed, not why, so it holds for a workload that entered simulation a moment ago and for one that is simply quiet. No minimum time in simulation and no minimum covered span is set. Decision 2 and the consequence are corrected in place. (b) Issue #256: the command line and the surface remain unguarded by decision, and now say so where they are used: the usage and help of `innerwall workload set-mode` and the description of `POST /api/v1/mode-changes` state that a change to enforced is not checked against any evidence and asks for no acknowledgment, and name the simulation review as where the evidence is weighed. The consequence is corrected in place. The server-side evidence guard remains the recorded backlog; it changes the surface's contract and is decided in its own ADR when it is built. diff --git a/docs/guides/promotion-and-enforcement.md b/docs/guides/promotion-and-enforcement.md index 1ea475e..2e4dd72 100644 --- a/docs/guides/promotion-and-enforcement.md +++ b/docs/guides/promotion-and-enforcement.md @@ -14,7 +14,7 @@ The agent's own connection to the control plane is never at risk: the agent only Promotion starts from a ruleset's simulation review ([reading a simulation review](simulation-review.md)): -1. **Read the verdict.** **Safe to enforce** means every observed inbound connection on the simulating workloads matched an enabled rule and nothing else failed. **Not safe to enforce yet** lists each failing condition. +1. **Read the verdict.** **Safe to enforce** means traffic was observed in simulation in the range, every observed inbound connection on the simulating workloads matched an enabled rule, and nothing else failed. **Not safe to enforce yet** lists each failing condition. 2. **Open the promote dialog.** **Promote to enforced…** opens **Switch scope to enforced**, which restates the verdict and, when it is not safe, the cost: how many peer/service pairs and connections would be dropped, and whether the evidence for the range is incomplete. Workloads in scope that are still in visibility are listed and skipped (they never simulated); a degraded workload is skipped unless you include it, since it would enforce a stale version. 3. **Acknowledge, if the verdict is not safe.** Enforcing past an unsafe verdict takes an explicit acknowledgment of exactly that cost ("I understand … will be dropped", with "and that the evidence for this range is incomplete" when it is). Without it, nothing is enforced. 4. **Enforce.** The dialog records one mode change covering the listed workloads. Each workload's sync state shows when its agent has applied the new version. @@ -24,7 +24,7 @@ Promotion starts from a ruleset's simulation review ([reading a simulation revie **Rolling back is the same action in reverse:** change the workloads' mode back to simulation (the fleet's **Change mode for selected…**, the **change…** beside the mode on the workload page, or `innerwall workload set-mode simulation`). Nothing is dropped from the moment the agent applies it. > [!WARNING] -> The console gates every change to enforced, wherever it starts. The fleet's **Change mode for selected…** and the **change…** beside the mode on the workload page give each workload the change would move the verdict the review composes for that workload alone, over the review's default range (the last 24 hours), and when any of them is not safe or never simulated, the dialog counts them ("No simulation evidence for N of M selected", "Not safe to enforce for N of M selected"), names the workloads behind each count, and enforces only after the same explicit acknowledgment a promotion past an unsafe verdict takes. It is the deliberate way to enforce what the review would not offer, such as a re-enrolled host whose previous identity earned enforcement; promote through the review otherwise. Changes to visibility or simulation stay one step. The gate is the console's: `innerwall workload set-mode` and `POST /api/v1/mode-changes` set any mode, enforced included, in one step, with no verdict and no acknowledgment, even for a workload with no simulation evidence at all. A server-side evidence guard is on the [roadmap](../../ROADMAP.md). +> The console gates every change to enforced, wherever it starts. The fleet's **Change mode for selected…** and the **change…** beside the mode on the workload page give each workload the change would move the verdict the review composes for that workload alone, over the review's default range (the last 24 hours), and when any of them is not safe or never simulated, the dialog counts them ("No simulation evidence for N of M selected", "Not safe to enforce for N of M selected"), names the workloads behind each count, and enforces only after the same explicit acknowledgment a promotion past an unsafe verdict takes. It is the deliberate way to enforce what the review would not offer, such as a re-enrolled host whose previous identity earned enforcement; promote through the review otherwise. Changes to visibility or simulation stay one step. The gate is the console's: `innerwall workload set-mode` and `POST /api/v1/mode-changes` set any mode, enforced included, in one step. A change to enforced through either is not checked against any evidence and asks for no acknowledgment, even for a workload with no simulation evidence at all, and each says so in its help and its description. A server-side evidence guard is on the [roadmap](../../ROADMAP.md). ## What enforcement looks like on the host diff --git a/docs/guides/simulation-review.md b/docs/guides/simulation-review.md index 82b5553..8e65550 100644 --- a/docs/guides/simulation-review.md +++ b/docs/guides/simulation-review.md @@ -14,7 +14,7 @@ A workload in simulation holds exactly the ruleset it would hold enforced, with The review lists the `would_block` traffic of the workloads its ruleset's scope matches, over the range you choose (the last hour to the last 30 days, 24 hours by default). -**Evidence starts when the workload enters simulation.** Traffic a workload received in visibility was recorded as `observed`, and a stored flow is never rewritten (ADR-0019), so that traffic never appears as would-block, and nothing is evaluated retroactively. After moving a tier to simulation, the review fills as new connections arrive: a peer that connects once a day needs a day of simulation before the review can show it. The review says how much observation stands behind its verdict ("Observed for 6h …; a peer that connects less often than that has not been seen"). Choose a range that covers your slowest regular traffic (nightly jobs, weekly reports) and let simulation run that long. +**Evidence starts when the workload enters simulation.** Traffic a workload received in visibility was recorded as `observed`, and a stored flow is never rewritten (ADR-0019), so that traffic never appears as would-block, and nothing is evaluated retroactively. After moving a tier to simulation, the review fills as new connections arrive: a peer that connects once a day needs a day of simulation before the review can show it. The review says how much observation stands behind its verdict ("Observed for 6h …; a peer that connects less often than that has not been seen"), and until any traffic has been recorded in simulation in the range it does not call the scope safe. Choose a range that covers your slowest regular traffic (nightly jobs, weekly reports) and let simulation run that long. The range is a range, not a starting point: it also counts any `would_block` traffic left from an earlier stint in simulation that falls inside it. @@ -22,7 +22,7 @@ The range is a range, not a starting point: it also counts any `would_block` tra The review's headline is one of: -- **Safe to enforce.** Every observed inbound connection on the simulating workloads matched an enabled rule, and nothing else fails. +- **Safe to enforce.** Traffic was observed in simulation in the range, every observed inbound connection on the simulating workloads matched an enabled rule, and nothing else fails. - **Not safe to enforce yet.** At least one condition fails. Each failing condition is listed beneath it. - **No workload in scope**, or **Nothing is simulating in this scope**: there is no simulated verdict to review. @@ -34,10 +34,13 @@ The conditions, each of which fails the verdict on its own: |---|---|---| | Would-block traffic | `N peer/service pairs would be dropped` | Decide each pair: admit it, or accept that enforcement drops it (below). | | Evidence gaps | `Evidence incomplete for db-1 between 13:02 and 13:04 UTC — the agent was not reporting`, or for several gaps `Evidence incomplete for db-1: 6 gaps totalling 16m between 18:44 and 19:42 UTC — the agent was not reporting` | Find out why the evidence is missing ([evidence gaps](#evidence-gaps)). | +| No traffic in simulation | `No traffic was recorded in simulation in this range — no observed traffic stands behind this verdict` | Give the scope time in simulation, or widen the range. If the tier should have had traffic, look at each workload's **Inbound flows** tab and last flow report (below). | | A workload offline | `db-1 is offline (last seen 2h ago) — nothing it saw since reaches this review` | Bring the agent back, or exclude it from the decision deliberately. A workload whose control channel is reconnecting while its flow reports still arrive is counted as offline here. | | A workload degraded or pending | `… has not applied its latest policy (applied v3, rendered v4)` | Its flows were evaluated against a policy other than the one you are judging; wait for it to apply, or find why it failed ([states](../reference/states.md#sync-states)). | | A workload still in visibility | `N workloads in scope are still in visibility mode and produced no verdict` | Move them to simulation, or accept that the review says nothing about them. | +No drops in a range where nothing was observed proves nothing, so the no-traffic condition fails the verdict even when every other condition holds. It says that nothing was observed, not why: a workload that entered simulation a moment ago and one that is simply quiet read the same. It judges the scope as a whole, like every condition: traffic recorded on any workload in scope, however little, satisfies it. No minimum time in simulation is required. + A workload that dropped flow records is noted beside the verdict: its verdict may be incomplete. ## Would-block traffic @@ -73,7 +76,7 @@ The condition states the gaps in the range as they are stored. Gaps that overlap ## Promoting -When the verdict is safe, **Promote to enforced…** opens the promote dialog with the verdict restated. When it is not safe, the dialog restates the cost (how many peer/service pairs and connections would be dropped, and whether the evidence is incomplete) and enforcing takes an explicit acknowledgment of exactly that. The acknowledgment is the deliberate override ADR-0001 records: promotion past evidence that does not support it is possible, never silent. What promotion does on the host, and how to roll it back, is in [promotion and enforcement](promotion-and-enforcement.md). +When the verdict is safe, **Promote to enforced…** opens the promote dialog with the verdict restated. When it is not safe, the dialog restates the cost (how many peer/service pairs and connections would be dropped, and whether the evidence is incomplete; with nothing to drop, the first condition that fails, such as no traffic recorded in simulation) and enforcing takes an explicit acknowledgment of exactly that. The acknowledgment is the deliberate override ADR-0001 records: promotion past evidence that does not support it is possible, never silent. What promotion does on the host, and how to roll it back, is in [promotion and enforcement](promotion-and-enforcement.md). > [!NOTE] -> Fleet health does not yet tell a workload that receives no inbound traffic from one whose observation is broken without any gap being recorded: both show no flows. A tier whose review shows no traffic at all deserves a look at each workload's **Inbound flows** tab and last flow report before it is promoted. +> Fleet health does not yet tell a workload that receives no inbound traffic from one whose observation is broken without any gap being recorded: both show no flows. A scope whose review shows no traffic at all is not safe to enforce on that alone, and the condition cannot say which of the two it is: look at each workload's **Inbound flows** tab and last flow report before acknowledging past it. A scope where some workloads saw traffic passes the condition, so a quiet workload inside a busy scope deserves the same look. diff --git a/docs/reference/innerwall-cli.md b/docs/reference/innerwall-cli.md index 1e2a174..09bcdb5 100644 --- a/docs/reference/innerwall-cli.md +++ b/docs/reference/innerwall-cli.md @@ -236,7 +236,7 @@ innerwall workload retire - **`counts`** prints the active fleet's size: `removed`, then each sync state, then the total, then `retired`. A removed workload is counted in `removed` alone, so the lines above the total sum to it; a retired workload is outside the total and counted in `retired` alone. It is the read `GET /api/v1/workloads/counts` serves. - **`status`** prints one workload in full: mode, lifecycle (active, or retired and when), sync state, the owned table's state, applied and latest versions, last seen on the control channel, last flow report, last snapshot sent, last acknowledgment, last failed apply, credential expiry and any late renewal, agent version, dropped flow records, source overruns, clock skew, addresses, host facts, and listening services. - **`set-labels`** replaces the workload's whole label set and renders. The labels are admitted against the grammar (ADR-0022). -- **`set-mode`** changes one workload's mode, as a recorded mode change of exactly that workload, and renders. It does not consult the simulation review: the review's verdict and its acknowledgment gate are the console's, on its promote flow and on its mode changes to enforced, and `set-mode` enforces with neither ([promotion and enforcement](../guides/promotion-and-enforcement.md)). +- **`set-mode`** changes one workload's mode, as a recorded mode change of exactly that workload, and renders. A change to enforced is not checked against any evidence and asks for no acknowledgment, as its usage and help say: the simulation review in the console is where the evidence is weighed, and the review's verdict and its acknowledgment gate are the console's, on its promote flow and on its mode changes to enforced ([promotion and enforcement](../guides/promotion-and-enforcement.md)). - **`resend-snapshot`** directs the workload's agent to reconnect, so its new stream begins with a snapshot. Delivery is not confirmed: the `last snapshot` instant in `workload status` advances when the agent has reconnected ([states](states.md#resend-snapshot)). - **`retire`** retires the workload, one way, through the function `POST /api/v1/workloads/{id}/retire` calls: its credential is refused from then on, its live stream is ended, its addresses leave every peer set, and an open silence of its agent is stored as an evidence gap. It prints the instant, how many workloads' policy versions advanced, and the silence it closed, if any. A retired workload's labels and mode can no longer be changed. Its history stays readable by its id; the host returns only by enrolling again, as a new workload ([states](states.md#retired)). Until the old credential expires, enrollment on the host refuses to overwrite it: stop the daemon and remove the agent's state directory first ([credential lifecycle](../guides/credential-lifecycle.md#beyond-the-grace-re-enrollment)). diff --git a/ui/src/api/generated.ts b/ui/src/api/generated.ts index 9730d35..c0753fa 100644 --- a/ui/src/api/generated.ts +++ b/ui/src/api/generated.ts @@ -161,6 +161,11 @@ export interface 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. */ post: operations["createModeChange"]; delete?: never; From 0bf0c2c02f08a6059b0dde988b22b4b6bdc37235 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 05:40:48 -0600 Subject: [PATCH 3/3] cli: discard set-mode's help write error explicitly errcheck flags the unchecked write of set-mode's help. The command line's other writes to a terminal discard the result explicitly; this one does too. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- cmd/innerwall/workload.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/innerwall/workload.go b/cmd/innerwall/workload.go index 26e26e5..16efa47 100644 --- a/cmd/innerwall/workload.go +++ b/cmd/innerwall/workload.go @@ -277,7 +277,7 @@ func runWorkloadSetMode(ctx context.Context, args []string) error { fs := flag.NewFlagSet("innerwall workload set-mode", flag.ContinueOnError) dbURL := fs.String("database-url", "", "Postgres connection string (default $"+envDatabaseURL+")") fs.Usage = func() { - fmt.Fprintln(fs.Output(), setModeUsage) + _, _ = fmt.Fprintln(fs.Output(), setModeUsage) fs.PrintDefaults() } if err := cli.Parse(fs, args, 2); err != nil {