Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
feat(parity): phase 1, make every claim true on the default path (#1090)
Beenu Arora45417135b602
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 915a0ee0a..e854f047d 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -344,6 +344,15 @@ jobs:# themselves the same published number.- name: Verify vendored aisoc_benchmark is in syncrun: python scripts/sync_vendored_benchmark.py --check+ # The gates in this repository certify functions, not call paths, so a+ # claim row can pass on a unit test of a module nothing imports. That+ # is not hypothetical: the hunting agent, the pseudonymizer, the+ # closure guardrails and a working ReAct loop were each complete,+ # tested, and reachable from nothing.+ - name: Module reachability — self-test+ run: python scripts/check_module_reachability.py --self-test+ - name: Verify every service module has a production importer+ run: python scripts/check_module_reachability.py# Two permission models shipped side by side: 275 route dependencies# read the hardcoded ROLE_PERMISSIONS map while 27 read the# user_roles / role_permissions tables the console's RBAC screen@@ -1339,6 +1348,19 @@ jobs:# runners and no workflow ever ran it.run: python3 scripts/check_store_migrations.py+ # Both of these import each service's FastAPI app, so they belong in+ # the job that installs the service dependencies rather than the lint+ # job, which installs only ruff and mypy. Placed there first, they+ # failed closed with "the source tree was not read", which was the+ # right refusal in the wrong place.+ - name: Console route contract — self-test+ run: python scripts/check_console_route_contract.py --self-test+ - name: Verify every console API path resolves to a route or a rewrite+ run: python scripts/check_console_route_contract.py+ - name: Duplicate routes — self-test+ run: python scripts/check_route_duplicates.py --self-test+ - name: Verify no method and path pair is registered twice+ run: python scripts/check_route_duplicates.py- name: Gate the public benchmark scoreboard (Phase E1)# Ties apps/docs/static/data/scoreboard.json to a real deterministic# live-agent MITRE-accuracy run: the newest substrate row must match adiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 899f5e7f4..8ced844b7 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -97,7 +97,7 @@ discover it.| Tool | Version | Why this one ||--------|----------|---------------------------------------------------------|-| Python | 3.12 | The API and agent services; 3.11 also works locally |+| Python | 3.11 | What CI runs and what every image ships. 3.12 is not tested || Node | 22 | `apps/web`, `services/realtime`, `services/mcp` || pnpm | 8.15.1 | Pinned in `package.json`; a different major resolves differently || Go | 1.26 | Every `go.mod`, gated by `scripts/check_toolchain_versions.py` |@@ -374,7 +374,10 @@ class MyConnector(BaseConnector):async def fetch_alerts(self, since_seconds: int = 300) -> list[dict]: ... # raw vendor JSON, no normalization- def normalize(self, raw_event: dict) -> dict: ... # OCSF-aligned shape; severity ∈ {"info","low","medium","high"}+ # Five tiers, not four. A vendor ladder that publishes a distinct+ # `critical` must map to `critical` and must never be collapsed into+ # `high`: see the severity section of the connector platform doc.+ def normalize(self, raw_event: dict) -> dict: ... # severity in {"info","low","medium","high","critical"}```Field types are `text`, `secret`, `select` (with `options`), `textarea`,@@ -430,7 +433,11 @@ The bundled test suite already runs against 100+ tests across 9 connectors### 5. Docs-Add `apps/docs/docs/connectors/<connector-id>.md` with prereqs, exact+Connector pages are **generated** by `scripts/generate_connector_docs.py` from+your `schema()`, so run it rather than writing the page by hand. An existing+hand-written page wins over the convention and is left alone, but it must+still mention every required and secret field or the gate fails. If you are+writing one by hand anyway, it needs prereqs, exactpermissions/scopes, secret rotation walkthrough, severity heuristicstable (mirrors what's in your `normalize()`), and a troubleshootingsection. Add the new page to `apps/docs/sidebars.ts` under thediff --git a/GAP_CLOSURE_PROGRESS.md b/GAP_CLOSURE_PROGRESS.mdindex de5e6ba80..b06292496 100644--- a/GAP_CLOSURE_PROGRESS.md+++ b/GAP_CLOSURE_PROGRESS.md@@ -410,7 +410,7 @@ suites' job, and anything at all against a live vendor MCP server.## Phase 6: Tenant skills and better triage context-- [x] **6.1 Tenant-authored skills** in YAML in the console editor, validated against the tenant's actual tools. Migration **070**, two tables: `aisoc_tenant_skills` (current state) and `aisoc_tenant_skill_versions` (append-only history). A skill carries match conditions, a plan and expected pivots like a `Strategy`, plus the four fields a built-in cannot have because they are statements about one organisation: guidance, verdict guidance, required evidence and escalation conditions, with owner, server-assigned version and a **required** expiry. The parser refuses unknown top-level keys rather than ignoring them, because `verdict_guidence` otherwise produces a skill that silently does half its job. Tool validation reads the tenant's own rows and their own registry: the built-in lake pivots, the Phase 4 customer-product tools whose product they have connected, and the tools on an **enabled** MCP server's allowlist, so a registered-but-disabled server contributes nothing. The customer half makes the same three reads `GET /agent-tools/backends` makes. See D26, where the gate caught Phase 4.3 landing underneath this work and a known tool name is accepted rather than refused while the registry is unknown.+- [x] **6.1 Tenant-authored skills** in YAML over the API. **There is no console editor**: skills are authored by `POST`ing YAML, and the console surface arrives with parity 6.3. Validated against the tenant's actual tools. Migration **070**, two tables: `aisoc_tenant_skills` (current state) and `aisoc_tenant_skill_versions` (append-only history). A skill carries match conditions, a plan and expected pivots like a `Strategy`, plus the four fields a built-in cannot have because they are statements about one organisation: guidance, verdict guidance, required evidence and escalation conditions, with owner, server-assigned version and a **required** expiry. The parser refuses unknown top-level keys rather than ignoring them, because `verdict_guidence` otherwise produces a skill that silently does half its job. Tool validation reads the tenant's own rows and their own registry: the built-in lake pivots, the Phase 4 customer-product tools whose product they have connected, and the tools on an **enabled** MCP server's allowlist, so a registered-but-disabled server contributes nothing. The customer half makes the same three reads `GET /agent-tools/backends` makes. See D26, where the gate caught Phase 4.3 landing underneath this work and a known tool name is accepted rather than refused while the registry is unknown.- [x] **6.2 Lifecycle**: draft, backtest through the Phase 1 replay, active; every investigation records the skill version that guided it. Two refusals carry the phase: a content edit bumps the version, drops to draft and **detaches both reports**, and activation requires a backtest of the exact version plus both halves of it. The rule is written in the migration's CHECK, in the store and on the docs page, and `scripts/check_tenant_skill_contract.py` fails if it leaves any of the three. The backtest is two Phase 1 replay evaluations over one window, seed and resample count; nothing re-implements replay, scoring or reporting. Skills became the fourth frozen context store, and the deliberate backtest bypass is published rather than silent: see D27.- [x] **6.3 Triage context**, all three sources. **Knowledge-base runbooks with citations: done.** The agents service had never read the knowledge base; it now retrieves through `GET /kb/runbooks/for-triage` on the same `TriageContextReader` seam the other three sources use, and every chunk in the prompt carries a marker whose citation record resolves to a document id **and chunk index**, because a marker pointing at a forty-chunk document is not something a reader can check. Runbook text is contained as untrusted evidence rather than as first-party guidance (nonce fence, inline boundary sentence, guard scan on the **raw** text), and the guard's held-out rate of 2 of 28 is what the docs cite rather than its tuned figure. A flagged chunk is dropped rather than demoting the case, because demoting on a poisoned library document would let anyone who can write a runbook switch off auto-close for the tenant. This added a **second freeze kind** to the replay: see D31.- **The last N analyst dispositions with reasons: done.** `app/context/dispositions.py` reads `aisoc_analyst_feedback`, which is append-only and can therefore answer "the last N" at all — the institutional-memory override row is upserted per signature, so it holds the latest decision and no history. This is deliberately *below* the corroboration threshold organisation memory enforces: a disagreement recorded once is invisible there, and it is exactly what an analyst working the queue by hand would see. A decision tagged against the same rule is ordered ahead of one matched on a shared entity, because the rule is the more specific claim.@@ -466,13 +466,16 @@ suites' job, and anything at all against a live vendor MCP server.## Phase 11: File and URL analysis provider contract-- [!] **Phase 11 is not this program's to build.** Another agent is building it- in parallel against the MalwareAnalyzer API, whose access the maintainer has- supplied. Recorded here so the phase is not double-built, and so a later- session does not read the unticked boxes as open work.- - [!] 11.1 Interface, CAPEv2 reference provider, mock, documented commercial slot.- - [!] 11.2 Upload policy: hash lookup first, disclosure off by default, air-gap refuses non-local.- - [!] 11.3 Wiring to enrichment, phishing attachments and the agent tool surface.+- [x] **Phase 11 shipped in v12.0.0.** It was marked blocked here because+ another agent was building it in parallel, and the marker outlived the work:+ the tree carries `services/api/app/services/sandbox/base.py` with the CAPEv2,+ mock and MalwareAnalyzer providers, the upload policy with migration+ `064_sandbox_upload_policy.sql` and `scripts/check_sandbox_upload_policy.py`,+ the enrichment and agent-tool wiring, and six routes at+ `services/api/app/api/v1/endpoints/sandbox.py`. Corrected by parity 1.2.+ - [x] 11.1 Interface, CAPEv2 reference provider, mock, documented commercial slot.+ - [x] 11.2 Upload policy: hash lookup first, disclosure off by default, air-gap refuses non-local.+ - [x] 11.3 Wiring to enrichment, phishing attachments and the agent tool surface.## Phase 12: Production proof and a stable release channeldiff --git a/Makefile b/Makefileindex 30f569724..47a1946c9 100644--- a/Makefile+++ b/Makefile@@ -177,7 +177,7 @@ up-full: env _ports _refresh# `pull_policy: missing` is correct for a pinned tag — `v12.0.0` is immutable,# so once it is local there is nothing to fetch — and wrong for `latest`, which# is republished on every merge to main. With `AISOC_VERSION=latest` (the-# default) and `missing` on all fifteen first-party services, `git pull &&+# default) and `missing` on all 16 first-party services, `git pull &&# make up` ran brand-new compose configuration against whatever images the# machine happened to have. Nothing anywhere told an operator to pull.#diff --git a/PARITY_PROGRESS.md b/PARITY_PROGRESS.mdindex 93c731f58..d1fb35500 100644--- a/PARITY_PROGRESS.md+++ b/PARITY_PROGRESS.md@@ -216,3 +216,130 @@ a reachability finding for 1.4 rather than a claim edit.The security batch comes first and is tracked separately. Phase 1 starts onceit has landed and been released, because several of its items assume thosefixes exist.++## Phase 1.1 — overclaims retracted (2026-10-01)++All twelve rows narrowed or removed, each naming the sub-item that restores it.+Every figure re-derived from the tree rather than copied from the plan.++| Claim | What it says now | Restored by |+|---|---|---|+| Hunting agent + 68-hunt library | The 68 YAML hunts are real; the **agent is not wired** (nothing outside its test imports it) and the scheduler replays synthetic JSONL | 6.1 |+| Hosted egress is pseudonymized by default | Retracted. The redactor exists and is unit-tested; **no LLM call site invokes it**. Matrix row 19 narrowed from "no data exfiltration" with the reason in the row | 2.4 |+| Institutional memory on PostgreSQL + pgvector | Narrowed to reason-coded key/value on plain Postgres. **No pgvector, no embedding** on that path | 6.5 |+| `auto_close` grant closes alerts of that class | Recorded but **not enforced**: no code reads the grant, closure still uses one process-wide threshold | 2.1 |+| SAML, OIDC, group mapping, `SAML_IDP_METADATA_URL`, TOTP, per-role MFA | Moved to planned. Both handlers answer 501 since v15.0.0 and neither provisions a user, binds a tenant nor maps a group | 4.1, 4.2 |+| SOC 2 Type II dashboard; six frameworks including DORA | Narrowed to **24 controls across 5 frameworks**, DORA absent | 1.3 |+| Shift handoff, EASM, MSSP ARR dashboard, gamification | Removed from `intro.md` | None |+| WCAG AA full pass | Narrowed to the components axe covers | 4.7 |+| EU residency, `events_dist`, active-active, RPO/RTO | Labelled a design, banner at the top of the document | None |+| GCP KMS and Vault Transit implement the same protocol | Corrected: `get_vault` accepts local and AWS KMS only | None |+| Tenant skills authored in a console editor | Corrected: API-only | 6.3 |+| ATT&CK coverage of 493 techniques | **Generator fixed, not output.** Coverage now counts executable rules only: **391**, labelled tag coverage. The 493 survives as `unique_techniques_all_rules` | 5.5 |++Two figures from D4 and D5 moved while this was written, which is why the plan+says to re-derive rather than copy:++- ATT&CK over executable rules reads **391**, not the 387 captured. The corpus+ grew; the method is what matters.+- `stats.executable` read **2,767** against item flags of **2,603**. The 164 in+ between are playbooks and plugins carrying no flag. Both are defensible+ numbers; publishing one of them under the name `executable` was not, so the+ index now reports `executable_detections`, `reference_only_detections` and+ `not_a_detection` separately.++## Phase 1.2 — documentation drift cleared (2026-10-01)++Generators fixed where a generator owned the number, per the plan's rule.++| Drift | Was | Now |+|---|---|---|+| `playbooks/README.md` | 50 playbooks across 9 directories | 62 across 21, the figure the marketplace index already published |+| Hunt scheduler docstring | synthetic is "the default in dev/CI" | synthetic is the default **everywhere** and the only provider implemented, so scheduled hunts run on a fixture corpus on every deployment. Parity 6.1 |+| Detection engine docstring | "rules are indexed by `product`" over an 817-rule corpus | the whole corpus is evaluated per event; `_candidates` returns `self._rules` unchanged and the docstring now records why a product pre-filter was removed. Indexing is parity 6.9 |+| Auto-triage docstring | metrics "exposed via the /triage/stats API" | no route exposes them; that endpoint has never existed |+| `install.sh`, `walkthrough.mdx`, `Makefile` | 10, fifteen, fifteen | **16**, derived by `check_profile_service_counts.py`, and all three now **registered** in its `CLAIM_SITES` so none can drift again. 18 published figures became 21 |+| ClickHouse schema comment | "hot tier, 30 days" over a `90 DAY` TTL | says 90 and points at the TTL that governs |+| Upgrade guide | no per-major section at all | a table covering **v10 through v15**, each row saying what an operator must do, derived from each major's own `### BREAKING` section |+| `GAP_CLOSURE_PROGRESS.md` Phase 11 | `[!]` blocked | `[x]`, with every file it claims verified to exist |+| CONTRIBUTING | Python 3.12, four severity tiers, hand-written connector docs | 3.11 (what CI runs), five tiers with the no-collapse rule, generated pages |++The registration matters more than the correction. Three figures had drifted+to numbers the compose file never supported, and an unregistered figure is one+nobody notices going stale, which is how all three got there. Proven by+drifting `install.sh` to 11 and watching the gate name it.++## Phase 1.3 — broken console paths repaired (2026-10-01)++| Was broken | Fix |+|---|---|+| 7 compliance calls to 4 route shapes that 404'd | Built the routes with real rows: `GET /{framework}`, `/heatmap`, `/export` (CSV and JSON, hash chain included) and `POST /{framework}/collect`. Slug mapping derived from the `FRAMEWORKS` keys, so a new framework needs no second edit |+| `POST /{framework}/collect` could have been another no-op | It writes **real evidence rows** from real platform state: audit-log depth, RLS table count, credential-key configuration, passkey enrolment. **10 of 24 controls**, every id read out of `FRAMEWORKS`. The other 14 report `manual` |+| The case report pane fetched a route nobody had written | `GET /cases/{id}/investigations/{run_id}/report.md`, proxied to the agents service with the same two-step tenant scoping the sibling route uses, which that route shipped without (GHSA-x2gf-3p79-wvgm) |+| Two agents handlers on `/api/v1/investigations/{run_id}`, each reading its own store | `router.py`'s pair moved to `/api/v1/agent-runs`. It had no caller; `investigate.py` owns the lifecycle and its report routes, so it keeps the canonical path and the status poll now reads the store that is written |+| honeytokens and purple-team had no rewrite | Added, and the `NEXT_PUBLIC_*` bases removed: Next inlines those at build time, so a published image could not be pointed anywhere by configuration |+| 5 dead client functions | Deleted (`agentsApi.investigate`, `.getInvestigation`, `.streamInvestigation`, `graphApi.getPaths`, `.getBlastRadius`, `alertsApi.getTimeline`). The plan said seven; six is what no route served **and** nothing called |++### Two gate defects found on the way++**The S1c console-credential gate had a blind spot.** `FrameworkView.tsx` called+the compliance API with a bare `fetch` and no `Authorization` header, and the+gate reported the tree clean. The fetcher classifier was right; the **key** was+a variable (`const dashKey = ...`), so no API path appeared at the call site+and the call was skipped. The gate now resolves a local binding: 33 calls seen+became 34, and re-injecting the defect makes it name the file and line.++**The new route-contract gate was vacuous in its first version.** It treated+any matching Next rewrite as resolution. `/api/v1/:path*` routes everything+left over to the API service, so all 209 console paths passed against a tree+with 14 broken calls. A rewrite is proof of routing, not of service, so a+rewrite now only counts when the service it points at actually serves the+path. **14 findings pre-fix, 0 after.**++### Deviation D8: six dead client functions, not seven++The plan says seven. Six is what the measurement supports: 22 client members+have no caller outside `lib/api.ts`, but 16 of those target routes that exist,+and an unused-but-working client function is a product-surface judgement+rather than a correctness defect. The six removed are the ones that were both+uncalled and pointed at nothing.++## Phase 1.4 — the gates are path-aware (2026-10-01)++| Gate | What it closes |+|---|---|+| `check_module_reachability.py` (new) | A claim row could pass on a unit test of a module nothing imports. **889 of 926 modules reachable from 68 entry points; 37 allowlisted** with a reason each. Tests are deliberately not entry points: a module imported only by its own test is the shape being looked for |+| `check_route_duplicates.py` (new) | Two modules under one prefix shadowing each other, which the static pass records in its own docstring as invisible to it. Names `agents: GET /api/v1/investigations/{run_id}` with both owners on the pre-phase tree |+| `check_console_route_contract.py` (new, 1.3) | A console path that no service serves. 14 pre-fix, 0 after |+| `check_claim_gate_matrix.py` (extended) | Every row now declares `core` or `full` (**232 core, 24 full**) and must name a runnable gate rather than prose |+| `check_python_route_state.py` | The Python demo-state and module-global half. **Already shipped in v15.0.0**, so this sub-item is a deviation rather than work |+| `check_console_auth_headers.py` (extended, 1.3) | A `useSWR` key held in a variable, which is how an uncredentialed compliance call survived the sweep meant to find it |++### The reachability gate found its own bugs first++Its first run reported **159** unreachable modules. Two were defects in the+gate, not the tree: a package's `__init__` resolved `from .x import Y`+against its *parent*, so every module a package re-exported read as dead;+and importing `a.b.c` did not mark `a` and `a.b`, so 78 package markers+read as dead because nothing names them directly. After both, **37**, and+every one of those is real.++It also independently named three modules the capability review had found by+hand: the hunting agent, the pseudonymizer and the closure guardrails. That+is the useful signal, because it means the gate would have caught them+without anyone reading the code.++### Deviations++**D9. Two of 1.4's four gates already existed in part.** The Python demo-state+and module-global check shipped as `check_python_route_state.py` in v15.0.0,+so 1.4 adds nothing there. `check_route_shadowing.py` exists and is kept: it+is the breadth pass that needs no service importable, and the new duplicate+gate is the depth half rather than a replacement.++**D10. Rows are not failed on a gate test importing an unreachable module.**+The plan asks for it. The matrix's `Gate` cell is prose naming a workflow job+or a file, not a resolvable import, so the rule would have to parse free text+to decide what to import. Both halves exist and are enforced separately: every+row names a runnable gate, and every module has an importer or a reason.+Recorded rather than faked with a heuristic that would pass on anything.diff --git a/README.md b/README.mdindex cafc5cf6b..d3c65c816 100644--- a/README.md+++ b/README.md@@ -191,7 +191,7 @@ rejects, triage falls back to a deterministic path and the rail shows which one| AI triage + Investigation Ledger | Beta | Unit + substrate eval + local-model run | Yes, copilot mode || Event lake + hunting (ClickHouse) | Beta | Unit | Yes, `full` profile || Retro-hunts when new intel arrives | Beta | Unit + live ClickHouse replay | Yes, `full` profile |-| Hunting agent + 68-hunt library | Beta | Unit + boundary gate | Yes, `full` profile |+| 68-hunt YAML library, replayed against synthetic events | Alpha | Unit + boundary gate | Yes, `full` profile. The NL hunting agent is **not wired**: nothing outside its own test imports it, and the scheduler reads a synthetic JSONL corpus rather than tenant data. Restored by parity 6.1 || SCIM 2.0, white-label, usage metering | Beta | Unit + Okta/Entra sequences | Yes || Entity graph (Neo4j) | Beta | Unit | Yes, `full` profile || Governed response actions | Beta | Unit | Human-approved only |diff --git a/ROADMAP.md b/ROADMAP.mdindex 905bae3b4..5480a3e62 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -44,10 +44,10 @@ A proof-first, security-first program to make every README claim gate-backed, cl- **Phase D (breadth):** D1 eight connectors (QRadar/Exabeam/Securonix/Devo/Netskope/Windows-Sysmon/Zeek-Suricata/syslog-CEF) · D2 AI/LLM-usage audit connector + `llm-*` detections + hot/cold lake tiering · D3 live-vendor mock-server smoke.- **Phase E (prove it):** E1 CI-gated benchmark scoreboard tied to a deterministic live-agent MITRE-accuracy run.-The claim-to-gate matrix stands at **255 rows — 255 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).-The claim-to-gate matrix stands at **255 rows — 255 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).-The claim-to-gate matrix stands at **255 rows — 255 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).-The claim-to-gate matrix stands at **255 rows — 255 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).+The claim-to-gate matrix stands at **258 rows — 258 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).+The claim-to-gate matrix stands at **258 rows — 258 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).+The claim-to-gate matrix stands at **258 rows — 258 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).+The claim-to-gate matrix stands at **258 rows — 258 GATED / 0 PARTIAL / 0 NO GATE** — **every product claim is backed by a failing test**, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).## v4.0 — Shipped@@ -121,10 +121,10 @@ The claim-to-gate matrix stands at **255 rows — 255 GATED / 0 PARTIAL / 0 NO G- [x] Full analyst audit log (append-only `audit_log` table + middleware + UI)### Compliance-- [x] SOC 2 Type II evidence collection dashboard + PDF export+- [x] Compliance evidence mapping for **24 controls across 5 frameworks** (SOC2, PCI-DSS, HIPAA, ISO27001, NIST-CSF), with PDF export. Not a SOC 2 Type II evidence dashboard: the console pages for it call routes that do not exist. Restored by parity 1.3- [x] ISO 27001 control mapping- [x] NIST CSF / NIST 800-53 control coverage heatmap-- [x] PCI-DSS, HIPAA, DORA module+- [x] PCI-DSS and HIPAA control mappings. **DORA is not mapped** by any code path- [x] MTTD / MTTR / MTTC SLA tracking per tenant### High Availability & Operations@@ -209,7 +209,7 @@ SOAR platforms drove this release.- [x] `shifts.py` — shift-handoff CRUD- [x] `stix_taxii.py` — STIX 2.1 / TAXII 2.1 publishing-- [x] `compliance.py` — automated compliance evidence (SOC 2, ISO 27001, NIST CSF, PCI-DSS, HIPAA, DORA)+- [x] `compliance.py`, automated compliance evidence for 24 controls across SOC 2, ISO 27001, NIST CSF, PCI-DSS and HIPAA. **DORA is not among them**- [x] `deployment.py` — deployment / air-gap toggles### New connectors (16 → 26)@@ -237,7 +237,7 @@ SOAR platforms drove this release.All items below were shipped as part of the v1.0 buyer-value plan.Implemented and reviewed by Beenu Arora <[email protected]>.-- [x] WCAG AA full accessibility pass (axe-core CI gate — `apps/web/src/test/a11y.test.tsx`)+- [x] axe-core CI gate over the components listed in `apps/web/src/test/a11y.test.tsx`. **Not a full WCAG AA pass**: the queue, alert list, case workspace, investigation rail and settings are not covered. Restored by parity 4.7- [x] Light theme persisted in user profile (`ThemeProvider.tsx` + `PATCH /api/v1/users/me/preferences`)- [x] Saved views and custom drag-drop dashboard widgets per analyst (`saved_views.py` + `DashboardView.tsx`)- [x] AI-generated weekly executive digest — auto-emailed PDF (`digest_pdf.py` + `weekly_digest_task.py`)diff --git a/apps/docs/docs/compliance/evidence-pack.md b/apps/docs/docs/compliance/evidence-pack.mdindex ed761f362..3d1f8ab3d 100644--- a/apps/docs/docs/compliance/evidence-pack.md+++ b/apps/docs/docs/compliance/evidence-pack.md@@ -33,10 +33,10 @@ and says so.| Prompt-injection resistance | Three adversarial corpora: 32 payloads scanned in isolation and 71 incident pairs whose payloads are placed in attacker-controllable fields, both against a clean twin with a recall floor and a false-positive ceiling, plus 34 held-out pairs authored after the guard was frozen and carrying no floor at all, on which the guard measures 7.1% | `services/agents/tests/adversarial/` || Claim-to-gate traceability | Every product claim mapped to the CI job that fails when it stops being true | `docs/audit/CLAIM_TO_GATE_MATRIX.md` |-The last row is the one worth reading first. It is the honest index: 255 rows-The last row is the one worth reading first. It is the honest index: 255 rows-The last row is the one worth reading first. It is the honest index: 255 rows-The last row is the one worth reading first. It is the honest index: 255 rows+The last row is the one worth reading first. It is the honest index: 258 rows+The last row is the one worth reading first. It is the honest index: 258 rows+The last row is the one worth reading first. It is the honest index: 258 rows+The last row is the one worth reading first. It is the honest index: 258 rows`GATED`, 0 `PARTIAL`, and a ratchet that refuses to let a row sit at`NO GATE`. Re-read the figure from the table rather than from here — a countcopied into prose goes stale in silence, which is whydiff --git a/apps/docs/docs/deployment/walkthrough.mdx b/apps/docs/docs/deployment/walkthrough.mdxindex 1c7f186cc..94f258779 100644--- a/apps/docs/docs/deployment/walkthrough.mdx+++ b/apps/docs/docs/deployment/walkthrough.mdx@@ -91,7 +91,7 @@ resolves on the reader's own machine to something that is not your console.make up```-This pulls the published images, starts the fifteen CORE services, waits for+This pulls the published images, starts the 16 CORE services, waits foreach one that declares a health check, and then creates the firstadministrator. On a first run it also downloads the bundled`llama3.2:3b-instruct-q4_K_M` model — about 2 GB — into a named volume; onlydiff --git a/apps/docs/docs/intro.md b/apps/docs/docs/intro.mdindex b648137df..f261c3294 100644--- a/apps/docs/docs/intro.md+++ b/apps/docs/docs/intro.md@@ -56,11 +56,7 @@ for the full list.- **Autonomous alert triage** — LLM-based auto-triage agent classifies alerts as true positive, false positive, or benign with confidence scoring. High-confidence false positives are auto-closed; uncertain alerts escalate to human analysts.- **Conversational investigation chat** — multi-turn NL interface for querying alerts, cases, and threat intel with quick actions and a persistent investigation context panel.- **MITRE ATT&CK coverage advisor** — identifies detection gaps across tactics, recommends new rules, and enables one-click detection generation for uncovered techniques.-- **Shift handoff dashboard** — SOC shift management with handoff item tracking, shift summary KPIs (alerts triaged, cases opened, escalations), and report generation.-- **EASM (External Attack Surface Management)** — continuous asset discovery, exposed service detection, certificate monitoring with expiry alerts, and risk scoring.-- **MSSP executive dashboard** — cross-tenant view with aggregated KPIs (MTTD, MTTR, SLA compliance, ARR) and per-tenant risk scoring for managed security providers.- **Alert noise tuning** — closed-loop dashboard driven by analyst TP/FP verdicts, with auto-tune toggles per rule and monthly noise trend visualization.-- **Team analytics & gamification** — analyst leaderboard with sortable performance metrics, badges (MITRE Master, Speed Demon, Zero FP, Precision Strike), and team highlights feed.- **STIX/TAXII publishing** — bidirectional threat intel sharing with STIX 2.1 bundle creation and TAXII collection management. Optional [STIX → MISP push](./integrations/misp-push) republishes high-confidence indicators and bundles to a MISP server with `dry-run` / `health` endpoints for fail-closed staging rollouts.- **Automated compliance evidence** — continuous collection from connected sources across SOC 2, ISO 27001, NIST CSF, PCI-DSS, HIPAA, and DORA frameworks.- **AI-generated incident reports** — one-click PDF/MD export of case investigation summaries directly from the case detail view.diff --git a/apps/docs/docs/operations/security.md b/apps/docs/docs/operations/security.mdindex 8540b2036..5dc285325 100644--- a/apps/docs/docs/operations/security.md+++ b/apps/docs/docs/operations/security.md@@ -42,21 +42,41 @@ Rotate `SECRET_KEY` periodically. Doing so invalidates every active session, whi### Single Sign-On (SSO)-AiSOC supports two enterprise SSO protocols out of the box:+:::warning Planned, not shipped-- **OIDC** — configured via `services/api/app/auth/oidc.py`. Point AiSOC at your IdP's discovery URL, set the client ID/secret, and map IdP groups to AiSOC roles in the role mapping config. Common IdPs tested: Okta, Entra ID (Azure AD), Google Workspace, Auth0.-- **SAML 2.0** — configured via `services/api/app/auth/saml.py`. Upload your IdP metadata XML or set the `SAML_IDP_METADATA_URL`. Group-to-role mapping uses the same shape as OIDC.+**Neither SSO protocol completes a sign-in today.** Both handlers existed as+stubs that issued a token for a principal no identity provider had seen; in+`v15.0.0` those were deleted and both now answer `501 Not Implemented` when+unconfigured. What is missing is the rest: neither provisions a local user,+binds a tenant, maps IdP groups to roles, nor issues the bearer token the API+verifies. `SAML_IDP_METADATA_URL` is read by nothing.-Both providers issue the same internal JWT after authentication, so authorization (RBAC, RLS) works identically regardless of how the user signed in.+Restored by parity 4.1, which adds an end to end CI test against a+containerised test identity provider for both protocols.++:::++The two protocols AiSOC is building toward:++- **OIDC**, in `services/api/app/auth/oidc.py`. Discovery URL, client id and+ secret, and IdP group to role mapping.+- **SAML 2.0**, in `services/api/app/auth/saml.py`. IdP metadata by file or by+ URL, with the same group mapping shape as OIDC.++Both are intended to issue the same internal bearer token, so that RBAC and+RLS apply identically however a user signed in.### Multi-Factor AuthenticationTwo MFA paths are available:- **WebAuthn / passkeys** — implemented in [`services/api/app/api/v1/endpoints/passkeys.py`](https://github.com/beenuar/AiSOC/blob/main/services/api/app/api/v1/endpoints/passkeys.py). Required for the [Responder PWA](../intro) (`/responder/*` route). Passkey-only login means there is no password fallback for on-call responders — you authenticate with the device, biometric, or hardware key the user registered.-- **TOTP** — standard 6-digit time-based codes for analyst console accounts when SSO is not in use. Backup codes are generated at enrolment and shown once.+- **TOTP**, with backup codes and per-role enforcement, is **planned and not+ implemented**. No TOTP enrolment, verification or backup-code path exists in+ the tree. Restored by parity 4.2.-Both MFA methods are enforced per-user, configurable per-role: tenant admins can require MFA for any role they choose.+Passkeys are enforced for the Responder PWA. **Per-role MFA enforcement for the+console is not implemented**; it arrives with parity 4.2.### API keysdiff --git a/apps/docs/docs/operations/shadow-mode.md b/apps/docs/docs/operations/shadow-mode.mdindex 140dd236d..7af0694fe 100644--- a/apps/docs/docs/operations/shadow-mode.md+++ b/apps/docs/docs/operations/shadow-mode.md@@ -274,7 +274,11 @@ decides.Two capabilities can be earned:-* `auto_close` on an alert class: the agent closes alerts of that class without+* `auto_close` on an alert class. **Recorded but not yet enforced**: the grant is written+ and earned as described below, and no code reads it, so earning it changes nothing+ today. Closure is still governed by the single process-wide+ `AISOC_AUTO_CLOSE_THRESHOLD`. Restored by parity 2.1. As designed, it would let+ the agent close alerts of that class withouta human.* `auto_execute` on a response verb: that verb's autonomy tier ceiling rises.diff --git a/apps/docs/docs/operations/upgrades.md b/apps/docs/docs/operations/upgrades.mdindex 6ba8c213e..5097fc768 100644--- a/apps/docs/docs/operations/upgrades.md+++ b/apps/docs/docs/operations/upgrades.md@@ -125,6 +125,26 @@ docker compose -f docker-compose.yml -f infra/compose/docker-compose.dev.yml upMajor releases occasionally ship one-way migrations (e.g. column drops). When that's the case, the CHANGELOG flags the migration as "irreversible" and the only rollback is restoring from the database snapshot you took in step 2 of the pre-upgrade checklist.+## Upgrading across a major++Every major below changes behaviour rather than only schema, so read the row+for each one you are crossing. The authoritative list of what breaks is the+`### BREAKING` section of [`CHANGELOG.md`](https://github.com/beenuar/AiSOC/blob/main/CHANGELOG.md);+this table says what an operator has to **do**.++| From, to | What changes | What you do |+|---|---|---|+| any, **v10.0.0** | Services stop connecting to Postgres as a superuser, so the 92 row-level security policies begin to apply. The four services running their own alembic chain migrate as the owner, not as the app role. | Run the migrations with `DATABASE_MIGRATION_URL` set to the owning role. A service that still connects as a superuser bypasses every policy, so check the role before and after. |+| v10, **v11.0.0** | `POST /v1/ingest` and `/v1/ingest/batch` require a credential. CORE needs **8 GB of memory and 20 GB of disk**, up from about 6.5 GB. | Mint an ingest token and set it on every producer before upgrading, or ingestion stops. Check the host has the headroom first. |+| v11, **v12.0.0** | The actions service returns 503 on every mutating route, and the realtime edge rejects every connection, until their required secrets are set. | Set them before you start the stack. Both failures are deliberate and loud. |+| v12, **v13.0.0** | 75 state-changing routes require a permission they did not require before, and several move to `settings:write`, which `soc_analyst`, `soc_lead` and `threat_hunter` do not hold. | Expect HTTP 403 where operators previously got 200. Review who needs `settings:write` before upgrading, not after. |+| v13, **v14.0.0** | No route will confer a role, scope or organisation membership beyond the caller's own authority, and `platform_admin` and `admin` are unreachable from every API route. | The only way to mint a wildcard role is `python -m app.scripts.bootstrap_admin` against the database. Any automation that created one through the API stops working. |+| v14, **v15.0.0** | `/api/v1/shifts` is removed and `/api/v1/threatintel/stix/*` reads answer 404 outside demo mode. `make up` starts a production-class stack and `AISOC_DEV_MODE` no longer defaults to on. | Delete any caller of those routes; neither served data anyone entered. Set `ENVIRONMENT=development` explicitly if you were relying on the dev auth bypass, and expect previously silent warnings to become boot refusals. |++Upgrading more than one major at a time is supported but untested as a single+step. Do them one at a time, running migrations between each, so that a+failure names the version that caused it.+## Version skewWithin a given major version, the following components are guaranteed to be wire-compatible across one minor version of skew:diff --git a/apps/web/next.config.js b/apps/web/next.config.jsindex 046377c7f..8fdda3926 100644--- a/apps/web/next.config.js+++ b/apps/web/next.config.js@@ -42,6 +42,12 @@ const AGENTS_HOST = process.env.AGENTS_URL || 'http://localhost:8001';const FUSION_HOST = process.env.FUSION_URL || '';const ENRICHMENT_HOST = process.env.ENRICHMENT_URL || 'http://enrichment:8082';const OSQUERY_TLS_HOST = process.env.OSQUERY_TLS_URL || 'http://localhost:8090';+// Both services are `extras`-profile, so the default points at the published+// host port rather than a compose service name: a developer who started them+// gets a working page, and a deployment that did not start them gets a+// connection error rather than a 404 from the console itself.+const HONEYTOKENS_HOST = process.env.HONEYTOKENS_URL || 'http://localhost:8008';+const PURPLE_TEAM_HOST = process.env.PURPLE_TEAM_URL || 'http://localhost:8006';const nextConfig = {reactStrictMode: true,@@ -173,6 +179,28 @@ const nextConfig = {source: '/api/v1/playbooks',destination: `${AGENTS_HOST}/api/v1/playbooks`,},+ // Honeytokens and purple-team had no rewrite at all. Their pages read a+ // `NEXT_PUBLIC_*` base that defaults to an empty string, so every call+ // went to the console's own origin and Next answered 404. Worse, a+ // `NEXT_PUBLIC_*` value is inlined at build time, so setting it on a+ // published image does nothing: the pages could not be fixed by+ // configuration at all.+ {+ source: '/api/v1/honeytokens/:path*',+ destination: `${HONEYTOKENS_HOST}/api/v1/honeytokens/:path*`,+ },+ {+ source: '/api/v1/honeytokens',+ destination: `${HONEYTOKENS_HOST}/api/v1/honeytokens`,+ },+ {+ source: '/api/v1/purple-team/:path*',+ destination: `${PURPLE_TEAM_HOST}/api/v1/purple-team/:path*`,+ },+ {+ source: '/api/v1/purple-team',+ destination: `${PURPLE_TEAM_HOST}/api/v1/purple-team`,+ },// Hunt search + saved searches (singular /hunt, distinct from /hunts corpus){source: '/api/v1/hunt/:path*',diff --git a/apps/web/public/marketplace/index.json b/apps/web/public/marketplace/index.jsonindex 8124abbe9..f51cd5ba7 100644--- a/apps/web/public/marketplace/index.json+++ b/apps/web/public/marketplace/index.json@@ -1,7 +1,7 @@{"$schema": "https://example.com/schemas/marketplace/v1.json","version": "1.0.0",- "generated": "2026-09-28T22:12:26Z",+ "generated": "2026-10-01T21:06:28Z","categories": [{"id": "playbooks",@@ -39,10 +39,409 @@"stable": 877},"executable": 2767,- "quarantined": 4388+ "quarantined": 4388,+ "executable_detections": 2603,+ "reference_only_detections": 4388,+ "not_a_detection": 164},"mitre_coverage": {+ "unique_techniques": 391,"techniques": {+ "T1001.003": 1,+ "T1003": 21,+ "T1003.001": 58,+ "T1003.002": 24,+ "T1003.003": 21,+ "T1003.004": 10,+ "T1003.005": 8,+ "T1003.006": 7,+ "T1003.008": 1,+ "T1005": 7,+ "T1007": 2,+ "T1008": 3,+ "T1011": 1,+ "T1012": 8,+ "T1016": 3,+ "T1018": 15,+ "T1020": 3,+ "T1021": 4,+ "T1021.001": 10,+ "T1021.002": 24,+ "T1021.003": 8,+ "T1021.004": 4,+ "T1021.005": 1,+ "T1021.006": 10,+ "T1021.007": 1,+ "T1027": 58,+ "T1027.001": 1,+ "T1027.003": 1,+ "T1027.004": 3,+ "T1027.005": 4,+ "T1027.010": 7,+ "T1030": 1,+ "T1033": 12,+ "T1036": 22,+ "T1036.002": 3,+ "T1036.003": 9,+ "T1036.004": 1,+ "T1036.005": 3,+ "T1036.007": 1,+ "T1037": 1,+ "T1037.001": 3,+ "T1037.002": 1,+ "T1037.004": 2,+ "T1039": 2,+ "T1040": 8,+ "T1041": 9,+ "T1046": 11,+ "T1047": 34,+ "T1048": 8,+ "T1048.001": 1,+ "T1048.003": 5,+ "T1049": 4,+ "T1052": 2,+ "T1052.001": 1,+ "T1053": 4,+ "T1053.001": 1,+ "T1053.002": 2,+ "T1053.003": 4,+ "T1053.005": 24,+ "T1053.006": 1,+ "T1055": 11,+ "T1055.001": 3,+ "T1055.003": 1,+ "T1055.011": 1,+ "T1055.012": 3,+ "T1056": 1,+ "T1056.001": 3,+ "T1056.002": 1,+ "T1057": 3,+ "T1059": 49,+ "T1059.001": 132,+ "T1059.002": 3,+ "T1059.003": 24,+ "T1059.004": 8,+ "T1059.005": 19,+ "T1059.006": 3,+ "T1059.007": 16,+ "T1059.009": 2,+ "T1068": 11,+ "T1069": 3,+ "T1069.001": 12,+ "T1069.002": 11,+ "T1069.003": 1,+ "T1070": 17,+ "T1070.001": 3,+ "T1070.002": 1,+ "T1070.003": 6,+ "T1070.004": 6,+ "T1070.005": 4,+ "T1070.006": 1,+ "T1071": 7,+ "T1071.001": 16,+ "T1071.004": 12,+ "T1072": 4,+ "T1074.001": 4,+ "T1078": 51,+ "T1078.001": 5,+ "T1078.002": 7,+ "T1078.003": 2,+ "T1078.004": 49,+ "T1082": 13,+ "T1083": 9,+ "T1087": 10,+ "T1087.001": 10,+ "T1087.002": 19,+ "T1087.004": 5,+ "T1090": 16,+ "T1090.001": 4,+ "T1090.002": 1,+ "T1090.003": 9,+ "T1091": 1,+ "T1095": 5,+ "T1098": 47,+ "T1098.001": 22,+ "T1098.003": 6,+ "T1098.004": 6,+ "T1098.007": 1,+ "T1102": 5,+ "T1102.002": 1,+ "T1105": 49,+ "T1106": 6,+ "T1110": 23,+ "T1110.001": 7,+ "T1110.002": 1,+ "T1110.003": 4,+ "T1110.004": 4,+ "T1112": 58,+ "T1113": 7,+ "T1114": 1,+ "T1114.001": 1,+ "T1114.002": 1,+ "T1114.003": 2,+ "T1115": 3,+ "T1119": 3,+ "T1120": 2,+ "T1123": 4,+ "T1124": 2,+ "T1125": 1,+ "T1127": 15,+ "T1127.001": 1,+ "T1132.001": 4,+ "T1133": 18,+ "T1134": 2,+ "T1134.001": 6,+ "T1134.002": 2,+ "T1134.003": 3,+ "T1134.004": 1,+ "T1135": 7,+ "T1136": 3,+ "T1136.001": 12,+ "T1136.002": 3,+ "T1136.003": 4,+ "T1137": 4,+ "T1137.002": 1,+ "T1137.003": 1,+ "T1137.006": 3,+ "T1140": 7,+ "T1176": 1,+ "T1176.001": 2,+ "T1185": 3,+ "T1187": 3,+ "T1190": 39,+ "T1195": 3,+ "T1195.001": 1,+ "T1195.002": 9,+ "T1197": 13,+ "T1199": 12,+ "T1200": 3,+ "T1201": 3,+ "T1202": 26,+ "T1203": 6,+ "T1204": 6,+ "T1204.001": 3,+ "T1204.002": 21,+ "T1204.004": 5,+ "T1207": 2,+ "T1210": 4,+ "T1211": 4,+ "T1212": 5,+ "T1213": 2,+ "T1216": 8,+ "T1216.001": 2,+ "T1217": 3,+ "T1218": 89,+ "T1218.001": 5,+ "T1218.003": 7,+ "T1218.004": 1,+ "T1218.005": 8,+ "T1218.007": 6,+ "T1218.008": 5,+ "T1218.009": 3,+ "T1218.010": 11,+ "T1218.011": 21,+ "T1218.014": 2,+ "T1219": 5,+ "T1219.002": 32,+ "T1220": 4,+ "T1222": 2,+ "T1222.001": 5,+ "T1222.002": 1,+ "T1404": 2,+ "T1482": 14,+ "T1484": 1,+ "T1484.001": 8,+ "T1484.002": 2,+ "T1485": 34,+ "T1486": 12,+ "T1489": 10,+ "T1490": 20,+ "T1491.001": 2,+ "T1496": 4,+ "T1497.001": 1,+ "T1498": 4,+ "T1498.001": 2,+ "T1498.002": 2,+ "T1499": 1,+ "T1499.001": 1,+ "T1499.004": 1,+ "T1505.002": 2,+ "T1505.003": 9,+ "T1505.004": 3,+ "T1518": 4,+ "T1518.001": 2,+ "T1525": 8,+ "T1526": 2,+ "T1528": 9,+ "T1529": 3,+ "T1530": 35,+ "T1531": 10,+ "T1535": 1,+ "T1537": 7,+ "T1539": 6,+ "T1542.001": 3,+ "T1542.003": 1,+ "T1543": 10,+ "T1543.001": 4,+ "T1543.002": 2,+ "T1543.003": 31,+ "T1543.004": 2,+ "T1546": 5,+ "T1546.001": 4,+ "T1546.002": 1,+ "T1546.003": 11,+ "T1546.004": 2,+ "T1546.007": 1,+ "T1546.008": 5,+ "T1546.009": 1,+ "T1546.010": 1,+ "T1546.011": 4,+ "T1546.012": 3,+ "T1546.013": 3,+ "T1546.014": 1,+ "T1546.015": 5,+ "T1547": 9,+ "T1547.001": 16,+ "T1547.004": 3,+ "T1547.005": 2,+ "T1547.006": 5,+ "T1547.009": 3,+ "T1547.010": 1,+ "T1547.015": 3,+ "T1548": 7,+ "T1548.001": 4,+ "T1548.002": 50,+ "T1548.003": 2,+ "T1548.004": 1,+ "T1550": 5,+ "T1550.001": 2,+ "T1550.002": 6,+ "T1550.003": 4,+ "T1550.004": 1,+ "T1552": 3,+ "T1552.001": 20,+ "T1552.002": 3,+ "T1552.004": 7,+ "T1552.005": 1,+ "T1552.006": 4,+ "T1552.007": 1,+ "T1553": 1,+ "T1553.001": 5,+ "T1553.002": 2,+ "T1553.004": 9,+ "T1553.005": 5,+ "T1554": 3,+ "T1555": 9,+ "T1555.001": 5,+ "T1555.003": 9,+ "T1555.004": 3,+ "T1555.005": 2,+ "T1556": 43,+ "T1556.001": 1,+ "T1556.003": 1,+ "T1556.004": 1,+ "T1556.006": 16,+ "T1556.007": 1,+ "T1557": 2,+ "T1557.001": 13,+ "T1557.002": 3,+ "T1557.003": 1,+ "T1558": 3,+ "T1558.001": 2,+ "T1558.002": 2,+ "T1558.003": 16,+ "T1558.004": 4,+ "T1559.001": 3,+ "T1559.002": 1,+ "T1560": 2,+ "T1560.001": 12,+ "T1561.002": 1,+ "T1562": 5,+ "T1562.001": 31,+ "T1562.004": 7,+ "T1562.006": 2,+ "T1562.008": 11,+ "T1562.012": 2,+ "T1563.002": 2,+ "T1564": 7,+ "T1564.001": 3,+ "T1564.002": 2,+ "T1564.003": 6,+ "T1564.004": 12,+ "T1564.006": 2,+ "T1564.008": 1,+ "T1565": 2,+ "T1565.001": 3,+ "T1565.002": 1,+ "T1566": 6,+ "T1566.001": 15,+ "T1566.002": 2,+ "T1567": 18,+ "T1567.001": 1,+ "T1567.002": 18,+ "T1568.001": 2,+ "T1568.002": 3,+ "T1569": 1,+ "T1569.002": 29,+ "T1570": 5,+ "T1571": 1,+ "T1572": 29,+ "T1573": 2,+ "T1573.002": 7,+ "T1574": 3,+ "T1574.001": 23,+ "T1574.002": 4,+ "T1574.005": 1,+ "T1574.006": 2,+ "T1574.007": 1,+ "T1574.011": 11,+ "T1574.012": 2,+ "T1578": 1,+ "T1578.002": 1,+ "T1578.003": 1,+ "T1583.001": 4,+ "T1584": 1,+ "T1586.003": 1,+ "T1587": 1,+ "T1587.001": 4,+ "T1588.002": 6,+ "T1589.002": 1,+ "T1590.001": 1,+ "T1590.002": 1,+ "T1592": 2,+ "T1593.003": 1,+ "T1595": 1,+ "T1595.002": 1,+ "T1599": 1,+ "T1599.001": 1,+ "T1600.001": 1,+ "T1606.002": 1,+ "T1608": 2,+ "T1608.003": 1,+ "T1609": 1,+ "T1610": 12,+ "T1611": 25,+ "T1612": 1,+ "T1614.001": 2,+ "T1615": 4,+ "T1620": 4,+ "T1621": 7,+ "T1622": 1,+ "T1647": 1,+ "T1649": 4,+ "T1656": 1,+ "T1659": 1,+ "T1685": 106,+ "T1685.001": 15,+ "T1685.002": 2,+ "T1685.005": 4,+ "T1686.001": 2,+ "T1686.003": 10,+ "T1689": 1+ },+ "total_with_mitre": 2472,+ "unique_techniques_all_rules": 493,+ "techniques_all_rules": {"T1001.003": 2,"T1003": 51,"T1003.001": 87,@@ -537,8 +936,7 @@"T1689": 1,"T1690": 1},- "unique_techniques": 493,- "total_with_mitre": 5800,+ "measure": "attack_technique_tags_on_executable_rules","by_tier": {"community": {"T1078.004": 1diff --git a/apps/web/src/app/(app)/honeytokens/page.tsx b/apps/web/src/app/(app)/honeytokens/page.tsxindex 8016c8286..537669a85 100644--- a/apps/web/src/app/(app)/honeytokens/page.tsx+++ b/apps/web/src/app/(app)/honeytokens/page.tsx@@ -8,7 +8,9 @@ import { apiHeaders } from '@/lib/api';// Same-origin by default — Next.js rewrites proxy `/api/v1/honeytokens/*`// to the honeytokens service. Override with `NEXT_PUBLIC_HONEYTOKENS_URL`// to debug against a different origin.-const API = process.env.NEXT_PUBLIC_HONEYTOKENS_URL ?? "";+const API = '' // Same origin, through the rewrite in next.config.js. This read a+ // NEXT_PUBLIC_* base, which Next inlines at build time, so a+ // published image could not be pointed anywhere by configuration;// The tenant used to come from `NEXT_PUBLIC_TENANT_ID`, defaulting to the// literal `00000000-0000-0000-0000-000000000001`. A `NEXT_PUBLIC_*` value isdiff --git a/apps/web/src/app/(app)/purple-team/page.tsx b/apps/web/src/app/(app)/purple-team/page.tsxindex e542f1c10..6af1cc669 100644--- a/apps/web/src/app/(app)/purple-team/page.tsx+++ b/apps/web/src/app/(app)/purple-team/page.tsx@@ -9,7 +9,9 @@ import { apiHeaders } from '@/lib/api';// Same-origin by default — Next.js rewrites proxy `/api/v1/purple-team/*` to// the purple-team service. Override with `NEXT_PUBLIC_PURPLE_TEAM_API` for// debugging against a different origin.-const API = process.env.NEXT_PUBLIC_PURPLE_TEAM_API ?? ''+const API = '' // Same origin, through the rewrite in next.config.js. This read a+ // NEXT_PUBLIC_* base, which Next inlines at build time, so a+ // published image could not be pointed anywhere by configuration// --------------------------------------------------------------------------// Typesdiff --git a/apps/web/src/components/compliance/FrameworkView.tsx b/apps/web/src/components/compliance/FrameworkView.tsxindex ab210074d..8853bf322 100644--- a/apps/web/src/components/compliance/FrameworkView.tsx+++ b/apps/web/src/components/compliance/FrameworkView.tsx@@ -4,7 +4,7 @@ import useSWR, { mutate } from 'swr';import { useState } from 'react';import { ComplianceHeatmap } from './ComplianceHeatmap';import { EmptyState, EmptyStateIcons } from '@/components/ui/EmptyState';-import { apiFetch } from '@/lib/api';+import { apiHeaders, apiFetch } from '@/lib/api';interface Evidence {id: string;@@ -48,16 +48,19 @@ interface FrameworkData {controls: ControlWithEvidence[];}+// The evidence table's own vocabulary, not a second one. A control is+// `accepted` once an auditor has signed off an item, `pending` while+// evidence exists but is unreviewed, `rejected` when every item was+// rejected, and `missing` when there is none.const STATUS_BADGE: Record<string, string> = {- approved: 'bg-green-900 text-green-300',- collected: 'bg-blue-900 text-blue-300',- review: 'bg-yellow-900 text-yellow-300',+ accepted: 'bg-green-900 text-green-300',+ pending: 'bg-yellow-900 text-yellow-300',rejected: 'bg-red-900 text-red-300',missing: 'bg-gray-800 text-gray-400',};const fetcher = (url: string) =>- fetch(url).then((r) => {+ fetch(url, { headers: apiHeaders() }).then((r) => {if (!r.ok) throw new Error(`HTTP ${r.status}`);return r.json();});@@ -97,7 +100,7 @@ export function FrameworkView({ framework }: Props) {async function handleExport() {setExporting(true);try {- const res = await apiFetch(`/api/v1/compliance/${framework}/export`);+ const res = await apiFetch(`/api/v1/compliance/${framework}/export?fmt=json`);if (!res.ok) throw new Error(`HTTP ${res.status}`);const exportData = await res.json();diff --git a/apps/web/src/components/detections/CoverageView.tsx b/apps/web/src/components/detections/CoverageView.tsxindex c5d0037b9..aeedce635 100644--- a/apps/web/src/components/detections/CoverageView.tsx+++ b/apps/web/src/components/detections/CoverageView.tsx@@ -147,10 +147,15 @@ function Summary({return (<div className="mb-6 grid grid-cols-2 gap-3 lg:grid-cols-5">- <Card label="Techniques covered" value={coverage.unique_techniques}>+ {/* Tag coverage, and labelled as such. The number says a rule that+ can fire claims the technique; it does not say the rule would+ catch an attacker using it. The generator counted every rule on+ disk until 2026-10-01, including reference-only ones, which read+ as 493 techniques covered when the executable figure was 391. */}+ <Card label="Techniques tagged" value={coverage.unique_techniques}>{tierFilter === 'all'- ? 'across all tiers'- : `in ${TIER_LABEL[tierFilter]} tier (${techShown} shown)`}+ ? 'on executable rules, across all tiers'+ : `on executable rules in ${TIER_LABEL[tierFilter]} tier (${techShown} shown)`}</Card>{/* The executable figure leads, because this page is called Coveragediff --git a/apps/web/src/components/landing/Features.tsx b/apps/web/src/components/landing/Features.tsxindex 5da7350da..0608df411 100644--- a/apps/web/src/components/landing/Features.tsx+++ b/apps/web/src/components/landing/Features.tsx@@ -22,7 +22,7 @@ const FEATURES = [{title: 'Three-tier agent memory',description:- 'Session (in-process LRU), working (Redis, 24 h TTL), and institutional (PostgreSQL + pgvector, permanent). Agents carry context across tool calls, cases, and sessions; institutional knowledge survives restarts.',+ 'Session (in-process LRU), working (Redis, 24 h TTL), and institutional (PostgreSQL, reason-coded key/value, permanent). Agents carry context across tool calls, cases, and sessions; institutional knowledge survives restarts. Recall is by key and reason code, not semantic: there is no embedding index on this path yet.',icon: (<path d="M12 2a5 5 0 015 5v1h1a3 3 0 010 6h-1v1a5 5 0 01-10 0v-1H6a3 3 0 010-6h1V7a5 5 0 015-5z" />),diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex 3e681e39e..ad9f84efa 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -1092,17 +1092,6 @@ export const alertsApi = {body: JSON.stringify({ ids, action, ...data }),}),- getTimeline: (id: string) =>- request<{- events: Array<{- id: string;- timestamp: string;- type: string;- title: string;- description: string;- }>;- }>(`/api/v1/alerts/${id}/timeline`),-/*** Structured AI explanation for one alert (Stage 2 #6).*@@ -3214,27 +3203,6 @@ export interface AgentInvestigation {}export const agentsApi = {- investigate: (alertId: string) =>- request<AgentInvestigation>('/api/v1/agents/investigate', {- method: 'POST',- body: JSON.stringify({ alertId }),- }),-- getInvestigation: (id: string) =>- request<AgentInvestigation>(`/api/v1/agents/investigations/${id}`),-- /**- * Stream an investigation as Server-Sent Events / NDJSON. Returns the- * raw `Response` so callers can pipe to a reader.- */- streamInvestigation: (alertId: string, signal?: AbortSignal) =>- fetch(`${AGENTS_BASE}/api/v1/agents/investigate/stream`, {- method: 'POST',- headers: apiHeaders(),- body: JSON.stringify({ alertId }),- signal,- }),-/*** Stream a structured "Explain this alert" walkthrough as NDJSON.*@@ -4016,20 +3984,9 @@ export const graphApi = {params: filters as Record<string, string | number>,}),- getPaths: (entity: string, options: { maxHops?: number } = {}) =>- request<{ paths: AttackPath[] }>(`/api/v1/graph/paths`, {- params: { entity, ...options },- }),-getMitreCoverage: () =>request<MitreCoverage>('/api/v1/graph/mitre/coverage'),- getBlastRadius: (entity: string) =>- request<{ radius: AttackGraph; affectedAssets: string[] }>(- `/api/v1/graph/blast-radius`,- { params: { entity } },- ),-/*** Fetch the reconstructed attack-path graph for a single case.* Backed by the Attack-Path Investigation Agent endpointdiff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.mdindex 6dab602dd..baaeac25d 100644--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md@@ -6,283 +6,286 @@ Rule (enforced from Phase 2 onward by `scripts/check_claim_gate_matrix.py`, wireStatuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL` (some aspect gated, gap named) · `NO GATE` (unproven).-| Claim | Source | Gate (workflow :: job) | Status | Closes in |-|---|---|---|---|---|-| Offline sandbox demo runs with no key/network in < 5 s | README L38 | `readme-gates.yml :: sandbox-offline` (ubuntu+macos matrix) | GATED | - |-| `pnpm aisoc:demo` boots the real stack | README L40, L45 | `compose-smoke.yml` (cold health) + `integration.yml :: spine` (Phase A3 — default `docker compose up` ships connectors + graph-at-ingest by default; asserts cold-boot → ingest → lake + detection engine → alert row with the spine test's measured raw-event→alert latency) | GATED | - |-| 84 connectors | README L116, L168 | `ci.yml :: python-lint` (`generate_connector_count.py --check`) | GATED (count) | - |-| Connectors: schema-driven config + vault-encrypted secrets | README L168 | `ci.yml` connectors matrix (`test_schemas.py` + `test_conformance.py` — secret-shaped fields must be `type=secret`); vault tests + `test_live_vendor_smoke.py` (Phase D3 — mock-server drives each connector's real HTTP client + normalize) | GATED | - |-| Connectors: live Test connection | README L168 | `ci.yml` connectors matrix (`test_conformance.py` — every connector implements the async `test_connection` contract) + `connector_conformance.py --check` published matrix + `test_live_vendor_smoke.py` (Phase D3 — mock-server conformance: `test_connection()` + paginated `fetch_alerts()` HTTP path exercised against realistic vendor payloads) | GATED | - |-| Investigation Ledger stores every step | README L61, L169 | `ci.yml :: Python — Lint & Type-check` (`check_ledger_replay_contract.py` — response model ↔ console type, client requests ↔ router decorators, and `seq` ordering/uniqueness, each in both directions) + `ci.yml :: Python — Tests` (`test_investigation_replay.py`, 37 cases over `/replay`, `/events`, `/explain`; removing `ORDER BY seq` fails five of them) | GATED | — |-| Public eval harness gates every PR | README L62, L77 | `ci.yml :: p1-eval` | GATED (but suites are self-consistency; see reality report) | Phase 4 |-| Alert-reduction is a real measurement | README / benchmark page | `ci.yml :: python-test` (fusion) runs `test_alert_reduction_real.py`, which groups a 1 000-alert stream with `RawAlert.correlation_key()` — the method `Correlator` actually calls — and bounds the ratio on both sides, because a floor alone is satisfied by a key that collapses everything into one incident | GATED | the legacy suite's 75.3% stays published for continuity and is labelled as not describing this product; the measurement is still a synthetic workload, as the benchmark page states |-| Runs entirely on your infrastructure / no data exfiltration | README L63 | `ci.yml :: python-test` (agents) runs `test_privacy_redactor.py` (zero raw PII survives) | GATED (redaction gated; the CLI now has no default telemetry endpoint and `telemetry.test.ts` pins that an enabled-but-unconfigured run makes zero network calls; **v9.0 adds the Helm egress default-deny** — `infra/helm/aisoc/templates/networkpolicy.yaml`, gated by `helm.yml` which asserts it denies by default, excludes `169.254.169.254/32` from every allowed CIDR, and stays opt-in because a CNI that does not enforce NetworkPolicy ignores it silently; **the platform-wide half landed with `check_default_egress.py`** — every service's declared settings defaults are read and a public host that no air-gap guard covers fails, with each exemption naming the guard that justifies it so deleting the guard withdraws the exemption — plus `tests/test_no_default_egress.py`, which patches the socket layer and drives each service's import and startup with a blank environment, covering 7 of 13 services in CI and naming the missing package for each of the other 6 rather than skipping silently. `services/purple-team` declared an ATT&CK CDN URL nothing in the service read, and it was deleted rather than exempted. **the container half landed with `check_container_egress.py`** — images built from the commit under test start on a docker network created with `--internal`, with a DNS sinkhole as their only resolver, and every name they ask for is classified with the same predicate the services enforce air-gap policy with. Observation, not only prevention, because a block alone cannot tell "made no call" from "made a call that failed". Two controls, because zero observations is what a correct run and a blind probe both look like and the API's unconfigured startup legitimately records zero — it dials Postgres on loopback, which needs no DNS: a canary wired with the identical network and `--dns` flags must be seen by the sinkhole, and a container that emitted no log line and asked for no name is a finding rather than a pass. `container-egress.yml` also builds an image that deliberately resolves a public name and requires the gate to fail on it. One limit stated rather than implied: a dial straight to a public IP literal asks no DNS, so it is prevented by the `--internal` network and statically checked by `check_default_egress.py`, but not observed) | — |-| Detection-as-Code rejects candidates that regress MITRE accuracy | README L170 | `ci.yml :: python-test` (`test_detection_eval.py` — candidate `rule_body` run through the real engine vs its own positive/negative fixtures; approval requires it) + `p1-eval` w2-dac baseline | GATED | - |-| 800+ native detection rules | README L78, L170 | `validate-detections.yml` (strict fixture replay) | GATED | - |-| 6000+ imported detection rules | README L78 | `validate-detections.yml` (parse/provenance + `detection_truth_table.py --check`); README cites the executable figure (2603) not the on-disk figure (6991) for coverage | GATED | - |-| L0-L4 automation maturity gates every action | README L171 | `ci.yml` autonomy-policy drift test + `test_autonomy_safety.py` (dry-run-default, rollback-capability contract, verification-mandate, scorecard) + `test_governed_dispatch.py` (Phase B2 — `decide()` wired into the live-actions `/dispatch` path: above-tier→dry-run, dry-run-off→queued, L0→blocked, executor never invoked when queued/blocked) | GATED | - |-| Hunt-as-Code + `/hunt` | README L172 | `ci.yml :: p1-eval` (`hunt_corpus`) | GATED | - |-| Weekly benchmark scoreboard runs live against `main` | README L173 | `ci.yml` agents job (Phase E1 — `scripts/check_scoreboard.py` runs the deterministic live-agent MITRE-accuracy eval over the 200-incident corpus and fails if the published `scoreboard.json` substrate row drifts > 0.02, the schema is invalid, or a substrate row is mislabelled) + `wet-eval.yml` (weekly funded LLM rows) | GATED | - |-| MCP server exposes 18 tools | `services/mcp/README.md`; `apps/docs/docs/integrations/mcp.md`; `apps/docs/docs/intro.md`; `docs/architecture/SYSTEM_DESIGN.md` | `ci.yml :: mcp` (`tests/tools.test.ts` pins the exact tool set, and `tests/published-count.test.ts` compares the figure in each of the seven documents that publish it against `ALL_TOOLS.length`, failing in **both** directions: a figure that disagrees, and a document that has stopped carrying one, so deleting the claim is a finding rather than a pass. A floor refuses to let an empty registry make every document agree with zero) | GATED | The row previously read 13 and named `ci.yml :: mcp` as the gate. That job pins the tool *set* and had never read a document, so six published figures could have drifted with nothing to say so |-| Plugin SDK Python/TS/Go | README L79, L193 | `ci.yml :: sdk-*` (build/test per language) + `openapi-breaking.yml` (a spec change that would break the generated clients) + `ci.yml :: Python — Lint & Type-check` (`check_sdk_surface.py` — every endpoint a client calls must exist in `docs/openapi.yaml`, the three languages are held to a declared namespace manifest, and a declared codegen target must exist) | GATED (the three `sdk-*` jobs compiled each SDK in isolation and never compared a client to the API it claims to speak to: `packages/sdk-go` passed all three over a file of type declarations with no functions and no `net/http`, and `packages/sdk-ts` cited a codegen artefact that did not exist. Writing the gate found four operations both clients called that the API does not serve, two of them pinned by tests that mock the transport. The gate proves an endpoint *exists*; field-level response-shape parity is still hand-kept and the SDK headers now say so) | — |-| Prompt-injection resistance | (implied by agent claims) | `ci.yml :: python-test` (agents) runs `test_prompt_sanitizer.py`, `test_prompt_envelope.py` and `tests/adversarial/` — a 32-payload corpus grouped by attacker goal, enforcing a recall floor **and** a false-positive ceiling on real security content that reads adversarially. Action-trigger and exfiltration payloads are individually required rather than averaged, because an injected containment turns the SOC into a denial-of-service tool pointed at its own estate. Phase 3 adds a second, harder corpus at incident level (`test_injection_incidents.py`) whose payloads are written to fit the field they arrive in, enforcing a floor, a ceiling and an exact ratchet naming every current blind spot by id | GATED | obfuscation is an arms race and is recorded rather than individually required; no payload is xfail at present, the homoglyph and newline-flood payloads having been closed by confusable folding and by a rule reaching them. The two corpora measure the same guard and are **not comparable**: one asks whether the guard recognises a string, the other whether it recognises it where an attacker can put it, and the second scores materially lower. Neither measures a model |-| Prompt-injection payloads are graded against a clean twin, so a rate is attributable to the payload | `services/agents/tests/adversarial/injection_incidents.py` | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (every pair differs in exactly **one** telemetry field, asserted by a structural diff rather than by inspection; the payload is present at that field in the injected twin and absent from the clean one; where a base incident lacks the field both twins gain the scaffold record so the injected twin never carries structure the clean twin lacks. A guard detection requires a signal at the injected field **and** no signal at that field in the clean twin, proven in the direction that broke by contaminating a base incident and asserting the pair stops counting) | GATED | The corpus is synthetic and labelled so at every record. It grades placement and phrasing, not whether a payload would be delivered: that a DNS name can carry an instruction is asserted, that an attacker controls that DNS name is assumed |-| The injection corpus is generated deterministically and cannot change silently | `services/agents/tests/adversarial/injection_incidents.py` | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (the whole corpus is pinned by a SHA-256 digest that a payload, pairing or base-incident change moves, so an edit lands with the diff beside it; two builds in one process are compared, and the serialised record is asserted to carry no clock, uuid or random field, which is the shape that would survive a same-process comparison) | GATED | The digest pins the corpus, not the guard. A corpus change and a guard change move different numbers, which is why the ratchet names payload ids rather than only a rate |-| Injection rates that no model produced read "not measured", never `0` | `services/agents/tests/adversarial/injection_metrics.py`; `apps/docs/docs/benchmark.md` (Latest results) | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (a deterministic run leaves the three behavioural rates unmeasured, and each is asserted to carry no `value`, to render the words "not measured", and to serialise without a number, so a formatter cannot round an unrun metric to zero. `Rate(0, 10)` still renders as a real zero, so the two remain distinguishable) + `ci.yml :: python-test` (root) runs `test_injection_eval_gate.py` (a `--live` run with no key, and a run whose every dispatch failed, both emit `measured: false` with a reason and **no `value` key at all**; the rendered markdown row contains "not measured" and not `0.0%`; a partial run reports the denominator it actually answered) | GATED | A zero and an absence are different facts, and these are the files that keep them apart. The live rates have **never been measured** on any model, because no funded key exists; that is a maintainer blocker, not a gap in the gate |-| The published injection numbers are the measured ones, and the weekly job cannot go green having measured nothing | `apps/docs/docs/benchmark.md` | `ci.yml :: p1-eval` (`check_injection_eval.py --check --benchmark-md` fails when the committed page and a live measurement disagree, and CI is asserted never to pass `--write-benchmark`, so a stale page is a finding rather than a silent rewrite) + `ci.yml :: python-test` (root) runs `test_injection_eval_gate.py` (the `wet-eval` job is asserted to carry `if: needs.preflight.outputs.should_run == 'True'` so an unconfigured repository shows *skipped* rather than passed, the preflight is asserted to write a `::warning` and a step summary, and the live injection step is asserted to sit inside the gated job and never in the ungated preflight. Proven capable of failing by deleting the `if:` and watching it go red) | GATED | The gate proves the page matches the deterministic half. The live half's freshness is `scripts/check_scoreboard.py`'s job, which refuses a scoreboard older than 45 days |-| The injection gate measures the guard the product runs, and leaves no trace in the interpreter | `scripts/check_injection_eval.py` | `ci.yml :: python-test` (root) runs `test_injection_eval_gate.py` (the gate loads the real `PromptInjectionGuard` by path rather than reimplementing its patterns, refuses a tree with no corpus and a tree with no guard, and is asserted to leave `sys.modules` exactly as it found it. The first version leaked a synthetic top-level `app` package and errored 21 unrelated tests in a full-suite run that is green on `main`, while every test in its own file still passed; a pre-existing real `app` entry is restored rather than removed) + `gate-contract.yml` (`check_gate_contract.py` — the gate refuses both the bare and the skeleton empty tree under the exact arguments the workflow passes) | GATED | A second copy of the matcher would measure something the product does not run, which is the defect the alert-reduction suite published for months |-| A constrained field is read as the instruction it encodes rather than as one opaque token | `services/agents/app/prompting/envelope.py` | `ci.yml :: python-test` (agents) runs `tests/adversarial/test_injection_incidents.py`, whose exact ratchet names every remaining blind spot by id, and `test_prompt_envelope.py`. Every string is matched against a **segmented** view in which identifier punctuation reads as a word separator, so a rule written for prose reaches a DNS label, a file name and a command line without being rewritten; each rule declares which views it is valid on, and the two that would become ambiguous once punctuation is gone are literal-only. Containment aimed at a named target is matched by the argument's *shape* rather than by a noun list, which is what a list could never hold. Tool names match on token boundaries, so `disable_user` no longer fires inside `disable_user_offboarding_batch.ps1` | GATED | Corpus detection 66.7% to 98.1% (53/54) and the prose corpus 0.852 to 0.96, with prose false positives still at 0.00. **That is the tuned number and it is not the one to plan against**: the same change scores 7.1% on payloads authored afterwards, per the row below. `=` and `:` stay out of the separator set because they bind a key to a value that several rules read |-| The injection guard's generalisation is measured on payloads authored after it was frozen, and that measurement carries no floor | `services/agents/tests/adversarial/injection_holdout.py`; `apps/docs/docs/benchmark.md` | `ci.yml :: p1-eval` (`check_injection_eval.py --check --benchmark-md` grades 28 adversarial payloads and 6 benign controls written after the guard was committed, publishes the rate beside the tuned one, and fails when the page and the measurement disagree. `HOLDOUT_UNDETECTED` is checked in **both** directions, so a miss the file does not list and a listed payload the guard now catches are each a finding; proven capable of failing by removing a real miss from the record and by adding a caught payload to it) + `ci.yml :: python-test` (agents) runs `test_injection_holdout.py` (the payloads and ids are asserted disjoint from the tuned corpus, every surface and goal the tuned corpus reaches is reached here so a held-out set cannot flatter the guard by skipping its weak fields, the twins differ in one field, and no clean twin already flags at the target field) | GATED | **The rate is 7.1% (2/28) against 98.1% on the tuned corpus, and the guard before the hardening scores 3.6% here.** There is deliberately no floor and no ratchet: a target on a held-out set is an instruction to tune against it, so CI gates that the measurement happens and that the record describes the tree, never that the number is good. Authored by someone who could read the patterns, which for an MIT-licensed guard is the correct threat model rather than a pessimistic one |-| Cross-tenant isolation (Postgres) | (implied by multi-tenant) | `cross-tenant-rbac.yml` (nightly, 3 endpoints) + `ci.yml` + `integration.yml :: migrations` (`tests/isolation/test_postgres_rls.py` — the live-DB replay this row's gap named. Against the real chain on `postgres:16` it seeds an A row and a B row into **every** RLS-covered tenant table, asserts both are visible unscoped before asserting either absence, then binds the session to A and asserts B's row is unreachable on each one. Reads run as a role created with `NOSUPERUSER NOBYPASSRLS`, because the role the services ship with bypasses RLS outright — a fact the suite asserts rather than footnotes, so a green run here can never be read as "isolation is on in production". Also fails when a tenant-scoped table has no policy, when a policy exists without `FORCE`, when an exclusion no longer describes an unprotected table, and when any policy reads a session variable nothing sets) | GATED | reads as `DATABASE_URL`, which is the role the deployment ships: `061_runtime_app_role.sql` moved the services onto a DML-only `aisoc_app` and the suite's purpose-built probe role is gone, so the replay covers what runs. The gap this row carried — "reads as the probe role, not as the deployed role" — is closed. `test_the_owner_still_bypasses_which_is_why_they_are_two_roles` asserts the two roles have not silently merged back |-| Every authenticated route reads only the caller's own tenant | (implied by multi-tenant) | `ci.yml` api job (`test_tenant_scope_and_auth_holes.py` — the identity-timeline alert query binds the caller's tenant and keeps the caller-supplied search term a parameter; the case-timeline linked-alert hydration binds a tenant; and a directory-wide sweep over `app/api/v1/endpoints/*.py` fails if **any** raw `FROM aisoc_alerts` read omits `tenant_id`, so a new endpoint cannot reintroduce the shape) | GATED | the sweep covers raw SQL against the alerts tables; ORM reads rely on the existing per-endpoint isolation tests |-| Every playbook route requires an authenticated, permitted caller | (implied by RBAC) | `ci.yml` api job (`test_tenant_scope_and_auth_holes.py` — each of the eight route functions takes an authenticated principal, the decorated-route count is asserted against the expected permission map so a new ungated route fails, execute stays distinct from write, and every permission named is one a role actually grants) | GATED | - |-| An MSSP parent holds only tenants that invited it | operations/security.md (MSSP parent/child links) | `ci.yml` api job (`test_mssp_cross_tenant_authz.py` — the four child-scoped write routes refuse a tenant that is not the caller's child and persist nothing; unknown and unowned are indistinguishable so the routes cannot enumerate tenant UUIDs; onboarding refuses without an invite, refuses an invite addressed to another parent, consumes the invite on success, and refuses self-adoption) | GATED | the guard is unit-level against the route functions; the nightly live-DB `cross-tenant-rbac.yml` sweep does not yet cover the MSSP routes |-| Cross-tenant isolation (Qdrant/Neo4j/Redis/ClickHouse/Kafka) | (implied by multi-tenant) | `isolation.yml` (offline: read paths construct a tenant scope) + `isolation-live.yml` (live A-vs-B replay: Neo4j property filter, Redis keyspace namespacing, ClickHouse via production `lake_sql.rewrite_for_tenant`, Kafka per-tenant envelope filter) | GATED | - |-| A required check that reports success on `main` executed its assertions | (implied by every `GATED` row in this file, each of which names a required check) | `grading-integrity.yml :: substantive-shape` (`check_required_check_substance.py --static`: every path through a required check's job is enumerated by binding the run-time references its conditions read, and none may run strictly less assertive work than another path through the same job — which passes two ways of booting one stack and fails announcing that nothing was checked. Step classification comes from evaluating each `if:` under a simulated protected-branch push, so `failure()` and pull-request-only steps are excluded as genuinely not applicable rather than by a list of names that goes stale. A `continue-on-error` step no blocking step reads the outcome of is also refused here, because the API cannot see one) + `grading-integrity.yml :: substantive-runs` (the same relation against the Actions API: for every context in `.github/required-checks.json`, each successful push run on `main` must have executed a complete path. Refuses a missing token, a manifest that disagrees with branch protection when it can read it, a context with no job in the tree, an empty fetch, and a window that has held no runs for seven days) | GATED | Proven against the pre-fix tree: the static half fails at `6014ae92` naming both checks and the 12 and 11 steps a skip path would not run, and passes after. The run-history half measured 26/100 and 73/100 over the 100 most recent successful push runs (the other 20 contexts: 100/100) and exits 1 on them. **Three limits stated rather than papered over.** The API reports each step's post-`continue-on-error` conclusion, so a soft failure inside a green job is invisible to the run-history half — which is why the shape is refused statically instead; zero such steps were observed across 4,660 jobs, consistent with both "none failed" and "none can be seen". A filter forced true inside a `run:` block is invisible to the static half, which is why both fixed workflows spell the exemption into an expression as well. And the workflow-runs endpoint is neither stable across pages nor guaranteed fresh — 250 requested rows held 157 unique ids, and one single-page read came back six weeks stale with a second read of the same endpoint agreeing — so the window is one page, capped at 100 and refused above that, with freshness checked against the branch's commit list from a different endpoint; a `paths:`-filtered workflow is exempt from that oracle and named in the output as unverified |-| SAST | README badge (CodeQL) | `codeql.yml` (the scan) + `codeql-alert-gate.yml` (the invariant: `scripts/check_codeql_alerts.py` fails on any open CodeQL alert at any severity, `note` included, and refuses a ref whose declared languages were not analysed at the triggering commit — `analyze` never failed a build on findings, so this row named a scan and not a gate) | GATED | - |-| Dependency CVE scanning | (implied by security) | `security-audit.yml` | GATED | - |-| OpenSSF Scorecard | README badge L13 | `scorecard.yml` | GATED | - |-| Container image / IaC / secret scanning (Trivy/checkov/tfsec/gitleaks/Semgrep) | (implied by security) | `security.yml` (claim-matrix ratchet, gitleaks and Trivy fail outright; Semgrep, checkov and tfsec fail on a changed finding count via `check_scanner_ratchet.py` against the ceilings in `.security/allowlist.yml`) + `ci.yml :: Python — Lint & Type-check` (the same gate's allow-list-schema and scanner-coverage half, which needs no scanner). **Four of the six are required checks on `main`** — `Secret scan (gitleaks)`, `Trivy filesystem`, `IaC scan (tfsec, ratcheted)` and `IaC scan (checkov, ratcheted)` — because a hard gate that is not a required context blocks nothing: Trivy fails outright on a fixable HIGH/CRITICAL and had been red on `main` for nine consecutive runs with nothing to stop a merge. All six were checked for the defect that makes a required check worthless rather than assumed safe — `security.yml` declares no `paths:` filter and no job-level `if:`, and across 40 `pull_request` runs each of the six reported a real conclusion and **none reported `skipped`**, which GitHub counts as passing. `Semgrep (ratcheted)` and `IaC scan (checkov, ratcheted)` each used to carry a `continue-on-error` step whose outcome no later step read, so either job could report success over a scan that failed, where the Actions API cannot see it; **both are now closed** — the scan step carries an `id` and a blocking step reads `steps.<id>.outcome == 'failure'`, placed *ahead* of the ratchet because a scan that dies part-way still writes a short report and the ratchet's shrink-only arm would answer it with "lower the ceiling to N". checkov's `pip install` also moved out of the absorbed step into a blocking one of its own, and the trailing or-true suffix that used to discard checkov's exit code became an explicit rule over that code — 0 and 1 are a scan that ran, anything above is a scan that did not. `--soft-fail` was measured and rejected as the way to write that: it collapses 1 into 0 but leaves 2 alone, and is silent on a `-d` naming a directory that does not exist, which exits 0 under every combination. **`Semgrep (ratcheted)` stays deliberately unrequired even so, and the reason is measured rather than cautious**: it is non-deterministic on an unchanged tree — four pull requests on one base within thirteen minutes split 102/40 and 101/39 over the identical 387 rules and 2,267 files, recorded in `.security/allowlist.yml` — so requiring it would red roughly one pull request in twenty for a reason no author can act on, and the only remedy is a re-run, which trains people to re-run rather than to read. Closing its absorbed-failure hole and requiring it are separate questions, and only the first was answered yes | GATED (this row previously said the three observe scanners "report-and-ratchet" against `.security/allowlist.yml`, and neither half was true: nothing compared the printed counts to anything, and the allow-list had **no reader anywhere in the tree**. The ratchet now fails on more findings than the ceiling, on fewer (shrink-only, printing the measured number), on zero against a non-zero ceiling — a scanner that did not run — on a scanner version that is not the one the ceiling was measured with — for all three, which this row claimed before it was true: the arm read `if version and measured_with and ...` and tfsec's JSON carries no version field, so its counter returned `None` and the `measured_with` in the allow-list was never compared against anything. A version the gate cannot establish is now a failure rather than a skip, tfsec's is read from the binary's own `--version` (a pinned URL says what was asked for; a cached binary would still satisfy it), and a report version and a `--tool-version` that disagree fail in both directions. `_versions_pinned` also could not see a curled binary's pin, which silently exempted tfsec from the test that keeps pin and ceiling in step — on an expired or unreasoned suppression, and on a ceiling/scanner set mismatch in either direction. All three scanners are pinned exactly, because for a ratchet the scanner version is the behaviour. GitHub push-protection remains the always-on hard secret gate) | — |-| Signed / attested release artifacts | (implied by "run next to crown jewels") | `release.yml` + `publish-images.yml` (cosign keyless signatures, CycloneDX SBOM attestation, BuildKit SLSA provenance + SPDX SBOM per image; SHA-pinned actions), `build-extensions.yml` (extension cosign) | GATED | - |-| Insecure defaults hard-fail in production | (implied by self-host) | `ci.yml` api tests (`test_security_defaults.py::test_enforce_*`; `enforce_secure_defaults` raises at boot in production) | GATED | - |-| OpenAPI stability for 3 SDKs + MCP | (implied by SDKs) | `check-openapi.yml` (drift) + `openapi-breaking.yml` (`scripts/openapi_diff.py` — PR spec vs base fails on removed endpoint/schema/field, type change, tightened request, or dropped enum value). A deliberate break goes through the `breaking-change-approved` PR label, which still runs the detector and records every break it permits plus the CHANGELOG `### BREAKING` note that justified it; `--allow-breaking` requires that note as an argument, so the bypass cannot be wired up without the record. Four of the tests assert the *workflow* reaches the flag — it previously had no caller at all | GATED | - |-| Ingested events land in the queryable ClickHouse lake | README (SIEM / lake) | `integration.yml :: spine` (Phase A1 — after the spine ingests, asserts `SELECT count() FROM aisoc.raw_events > 0` against the live ClickHouse container; `services/fusion` `LakeWriter` archives every normalized event) | GATED | - |-| Detection rules fire on the live event stream (not just CI fixtures) | README L170 (detection engine) | `integration.yml :: spine` (Phase A2 — posts an event matching the native `aws-root-account-login` rule, asserts the fusion `DetectionEngine` produces the alert) + `validate-detections.yml` (exported-ruleset drift `--check`) + fusion `test_detection_engine.py` / `test_detection_matcher_parity.py` | GATED | - |-| Three-model AI: behavioral (UEBA) model feeds alert scoring in production | README (multi-model) | `ci.yml` fusion job (`test_ueba_signal.py` — the `ueba.anomalies` stream warms a per-entity cache that boosts fuse-time confidence + anomaly score; wired in `fusion_engine.process`) | GATED | - |-| Agent auto-triages every alert (not manual/API-only) | README (autonomous triage) | `ci.yml` agents job (`test_fused_alert_worker.py` — `FusedAlertTriageWorker` consumes `aisoc.alerts.fused`, auto-triages each alert copilot/read-only with cost-governor dedup + circuit-breaker, degrades to deterministic triage without an LLM key, never dispatches a response) | GATED | - |-| Connector credentials reach the SOAR executors (not simulation-only) + autonomy policy governs every real execution | README (SOAR / response) | `ci.yml` actions job (`test_credential_resolver.py` — per-vendor auth_config→executor-param translation pinned; `test_governed_dispatch.py` — Phase 9a `decide()` wired into live dispatch: above-tier ⇒ dry-run preview, dry-run-disabled ⇒ queued approval, L0 ⇒ blocked, executor never invoked when queued/blocked) | GATED | - |-| Rollback is real (not "return True"), post-action verified, and approvals are restart-durable | README (response / rollback) | `ci.yml` actions job (`test_rollback.py` — real vendor reverse calls, honest simulated/failed states, REVERSIBLE_ACTIONS gated against the actual reverse impls; `test_verification.py` — re-queries vendor, never a false VERIFIED) + slack-bot job (`test_timer_store.py` — pending SLA timers persist + recover across restart) | GATED | - |-| Environment-specific noise reduction (business context) applied post-fusion → pre-triage | README (noise reduction) | `ci.yml` agents job (`test_business_context_hotpath.py` — YAML when/then rules mutate severity/route/tags and suppress before any triage spend, wired into `FusedAlertTriageWorker.triage`; `AISOC_BUSINESS_CONTEXT_ENABLED` gate) | GATED | - |-| Related alerts auto-collapse into one ordered attack chain at fuse time | README (attack chains) | `ci.yml` fusion job (`test_attack_chain_grouper.py` — shared-entity alerts join one chain within the window, members ordered by MITRE kill-chain stage, cross-entity link via shared IP; wired into `fusion_engine.process` → `enrichments.attack_chain`) | GATED | - |-| Effective Permissions resolves against a live posture snapshot (not empty stub) | README (effective permissions) | `ci.yml` api job (`test_posture_loader.py` — assembles the Okta resolver snapshot from connector `get_resource_config` calls and resolves it; cloud providers consume a connector-provided reconciled snapshot; failures degrade to empty, never fabricated) + connectors `/connectors/{id}/resource_config` endpoint | GATED | - |-| Unified Data Explorer (NL + SQL across the lake) replaces the SIEM context-switch | README (data explorer) | `ci.yml` web-test job (`ExploreView.test.tsx` — NL question → `nl-query/translate` → `lake/sql` → BI table; raw-SQL run; source pivots to identity/graph/intel; error surfaced) + web-lint type-check | GATED | - |-| Autonomy posture is copilot-by-default with a visible per-action/blast scorecard | README (autopilot/copilot) | `ci.yml` web-test job (`AutonomyScorecard.test.tsx` — posture stays Copilot unless a high/critical-blast action auto-executes; distribution + override counts; rendered badge) | GATED | - |-| Broad SIEM/NDR/edge coverage (QRadar, Exabeam, Securonix, Devo, Netskope, Windows/Sysmon, Zeek/Suricata, syslog/CEF) | README (connector count) | `ci.yml` connectors job (`test_schemas.py` + `test_conformance.py` gate every connector; `test_siem_expansion.py` + `test_ndr_edge_expansion.py` pin each new connector's severity-ladder mapping) + `generate_connector_count.py --check` (registry-derived count, README phrase) | GATED | - |-| The console's `connector_type` vocabulary names only connectors the platform can ingest | `packages/types/src/generated/connector-types.ts` (the exported `ConnectorType` union) | `ci.yml` python-lint job (`scripts/generate_connector_types.py --self-test` then `--check` — the union is generated from `_CONNECTOR_CLASSES`, the `connectorProfiles` keys and the `connectorTypeCanonical` folds, so it cannot be hand-edited into naming something nothing resolves; the self-test hand-edits the output, deletes it, puts a union back in `connector.ts` and flattens a fold, and requires each to be caught) + `check_connector_profiles.py` (every member resolved against the normalizer and the registry, in both directions) + `tests/test_connector_types_generated.py` (13 cases: regeneration is idempotent, reversing the registry changes no byte, identity is read off the class so `jira_connector.py` -> `jira` and `tenable.py` -> `tenable_io` are not misnamed, and a new connector shows up as drift) | GATED | - |-| AI/LLM-usage governance: audit connector + detections + tiered lake storage | README (AI usage / storage) | `ci.yml` connectors job (`test_llm_usage.py` — OpenAI/Anthropic audit connector emits the dotted `event_type` the `llm-*` rules match) + `validate-detections.yml` (8 `llm-*` native rules replay) + api job (`test_storage_tiering.py` — hot/cold TTL-move policy + DDL gate; verified on live ClickHouse) | GATED | - |-| Outcomes compound: repeat alerts auto-suppressed from prior dispositions (measured, not estimated) | README (closed loop) | `ci.yml` agents job (`test_outcome_memory.py` — every durable triage outcome is written back as a per-signature prior; a later alert matching a trusted prior benign/FP disposition is auto-resolved WITHOUT re-triage; human priors trusted immediately, AI priors require corroboration, a prior TP never auto-closes) + api funnel `repeat_alerts_suppressed`/`repeat_suppression_rate` measured from `aisoc_outcome_suppressions` | GATED | - |-| Institutional memory nudges fuse-time confidence (bounded, per-tenant) | README (compounding memory) | `ci.yml` fusion job (`test_memory_nudge.py` — distilled per-signature priors nudge new alerts of that signature ±0.10 in `ConfidenceScorer`; unknown signatures unchanged; `MemoryPriorProvider` distils per-tenant priors from disposition history so one tenant never nudges another) | GATED | - |-| Scheduled hunt findings flow into governed detection proposals | README (proactive hunting → detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — a scheduled hunt that returns hits opens a DRAFT `DetectionRuleProposal` (source `hunt-finding`) into the propose→review→eval-gate→promote lifecycle; zero-hit / flag-off paths open nothing) **plus `test_hunt_scheduler_execute.py` + `test_event_warehouse_providers.py`, which gate the executor the lifecycle depends on** | GATED | this row was previously proven only by `test_wave1_loop_edges.py`, which injects an `executor` stub (`runner = executor or _execute_hunt`). The real `_execute_hunt` could not return a hit on any deployment, so the gate passed against a path that could not run — see the row below |-| A scheduled hunt runs against the SIEM the tenant connected in the console | (implied by hunt scheduling + multi-tenant) | `ci.yml` api job (`test_event_warehouse_credentials.py` — credentials resolve from the tenant's vault-encrypted `connectors` row, the query is tenant + enabled + type scoped in compiled SQL, a pinned connector id is still tenant-filtered, and an undecryptable secret is distinguishable from an unconnected one; `test_event_warehouse_registry.py` — a Splunk-only tenant is routed to Splunk rather than to Elasticsearch; `test_event_warehouse_providers.py` — each driver runs against its connector's URL with its connector's auth, and the SSRF allow-list is that connector's own endpoint) | GATED | the drivers are exercised against mocked vendor HTTP, not a live Splunk or Elasticsearch; a vendor-sandbox integration job needs credentials nobody has provisioned |-| Analyst disposition history drives human-approval-gated tuning proposals | README (self-improving detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — the previously-orphaned `suggest_tuning` engine is wired to real per-rule disposition history via `/detection/tuning/auto-suggest`, opening DRAFT proposals; `test_detection_tuner.py` fixture-gates the engine) + `ci.yml :: Python — Lint & Type-check` (`check_raw_sql_columns.py` — every table and column a raw `text()` INSERT/UPDATE names must be one some migration creates) | GATED (the gap this row used to name was wrong in the repository's favour: no job ran `services/api/tests/` against a real database at all, and the only assertion on the insert was a substring test that would still have passed on the wrong table name, because the wrong name contains the right one. The structural gate caught what no mock could — `detection_rule_proposals` has never had a `source` column, so all three automated proposal paths raised on their first row on every deployment; migration 073 adds it) | — |-| Detections can be backtested over historical lake data before promotion | README (detection engineering) | `ci.yml` api job (`test_backtest.py` — bounded/allow-listed SQL construction with injection-sanitised source filter, lake-row→event mapping with JSON payload expansion, exact would-fire count + hit-rate + samples; `test_backtest_gate.py` — opt-in `AISOC_BACKTEST_MAX_HIT_RATE` /decide gate) + web type-check (rule-editor backtest panel) + `isolation-live.yml` (`tests/isolation/test_backtest_lake_live.py` — the real `fetch_lake_events` against ClickHouse 23.8, table built from `clickhouse/001_init.sql` and rows seeded through the production `lake_writer.event_to_row`) | GATED (the gap this row used to name was wrong: nothing ran the live fetch, and the tenant-scoping path existed twice — `detection_rules.py` carried its own near-identical copy, now deleted, with a test asserting exactly one definition survives. The live path exposed a defect no unit could: the writer stores OCSF `raw_data` into a column named `raw_payload` and `rows_to_events` expanded neither, so the payload expansion its docstring promises had never run on a real lake row. `services/api/app/services/backtest.py` was also absent from the workflow's path filter, so a change to the function under test did not trigger the job) | — |-| Detections can be authored in Python (`def rule(event)`) with a fixture gate | README (detection engineering) | `python-detections.yml` (`aisoc_detections.runner` fails a blind rule that misses a positive or a noisy one that fires on a negative; every bundled detection must ship ≥1 positive + ≥1 negative case) + `test_framework.py` (fail-closed evaluate, metadata validation) | GATED | - |-| AI Detection Builder: NL → rule + AUTO-generated fixtures → non-circular eval-gate → governed proposal | README (detection engineering) | `ci.yml` api job (`test_ai_detection_builder.py` — fixtures are DERIVED from the generated rule's own selection, not invented, and genuinely pass the non-circular gate: fires on the positive, quiet on the negative) | GATED | - |-| No-code / simple detection builder compiles to a valid rule | README (detection engineering) | `ci.yml` web type-check + lint (`SimpleRuleBuilder.tsx` `buildSigma` compiles field/operator/value rows to Sigma, dropped into the governed editor) | GATED | - |-| Response actions run under least-privilege for the invoking identity | README (autonomy + safety) | `actions` job (`test_authz.py` — `authorize_action` denies a principal lacking the action's blast-radius permission; tier hierarchy + wildcards; tenant binding) | GATED | - |-| Actions-service mutating routes are authenticated (fail-closed in prod) | README (autonomy + safety) | `actions` job (`test_authz.py` — `require_service_auth` returns 401 on a bad/absent bearer token, 503 when unconfigured in production, open only in dev mode) | GATED | - |-| Approvals are bound to a qualified approver (separation of duties) | README (autonomy + safety) | `actions` job (`test_authz.py` — `authorize_approver` requires the action's permission and rejects the requester approving their own action) | GATED | - |-| Customizable dashboard / report builder validates + renders | README (analytics + reporting) | `ci.yml` api job (`test_report_builder.py` — whitelisted widget types + data sources, unique widget ids, bounded size; render resolves each widget and is resilient to a failing/missing resolver; `/report-builder/render` wires the real tenant-scoped `alerts_by_severity`) | GATED | - |-| Agentless CSPM scans a cloud snapshot for misconfigurations | README (cloud posture) | `ci.yml` api job (`test_compliance_cspm.py` — public S3, world-open security groups on sensitive ports, IAM users without MFA / stale keys, public/unencrypted RDS + EBS all flagged with severity + control refs; clean resources yield nothing) | GATED | - |-| Security findings/detections map to compliance controls with auto-evidence | README (compliance) | `ci.yml` api job (`test_compliance_cspm.py` — MITRE→control mapping, per-control evidence records for detections + CSPM findings, unknown controls skipped) | GATED | - |-| Alerts fan out to Opsgenie / email / external-SOAR destinations (SSRF-guarded) | README (destinations + SOAR) | `ci.yml` api job (`test_compliance_cspm.py` — Opsgenie priority mapping, email subject/recipients, `aisoc.handoff.v1` SOAR envelope; outbound webhook guard blocks non-http(s) schemes + private/loopback targets) | GATED | - |-| Per-tenant configurable data retention with tenant-scoped purge | README (data lifecycle) | `ci.yml` api job: `test_retention.py` (purge SQL well-formed — clamped window, mandatory tenant predicate, parameterised cutoff) **plus** `test_retention_worker.py`, which asserts the worker issues the delete, that a dry run reports the blast radius without deleting, that the alert delete binds its tenant explicitly (the worker runs with row security off, so relying on RLS would purge every tenant under the first tenant's window), that per-tenant windows are not shared, that tenants without an explicit policy are untouched, and that the count SQL used for the preview has the same predicate as the delete | GATED | `audit_days` is storable but not purged: the audit log is an append-only hash chain, so truncating it invalidates every later verification. Needs chain-aware truncation with a re-anchored checkpoint. |-| Self-service field-extraction / transform pipelines (custom parsers) | README (data lifecycle) | `ci.yml` api job (`test_pipeline_transforms.py` — the whitelisted DSL renames/maps/extracts onto OCSF with dotted paths + ReDoS-proof grok `extract` (re.escape'd literals + fixed token map, no raw user regex); validation rejects unknown ops/tokens / oversized pipelines; fail-open per op never drops an event; input never mutated) | GATED | - |-| Every package the README tells a visitor to install either resolves, or says in the present tense that it does not | README (Try AiSOC in 60 seconds); each package README | `release.yml :: package-report` (`check_published_packages.py --require-network` asks npm and PyPI directly and writes the answer to the run summary; a package `.github/release-packages.yml` declares published that does not resolve fails the release, and so does one declared unpublished that does) + `ci.yml :: python-test` (root) runs `test_package_install_claims.py` (the same manifest, the same registry query, so the gate and the READMEs cannot disagree) and `test_release_publish_signal.py` (every upload step is guarded by the credential decision, and the job titles carry it) | GATED | The row previously read "…is published" and named `npm-publish` + `pypi-publish` as the gate. Those jobs prove a package is *packable*, never that it shipped: on v12.2.0 all eight reported success and all eight registries returned 404, because only the final upload step is credential-gated. The claim has been restated to what is true and enforced, and the gate moved to one that asks a registry instead of reading a job status |-| The install commands the README advertises actually run | README (on-ramp table) | `readme-gates.yml :: published-onramp` (runs `npx aisoc@latest triage --demo` and `pip install aisoc-sandbox && aisoc-sandbox demo` against the public registries on a clean runner with no checkout, Linux + macOS, daily as well as on diff; self-arming — warns while a package is unpublished, hard-fails once it exists and breaks) | GATED | - |-| Documentation links on the front door resolve | README / SUPPORT / CONTRIBUTING | `link-check.yml :: front-door` (hard gate over the five files a new visitor reads; `:: docs-tree` observes the wider documentation tree so pre-existing rot is burned down deliberately rather than blocking unrelated PRs) | GATED | - |-| The CLI makes no network call unless an endpoint is configured | `packages/aisoc-lite/TELEMETRY.md` | `ci.yml` aisoc-lite vitest (`telemetry.test.ts` — there is no default endpoint, and an enabled-but-unconfigured run is asserted to make zero `fetch` calls) | GATED | - |-| The visual assets the README embeds exist | README (console tiles + walkthrough) | `readme-gates.yml :: static` (`gate_demo_asset_references` covers `apps/web/public/screenshots/` as well as `demo/`, so a renamed or deleted tile fails instead of rendering as a broken image) | GATED | - |-| Groundedness: the agent asserts no indicator absent from the evidence it was given | README (groundedness axis) | `live-agent-eval.yml` (dispatches the real four-agent LangGraph pipeline against a locally-served model, scores every incident with `app.confidence.groundedness`, and `scripts/check_live_agent_floor.py` fails the run below the floor recorded in `services/agents/tests/eval_data/live_agent_floor.json`) + `ci.yml :: Python — Tests` (`test_groundedness_eval.py`, `test_groundedness_gate.py`) | GATED (three sub-claims, all now covered. The scorer is proven by `test_groundedness_eval.py`; `test_groundedness_gate.py` drives the real triage worker and proves an ungrounded `false_positive` at 0.97 confidence is demoted to `needs_review` rather than auto-closed; and the third — that *the live agent* asserts no indicator absent from its evidence — is now measured, because the workflow runs. It could not before: its live path imported `InvestigatorAgent`, a class that exists nowhere in `services/agents`, so the first dispatch failed in 92 seconds and every later one would have. **The floor is 0.40 on a deterministic 10-incident slice, derived from runs rather than chosen**: seven local runs returned 0.5561 to four decimal places (the agents decode greedily at temperature 0, so it is a point mass on one machine), while three GitHub-runner runs returned 0.5821, 0.5329 and 0.5933 — a spread of 0.0604, because a quantised model decoding on a different kernel diverges at the margins. The floor sits 0.1329 below the lowest run observed anywhere, about 2.2 times that spread, and still fails anything a quarter worse. The declaration carries every run behind it and the loader refuses a floor above its own evidence. **Scope, stated because it is narrow**: this grades a locally-served `qwen2.5:0.5b`, no hosted provider has ever been exercised, and the job is scheduled plus on-demand rather than per-PR because a threshold tight enough to be useful on a PR would be tight enough to flake on a runner nobody controls) | — |-| A live-agent eval can run with no funded provider key | (implied by the public eval harness) | `live-agent-eval.yml` (Ollama-hosted local model reached through `OPENAI_BASE_URL`; `--wet-limit` keeps it inside a CI budget, `--wet-require-live` stops a degraded run publishing substrate numbers as live-agent performance, and `check_live_agent_floor.py` asserts the result) | GATED (**observed**, not designed-for. [Run 36517390566](https://github.com/beenuar/AiSOC/actions/runs/36517390566) on `main` dispatched the real agent over ten incidents, placed 62 LLM calls, measured a groundedness of 0.5933 and cleared the floor — with no secret of any kind in the repository. This row previously said 0 runs, and the reason was not scheduling: the live path named a class that does not exist, and two further defects would each have published a number nobody measured — MITRE accuracy read a corpus key that is not there, so it would have reported `0.0000`, and a self-hosted model was priced against the gpt-4o rate card. A third shape slipped past `--wet-require-live` entirely: with the model pins unset every agent caught its provider error and used its deterministic path, and the run reported 0.8050 at 0.11s per investigation — so the harness now refuses a run that placed no LLM call, and the report carries `llm_calls_placed` beside the mean. Runtime is a real constraint and is handled rather than hidden: an unbounded completion ran to 40,960 tokens and twenty minutes on a runner, which is why `app/investigator/limits.py` bounds it — and a timeout reports as `cancelled`, not `failed`, so a run that measured nothing would not have looked like a failure) | — |-| Response actions are verified against the vendor, not assumed from a 200 | README (verified response) | `ci.yml` actions matrix (`test_dispatch_verification.py` — asserts the dispatcher reaches the verifier on the live path, that an action which reported success with the effect absent is downgraded to FAILED, and that `unverified` is never upgraded to a confirmation) | GATED | - |-| Host isolation is confirmed by reading real containment state | (implied by verified response) | `ci.yml` actions matrix (`test_verification.py` — a resolvable-but-uncontained host must score FAILED; `containment_pending` must not count as verified) | GATED | - |-| Autonomy is governed per tenant, not per deployment | `apps/docs/docs/concepts/automation-maturity.md` (L0–L4) | `ci.yml` actions matrix (`test_tenant_policy.py` + `test_dispatch_tenant_governance.py` — two tenants get their own tiers, an unreadable policy falls to a conservative floor rather than inheriting a permissive env default, and the L4 whitelist reaches `decide()`) | GATED | - |-| Repeat alerts matching a trusted benign prior are suppressed without re-triage | README (compounding loop), `/metrics/funnel` | `ci.yml` agents tests (`test_repeat_suppression_closes_the_loop.py` — asserts two *alerts* representing the same condition produce the same signature, and that a different detection on the same host does not collide) | GATED | - |-| A verdict is not auto-closed on reasoning the evidence does not support | README (groundedness axis) | `ci.yml` agents tests (`test_groundedness_gate.py` — an auto-closing verdict citing an indicator absent from the alert is demoted to `needs_review` at runtime, with confidence lowered to match) | GATED | - |-| Entity-graph reads are scoped to the querying tenant | `apps/docs/docs/architecture/graph-schema.md` | `ci.yml :: api tests` (`test_graph_tenant_isolation.py` — asserts `tenant_id` is actually bound to the driver, and that every node of every blast-radius path is scoped; `tenant_id IS NULL` is not accepted anywhere) | GATED | - |-| Analysts can hunt the events AiSOC itself ingested | README (hunt surface) | `ci.yml :: api tests` (`test_lake_hunt.py` — the translator IR compiles to parameterised ClickHouse SQL with the tenant predicate generated rather than rewritten in; no question text reaches the SQL string) | GATED | - |-| Business-context rules authored in the console affect triage | `apps/docs/docs/console/` (business context) | `ci.yml` agents tests (`test_business_context_per_tenant.py` — rules resolve per tenant from Postgres, one tenant's suppression cannot affect another, and an outage serves last-known rules rather than silently un-suppressing) | GATED | - |-| Seeded sample data never renders as a tenant's real state | Standing honesty rule (synthetic vs real) | `ci.yml :: python-lint` (`check_mock_data_gated.py` — fails the build on a `fallbackData` receiving sample data un-wrapped, on sample data assigned to state with no demo-mode check, and on a module-scope array of named entities carrying measurements in a component with no demo gate; the reviewed-exception list is checked in both directions so a stale exemption fails) + `tests/test_mock_data_gate.py` | GATED | the first two patterns needed a `MOCK_`/`DEMO_` name *and* a setter or `fallbackData`, so a fabricated table written inline under an ordinary name in a component that never fetched matched nothing — `MSSPDashboardView` and `TeamAnalyticsView` both shipped under a green gate until the third pattern was added; the check remains shape-based and cannot prove a view is honest |-| No fabricated value is reachable, and no component decides for itself that it is a demo | Standing honesty rule (synthetic vs real) | `ci.yml :: python-lint` (`check_demo_state_gated.py` — every read of a fabricated symbol must have a gate *in scope*, so a ternary, a factory call, or a constant assembled out of a mock all fail; and a `demoMode`-style local `useState` fails outright) + `tests/test_demo_state_gate.py` | GATED | the shape gate above accepts a file that mentions `demoFallback` anywhere — `SLADashboard.tsx` had it on line 446 and an ungated `isValidMetrics ? rawMetrics : MOCK_SLA_METRICS` on line 457, so 847 alerts and a 42.5m MTTR rendered on first paint and on error; this gate is scope-based rather than shape-based but still cannot prove a view is honest |-| Published executable-detection count matches what the engine loads | `docs/detections/truth-table.md` | `validate-detections.yml` (`detection_truth_table.py --check` now derives `executable` from `detection_ruleset.json` membership rather than file path and body keys; the old heuristic published 947 while the engine loaded 825, counted 77 Sigma rules with no evaluator, and would have certified a bulk un-quarantine as a no-op) | GATED | - |-| A detection rule matches on fields that exist in telemetry | (implied by the detection corpus) | `validate-detections.yml` (`check_detection_fields.py` — ratchets rules depending on computed fields such as sliding-window counters and allowlist booleans, which no connector can supply; fixture replay cannot catch these because fixtures are synthesized from the rule under test) | GATED (ratchet) | ratchet to 0 |-| Every shipped imported rule was observed to fire through the real connector and the real engine | README, `concepts/detections.md`, `docs/detections/sigma-compilation.md` | `validate-detections.yml` (`compile_sigma_ruleset.py --check` recompiles the ruleset and fails on drift, so no rule enters it without its proof replay producing a hit on a vendor-shaped event and nothing on an empty one; `--prove-gate` then reverts the Windows connector to its pre-lift behaviour and **requires all 1,687 Windows rules to stop firing**, so the proof is known to be capable of failing rather than merely never having failed. `check_detection_fields.py` is deliberately not the evidence here — its own docstring says it over-approximates and that "a false pass is a rule this gate should have caught") | GATED | reachability only: the gate proves a rule fires on a well-formed event of its own log source, never that it detects an attack or that it is tuned. There is no per-rule false-positive-rate gate and `false_positives:` is prose |-| Vendor fields nested under `raw_event` are visible to detections | (implied by the detection corpus) | `ci.yml` fusion tests (`test_detection_field_namespace.py` — 663 of 825 loaded rules referenced an invisible field before this; both the stateless and windowed engines now merge the payload identically) | GATED | - |-| A connector's alerts are attributed to that connector, not to Splunk | `apps/docs/docs/connectors/` | `ci.yml` ingest tests (`TestUnknownConnectorFallbackIsVendorNeutralAndPromotable` — the lenient fallback borrowed the `splunk_enterprise` profile, mis-attributing 26 connectors and, being category 4 with an empty severity map, making their events unpromotable) | GATED | - |-| Customer AI estate: routine agent activity is not auto-promoted to an alert | README (AI estate), `packages/aisoc-ai-sdk/README.md` | `ci.yml` ingest tests (`TestAiRuntimeActivityIsNotAFinding` + `TestAiGuardrailFindingIsAlwaysPromotable` — asserts the 6003/2001 split in both directions, since all-2001 floods the queue with an agent's normal operation and all-6003 leaves a detected injection silent in the lake) | GATED | - |-| AI prompt content does not leave the customer's process by default | `packages/aisoc-ai-sdk/README.md` | `ai-sdk.yml` (`test_ai_sdk.py` — hashed capture asserts no content is transmitted while still reporting which secret shapes were present; masked/full are opt-in per client) | GATED | - |-| The AI SDK never breaks or blocks the host application | `packages/aisoc-ai-sdk/README.md` | `ai-sdk.yml` (transport failure, full queue and unconfigured endpoint all assert a dropped span rather than a raise; a zero-runtime-dependency check stops the package pulling a transport library into a customer's resolution) | GATED | - |-| Every MCP tool call is accounted for | `services/mcp/README.md` | `ci.yml` MCP vitest (`telemetry.test.ts` — records successes and refusals, transmits argument keys but never values, bounds its buffer, and never raises on an unreachable inbox; the README previously claimed an audit trail the server did not emit and the API's audit middleware does not cover for read tools) | GATED | - |-| Windowed detection rules are declarable without editing the engine | `detections/splunk-imports/_quarantine/README.md` | `validate-detections.yml` (`export_windowed_ruleset.py --check`) + `ci.yml` fusion tests (`test_windowed_ruleset_loader.py` — a malformed rule is skipped individually, a duplicate id cannot shadow a builtin threshold, and zero thresholds/windows are refused) | GATED | - |-| The agent's abstention rate and groundedness are published | `/metrics/funnel` | `ci.yml :: api tests` (`test_triage_quality_metrics.py` — asserts `mean_groundedness` averages only scored verdicts, so the deterministic path is not counted as zero, and that a missing column degrades rather than failing the funnel) | GATED | - |-| UEBA baselines non-human principals (service accounts, AI agents) | `apps/docs/docs/` (UEBA) | `ci.yml` ueba tests (`test_non_human_entities.py` — the entity-type list widened without becoming free text, and a zero-variance baseline returns None rather than a 0.0 that would read as permanently normal) | GATED | - |-| Envelope encryption: per-secret DEKs wrapped by a KEK in KMS | platform-threat-model.md (information disclosure) | `ci.yml` api job (`test_credential_vault_envelope.py`) — vault writes `vault:v2` when enabled, distinct DEK per secret, `vault:v1` rows still decrypt after the switch, a v2 row fails closed if envelope mode is later disabled, and an unrecognised mode refuses to boot rather than silently writing v1 | GATED | KMS backends beyond AWS are implemented against the same protocol but not integration-tested |-| Tenant offboarding erases data from every store | operations (data lifecycle) | `ci.yml` api job (`test_tenant_deletion.py`) — the Postgres table list is discovered from `information_schema` rather than hardcoded (14 of 72 tenant-scoped tables have no FK cascade, so a hardcoded list silently orphans them), the tenants row is deleted last, a failed satellite store rolls Postgres back and reports `complete: false`, and global MITRE reference nodes survive the graph purge | GATED | Neo4j MERGEs shared entities on `natural_key` with `tenant_id` as a property, so deleting by tenant can remove a node another tenant also referenced; it re-creates on their next ingest |-| Per-tenant rate limiting on the public ingest inbox | operations (ingest) | `ci.yml` ingest job (`ratelimit_test.go`, run under `-race`) — separate request and event ceilings, one tenant cannot consume another's budget, a rejected batch consumes no quota, `Retry-After` always rounds up, and idle buckets are swept so the map cannot grow on an attacker-controlled dimension | GATED | limits are per replica (in-process), so the effective ceiling is rate x replicas; an exact global cap needs edge termination |-| A push to the ingest spine is authenticated and its tenant comes from the credential | README (connect real data), operations (ingest authentication) | `ci.yml` ingest job (`ingest_auth_test.go`) — two tenants are seeded and the outsider's own token is proved to write first, so the cross-tenant refusal cannot pass vacuously; `X-Tenant-ID` is intersected with the credential's scope rather than trusted, a service token with no declared tenant resolves to an empty scope and refuses instead of widening, a token minted for another template is refused, and a nil authenticator fails closed + `golden-pipeline.yml` (an unauthenticated push to the deployed service is refused, observed from outside) | GATED | - |-| Incident resolves to identity, asset, cloud, business and threat context | architecture (context graph) | `ci.yml` api job (`test_incident_context.py`) — the test parses the generated Cypher and asserts every matched variable is tenant-scoped or is a label holding no tenant data, that no variable-length pattern binds a global label (which would bridge tenants), that every dimension is row-capped, and that one failing or slow dimension neither hangs nor discards the others; plus `ci.yml` agents job (`test_bundle_incident_context.py`) for the bundle and prompt wiring | GATED | population of the new labels from connectors is separate work; the traversal returns empty until they are written |-| A failed context lookup is distinguishable from an alert with no context | architecture (context graph) | `ci.yml` api + agents jobs — an unreachable graph sets `partial` and names the failed dimensions, and the prompt states the gap explicitly rather than omitting it, because silence reads to a model as 'no context exists' | GATED | - |-| Graph schema changes are versioned and applied to existing deployments | architecture (graph schema) | `graph-schema-check.yml` — the drift gate now compares Go and YAML in **both** directions (it previously only failed when YAML declared something Go lacked, which is the opposite of how the code changes, and passed with 28 Go labels against 17 in YAML); the version is read from schema.go rather than duplicated a third time; and `app.db.graph_migrations` records applied migrations so a schema change lands on existing deployments, not just fresh installs | GATED | ClickHouse and Qdrant still have no migration mechanism |-| Investigations pivot through the estate rather than summarising one alert | README (recursive investigation) | `ci.yml` agents job: `scripts/check_investigation_depth.py` asserts the tool loop has a production caller (it shipped working with none), that every strategy names real tools, that every tool offered to the model is named by some strategy, and that selection discriminates rather than always returning the fallback; plus `test_deep_investigation.py`, where repeated calls to one tool count as one pivot and a tool reporting its data class is unavailable counts as none | GATED | the corpus arm of the gate grades recorded runs and is only exercised when the eval harness has been re-run |-| The model never writes SQL and never supplies its own tenant | architecture (investigation tools) | `ci.yml` api job (`test_investigation_tools.py`) — every tool composes parameterised SQL with the tenant bound from the session, an injected `tenant_id` argument is discarded, entity names from untrusted alert payloads are bound not interpolated, and row and lookback limits are clamped | GATED | - |-| A tool that cannot answer reports why, rather than returning nothing | architecture (investigation tools) | `ci.yml` api job — the four tools whose data class nothing ingests return `available: false` naming the connector that would populate it, never an empty result set (which reads to a model as 'I checked and found nothing'), and the test asserts the reason is an ingestion gap rather than an argument error, since both set the same flag | GATED | - |-| Identity, organisational and business context can be imported and is re-runnable | architecture (context graph) | `ci.yml` api job (`test_context_import.py`) — an import never deletes, omitted fields do not blank stored values, `is_active` is derived from `end_date` rather than trusted (an export claiming a departed employee is active would erase the finding this data exists to enable), ids are namespaced per tenant, an unrecognised criticality is rejected rather than coerced because the autonomy policy reads it, and a CMDB host or account the platform has never ingested is reported as a coverage gap rather than created as a node that looks monitored; plus `graph` package tests for CloudAccount derivation from ARNs | GATED | Vulnerability and Secret nodes still need a scanner and CSPM feed; the threat chain needs the threatintel writer |-| Every response action declares its impact, reversal, permission and verification | README (governed response) | `ci.yml` actions job: `scripts/check_action_contract.py` asserts every registered executor declares a coherent contract. Defaults are unsafe on purpose (irreversible + prohibited), so an undeclared action fails closed and is named rather than quietly becoming dispatchable. A HIGH-impact action with no verification probe fails here rather than in an incident, and a declared reverse capability absent from the vocabulary fails too - the rollback path would otherwise resolve to nothing while believing it has a route back | GATED | - |-| An executor that exists is reachable, and a capability that is declared is implemented | concepts/live-actions.md (reachability) | `ci.yml` actions job: `scripts/check_action_contract.py` compares the five registries a verb needs before it can be recommended and then dispatched — the legacy `ActionType` executor, the live-action adapter, the capability contract, the vocabulary, and what `services/agents` proposes by name — **in both directions**, plus `test_capability_reachability.py`, which injects drift in each direction and asserts the gate names it. `ack_alert` and `suppress_alert` had working Splunk, Elastic and Defender arms and appeared in none of the other three, so governed dispatch answered `executor_not_found` for code that ran; `create_ticket` and `notify` were registered and dispatchable while absent from the vocabulary they validate against. Both exemption lists are ratchets that fail when an entry gains an implementation and is not removed | GATED | both exemption lists are empty: `capture_forensics` gained a Defender investigation-package arm with a probe that reads the package back, `chatops_verify` gained `AWAITING_COMPLETION` so a delivered-but-unanswered prompt stops reporting as a completed action, and `add_ioc_to_blocklist` / `run_playbook` left the `ActionType` surface because neither had an implementation path |-| A verb the agent recommends is one the platform can actually perform | concepts/live-actions.md (reachability) | `ci.yml` actions job: `scripts/check_action_contract.py` parses every `ProposedAction(action_type=...)` call site in `services/agents` (including the conditional form `attack_path_agent` uses) and fails when a proposed verb has no executor, plus `test_capability_reachability.py`, which injects that drift and asserts the gate names the file and line. `investigation_agent` proposed `capture_forensics` on the C2 / exfiltration path with `requires_approval=True` and nothing implemented it, so the product raised an approval for evidence acquisition on its most serious incidents and answered `No executor found for action type` when an analyst approved — the other reachability checks compare the actions service against itself and could not see it | GATED | - |-| Approval is a function of confidence and impact, and only ever stricter | README (graduated autonomy) | `ci.yml` actions job (`test_approval_matrix.py`, 45 cases) - severe and irreversible impact never auto-execute at any tier or confidence, a contract demanding a human survives L4 at 100%, an unknown tier collapses to the most restrictive, and a missing confidence score is the lowest band rather than a free pass (otherwise a scoring bug becomes an autonomous action) | GATED | - |-| The actions capability mirror matches the connectors enum | capabilities.py (mirror contract) | `ci.yml` actions job - folded into the contract gate. capabilities.py has documented this check at `tests/test_capability_mirror.py` for months; no such file exists, which is how four reverse verbs the contracts name went missing from both sides | GATED | - |-| The benchmark is runnable against a third-party agent | README (public benchmark) | `ci.yml` agents job - `packages/aisoc-benchmark` defines a one-method adapter protocol with no import from this repository, plus an HTTP adapter, and the suite includes a live run against an external stub. A benchmark a vendor cannot run against their own product is a self-report | GATED | the published scoreboard still carries only our own runs; third-party submissions need a review process, not more code |-| Hallucination, abstention and calibration are measured, not estimated | README (public benchmark) | `ci.yml` agents job (`test_benchmark.py`) - hallucination is the fraction of cited indicators absent from the evidence the agent was given and is graded on abstentions too; accuracy is computed over answered incidents only so abstaining cannot raise it; and the calibration gap exposes an agent more confident when wrong | GATED | - |-| Benchmark figures declare the provenance of the corpus they came from | README (benchmark transparency) | `ci.yml` agents job - the runner refuses a corpus whose incidents do not declare provenance, the counts travel with the result so a consumer cannot drop them, `--limit` recounts over the slice rather than reporting the whole corpus, and the report prints provenance before any figure | GATED | the shipped corpus is 200 synthetic incidents; public-dataset and real-anonymised entries are supported by the schema but not yet contributed |-| Analyst disagreement becomes durable organisation memory | README (learning from analysts) | `ci.yml` api job (`test_analyst_feedback.py`) - the reason vocabulary is closed, corroboration counts distinct analysts rather than rows (one person clicking the same button ten times is one opinion), an approved-pentest statement expires within 14 days because one that outlives the pentest is an attacker's best friend, rule defects route to detection engineering rather than becoming a suppression that hides them, and a compiled statement names the process, principal, host and window rather than degrading to 'PowerShell is expected'; plus `test_feedback_context_statements.py` (both endpoints, and a service caller may not read a tenant it did not name) and the agents job's `test_organisation_memory_in_prompt.py`, which captures the messages handed to the model with and without a recorded disagreement and diffs them | GATED | the whole module was unreachable - `active_statements` had no caller and neither did `record_disagreement`, so the memory was neither written nor read. Both ends are wired: `POST /feedback/alert-override` takes an optional `reason_code`, and the agents triage worker reads `GET /feedback/context-statements` into the prompt. Still not surfaced in the console - an analyst can only tag a disagreement through the API |-| Backup artifacts are encrypted at rest and integrity-checked | architecture.md (backup & restore) | `integration.yml` backup-restore job: asserts the uploaded object carries the AiSOC AEAD header, has no gzip magic, leaks no schema names, and is listed in a SHA-256 manifest; then flips a bit and asserts restore refuses it. The job is no longer path-filtered at the workflow level, so it reports a verdict on every pull request and can therefore be a required check — a row marked GATED whose gate is not guaranteed even to run makes this file a liability rather than a control. `scripts/backup_crypt.py`, where every byte of the AES-256-GCM implementation lives, was missing from the old filter, so a change to the encryption itself did not run the gate that proves the encryption works | GATED | - |-| A human approval of a response action is authorized, not just logged | operations/action-approvals.md | `ci.yml` actions job (`test_approval_identity.py`) — an approval with no resolvable identity is refused, an unmapped ChatOps user cannot approve, a user below the action's blast-radius tier cannot approve, and separation of duties applies to a ChatOps approval; plus `test_interactions.py` and `test_callbacks_approver.py` assert the verified platform identity reaches the client rather than only the audit row | GATED | pending approvals are still an in-process dict, so they are lost on restart and not shared across replicas; nothing pushes a card proactively |-| A signed email approval link resolves and carries an identity | operations/action-approvals.md | `ci.yml` api job (`test_email_approval_endpoint.py`) — the path the issuer mints is requested rather than inspected in the route table, the recipient is signed into the token, swapping it breaks the signature, a token without one is refused rather than forwarded, and an already-decided action answers 409 | GATED | - |-| Every LLM call passes a fail-closed input contract before the request | operations/security.md (LLM input contract) | `ci.yml` agents job (`test_llm_contract_no_bypass.py`) — one gate AST-walks `.ainvoke`/`.astream`, a second flags any file in either service that names a completions endpoint and issues its own POST, each with a synthetic-bypass self-test; `ci.yml` api job (`test_llm_safety.py`) asserts per endpoint that it routes through the wrapper **and** no longer POSTs to a provider itself; `sync_vendored_llm_contract.py --check` keeps both services on one classifier | GATED | the contract is a minimum-leak control, not an injection sanitizer — that is `PromptInjectionGuard`, which demotes rather than refuses |-| A rule id names the same detection in the engine and in the catalogue | detections/truth-table.md | `validate-detections.yml` (`generate_detections.py --check` plus `test_detection_id_stability.py`) — the committed pack must reproduce byte-for-byte, YAML and engine ids are each compared against the lock, an id must name the same rule in both, and reordering the spec list must not renumber the engine | GATED | - |-| Which identity providers can resolve permissions live is stated, not implied | effective-permissions endpoint docstring | `ci.yml` api job (`test_posture_snapshot_coverage.py`) — a resolver registered without a declared snapshot source fails, the live-capable set is pinned, and a stale allow-list entry fails once its connector starts answering the posture sentinel | GATED | four of five providers cannot collect a live snapshot: no connector implements `__posture_snapshot__`, so they answer 412 rather than fabricating one |-| Config snapshots reach the graph when the feature reports enabled | architecture/graph-schema.md (`:CONFIGURED_AS`) | `ci.yml` ingest job (`http_provider_test.go`) — the provider's request shape is pinned against the served route, vendor-supplied ids are escaped so an ARN cannot inject a query parameter, a 501 is distinguished from an error, and the bi-temporal edge properties the schema declares are asserted present | GATED | `is_current` is set on write and never cleared, because closing the previous interval needs a read-modify-write the ingest hot path does not do |-| SIEM integrations are two-way: an AiSOC verdict reaches the finding that raised it | docs/integrations/siem-writeback.md | `ci.yml` actions job (`test_disposition_writeback.py` — a confirmed true positive escalates and is never closed, an unrecognised verdict is refused rather than normalised, and the taxonomy is compared against the agents service so a verdict present on one side only cannot silently mean nothing) + `test_siem_client_signatures.py` (every close and escalate arm autospec'd against its real client) + api job (`test_siem_writeback.py` — refusals, simulations and transport failures all record `executed=False`) + fusion job (`test_source_finding_link.py` — `finding.uid` reaches `alerts.external_id`, and only a vendor with a writeback arm gets a link row) | GATED | - |-| No OSS default resolves to a specific deployment's hostname, so a self-hosted install never presents another deployment's host as its own | self-host contract; `apps/docs/docs/deployment/env-vars.md` (CORS default) | `hosted-hostname.yml` (`scripts/check_hosted_hostname.py` — an exact occurrence count per path, checked in **both** directions: a new or grown occurrence and a stale exemption whose occurrence is gone both fail, so an allow-list entry cannot outlive what justified it; the root is resolved from the working directory rather than `__file__` and verified against sentinels, a zero-match scan is reported as broken rather than clean, and `--self-test` runs first proving the detector separates known-bad from known-good and that the comparison rejects a vacuous pass; it also pins the six vendored `cors.py` copies byte-identical) + `tests/test_hosted_hostname_gate.py` (39 cases, including the ten runtime defaults that leaked and a check that the CORS-tuple extractor itself would notice the origin coming back) | GATED | - |-| A dry run never reaches a customer's vendor | live-action dry-run contract | `ci.yml` actions job (`test_dry_run_credential_strip.py` — each client factory's read set is re-derived from its own source and compared with the adapter's strip list, stripping that set is asserted to make the factory return `None`, and an end-to-end dry run with full credentials trips a wire if any factory returns a client) | GATED | the wire covers the four SIEM factories the writeback path uses; other vendors' adapters are covered by the strip-list equality check only |-| No route lets its caller name the tenant it reads; a tenant parameter is intersected with the caller's scope | (implied by multi-tenant); `tests/isolation/README.md` | `isolation.yml :: route-scope` (`scripts/check_route_tenant_scope.py` — an AST pass over all routes under `services/`, failing in **both** directions: a route taking a tenant identifier with no auth dependency, and a route accepting one without passing it through a scope intersection. Request-body models are read too, since a `tenant_id` on a POST body is the same hole as a query parameter. `--self-test` injects a violation of each kind, asserts two clean controls pass, and strips the verifier the one conditional exemption names to prove a stale exemption is dropped; the root comes from `git rev-parse` and the scan prints how many routes across how many files it opened) + `tests/isolation/test_route_tenant_scope.py` (the vendored HS256 verifier rejects `alg: none`, a refresh token, a wrong key and an expired token; an empty scope refuses rather than widening; and a two-tenant replay seeds A and B through the real `EntityRiskEngine`, asserts both genuinely hold rows, then asserts an anonymous caller, an undeclared service token and a console session for B are each refused A's entity-risk queue) + `sync_vendored_tenant_scope.py --check` (six copies byte-identical but for `SERVICE_NAME`) | GATED | `services/mesh` is exempt by design (Ed25519 + k-anonymity; a bearer token would break federation rather than secure it) and three MSSP routes that *define* a scope rather than read within one are exempt with the constraint that stands in for the intersection named per row |-| Every route authenticates, or is public for a reason that is itself checked | (implied by multi-tenant + RBAC); `apps/docs/docs/operations/security.md` | `isolation.yml :: route-scope` (`scripts/check_route_auth.py` — default-deny over all 601 routes under `services/`, reusing the same AST collector as the tenant-scope gate so the two cannot drift. A route without an auth dependency must appear in one of three tables, each carrying its reason: a probe module, a named public route, or an **in-band credential** route whose entry names the verifier and lapses the moment the handler stops calling it. Fails in both directions — an unexplained route fails, and an exemption that no longer matches an unauthenticated route fails as stale, so the tables shrink as routes are secured. `--self-test` injects an unauthenticated mutating route, asserts router-level and module-local `Annotated[..., Depends(...)]` auth are both recognised, and strips a live in-band entry to prove a stale one is dropped) + `tests/isolation/test_route_auth_default_deny.py` (the real agents routers over ASGI: an anonymous caller is refused on all seven previously-open routes including playbook create/execute/delete, a valid console session still gets a non-empty response, a service token declaring no tenant is 403, and forged / expired / `alg: none` / refresh tokens are each refused) | GATED | `services/mesh` stays exempt by design (Ed25519 + k-anonymity; a bearer token would break federation rather than secure it), recorded as a service-level entry whose reason the inventory prints |-| Every query on a tenant-scoped table filters on a tenant, however the row was addressed | (implied by multi-tenant) | `isolation.yml :: route-scope` (`scripts/check_tenant_query_predicates.py` — the predicate question the parameter gate structurally cannot ask, since a route matching on an id takes no tenant. Both the tenant-scoped ORM models and the tenant-scoped tables are derived from the tree (the model's `tenant_id` column, the migrations' DDL) rather than listed, so a new migration cannot slip past. Scoping is recognised structurally through five shapes — inline `.where()`, a `filters` list, a variable binding, a later `q = q.where(...)`, a join, and a helper that takes the statement and returns it filtered — plus a predicate on the authenticated principal's own identity, a key an **enforcing** guard already validated against the caller's tenant, and an RLS context bound on the connection where the table carries a policy. "Enforcing" is decided structurally: a guard whose result is tested in a branch that only logs demonstrably continues on failure and earns no credit, a guard whose callee raises does, and a callee this module cannot resolve is refused rather than guessed — the previous rule guessed yes, so a fail-soft guard written inline was indistinguishable from one that 404s. The session is excluded from the validated set by what it is used as (the receiver of a call), since `db` reaches every raw statement's name set and was crediting queries keyed on something else entirely. Raw SQL is parsed too, with docstrings excluded so prose about a query is not read as one. Undecidable cases sit on a **shrink-only ratchet**: each entry carries a reason, an entry whose statement is now scoped fails as stale, and `MAX_RATCHET` is asserted against the table's length so growth needs a number raised in the diff) + `tests/isolation/test_route_auth_default_deny.py` (two tenants seeded against a real database, both asserted to hold rows before either absence is asserted, then tenant B naming tenant A's `query_id` gets nothing back) | GATED | 32 ratcheted exceptions remain, each with its reason — credential lookups that *establish* a tenant, deliberately cross-tenant MSSP portfolio reads, background workers that have no caller, and two SQL-fragment builders whose only caller appends the predicate. The two ledger writes that were ratcheted as "scoped by an RLS context" are gone: the rule now recognises that shape structurally, and re-checking it found the mechanism did not work — the agents service was setting `app.tenant_id`, which no policy reads |-| Every tenant-scoped table carries an RLS policy, and a policy that cannot engage says so rather than reading as protection | `apps/docs/docs/operations/security.md` (multi-tenant isolation) | `integration.yml :: migrations` (`tests/isolation/test_postgres_rls.py::test_every_tenant_table_is_protected_or_named` — both directions: a tenant-scoped table with no policy fails unless it is one of the named exclusions, and an exclusion that no longer describes an unprotected table fails as stale; `FORCE` is required on every one, since without it the table owner, which is the application, walks past the policy. `test_no_policy_reads_a_session_variable_nothing_sets` closes the bug class that made seven existing policies inert — four keyed on a GUC no code path sets, two raising `unrecognized configuration parameter` on an unbound session. `test_superuser_bypasses_rls_which_is_why_the_probe_role_exists` measures the shipped role's bypass so the coverage figure is never read as a live guarantee) + `check_tenant_query_predicates.py --inventory` (coverage derived from the migration text of all five schema chains, not one) | GATED | 93 of 96 — `approval_timers` joined the count in `062_approval_timers.sql`, having previously been created at runtime by `services/slack-bot`'s `PostgresTimerStore` and so covered by no chain, no policy and no `tenant_id`, on a table that decides whether a pending containment auto-rejects. The three left are named, not rounded away — `users` is excluded so authentication can resolve a principal before a tenant exists, and `case_tasks` / `case_timeline` are ORM models no migration creates, asserted still absent (both re-confirmed against a live `postgres:16` with the full chain applied: `users` is the only tenant-scoped table without a policy, and neither ORM table has a `CREATE TABLE` anywhere in the chain). The policies are no longer inert: `061_runtime_app_role.sql` moved every deployment surface onto a role with neither attribute, and the row below gates it |-| The role the services connect as is subject to row-level security, and the cross-tenant workers still see every tenant | `apps/docs/docs/operations/security.md` (the role the services connect as) | `isolation.yml` (`scripts/check_runtime_db_role.py` — fails when a runtime DSN connects as the role that surface provisions as the database superuser. Structural: the privileged role is read out of `POSTGRES_USER` / `db_username` in the tree, not matched against a name, so renaming it changes nothing and a fourteenth service with a copied DSN still fails. Both directions — a *migration* DSN that is **not** the owner fails too, since the runtime role holds no DDL and that deploy dies on the first `CREATE TABLE`; a surface containing a Postgres URL that the parser could not read fails as a blind spot rather than passing; and an `aisoc-db-role: owner` exemption left behind after its DSN moved fails as stale. Thirteen classifier fixtures run *before* every scan, and a run that matched no surface exits non-zero. Two directions were added once the four alembic services were modelled the same way: **which credential applies each chain**, discovered from every `alembic.ini`'s `script_location` rather than from a list of four paths, failing when a chain names no `*DATABASE_MIGRATION_URL` at all, when it names one no deployment surface sets, or when its `env.py` cannot be read; and **a DSN handed to a service that cannot read the variable**, resolved from the compose `build.context` to the service's own source plus its pydantic `env_prefix`. Against `origin/main` the extended gate produces seven findings where it previously printed OK) + `integration.yml :: migrations` (`--dsn`, which reads `pg_roles` and `pg_class` on a live database and catches `rolsuper`, `rolbypassrls`, ownership of a covered object, a view without `security_invoker`, and a role still accepting the password `002_rls.sql` shipped) | GATED | The parser's own blind spot was found by enumerating what it **credited**: `infra/terraform/main.tf` declares `db_username = var.db_username` and interpolates `${var.db_username}`, and the naive compare read those as two roles — so the one surface handing the RDS master user to every service was recorded as compliant. The same method found the next one: `docker-compose.yml` set `DATABASE_URL=aisoc_app` on `honeytokens`, `purple-team` and `osquery-tls` and the gate credited all three, while each read only its prefixed spelling and fell back to a default naming the *owner* — a role switch that reached none of them behind a compliant-looking surface. A docstring mentioning ``DATABASE_URL`` in prose credited a fourth until the reader was narrowed to non-docstring literals. A managed Postgres still needs the operator to create the role's login; the compose stacks and CI do it themselves |-| A cross-tenant worker that stops seeing data says so instead of reporting success | `apps/docs/docs/operations/security.md` (a session that never bound a tenant) | `isolation.yml` (`scripts/check_rls_policy_shape.py` — every surviving policy in all five schema chains must carry the `OR current_tenant_id() IS NULL` arm, because ingest, fusion, the retention purge and the schedulers read on a session that binds no tenant and would otherwise see zero rows and report success. Replays the chain in order so a definition a later migration repaired is not reported, which is what lets the seven broken policies stay in the tree as history instead of being silenced by an ignore list. Both directions: a policy reading a GUC nothing sets, or omitting `missing_ok`, fails from the other side; a schema file that enables RLS but yields no policy fails as a blind spot; `ENABLE` without `FORCE`, and `ENABLE` with no policy, both fail) + `services/api/tests/test_retention_worker.py` (the sweep refuses, and issues no delete, on a session that has a tenant bound) | GATED | Two blind spots in this parser were found by counting what it credited rather than what it flagged: the four alembic chains build SQL by implicit string concatenation with no `;` so none of their twelve tables parsed, and the first fix then read each revision's `downgrade()` too, so create and drop cancelled and the policy count did not move. The static set is a deliberate **superset** of the live one — two policies in `002` sit behind an `IF EXISTS` a text replay cannot evaluate — which is the safe direction |-| Documentation and marketing name no competitor product, while vendors AiSOC integrates with stay named | AGENTS.md (naming rule); docs portal + benchmark comparison tables | `competitor-names.yml` (`scripts/check_competitor_names.py` — an explicit name list plus a path allow-list for integration surfaces, both checked in both directions: a dead pattern, a stale allow entry that no longer excuses anything, and a drifted comparison-table marker each fail rather than reporting a clean tree; the scan prints the absolute root and file count so it cannot report on a tree it never read) + `tests/test_competitor_names_gate.py` (42 cases, including `Torq` asserted as a competitor in prose *and* left untouched across its connector module, manifest, docs page and tests) | GATED | the name list is AI-SOC/SOAR rivals; vendors that are purely integration targets are deliberately absent from it and are instead held out of the pinned comparison-table regions, which are checked against a wider vendor list |-| The published playbook schema describes the engine that runs playbooks | concepts/playbooks.md (step table + `x-aisoc-execution`); `schemas/playbook.schema.json` | `ci.yml` P2 job (`scripts/check_playbook_schema_parity.py --self-test` — compares the schema enum, the `StepType` enum, the engine's `_HANDLERS` table, the `x-aisoc-execution` map, `bounds.py` and the pack validator's trigger list, **every pair in both directions**; refuses to run on a tree missing its marker files instead of printing OK about files it never opened, and names the root, schema, step counts and playbook count it inspected) + `scripts/lint_playbooks.py` (every `*.playbook.json` in the tree, not the two it used to scan while reporting "2/2 passed") + `tests/test_playbook_schema_parity_gate.py` (18 cases; drift injected in each direction and the gate asserted to name it) | GATED | the `governed` execution class is compared against `engine.RESPONSE_STEP_TYPES` in both directions, and the published `StepType` union in `packages/types` against the engine's, because that file had drifted into a fourth 28-member vocabulary nothing imported. `approval` is the one remaining unimplemented type and the schema says so |-| A step a playbook engine cannot run never reports that it ran | concepts/playbooks.md (error handling) | `ci.yml` agents job (`test_playbook_engine_correctness.py::TestUnimplementedStepTypesFailClosed` — an `approval` gate the engine cannot honour halts the run instead of passing it, every handler-less `StepType` is asserted to fail rather than succeed, a missing handler is not retried, an explicit `on_failure: continue` is still honoured, and a dry run reports `would_fail` rather than a bare `dry_run: true`) | GATED | - |-| A playbook step that names a response verb reaches governed dispatch | concepts/playbooks.md (governed step table) | `ci.yml` agents job (`test_playbook_action_bridge.py` — every member of `RESPONSE_STEP_TYPES` is asserted to produce one dispatch, each carrying its own step id, so the contract is applied per step rather than per playbook) + `ci.yml` api job (`test_playbook_step_dispatch.py`) + `ci.yml` P2 job (`check_playbook_schema_parity.py` compares the schema's `governed` class against `engine.RESPONSE_STEP_TYPES` in both directions, so a verb labelled governed that the engine answers locally fails the build) | GATED | `approval` is deliberately not bridged: the engine has no pause to suspend, and per-step grading has replaced the need for it |-| A playbook step that did not touch a vendor never reports that it did | concepts/playbooks.md (status table) | `ci.yml` agents job (`test_playbook_action_bridge.py::TestNoFakeSuccess` — each of six non-executing outcomes fails the step and the run; `awaiting_completion` is asserted to count as executed and `pending_approval` not to, because collapsing that pair loses an action in flight or invents one that never ran) + `ci.yml` api job (`test_playbook_step_dispatch.py::TestHowItReadsTheResult` — every `LiveActionStatus` maps to one honest outcome and an unrecognised status is treated as not executed) | GATED | execution is off by default (`AISOC_PLAYBOOK_ACTIONS_EXECUTE`), so out of the box a response step previews and says so |-| The capability contract is applied on the registry-driven dispatch path, not only on `POST /actions` | concepts/live-actions.md (contract belongs to the verb) | `ci.yml` actions job (`test_dispatch_capability_contract.py` — a verb the blast table calls medium is held at its declared high impact, a contracted verb with no `ActionType` is governed rather than skipped, missing confidence is the lowest band, a read-only verb is not gated, and the contract is asserted unable to lower a verdict blast radius already gated) + `test_dispatch_tenant_governance.py` (a tenant `force_auto` override lifts the tier ceiling and cannot lower a contract that demands an analyst) | GATED | probes are keyed on `ActionType`, so a contracted verb without one reports `unverified` with the reason rather than leaving the field blank |-| The documented playbook upgrade command exists and produces valid output | docs/upgrade/MIGRATION.md (Step 5) | `ci.yml` P2 job (`tests/test_upgrade_playbooks.py` — a v3 playbook is asserted not to validate before and to validate after, against the real `schemas/playbook.schema.json`; every declared rename must land on a type the schema declares; the four types with no v4 equivalent are reported and left unchanged rather than mapped onto a nearest neighbour; check mode writes nothing; an empty scan is a failure, not a clean bill of health) | GATED | the doc previously named a script that did not exist, beside a field table whose v4 column named four spellings the schema rejects |-| Every `ActionType` resolves a capability contract, so the confidence matrix is never skipped | concepts/live-actions.md (the one alias, and when it goes) | `ci.yml` actions job (`scripts/check_action_contract.py` directions 7 and 8 — every `ActionType` must resolve a contract by name or alias, and every alias must key a real `ActionType`, point at a real contract, not shadow a capability of the same name, and describe a bridge some adapter actually implements) + `test_approval_gate_wiring.py` (`notify_slack` at 10% confidence was approved for auto-execution and now requires an analyst; the alias is asserted unable to *lower* a requirement) | GATED | one alias entry (`notify_slack` -> `notify`), with its retirement condition recorded: it goes when `ActionType` does |-| Every check this matrix names is actually run by CI | this matrix (each row names a gate) | `ci.yml` (`scripts/check_gate_coverage.py` — resolves the whole graph rather than reading workflow names: workflows, `make` recipes they invoke, the pytest suites they collect and the scripts those reach, so a check wired only through a test still counts. Both directions — a check no workflow reaches, and a workflow step naming a `scripts/` path that does not exist. `--self-test` runs first and asserts the resolver discriminates rather than returning "reached" for everything, and the corpus counts are printed so it cannot report on a tree it never opened) | GATED | the ratchet for a deliberately-unwired check is empty; it may shrink, never grow |-| What counts as a check is decided by what a script does, not what it is named | `scripts/check_gate_coverage.py` (the inventory it reports on) | `ci.yml` (three structural signals, all read from the tree: a declared verdict flag, an exit status derived from findings the script accumulates, and a workflow job whose output another job branches on. The first two are intrinsic, so an uncalled gate is still inventoried and the `SCRIPT -> WORKFLOW` direction is not vacuous. The classifier is also checked in reverse — a script CI runs with `--check` that the classifier does not inventory fails as `classifier-blind-spot`) + `tests/test_gate_coverage_classifier.py` (10 cases, including a gate planted under a name no convention would reveal, and a generator that aborts on an empty read asserted *not* to be a check) | GATED | - |-| No check reports OK over a repository with no content | every row above (a gate that credits an empty tree proves nothing about a full one) | `ci.yml :: python-test` (`scripts/check_gate_contract.py` — runs all 72 inventoried checks the way a workflow runs each one, inside a git repository holding only `scripts/`, and requires a non-zero exit. Two tree shapes, because they are two questions: **bare** omits the directories a gate judges, **skeleton** creates them empty. The second is the one that happens — a renamed package, a glob that stopped matching — and a gate opening with `if not X.is_dir(): return 2` answers the first for a reason that says nothing about its corpus. Measured before it was added: 64 of 71 checks already refused the skeleton, so the exception list stayed readable rather than doubling. A run that failed for a reason the empty tree did not cause — an argparse usage error, or an import of a module the repository does not supply — is INCONCLUSIVE and fails rather than counting as a refusal, so the gate cannot credit a failure it did not cause. Exceptions are recorded with the disposition they are excused for and checked in both directions: an entry naming nothing, and an entry whose gate has started behaving differently, both fail) + `tests/test_gate_contract.py` (45 cases) | GATED | 5 recorded exceptions, keyed by tree shape; the probe cannot pose the question to a gate whose only input is a path named on the command line, or one that lives inside `scripts/`. One entry exists because its dispositions legitimately differ: `check_logger_kwargs.py` scans every Python file in the repository, so against a skeleton it has a real corpus in `scripts/` and correctly finds nothing wrong |-| Every check resolves its root from git and carries a `--self-test` | `scripts/` (the gates themselves) | `ci.yml :: python-test` (`scripts/check_gate_contract.py` — a check that derives a repository root from `__file__` without consulting git fails as `root-from-file`, and one that declares no `--self-test` fails as `no-self-test`. Both read from the syntax tree: the first spelling matched `repo_root` anywhere in the text and `check_gate_coverage.py` emits it as a JSON key, so a non-compliant gate read as compliant on the strength of a dictionary key in its own output. Both exception lists are empty — all 72 comply — and an entry added to either must carry a reason) | GATED | - |-| Every model AiSOC sends has a gateway that defines it, and the variable compose supplies is the variable the resolvers read | `apps/docs/docs/operations/llm-gateway.md`, `.env.example`, README (AI triage) | `ci.yml :: python-lint` (`scripts/check_llm_model_routing.py` — both directions on every name: each role pin's alias must be defined by `infra/litellm/config.yaml` and each alias must be claimed by a pin; every model named in `.env.example` or `docker-compose.yml`, in a file that wires the bundled gateway, must be one the gateway defines; every variable compose points at the gateway must be read by *both* resolvers, and every gateway variable the resolvers read must be set by compose — the defect that shipped was compose supplying `LLM_GATEWAY_URL` and both resolvers deliberately ignoring it, so AI triage could not reach a model at all; a service given the gateway URL must also get `LITELLM_MASTER_KEY`, because a provider key sent there is rejected. Every parser is AST- or comment-aware and the self-test proves it: the config's commented Ollama example repeats `model_name: aisoc-triage` verbatim, `.env.example` documents the escape hatch as a commented `AISOC_MODEL_PIN_TRIAGE=`, and compose explains the gateway in prose two lines above the key it describes — a line regex credits all three) + `services/agents/tests/test_llm_factory.py` + `services/api/tests/test_model_aliases_routing.py` | GATED | Embeddings are a recorded exclusion — the gateway's model list is chat aliases only — and the gate checks that in both directions rather than trusting the comment |-| Every test file in the tree is executed by a workflow | `CONTRIBUTING.md` / the suites themselves | `ci.yml :: python-test` (`scripts/check_test_discovery.py` — the corpus is `git ls-files`, so a service added tomorrow is scanned with no edit, and an untracked install tree is out by construction rather than by a name somebody remembered. Reach is modelled the way pytest collects: directory arguments, `--ignore`, `conftest` `collect_ignore`, and `-m` marker deselection, because a file whose every test is deselected runs nothing however plainly it is named. Both directions — an invocation naming a path that is not in the tree fails too. Quarantine is a shrink-only list where each entry carries a reason and an entry that has become reachable fails as stale. Two blind spots in this parser were found by counting what it **credited**: a step that `cd`s into a service and then names `tests/` had its paths resolved against the repository root, which reported all 82 agents files unreached *and* credited the root tree with a package's invocation; and `-m` was first skipped as "a filter, not a collection rule", which would have credited a file in full under `-m "not integration"`) + `tests/test_test_discovery_gate.py` | GATED | - |-| Every reported LLM cost is measured, labelled an estimate, or absent | admin cost dashboard, `/costs/dashboard`, `/investigations` run + aggregate responses, Investigation Ledger, `/metrics/funnel` insights, investigation summary export | `ci.yml :: python-lint` (`scripts/check_cost_provenance.py` — the tracker priced the `aisoc-<role>` **alias** against a table of hosted list prices it does not appear in, so every call fell through a `(0.001, 0.002)` default: a 903-token completion on an operator's own hardware reported `total_cost_usd=0.000999`, and that figure reached the cost dashboard, the funnel, the per-run ledger and the budget circuit breaker, which trips at `AISOC_BUDGET_HARD_USD`. Seven rules, each a structural relationship with both name spaces enumerated: every money field has the count that qualifies it and every provenance count qualifies a money field; every column the writer writes is added by migration 063 and every column 063 adds is written or read; neither pricing table carries a fallback rate and neither can key on an alias; the two gateway headers read are the ones carrying a **total**, not the five sharing their prefix that carry a component, an adjustment or a *percentage*; every provenance field on the wire exists on both the Python and TypeScript sides, which cannot import one another; and a console surface that renders a currency amount consults a provenance count first. Every parser is AST- or comment-aware, proven by nine blind-spot cases built from text already in the corpus — `gateway_cost.py`'s docstring enumerates all seven cost headers to explain why five are refused, `cost_telemetry.py`'s docstring names the removed `(0.001, 0.002)` default, the migration's `COMMENT ON COLUMN` statements repeat every column name, and `api.ts` documents fields in comments above them — a line regex credits all of them) + `services/agents/tests/test_cost_provenance.py` (22 cases, header fixtures captured from a real gateway) + `apps/web/src/components/admin/CostDashboardView.test.tsx` (first-paint assertion that a window with 1,287 unmeasured calls renders no `$` at all) | GATED | A measured `0.0` — what a local model genuinely costs — is a value and is reported as one; only an *absence* renders as not measured |-| Published detection / marketplace counts match the tree | landing page (`Hero.tsx`, `ConnectorsMarquee.tsx`, `FeatureGrid.tsx`, `Pillars.tsx`), `ContributorLeaderboard.tsx` | `ci.yml :: python-lint` (`generate_corpus_stats.py --check` — the counts are generated into `apps/web/src/data/corpus-stats.json` + `corpusStats.ts` and imported, so a surface cannot carry its own literal; the generator reconciles three independent sources against each other — the compiled engine ruleset, `docs/detections/truth-table.md` and `marketplace/index.json` — and refuses to publish if they disagree. The landing page previously gave three different wrong answers at once: 6,998 detections in four places, 7,117 marketplace items, and 218 rules on the leaderboard, with no gate on any of them) | GATED | - |-| The corpus figure the product executes is distinguished from the corpus on disk | landing page, `docs/detections/truth-table.md` | `ci.yml :: python-lint` (`generate_corpus_stats.py --check` emits `executable` and `onDisk`/`quarantined` as separate fields and the UI leads with `EXECUTABLE_DETECTION_COUNT`; most of the indexed corpus is never loaded, so quoting the on-disk figure as the detection capability presents rules that cannot fire as executable) | GATED | `_quarantine/` membership is no longer a proxy for either figure — the Sigma compiler translates rules in place, so 1,724 files under that directory are loaded. Every count in the tree now derives from the compiled ruleset; anything classifying by path reports ~1,700 too many as inert |-| The retracted 75.3% alert-reduction figure is never presented as a measurement | `apps/docs/docs/benchmark.md`, `benchmarks/alert-reduction.md`, `BenchmarkResults.tsx`, `ComparisonTable.tsx`, `benchmark/page.tsx` | `ci.yml :: python-lint` (`check_alert_reduction_claims.py --check` — scans every published surface: no file may assert the legacy harness runs the production grouping ("faithful re-implementation", "same logic"), any file quoting 75.3% must carry the retraction, the `alert_reduction` suite card may not be declared `kind: 'measurement'`, and every surface publishing the real figure must quote `PUBLISHED_REDUCTION_PCT` from `services/fusion/tests/test_alert_reduction_real.py`, which that test asserts against its own measurement — so the chain from measurement to prose has no hand-copied link. `benchmark.md` had withdrawn the claim while two other surfaces went on asserting it, and `benchmark.md` itself re-asserted it in its own intro blockquote) | GATED | - |-| The same verb is graded identically whichever dispatch door it arrives through | README (graduated autonomy); `concepts/live-actions.md` | `ci.yml` actions job (`test_approval_doors_agree.py` — both live doors driven over 23 capabilities x 5 tiers x 3 confidence bands, 345 combinations, asserting the same answer to "did a vendor get touched without a human". A dry-run preview does not count as a touch, since the registry door downgrades an over-tier request to one. Against the previous tree it reports 5 disagreements: `search_siem` is read_only and automatic and sat in the analyst queue at the default tier while executing through the other door, because `TIER_MAX_AUTOMATIC["L1"]` said a tier the ladder defines as "MINIMAL blast-radius actions are automatic" auto-executes nothing; and `update_alert_disposition` was the one ActionType with no `ACTION_BLAST_RADIUS` entry, which is not a missing entry but two different ones, since the four readers of that table supply two different fallbacks. Structural checks alongside it fail a door that imports the raw matrix or compares against a specific `ActionImpact` inside its grading path — the shape a re-introduced bypass has — and require every `ActionType` to carry an explicit blast radius so neither fallback decides anything) | GATED | the grading itself is one function, `approval_matrix.evaluate_contract`, rather than two kept in agreement by discipline; the sweep exists for the axis it cannot unify, which is each door's separate blast-radius layer |-| An image the deployment files tell an operator to pull exists, at the tag they will request | README quickstart (`docker compose up`), `docs/deployment/*`, `infra/helm/aisoc` | `image-availability.yml` (daily) + the `verify` job of `publish-images.yml` and `release.yml` (`scripts/check_published_images.py` — resolves every reference in `docker-compose.yml` and the chart the way the tooling that reads them does, `${AISOC_VERSION:-latest}` to its default and an empty chart `tag:` to `Chart.AppVersion`, then asks GHCR. `--require-fresh` also compares the version the tag names, or the `VERSION` at the commit the image records in `org.opencontainers.image.revision`, against the tree. Against `main` before this gate existed it reported 14 findings: `aisoc-web:latest` two releases behind, `aisoc-web:v11.0.0` never pushed, three images named by compose that had never been published once, and a chart whose every tag defaulted to a `Chart.AppVersion` no image carried. Offline it prints SKIPPED rather than OK, and `--require-network` makes that a failure) | GATED | Third-party images (`postgres`, `redis`, `ghcr.io/berriai/litellm`) are named and counted but not resolved: the claim is about the images this project publishes, and anonymous third-party registry reads are rate-limited per runner IP. Existence is not asked on a pull request, because a PR that adds a service names an image that cannot exist until it has merged and published |-| An analyst label AiSOC cannot name is excluded from evaluation rather than guessed | `apps/docs/docs/evaluation/replay.md`; `services/actions/app/services/alert_history.py` (the taxonomy and its refusal rule) | `ci.yml` actions job (`test_alert_history.py`: each of the five SIEM readers is driven over its real HTTP path against vendor-shaped payloads with a mock transport, so a wrong endpoint, a wrong filter or a parser that KeyErrors on the documented shape fails here rather than on a customer's history. The assertions that carry the claim are the negative ones: every vendor's explicit "I do not know" (Splunk ES dispositions 5 `Other` and 6 `Undetermined`, Sentinel `Undetermined`, Defender `Unknown`, a site-custom QRadar closing reason, an untagged Elastic signal) is asserted to land on `unlabeled`, two conflicting Elastic tags yield `unlabeled` rather than a coin flip, and `unlabeled` is asserted **not** to be a member of `CANONICAL_DISPOSITIONS` so nothing downstream can score it as a verdict. `ClosedFinding.__post_init__` refuses a disposition that is neither canonical nor `unlabeled`, so a mapper cannot invent a third vocabulary. An unparseable close time raises rather than defaulting to now, because a silently-wrong close time puts a row on the wrong side of the train/test split and leaks the answer into its own evaluation) | GATED | Reachability and taxonomy only: the gate proves each reader parses its vendor's documented shape and refuses to guess, never that a given deployment's history is complete. Elastic ships no disposition field at all, so an untagged Elastic deployment yields no labels and the replay report says so rather than grading on zero |-| Uploading a customer file for analysis is off by default, per tenant per provider | `operations/sandbox-providers.md`; `POST /api/v1/sandbox/files` | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, which drives the real `evaluate_upload` over all 24 combinations of provider class x air-gap x consent x hash-known and requires a refusal for every one that is not "consented, unknown hash, provider accepts uploads, not air-gapped", then requires air-gap to outrank consent and a known hash to outrank consent. An AST pass separately fails any consent-shaped flag that defaults to `True`, anywhere in the package or the route module. Proven against injected violations of each rule, not only against the tree that satisfies them) + `ci.yml :: api tests` (`test_sandbox_upload_policy.py`, where the mock provider records every byte handed to it, so "nothing was uploaded" is asserted against what the provider received rather than inferred from a return value) | GATED | - |-| Hash lookup is tried before any file is uploaded | `operations/sandbox-providers.md` (upload policy) | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, which reads `analyse_file`'s AST and fails when `evaluate_upload` is called before `lookup_hash`, or `submit_file` before `evaluate_upload`, so the ordering cannot be lost to a refactor that keeps all three calls) + `ci.yml :: api tests` (a seeded hash returns `known` with the provider's upload log empty) | GATED | - |-| Air-gapped mode permits local analysis providers only | `operations/sandbox-providers.md`; `core/airgap.py` | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, which requires every adapter must declare `local=` on its `ProviderCapabilities`, so a new provider cannot be added without air-gap mode being able to classify it) + `ci.yml :: api tests` (`test_air_gap_mode_refuses_non_local_providers`, where the hosted provider is excluded from `usable_names()` while remaining visible in `names()` with its reason, and the local one becomes the default) | GATED | the registry gate is over the adapters in `providers/`; a provider constructed outside it would not be seen, which is why `build_registry` is the only assembly path |-| A file-analysis failure reaches an agent as "could not check", never as a clean result | `operations/sandbox-providers.md`; agent tool `lookup_file_hash` | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, whose AST pass fails any `except` block that constructs a `SandboxReport` or returns `outcome="known"`/`"not_seen"`, which is the shape that turns a provider outage into a benign verdict) + `ci.yml :: api tests` (`TestFailureIsNotACleanResult`, where a miss and a failure are asserted to produce different outcomes and different wording, and an unreachable provider is reported under `could_not_check` rather than folded into "no result") | GATED | the agent-side tool's wording is asserted in `services/agents/tests/test_sandbox_tool.py`; the model's interpretation of that wording is not gated and cannot be |-| A report field the provider does not publish reads "unavailable", never zero or empty | `operations/sandbox-providers.md` (provider contract) | `ci.yml :: api tests` (`test_sandbox_providers.py`, driven against a **recorded** report whose `attackTechniques` is `[]` beside `behavior.analyzed: false`; the adapter must return `UNAVAILABLE` with the stage's own reason attached, and the same payload with the stage marked run must return a real empty tuple. A missing score must not read as 0 and a missing IOC section must not read as "none found") | GATED | the recorded payload covers one provider and one shape of absence; CAPEv2's equivalents are synthetic because no live CAPEv2 instance was available |-| Replay evaluation runs the production triage path, not a copy of it, and writes nothing while it does | `apps/docs/docs/evaluation/replay.md`; `services/agents/app/replay/runner.py` | `ci.yml` agents job (`test_replay_shadow_no_writes.py` — every durable write on the triage path is monkeypatched on the **real** module to raise a `BaseException`, then a replay is run: a `BaseException` because the worker wraps most of its writes in `contextlib.suppress(Exception)`, which is correct production behaviour and is exactly what would let a leaked write pass a gentler guard. Zero writes is asserted as a *count* rather than as an absence, since a replay that stopped replaying and a replay whose writes were suppressed both write nothing and only the counter tells them apart. That the path is production's is pinned two ways: the worker's default sinks are asserted to be `LiveTriageWriter`/`LiveTriageContextReader`, and an AST pass over `services/agents/app/main.py` asserts the deployed worker is constructed without overriding either. `test_escalation_cannot_change_the_graded_verdict` drives the real worker with a graph runner that rewrites the verdict and asserts the returned summary is unmoved, which is what makes declining escalation in shadow mode sound rather than convenient) | GATED | Triage only. Fusion's correlation, fused confidence score, narrative and entity resolution are absent from a replayed finding; `ENVELOPE_LIMITS` is published in every report's method section rather than left as a comment |-| The test window of a replay cannot influence its own triage | `apps/docs/docs/evaluation/replay.md` (point-in-time context); `services/agents/app/replay/shadow.py` | `ci.yml` agents job (`test_replay_leakage.py` — three routes from a test-window decision back into a later one, each with its own test because one combined assertion would not say which broke: the outcome-memory prior that auto-closes a repeat without re-triage, the cost governor's dedup cache that short-circuits earlier still and leaves no ledger row or prior behind, and organisation memory read live into the prompt. Each is checked for **sensitivity** as well as for the guard: the memory test runs the identical corpus twice, once with the shadow sinks and once with a live reader and a recording writer, and asserts the second leaks at tier `memory`; the statements test asserts the frozen reader hands the agent the snapshot and that the same worker with the live reader picks up the poison. `capture_context` drops rows recorded after the split in both stores, and a snapshot taken at any other instant is refused rather than used) | GATED | Organisation-memory statements as `GET /feedback/context-statements` serves them carry no creation time, so the split filter has nothing to test them against and they are kept. The count is published as `statements_without_timestamp` in the report's method section rather than the freeze being claimed tighter than it is |-| A shadow verdict never fills in the analyst column it will be graded against | `apps/docs/docs/operations/shadow-mode.md`; `services/agents/app/workers/shadow_mode.py` | `ci.yml` agents job (`test_shadow_mode.py`) - the shadow sink is asserted to decline every acting method against a delegate that *records* rather than performs, so a forwarded call shows up as a recorded one rather than as an absence; `persist_auto_triage` is asserted to force `auto_closed` off and the `shadow` flag on; and the ledger statement is read to confirm `disposition`, `status` and `resolved_at` are each guarded by that flag with `NOT $10` rather than by the caller remembering to pass `auto_closed=False`. Plus `ci.yml` api job (`test_shadow_agreement.py`) - reconciliation only reads closed alerts and only writes decisions with `resolved_at IS NULL`, so a later change of mind cannot rewrite evidence a promotion already rested on | GATED | One limit. The SQL guard is read, not executed: there is no Postgres in the unit suites, so what is proven is that the statement carries the guard and binds the flag, not that Postgres evaluates the CASE as written. The caveat this row used to carry, that closures made in the customer's own SIEM reached no scheduler, is closed by the three rows below; D15 in the progress tracker records what it was |-| Agreement cannot be improved by declining to answer | `apps/docs/docs/operations/shadow-mode.md`; `services/actions/app/services/autonomy_evidence_rules.py` | `ci.yml` actions job (`test_autonomy_evidence_rules.py`) - the same ten right answers are scored with nothing declined and with ninety declined, and the agreement rate is asserted identical, because abstaining removes a decision from the numerator and the denominator together. The counterweight is asserted from the other side: a window where the agent answered ten of forty labelled cases posts a perfect agreement rate and a malicious recall of 8/30, since recall's denominator is every malicious case whether answered or not. The abstention rate is asserted to move where agreement does not, and `AgreementWindow` refuses to construct at all when its counts do not add up, so a miscounted aggregate raises instead of publishing a plausible rate | GATED | The metric is gated; what it is used *for* is Phase 2.3. This row proves the rate cannot be gamed, not that anything yet refuses a promotion on it |-| Live agreement is scored by the Phase 1 metrics rather than a second set | `plans/aisoc_gap_closure_plan.plan.md` (2.2, "using the Phase 1 metrics"); `apps/docs/docs/operations/shadow-mode.md` | `ci.yml :: python-lint` (`check_replay_contract_parity.py`, extended from three trees to four: `GRADED_DISPOSITIONS`, `ABSTENTION_VERDICTS` and the `MALICIOUS` spelling must be identical strings in `autonomy_evidence_rules.py` and in `aisoc_benchmark/replay.py`, compared in both directions, and `UNLABELED` must be spelled the same in all three. Proven capable of failing by drifting each of the two collections in turn and watching it fire, rather than only having never fired) + `ci.yml` (`sync_vendored_autonomy_evidence.py --check`, which byte-compares the API's copy, because a safety control defined twice is off in whichever copy is more generous) | GATED | Parity of the definitions is gated. That the two implementations compute the same number from the same rows is not: the grader scores a list of decision dicts and the live path aggregates in SQL, so they share a vocabulary rather than a code path |-| Autonomy is granted on a measured track record, and refused without one | `apps/docs/docs/operations/shadow-mode.md` (earning autonomy); `services/actions/app/services/autonomy_evidence_rules.py` | `ci.yml` actions job (`test_autonomy_promotion_gate.py`, which starts from one qualifying control and breaks one property per test, so a failure names the property rather than the file) + `integration.yml` (`tests/isolation/test_autonomy_promotion_live.py`, the phase's "Done when" run against a real Postgres: a tenant with 20 recorded shadow decisions is refused, the same tenant with 150 is granted, and injected disagreements demote it. The live half exists because the aggregate and the evaluator agree by convention and a convention is what drifts: only a real database executing the real statement over real rows proves the SQL counts what the gate expects. `AUTONOMY_PROMOTION_LIVE_REQUIRED=1` turns an unreachable database into a failure rather than a skip) | GATED | The four refusals are gated. What is not gated is whether the thresholds are the *right* numbers: 100 decisions and 30 malicious are the plan's, and 95% agreement and 90% recall are choices nobody has yet validated against an outcome. They are configurable per call and travel by value in every snapshot |-| A promotion cannot be earned by an agent that declines its hard cases | `apps/docs/docs/operations/shadow-mode.md` (what has to be true) | `ci.yml` actions job (`test_autonomy_promotion_gate.py::TestRefusalThreeAgreementBoughtByAbstaining` - an agent that answered a fifth of its queue perfectly is refused, and the test that matters removes the abstention cap entirely and asserts it is *still* refused, on malicious recall, so the second guard is shown to be load-bearing rather than redundant) + `integration.yml` (`test_an_abstention_is_excluded_from_agreement_by_the_real_sql`, which asserts the same property of the aggregate rather than of the type: 10 answered and 90 declined reads as 100% agreement and a 90% abstention rate against live Postgres) | GATED | Three guards, all gated: agreement's denominator, the abstention cap, and recall counting an abstention as a miss. None of them detects an agent that answers confidently and wrongly in a way its analysts also got wrong, which is the limit of grading against human labels at all |-| An override is distinguishable from earned autonomy, six months later | `apps/docs/docs/operations/shadow-mode.md` (overrides); `067_autonomy_grants.sql` | `integration.yml` (`test_it_is_a_different_word_everywhere_it_lands` - the audit action is `autonomy:overridden` not `autonomy:granted`, the grant row's `source` column is `operator_override`, and the refusals that were waived are in both the row's evidence snapshot and the audit entry's changes. The earned case is asserted from the other side: `waived_refusals` is an empty list, which is the record that nothing had to be overruled. `test_an_override_is_demoted_on_the_same_floors` asserts an override is not permanent, since exempting it would turn it back into the settings toggle this phase replaces) + `ci.yml` web (`AutonomyScorecard.test.tsx` renders the three states distinctly) | GATED | The source is derived from the gate's own verdict and `evaluate_promotion` takes no override argument, so a caller cannot have an override recorded as earned; a test pins that signature. What is not gated is whether the operator's stated reason is truthful |-| Every autonomy transition is in the hash-chained audit log with its evidence | `plans/aisoc_gap_closure_plan.plan.md` (2.3); `apps/docs/docs/operations/shadow-mode.md` | `integration.yml` (`TestTheTransitionsAreInTheHashChainedLog` - a promotion and the demotion that follows it are replayed through `audit_hash.verify_chain`, the same pure function an external auditor would run over a CSV export, and the second entry is asserted to chain onto the first rather than starting a new one. A `DELETE` against the trail is asserted to raise, because a grant whose record can be quietly removed has no audit trail) | GATED | The chain and the snapshot's presence are gated. The snapshot's *sufficiency* is a judgement: it carries the counts, the thresholds by value, absolute window bounds, the first and last decision id, the models and a digest of the rules, which is what a later reader needs, but no test can prove a question nobody has asked yet is answerable |-| A track record cannot unlock a high-blast containment | `apps/docs/docs/operations/shadow-mode.md` (what a grant can and cannot unlock); `services/actions/app/live_actions/dispatcher.py` | `ci.yml` actions job (`test_earned_autonomy_wiring.py` - an earned grant raises the tier ceiling to L3 and no further, so MINIMAL, LOW and MEDIUM blast are reachable and HIGH and CRITICAL are not, whatever the evidence says; the capability contract still applies on top, so a verb declared `analyst` or `mandatory_human` stays gated; and a grant is asserted never to lower a bar, only to widen the branch that was already heading for the approval queue) | GATED | The ceiling is gated. The reasoning behind it is a judgement and is stated where the code is: agreement on triage verdicts is evidence about the agent's judgement, not evidence that a high-blast containment was the right call, and one number must not be allowed to unlock both |-| A replay report prints "not measured" where there was no denominator, and no headline accuracy on a corpus too thin to support one | `apps/docs/docs/evaluation/replay.md`; `packages/aisoc-benchmark/aisoc_benchmark/replay.py` | `ci.yml` benchmark job (`test_replay_metrics.py` — a class the agent never predicted reports `None` precision and renders as "not measured", because `0.0` in a recall column says the agent missed every case and "never asked" is a different fact; below 30 malicious cases the headline is withheld with the count and the reason, and the rendered report is asserted to contain no percentage in that section. Three populations are asserted apart: unlabelled findings excluded from accuracy and counted, triage refusals scored as neither answer nor abstention, and abstentions counted against malicious recall. A verdict outside the taxonomy gets its own confusion-matrix column rather than being folded into one the agent did not say. Bootstrap intervals are seeded and the seed and resample count travel in the report, so two runs over one corpus render byte-identically) | GATED | Hallucination extraction reuses the existing `_INDICATOR_PATTERNS`, which over-counts rather than under-counts: a phrase shaped like a domain is checked and, if absent from the evidence, counted. The published rate is a ceiling and the per-decision list travels with it so a disputed count can be re-derived |-| An operator can measure triage against their own analysts from the CLI, the API or the console, and the report reproduces byte for byte | `apps/docs/docs/evaluation/replay.md` (Running one; Reproducibility, stated precisely); `packages/aisoc-cli` `aisoc replay` | `integration.yml :: replay-e2e` (`tests/e2e/test_replay_cli_end_to_end.py` — the CLI is run **twice** against a mocked Splunk ES holding 200 recorded closed notables, through the API, `services/actions`, `services/connectors` and `services/agents`, each started from the working tree rather than from a published image, and the two reports are compared as bytes. The comparison cannot pass vacuously: a second assertion fetches both reports *without* the latency exclusion and fails if more than that one line differs, so a stripped artefact cannot hide a field that stopped reproducing; further assertions require the report to carry the 200 findings read, the 60-finding graded window and a printed headline, because a withheld headline reproduces just as reliably while printing far fewer numbers. `AISOC_REPLAY_E2E_REQUIRED=1` makes an unreachable database a failure rather than a skip) + `ci.yml` cli job (`test_replay_command.py` — the CLI renders nothing of its own and writes the bytes the API returned, progress goes to stderr so `aisoc replay ... > report.md` is the report and nothing else, an omitted window is not filled in from the local clock, and a failed evaluation exits non-zero with the server's reason and writes no file) + `ci.yml` benchmark job (`test_replay_metrics.py` — two corpora differing only in latency render differently and identically once excluded; the stripper removes exactly the line the renderer emits, in both directions) | GATED | Reproducibility is a property of the deterministic model path and of a **pinned** window. An omitted `--since` / `--until` dates the window from now, which is a different window on a second run; pointed at a hosted model two runs may legitimately differ. No hosted provider has been exercised end to end here |-| A replay evaluation's results are tenant-scoped, and its tenant comes from the credential rather than the request | `apps/docs/docs/evaluation/replay.md` (The API); `services/api/migrations/065_replay_evaluations.sql` | `isolation.yml :: route-scope` (`check_route_auth.py` — the six new `/evaluations/replay*` routes carry an auth dependency or the gate fails; `check_route_tenant_scope.py` — no route, query parameter or request-body field on this surface names a tenant, and the internal routes it drives resolve theirs from the credential: `services/agents` through the vendored `tenant_scope` where a service token with no `X-AiSOC-Tenant-ID` resolves to an **empty** scope that refuses rather than widens, and `services/actions` by taking no tenant at all, since the credentials it is handed are the scope) + `isolation.yml` (`check_rls_policy_shape.py` — both new tables carry `FORCE` and the `OR current_tenant_id() IS NULL` arm, verified applied against a live `postgres:16`) + `ci.yml` api job (`test_replay_evaluation.py` — a connector in another tenant resolves to no row and the run fails rather than reading it; an evaluation id in another tenant is a 404 rather than a 403, since telling the two apart would confirm the id exists) + `ci.yml` agents job (`test_replay_route.py` — a service token with no tenant header is refused with no downstream call made, and the tenant the credential named is the one forwarded to the connectors service) | GATED | The per-decision rows carry the evidence triage was given, so a tenant's own alert content is at rest in `aisoc_replay_decisions`. That is the point (a disputed score has to be re-derivable) and it is stated on the docs page rather than left to be discovered |-| Closures your analysts make in your own SIEM are polled back on a schedule and graded, not merely capable of being | `apps/docs/docs/operations/shadow-mode.md` (Polling your SIEM for closures); `services/api/app/workers/shadow_reconcile.py` | `ci.yml` api job (`test_shadow_reconcile_sweep.py::test_the_deployed_lifespan_registers_the_sweep` - an AST pass over `services/api/app/main.py` as it ships, asserting three things because any one alone passes over a worker that never runs: the module is imported, a task is created through `_run_guarded_scheduler_worker`, and that call's `worker=` is the sweep's own `run_forever` rather than something that merely mentions it. The job name is pinned too, because the Redis lease is keyed on it and two names means two replicas sweeping one vendor at once. Proven capable of failing by running it against `main`'s `app/main.py`, where both it and the default-off assertion fail) + `ci.yml` actions job (`test_shadow_reconcile_route.py::test_the_route_is_reachable_on_the_deployed_app` - the receiving route is asserted present on the service's own `app`, since a router written and never included is the same defect one layer up. Reachability is asserted by *sending a request* and by reading `app.openapi()`, never by reading `app.routes`: on the FastAPI version these services pin, `include_router` does not populate `app.routes` at all, so an app with four routers mounted reports only the seven docs and probe routes it was born with, and the first draft of this test passed locally and failed in CI for exactly that reason) | GATED | Registration is gated, and so is every branch of one pass against a stubbed actions service. What is not gated end to end is a real vendor: no live Splunk, Sentinel, Elastic, QRadar or Defender has been polled by this sweep. The readers themselves are covered against recorded vendor payloads by the Phase 1.1 rows |-| A scheduled sweep tells a condition that will never resolve from one that might, and says which | `apps/docs/docs/operations/shadow-mode.md` (What stops it, and whether waiting helps); `services/actions/app/api/shadow_reconcile_router.py` | `ci.yml` actions job (`test_shadow_reconcile_route.py::TestPermanentIsNotTransient` - the vendor's own status decides, so all four of 400/401/403/404 answer 422 naming the operator action while 500/502/503/504 and a timeout answer 502 without it, and a 429 forwards the vendor's own `Retry-After` rather than a guess; a reader that could not build a client is refused before the matcher is reached, because an empty window reads as "these analysts closed nothing") + `ci.yml` api job (`test_shadow_reconcile_sweep.py::TestPermanentIsNotTransient` - a permanent refusal blocks the connector and stops polling it, a transient one never blocks and leaves the watermark untouched, an undecryptable credential blocks before the vendor is called at all, and a deployment-level refusal halts the whole pass rather than writing "needs an operator" onto every connector. Unblocking is asserted to require the connector row changing and nothing weaker, so a revoked credential resumes on the one event that could have fixed it) | GATED | The classification is drawn from the vendor's HTTP status. A vendor that answers 200 with an error body, or 500 for a permanently bad query, is classified by what it said rather than by what it meant |-| The sweep is bounded work against a customer's API: it keeps a watermark, honours rate limits and never re-reads a window forever | `apps/docs/docs/operations/shadow-mode.md` (What it does to your SIEM); `services/api/migrations/068_shadow_reconcile_state.sql` | `ci.yml` api job (`test_shadow_reconcile_sweep.py::TestRateLimitingAndTheWatermark` - the watermark advances to the latest closure actually seen rather than to the end of the window asked for, so a vendor that indexes late does not have findings stepped over; an **empty** window still advances it, minus the overlap, so quiet hours are not re-read forever; a window is capped so a connector blocked for a month catches up in steps rather than asking for the month in one search; a first pass starts when measurement started rather than at the beginning of the vendor's retention; the per-connector floor and the per-tick cap are both asserted to withhold a poll; and a `Retry-After` is stored and honoured. `test_a_transient_failure_leaves_the_watermark_alone` asserts a failure cannot look like progress) | GATED | Every limit is asserted against the sweep's own decision to poll. Whether the defaults are the *right* numbers for a given SIEM is a judgement: they are configurable and the docs table publishes each one beside what it bounds |-| The API scores a replay with the grader the benchmark package ships, not a second copy of it | `services/api/app/_vendor/aisoc_benchmark/VENDORED.md` | `ci.yml :: vendored-sync` (`scripts/sync_vendored_benchmark.py --check` — every module of `packages/aisoc-benchmark/aisoc_benchmark/` must be byte-identical in `services/api/app/_vendor/aisoc_benchmark/`, checked in **both** directions so a module present only in the mirror fails too, and refusing to report a clean mirror when the source directory yields no modules) | GATED | A mirror rather than an import, because the `aisoc-core-api` image is built with `./services/api` as its context and nothing under `packages/` exists at runtime. Same constraint that produced `_vendor/narrative.py` and `_vendor/nl_query/`. A second grader would eventually disagree with the first about what "hallucination rate" means while both kept calling themselves the same number |-| The published count of services each compose profile starts is what the compose file starts | README L130-132 (profile table); `apps/docs/docs/architecture.md`; `apps/docs/docs/quickstart.md`; `docs/audit/REPOSITORY_REALITY.md`; [ADR-0007](../decisions/0007-connectors-and-actions-in-core.md) | `ci.yml` gates job (`scripts/check_profile_service_counts.py`: ten published figures across four documents are compared against the profile membership parsed out of `docker-compose.yml`, with compose's "a service in no profile is in every profile" semantic implemented rather than assumed, and one-shot containers counted separately from long-running ones because "long-running services" is the figure the documents publish. Fails in **both** directions: a count that disagrees, and a watched figure that has vanished from a document, so deleting the claim fails as a stale entry rather than passing because nothing matched. Also asserts `actions` is reachable from the `chatops` profile, since `slack-bot` depends on it and compose refuses to render a file whose dependency is outside the profile being started, which is the specific state ADR-0007 created by putting `actions` in no profile at all. Proven able to fail by re-staling the README's core figure to 14) | GATED | The counts are gated; the **memory** figures in ADR-0007 are point-in-time measurements on one machine and no gate can re-measure them in CI. They are published with the host, the engine version and the date, and the ~8 GB README figure is deliberately left unmoved because 124.8 MiB does not move a number published to one significant figure |-| An operator can hand an earned autonomy grant back | `apps/docs/docs/operations/shadow-mode.md` (earning autonomy); `services/api/app/api/v1/endpoints/autonomy_policy.py` | `ci.yml` api job (`test_autonomy_grant_revocation.py`, which drives the real route over ASGI and asserts on what the database was told, because the handler that used to answer this request also returned 204: a revocation issues `UPDATE aisoc_autonomy_grants` and must touch `aisoc_autonomy_thresholds` not at all, it is audited as `autonomy:revoked` rather than as a demotion, a revocation matching no standing grant answers 404 rather than succeeding silently, a capability outside the shared vocabulary is refused, and resetting a threshold still reaches the reset. Proven against the pre-fix tree, where four of the six fail) | GATED | Gated against a recording session rather than a live Postgres. The grant lifecycle itself is covered against real Postgres by the Phase 2.3 rows above; what this row adds is that the route carrying it is reachable at all |-| Every route the app publishes is the route that answers for it | (implied by every route-level claim in this table); `services/api/tests/test_route_shadowing.py` | `ci.yml` api job (`test_route_shadowing.py`, where the corpus is `app.openapi()` and reachability is decided by *sending a request* for all 456 published operations and reading back which route Starlette matched, never by reading `app.routes`: on the FastAPI version these services pin, `include_router` does not populate it, so the previous version of this gate filtered an effectively empty list, compared zero pairs and reported success over the whole app. It refuses a corpus below a floor rather than calling an empty app clean, and it is proven able to fail both against a synthetic app carrying the defect and against the pre-fix tree, where it names `DELETE /api/v1/autonomy-policy/grants` as answered by `reset_action_threshold`) + `isolation.yml :: route-scope` (`check_route_shadowing.py`, one AST pass over all thirteen services and 628 routes, with a `--self-test` covering the shipped defect and four near misses) | GATED | The runtime half speaks for `services/api` alone, since it needs that service's driver stack importable. The other twelve are covered by the static pass, which is the weaker instrument and reports as much: it pairs routes within a module and router, so two modules mounted on one prefix are out of its reach, and it counts rather than judges a convertor-constrained parameter and a path that is not a string literal |-| A third-party MCP server reaches the agent read-only: a tool is callable only if the tenant allowlisted it and the server did not annotate it state-changing | `apps/docs/docs/operations/mcp-client.md` (What the agent may call) | `ci.yml` gates job (`scripts/check_mcp_client_policy.py`: `app/mcp/policy.py` may import nothing that can open a socket, so every refusal is reachable with no network; the **first** decision in `vet_tool` is asserted to be the allowlist, since one taken after the annotation still refuses but stops being the property claimed; the policy is then asked directly and must refuse a `destructiveHint` tool, a `readOnlyHint: false` tool and an un-allowlisted one. Proven able to fail by checking the annotation first, by defaulting stdio on, by removing the command allowlist, and by ignoring the destructive hint) + `ci.yml` agents job (`test_mcp_client.py`: against a real in-process MCP server: an allowlisted read tool binds, a destructive tool allowlisted *on purpose* still does not, and a tool declaring itself not read-only is refused with the annotation absent) | GATED | A destructive MCP tool is refused outright rather than routed to governed dispatch, because no MCP tool declares a capability contract. The plan permits either; this is the "or not at all" half, and the refusal names the door it would otherwise take |-| An MCP tool outside the allowlist is refused before any network call | `apps/docs/docs/operations/mcp-client.md` (What the agent may call) | `ci.yml` agents job (`test_mcp_client.py::test_refusal_at_dispatch_happens_without_a_network_call` and `::test_dispatch_rechecks_the_annotation_not_only_the_allowlist`: the invoker is handed a session factory that raises the moment anything asks it for a session, so the test fails if the refusal is taken anywhere downstream of a connection) + `scripts/check_mcp_client_policy.py` (every `Tool` built in `app/mcp/tools.py` must carry an `McpToolInvoker`, since a raw callable would skip both the dispatch re-check and the ledger write; proven able to fail by substituting a lambda) | GATED | An allowlist checked after the call is not an allowlist. The check runs twice: at discovery, where a refused tool is never shown to the model at all, and at dispatch, through the same pure function over the same discovered descriptor |-| Everything a third-party MCP server sends is treated as untrusted input, including its tool descriptions | `apps/docs/docs/operations/mcp-client.md` (Results are untrusted; A malicious tool description) | `ci.yml` agents job (`test_mcp_client.py`: a result carrying an injection is fenced with the run nonce, flagged and **not** filtered; a leaked nonce inside a result is redacted so the closing fence cannot be forged; an oversized result is cut at the tenant's cap and says so in words the model reads; a tool whose *description* instructs the model is dropped entirely rather than sanitised, and an injection hidden in a parameter description drops the tool the same way; the input schema is projected to `type`/`properties`/`required` so `$ref`, `default` and `examples` never reach the prompt) | GATED | The guard is not the control here and its own numbers say why: 0.96 on prose and 98.1% on the field-native corpus it was tuned against, but **2 of 28** on payloads authored after that hardening. An MCP server's payload is held-out data by definition, so the held-out figure is the one that applies. The nonce fence, the length cap and the schema projection are the controls; the guard is what makes a miss visible afterwards, and the docs page publishes the held-out figure beside the corpus one |-| Every MCP call, refusal and failure is recorded in the Investigation Ledger | `apps/docs/docs/operations/mcp-client.md` (What ends up in the ledger) | `ci.yml` agents job (`test_mcp_investigation.py`: the real `_LedgerWriter` calling the real `ledger.record_event`, captured at the database boundary rather than replaced above it, so the run id, resolved tenant, sequence numbers and payload shape are the ones that would reach Postgres; sequence numbers are asserted monotonic and above the graph range because `ON CONFLICT (run_id, seq) DO NOTHING` drops a collision silently; an unresolvable tenant is asserted to write nothing while the call still succeeds) + `scripts/check_mcp_client_policy.py` (the call, refusal and failure paths must each write a ledger kind) | GATED | A ledger row carries argument *names*, byte counts and the injection verdict, never argument values or result text: copying a third party's reply into the audit trail would put untrusted content somewhere with none of the containment. Cost is `not_applicable_no_model_call` rather than `0`, since an MCP call spends a vendor's compute and no model tokens |-| MCP server URLs pass the SSRF guard and the air-gap policy, and stdio servers stay disabled | `apps/docs/docs/operations/mcp-client.md` (Network and deployment policy) | `ci.yml` agents job (`test_mcp_client.py::TestTransportPolicy`: a loopback URL is refused before the transport exists, air-gap mode refuses a public server and permits an internal one, stdio is off with no environment set, enabling it is not sufficient without the command allowlist, the command is matched whole rather than by prefix or basename, and a shell metacharacter in an argument is refused) + `scripts/check_mcp_client_policy.py` (`validate_outbound_url` must be called at a lower line number than `streamablehttp_client` inside `session()`; proven able to fail by deleting the guard) | GATED | The registry also refuses an obviously unsafe URL at save time, but that check does not resolve DNS and is not the control: a name that resolved publicly at save time can resolve to link-local an hour later, so the enforcing check is the one immediately before the socket opens |-| The agents service requests the MCP registry at a path the API service serves | `services/agents/app/mcp/registry_client.py` | `ci.yml` agents job (`test_mcp_registry_client.py::test_the_registry_url_matches_where_the_route_is_mounted`: the app mount, the v1 router prefix and the endpoint router prefix are read out of the API service's own source with `ast` and composed the way the service composes them, then compared against the URL the client builds. Proven able to fail by emptying `API_PREFIX`, which names both the requested path and the served set) | GATED | The same defect D16 records: Phase 1.2 shipped a client missing `/api/v1`, so every request would have 404'd while three suites stayed green, because the test asserted the URL the code produced rather than the URL the service serves. This service cannot import that one, so reading the other tree's source is the only comparison in the direction that drifts |-| No MCP tool AiSOC ships can perform a response action; the action tool is dry-run only | `services/mcp/README.md` (Actions are previewed, never performed); `apps/docs/docs/integrations/mcp.md` | `ci.yml :: mcp` (`tests/actions.test.ts`: the **source** of `services/mcp/src/` is read and no string may name `/live-actions/dispatch`, so a second action tool added later is caught rather than only the one under test; the preview handler is driven against a recording client and asserted to make exactly one request, to the dry-run path, carrying `dry_run: true`; and its strict schema is asserted to reject a caller-supplied `dry_run: false`. Proven able to fail by pointing the module constant at the dispatch path, which reds both the source scan and the request assertion) | GATED | The enforcing control is upstream: `POST /api/v1/live-actions/dry-run` forces `dry_run: true` server-side whatever the body says and proxies only that path. This row is the second lock, on the side an agent can see, because an MCP key is credential material that lives in an editor's configuration file |-| Every tool AiSOC's MCP server publishes carries honest behaviour annotations | `services/mcp/README.md` (Tools exposed); `apps/docs/docs/integrations/mcp.md` (Annotations, and what is read-only) | `ci.yml :: mcp` (`tests/actions.test.ts`: every tool in `ALL_TOOLS` must declare `readOnlyHint` as a boolean rather than leaving it absent, no tool may be annotated destructive, and the set of tools annotated **not** read-only is pinned to exactly `aisoc_run_investigation`, so a future write tool cannot arrive annotated read-only and a read tool cannot drift into looking state-changing) | GATED | The annotations are what a client reads to decide whether it may call a tool at all. AiSOC's own MCP client refuses a tool whose server sets `destructiveHint: true` or `readOnlyHint: false`, and treats an absent annotation as no claim, so a server publishing nothing forces every operator to vouch for every tool by name |-| MCP server exposes 13 tools | README L179 | `ci.yml :: mcp` | GATED | - |-| Prompt-injection resistance | (implied by agent claims) | `ci.yml :: python-test` (agents) runs `test_prompt_sanitizer.py`, `test_prompt_envelope.py` and `tests/adversarial/` — a 32-payload corpus grouped by attacker goal, enforcing a recall floor **and** a false-positive ceiling on real security content that reads adversarially. Action-trigger and exfiltration payloads are individually required rather than averaged, because an injected containment turns the SOC into a denial-of-service tool pointed at its own estate. Phase 3 adds a second, harder corpus at incident level (`test_injection_incidents.py`) whose payloads are written to fit the field they arrive in, enforcing a floor, a ceiling and an exact ratchet naming every current blind spot by id | GATED | obfuscation is an arms race and is recorded rather than individually required; two payloads are currently xfail and counted in the recall rate. The two corpora measure the same guard and are **not comparable**: one asks whether the guard recognises a string, the other whether it recognises it where an attacker can put it, and the second scores materially lower. Neither measures a model |-| An investigation can read the vendor a tenant actually runs, not just CrowdStrike and Okta | `plans/aisoc_gap_closure_plan.plan.md` (4.2); `services/actions/app/live_actions/investigation_reads.py` | `ci.yml` actions job (`test_investigation_reads_phase4.py`, 25 tests over seven new executors against vendor-shaped synthetic payloads on the real HTTP path. Each verb is tested for the pair that must never collapse: a host or principal the vendor does not hold is `SUCCEEDED` with `found: False`, a vendor that 5xxs is `FAILED`, and a failed read is asserted to carry **no** `count`, `detections` or `found` key, because a `count: 0` reaching a model is the strongest exonerating evidence there is and would be false. Entra's licensed risk leg may fail without taking the sign-ins down and reads as unknown rather than as no risk; Google Workspace's 403 names the missing `admin.reports.audit.readonly` scope rather than reporting an account with no logins) + `ci.yml` gates job (`check_action_contract.py`, 79 executors, and `check_capability_mirror` comparing the actions vocabulary against the connectors `Capability` enum in both directions) | GATED | Five of the seven are new vendor arms on the three existing read verbs, so they inherit the `READ_ONLY` contract and cannot drift low; only `lookup_cloud_audit` and `lookup_endpoint_telemetry` needed their own entry. **No call in this repository has been made against a live vendor** for any of them: there is no funded CrowdStrike, SentinelOne, Entra, Google Workspace, Defender or AWS account here, so the wire shapes are pinned against the vendors' published schemas and the live path is unverified, which the docs state rather than imply |-| A caller of a vendor read never supplies query text; the executor owns the query | `plans/aisoc_gap_closure_plan.plan.md` (4.1, 4.2); `services/actions/app/clients/defender_client.py` (`_HUNT_TEMPLATES`) | `ci.yml` actions job (`test_investigation_reads_phase4.py`: `lookup_endpoint_telemetry` is offered four rejected inputs including a bare KQL pipeline, a template name with a statement appended and a case variation, and each is refused **before the credential is read** with a route asserted uncalled, so a refused template cannot reach the vendor; the accepted path is asserted on the KQL that reaches the wire rather than on the argument, with a hostile indicator carrying a quote and a pipe appearing only in its escaped form; the window and row cap are asserted at 720h and 200 against a caller asking for 99,999h and 10,000 rows. Entra's OData literal is asserted the same way, with the doubled quote present and the single-quote form absent) | GATED | The escaping is grammar-specific and each grammar is handled at its own boundary: KQL escapes backslash and double quote, OData doubles a single quote, and the CloudTrail attribute key is checked against AWS's own closed vocabulary rather than escaped at all. A new vendor grammar needs its own escape and its own test; nothing structurally forces that beyond review |-| AWS CloudTrail is read without adding boto3 to a CORE service | `services/actions/app/clients/aws_cloudtrail_client.py`; [ADR-0007](../decisions/0007-connectors-and-actions-in-core.md) | `ci.yml` actions job (`test_investigation_reads_phase4.py`: the SigV4 canonical request is pinned line by line against the documented shape, including the blank line between canonical and signed headers and the body hash as the final line; `SignedHeaders` is parsed back out of the `Authorization` header the client produced and every name in it asserted present on the request, which is the failure mode of a hand-rolled signer; the signing-key derivation is asserted sensitive to secret, date **and** region in turn, so a dropped link in the chain cannot pass as a plausible hex string; a session token is asserted both signed and sent. `canonical_parts` is the function `_authorization` itself calls, so the test is not comparing a producer against a copy of itself) | GATED | **The live AWS path is unverified.** There is no funded AWS account in this repository, so what is gated is that the algorithm matches the specification and that the response parsing and projection work against a recorded payload. A signature that AWS itself accepts has not been observed. boto3 is deliberately not added: it is not in the `aisoc-actions` image (measured: `ModuleNotFoundError`, against 1.43.101 in `aisoc-connectors`) and ADR-0007 has just published that image at 539 MB |-| The investigation agent reaches the customer's own SIEM, EDR, identity provider and cloud audit trail, not only AiSOC's event lake | `plans/aisoc_gap_closure_plan.plan.md` (4.1, 4.2, 4.3); `apps/docs/docs/operations/agent-vendor-tools.md` | `ci.yml` agents job (`test_deep_investigation_customer_tools.py`, the phase's acceptance bar: a recorded CrowdStrike detection with Splunk and CrowdStrike mocked reaches at least three distinct pivots and the assertion counts distinct **sources** rather than distinct tool names, so three pivots on one source fails. A tool that answered `could_not_check` is asserted absent from the pivot list, so the bar cannot be met by calling tools that all failed) + `ci.yml` gates job (`check_investigation_depth.py` grades the lake pivots **and** the customer-tool catalog, asserts the `scoped_customer_tools` binding and the `coverage_notes` prompt are still present in the driver, and was proven able to fail by removing each in turn) | GATED | The agent-side chain is gated in process against the API's HTTP boundary; the joins beyond it are separate rows. The tool *selection* is a scripted model, deliberately: grading whether a live model chooses to pivot would measure the model rather than the surface, and no hosted provider has been exercised here |-| A failed vendor read reaches the model as "could not check", never as an empty result | `apps/docs/docs/operations/agent-vendor-tools.md` (A failed read is never an empty result) | `ci.yml` agents job (`test_customer_tools.py`, 20 tests. Every failure path is asserted on the **wording** as well as the flag, because the flag is for code and the wording is what the model reads: the reason must contain "lookup failure", "NOT checked" and "not treat this as evidence", and must **not** contain "no results" or "nothing was found". Covered for a transport error, a 5xx, a 404, an unreadable body, a missing credential, an unreachable API, every one of the seven non-execution statuses, and a tenant with no SIEM connected. A genuine zero-row answer is asserted to say it IS evidence of absence *for the sources that answered*, and a partly-failed search keeps its own `partial` outcome rather than being rounded to clean) | GATED | The wording is gated; whether a given model honours it is a property of the model. The Phase 3 injection corpus is where that gets measured, and the untrusted-data notice is asserted present in the prompt rather than asserted effective |-| An agent is offered only the tools whose backend the tenant has configured | `plans/aisoc_gap_closure_plan.plan.md` (4.3); `apps/docs/docs/operations/agent-vendor-tools.md` (Only what you have connected is offered) | `ci.yml` agents job (`test_customer_tools.py` - a tenant with a Splunk and an Okta gets exactly `siem_indicator_search` and `identity_user_activity` and no EDR tools; a tenant with nothing connected gets **no** tools and two separate gap sentences, both asserted present in the findings; an unreachable API binds nothing and says "could not determine", asserted to appear in the model's prompt and not only in the reader's findings, because a note only the reader sees means the model reasoned without it) + `ci.yml` gates job (`check_agent_read_tools.py` compares the API's `AGENT_READ_CAPABILITIES` against the contract's READ_ONLY set, the executor list and the parameter allowlist, and compares the two indicator vocabularies across the agents and api trees in both directions; proven able to fail by exposing `isolate_host` and by drifting one vocabulary) | GATED | Advertisement is per connector **type**, not per instance: a tenant with two Splunks is offered one SIEM tool and the federated layer fans out to both, which is the existing behaviour of that endpoint |-| A model never composes SPL, KQL or ES-QL query text against a customer's SIEM | `plans/aisoc_gap_closure_plan.plan.md` (4.1); `apps/docs/docs/operations/agent-vendor-tools.md` (The model never writes a query) | `ci.yml` agents job (`test_customer_tools.py` asserts on the **JSON schema the model is handed**, not on the implementation, since the schema is what constrains a model: no property named query, search, spl, kql, esql, sql, free_text, field, filter, where or index on any tool, every property typed `string` or `integer` so a query cannot arrive as structured data, and `indicator_type` a closed sorted enum) + `ci.yml` api job (`test_agent_tools.py` - 23 value-shape cases in both directions, and every field token in the per-backend map asserted to match the identifier pattern the translators' own field check enforces, so a mapping that would 422 on every search cannot ship) + `ci.yml` connectors job (`Indicator.__post_init__` refuses a field name that is not an identifier, at the single choke point every translator goes through) | GATED | The field map is a reviewed table, not derived: there is no machine-readable source in this repository for what Splunk CIM calls a source address. The alternative, letting the model name the field, is the thing the boundary exists to prevent |-| Every tool call an investigation makes is in the Investigation Ledger | `plans/aisoc_gap_closure_plan.plan.md` (rules for every phase, LLM calls) | `ci.yml` agents job (`test_deep_investigation_customer_tools.py` captures what the driver hands `ledger.record_event` at the ledger's own function boundary and asserts one `tool_call` row per call in the trace, carrying the tool name **and its arguments**, because "the ledger shows every call" means an auditor can answer which host was read. Sequence numbers are asserted distinct and at or above 10,000: `record_event` carries `ON CONFLICT (run_id, seq) DO NOTHING`, so a collision with the graph runner's own numbering would be a silently dropped row, which is worse than an error because the ledger still looks complete) | GATED | `run_with_tools` built a trace and nothing carried it anywhere durable, so this is new rather than newly gated. The write is best-effort by design: a ledger failure must not take a completed investigation down, and `ledger_rows` on the result reports how many rows landed so "nothing to record" is distinguishable from "the ledger is not configured" |-| Sustained throughput and event-to-alert latency are measured end to end, on a named machine, on a named date | `apps/docs/docs/operations/performance.md`; `docs/perf/results/*.json` | `perf.yml :: published-results` (`check_perf_results.py`: every committed result must carry `measured_at` beginning with an ISO date, a `hardware` block naming a CPU, a container runtime or a CI runner rather than a bare core count, `not_a_production_slo: true` and disclaimer prose; the filename must begin with its own measurement date; and the docs page must mention every date a result carries, so the page cannot drift into presenting old figures under a new heading. Self-tested by injecting each of those nine violations and requiring each to be caught) + `perf.yml :: end-to-end` (the harness drives the real Compose spine nightly with `--assert-eps-floor`, `--assert-p95-ceiling-ms` and `--assert-no-loss`) + `ci.yml :: python-test` (root) `test_load_harness_contract.py` | GATED | The floors are two orders of magnitude below the published figures, deliberately: a shared GitHub runner is not the machine the numbers came off, and a gate tuned near a measurement flaps and gets disabled. A green perf job proves no catastrophic regression, not that any published figure still holds |-| A performance figure that was not measured reads "not measured", never `0` | `scripts/perf/load_harness.py`; `apps/docs/docs/operations/performance.md` (kind per-pod usage) | `perf.yml :: published-results` (`check_perf_results.py` rejects an unmeasured metric that carries a `value` key and one that carries no reason, and separately asserts a **measured** zero survives, since zero dead letters and zero drained lag are real results) + `ci.yml :: python-test` (root) `test_load_harness_contract.py` (the serialised form is asserted, because the renderer downstream sees JSON rather than the dataclass) | GATED | The kind run genuinely has no per-pod CPU or memory figures: `kubectl top` needs metrics-server and kind ships none. The committed JSON records the absence and the page says so in the same paragraph as the table |-| A fusion replica can be destroyed mid-stream with no event lost and none duplicated | `apps/docs/docs/operations/ha-deployment.md`; `apps/docs/docs/operations/performance.md` (failure injection) | `scripts/chaos/fusion_restart.py` (asserts against the `alerts` table in PostgreSQL, never against anything the replacement pod reports about itself: every sequence number ingest accepted must appear exactly once, and a missing one and a repeated one fail separately and are named). Self-tested in both directions, including the case where a loss and a duplicate cancel out in the row count. Run against the Kubernetes deployment on 2026-09-27; the result is committed at `docs/perf/results/2026-09-27-kind-chaos.json` and `perf.yml :: published-results` requires it to carry a verdict | GATED | The self-test and the committed result are gated; the **execution** against a live cluster is not on a CI trigger, because it needs a three-node cluster with two fusion replicas and published images. `docs/audit/REPOSITORY_REALITY.md` records the date and shape of the run that was performed rather than implying it happens continuously |-| A Helm install connects the event spine, rather than installing every object and consuming nothing | `infra/helm/aisoc/values-ha.yaml`; `apps/docs/docs/operations/ha-deployment.md` | `helm.yml :: render` (`KAFKA_BOOTSTRAP_SERVERS` is asserted present in the rendered ConfigMap and to resolve to the release's own brokers when the chart deploys them; a three-replica render is asserted to carry all three KRaft quorum voters; `ueba.enabled=false` is asserted to render no UEBA object, which it previously did) | GATED | Rendering is gated. That the brokers then form a quorum and fusion attaches was exercised on kind on 2026-09-27 and is recorded as such, not as a continuous check |-| A cross-service route this program adds is asserted against the URL the serving side actually serves | `GAP_CLOSURE_PROGRESS.md` (D16) | `ci.yml` api job (`test_agent_tools.py` parses `services/api/app/main.py`, `api/v1/router.py` and the endpoint module with `ast`, composes all three prefix levels, and asserts each literal the agents service builds is in the served set. Proven able to fail from **both** sides: dropping `/api/v1` from the client's path, and renaming the router's own prefix. The helper raises rather than returning an empty set, so a parser that stopped matching cannot certify nothing. Also asserts the `impact` field the API filters on exists on `LiveActionDescriptor` **and** is populated from the contract rather than left at its default) | GATED | Covers the two routes this phase adds and the actions discovery route it consumes. It is not a repository-wide scan: the general version would need every client's URL construction to be statically resolvable, and several build theirs from settings |-| A tenant can author an investigation skill in the console and it changes the plan on matching alerts | `apps/docs/docs/console/tenant-skills.md`; `plans/aisoc_gap_closure_plan.plan.md` (6.1, 6.2) | `ci.yml` agents job (`test_tenant_skill_investigation.py::test_done_when_a_skill_changes_the_investigation_plan_on_a_matching_alert`: one alert run twice through the real `run_deep_investigation`, everything held constant except whether the tenant has an active skill, asserting on the **system prompt the tool loop was handed** rather than on the verdict, because a verdict can be unchanged by a plan that did change. The built-in the alert would otherwise select is asserted by name, so "the skill won" and "nothing selected anything" are told apart) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py`) | GATED | A skill supplies the plan **and** the triage guidance. A skill that only changed the pivot plan could not be backtested at all: the replay grades triage verdicts, so the delta would read zero on every run |-| A skill may only name a tool that tenant's agent can actually call | `apps/docs/docs/console/tenant-skills.md` (expected_pivots is validated against your tools) | `ci.yml` api job (`test_tenant_skills.py::TestToolValidation`: the inventory is built from the tenant's **enabled** MCP servers only, so a registered-but-disabled server, an empty allowlist and another tenant's server each contribute nothing; a misspelt built-in and an un-allowlisted MCP tool get different messages because the author's next action differs) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py` compares `BUILTIN_PIVOTS` against the agents service's `KNOWN_PIVOTS` in **both** directions; proven able to fail by deleting a pivot from each side in turn) | GATED | Phase 4.3's per-tenant vendor-read advertisement does not exist yet, so the inventory is the built-in lake pivots plus Phase 5.2's MCP allowlists. A pivot naming a vendor read verb is refused with a sentence saying the surface is not built, rather than silently accepted |-| A skill cannot be activated without a backtest of the exact version being activated | `apps/docs/docs/console/tenant-skills.md` (Lifecycle) | `ci.yml` api job (`test_tenant_skills.py::TestLifecycle`: activation is refused with no backtest, with a backtest of a different version, when expired, and when one evaluation is used as its own baseline; a content edit is asserted to bump the version, drop the row to draft and detach both reports, while a reformat that leaves the parsed body identical keeps them) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py` requires the rule in the migration's CHECK, in the store and on the docs page; proven able to fail by weakening the SQL clause) | GATED | Stated in three places on purpose. The CHECK holds against a direct fix-up; the store's refusal is what produces a sentence an operator can act on rather than a constraint name |-| Every investigation a skill guided records which version guided it, and that version resolves back to its text | `apps/docs/docs/console/tenant-skills.md` (What gets recorded) | `ci.yml` agents job (`test_tenant_skill_investigation.py`: the provenance carries id, version and owner; the investigation pins the version triage already used rather than re-resolving, since the fetch is cached and an activation between the two reads would split them) + `ci.yml` api job (`test_tenant_skills.py`: a content edit leaves both versions in `aisoc_tenant_skill_versions`, and retire keeps the history while delete removes it) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py` requires the field on both `DeepInvestigationResult` and `InvestigationState`; proven able to fail by renaming it on either) | GATED | A recorded version with no history row is provenance-shaped and not provenance, so a skill row whose version is absent or zero is refused by the resolver rather than served |-| Tenant skills are frozen at the split point during a replay, and the backtest bypass is published rather than silent | `apps/docs/docs/console/tenant-skills.md` (What a backtest number does and does not say); `services/agents/app/replay/shadow.py` | `ci.yml` agents job (`test_replay_leakage.py`: a skill activated after the split never reaches the prompt, with a **sensitivity half** that runs the live reader and asserts the same poison does; the backtest candidate is asserted to reach the prompt *and* to be named in the method note with its caveat, with a sensitivity half asserting an ordinary replay of the same instant freezes it out; a skill with no activation stamp is counted the way an undated statement is) + `ci.yml` gates job (`scripts/check_triage_context_freeze.py`: every source `TriageContextReader` declares must be implemented by both readers, and every snapshot store must be filtered by `capture_context` and publish `_frozen` and `_dropped_after_split` in the method note. Proven able to fail by removing the frozen reader's method, by silencing the bypass, and by deleting one kept-count key while a neighbouring key remained, which an earlier substring version of the check missed) | GATED | A skill backtest deliberately applies a candidate authored after the window, which is what a backtest is. The figure is a statement about that window and not a forecast, and the method note says so in those words rather than leaving a reader to infer it |-| A SCIM request's tenant comes from its credential, never from the request | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `docs/decisions/0008-scim-trust-boundary.md`; `apps/docs/docs/operations/scim.md` | `isolation.yml` (`check_route_auth.py` and `check_route_tenant_scope.py` see `ScimPrincipal` as an authenticating dependency, so every one of the 17 SCIM routes is counted as authenticated rather than exempted; `aisoc_scim_tokens.tenant_id` is NOT NULL and RFC 7643 defines no tenant attribute) + `ci.yml` api job (`test_scim_provisioning.py::TestTokens` - a second tenant's credential gets 404 for a principal the first created, and discovery refuses an anonymous caller) | GATED | The credential is the only source of tenancy because the protocol has no field for one. There is nothing to intersect: a SCIM handler that read a tenant from anywhere would be the finding |-| SCIM bearer tokens are hashed at rest and rotate without an outage | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `apps/docs/docs/operations/scim.md` (Rotating a credential) | `ci.yml` api job (`test_scim_provisioning.py::TestTokens` - the stored value is asserted to be the SHA-256 digest and not the secret or its prefix; rotation is asserted to leave **both** secrets working inside the grace window and to refuse the old one after it; a zero grace window revokes immediately for rotation after a disclosure; rotation is asserted never to *extend* an earlier deadline) | GATED | The digest is correct here rather than a password KDF: the token is 192 bits from `secrets`, so there is no low-entropy guess to slow down, and a KDF on the request path would delay every sync an identity provider makes |-| SCIM deprovisioning ends access rather than flagging a row | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `docs/decisions/0008-scim-trust-boundary.md`; `apps/docs/docs/operations/scim.md` (What deprovisioning does) | `ci.yml` api job (`test_scim_provisioning.py::TestDeprovisioning` - a deactivation is asserted to revoke the principal's API keys by **count**, and to stamp `sessions_revoked_at`; `token_is_revoked` is asserted in all four directions including the fail-closed case of a token with no `iat`; minted tokens are asserted to carry `iat`, so the check has something to read; re-activation is asserted **not** to restore revoked API keys; the whole chain is repeated end to end through `DELETE /scim/v2/Users/{id}`) | GATED | DELETE deactivates rather than erasing, which RFC 7644 permits: erasing the row would take the principal's audit attribution and case history with it. A pre-existing fall-through that left a deactivated user's API key working under a generic role is closed in the same change |-| A directory group confers only a role AiSOC enforces, and an unrecognised group confers nothing | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `apps/docs/docs/operations/scim.md` (Mapping groups to roles) | `isolation.yml` (`check_scim_contract.py` compares the group-to-role mapping against `ROLE_PERMISSIONS` in **both** directions, so a role renamed there cannot leave a mapping pointing at a string that grants nothing, and a *new* role must be classified as assignable or recorded as deliberately unreachable; proven able to fail by introducing an unclassified role) + `ci.yml` api job (`test_scim_provisioning.py::TestRoleMapping` - membership is asserted to write `users.role`, which is the column the permission check reads, and removal to take it back; an unmapped group is asserted to confer nothing; no group name resolves to a wildcard role) | GATED | Precedence is a total order, so a principal in several mapped groups holds the same role regardless of the order a provider syncs in |-| The SCIM surface serves what its discovery documents advertise, and audits every write | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `apps/docs/docs/operations/scim.md` (What is implemented) | `isolation.yml` (`check_scim_contract.py` reads `ServiceProviderConfig` and the route table and compares them in both directions, so a capability advertised with no route **and** a route no document advertises both fail; asserts each of the eight mutating handlers still reaches the audit helper; asserts `main.py` includes the router, since a router nobody mounts serves nothing) + `ci.yml` api job (`test_scim_mounted.py` reads `app.openapi()` from the real application and refuses an empty inventory before asserting membership, because `include_router` does not populate `app.routes` on the pinned FastAPI) | GATED | Filtering implements one `attribute eq "value"` comparison and refuses the rest: a dropped filter would return every principal in the tenant, which a provider reads as "this user already exists" |-| No principal can confer a role, scope or organisation membership beyond its own authority, and the wildcard roles are unreachable from any request | `apps/docs/docs/operations/security.md` (Role grants are scoped to the granter); GHSA-pm3f-h6gc-rvgp | `isolation.yml` (`check_role_grant_scope.py` asks of every handler binding a request model that declares `role`, `org_role`, `granted_role`, `scopes`, `role_id` or `permission_ids` whether it reaches `app.core.role_grants`, checks each waiver still covers a live handler, and derives the refused set from `ROLE_PERMISSIONS` so a role declared with the wildcard later is un-grantable the moment it is declared; six injected drifts prove it fails, and run against the pre-fix tree it names all nine handlers) + `ci.yml` api job (`test_role_grant_scope.py` calls the shipped handlers and asserts both directions per call site — the escalating request is refused and nothing is written, a legitimate grant still lands; 16 of its 28 tests fail against the vulnerable tree, every one of them for the grant succeeding rather than for a missing symbol) | GATED | Scoped to grants a *request* makes. `scripts/bootstrap_admin.py` still mints a wildcard role out of band with database credentials, which is deliberate: it is the only path left, and it is not reachable over HTTP |-| An uploaded brand asset cannot execute, and is never fetched from a third party | `plans/aisoc_gap_closure_plan.plan.md` (13.2); `apps/docs/docs/operations/white-label.md` (SVG uploads are sanitised) | `ci.yml` api job (`test_svg_sanitizer.py`, 29 cases written as attacks rather than round trips: `<script>`, a namespace-qualified `<svg:script>` that a bare-name comparison misses, event handlers, `<foreignObject>` in well-formed XML, `<animate attributeName="href">`, `<set>`, an external `<use xlink:href>`, a remote `<image>`, `@import`, a `fill="url(https://…)"` paint server, `javascript:` in an `<a>`, a billion-laughs DTD, an XXE entity and a bare DOCTYPE. A benign logo is asserted to survive **intact**, because a sanitiser that removes everything is safe and useless) + `isolation.yml` (`check_whitelabel_metering.py` refuses any script-capable element or `on*` attribute entering the allowlist, and refuses a remote scheme in the logo reference; proven able to fail by injecting each) | GATED | Allowlist rather than denylist: a denylist of `<script>` passes while `<foreignObject>` renders arbitrary HTML. DTD and entity declarations are refused on a byte scan before parsing, which removes the expansion class rather than bounding it |-| A white-labelled organisation's console and PDF report carry its branding | `plans/aisoc_gap_closure_plan.plan.md` (13.2, Done when); `apps/docs/docs/operations/white-label.md` | `ci.yml` api job (`test_branding.py` renders the digest HTML that becomes the PDF and asserts the product name, the palette and the logo are present **and** that the platform wordmark is gone, since a report showing both is co-branded by accident; a separate case asserts the rendered report contains **no** external URL at all) + `web` job (`SidebarBranding.test.tsx` renders the real console shell against a branded API response and reads the wordmark out of the DOM, mocking the API client rather than the hook so the wiring is inside the test) | GATED | The PDF is this HTML through WeasyPrint, so asserting on the HTML asserts on the PDF without requiring the native stack in CI. Email approvals and ChatOps read the same resolved `sender_name` and are **not** covered end to end; the doc says so rather than implying they are |-| Usage metering equals the rows it summarises | `plans/aisoc_gap_closure_plan.plan.md` (13.3, Done when); `apps/docs/docs/operations/usage-metering.md` (Checking the numbers) | `ci.yml` api job (`test_usage_metering.py`, 15 cases. Every assertion counts rows **independently in the test** and compares, rather than comparing a producer against a copy of itself, which is how two console figures in this repository were wrong on real data while passing. The daily series summed is asserted equal to one query over the whole window; an alert seeded at exactly midnight is asserted counted once; another tenant's rows sit inside the window and are asserted never counted; `triages_model` + `triages_deterministic` is asserted to equal `alerts` exactly, so no triage is unaccounted for or double-counted) | GATED | Computed from source tables on request rather than kept in a counter table. A counter can only be tested against itself; a query cannot drift from the rows because it is the rows. `GET /usage/reconciliation` exposes the same comparison so an operator can run it on their own data |-| Metering reports "not measured" rather than zero, and carries no pricing logic | `plans/aisoc_gap_closure_plan.plan.md` (13.3, "No pricing logic"); `apps/docs/docs/operations/usage-metering.md` (What is not measured) | `ci.yml` api job (`test_usage_metering.py::TestHonesty` asserts `events_ingested` is named in `UNMEASURED` with a reason and is **not** also a meter, so it can never be reported as a number; asserts no meter key, label or SQL carries pricing vocabulary; asserts every meter binds its tenant as a parameter and formats nothing) + `isolation.yml` (`check_whitelabel_metering.py` re-checks all three against the declarations and was proven able to fail by removing a tenant binding) | GATED | The pricing check reads key, label and SQL only. `llm_cost_usd` is a measured provider charge and its description has to be able to say "not a price"; a gate forbidding the word would forbid the disclaimer with it |-| Auto-triage reads the tenant's knowledge-base runbooks and cites the chunks it was given | `apps/docs/docs/console/triage-context.md` (Knowledge-base runbooks) | `ci.yml` agents job (`test_triage_knowledge_base.py`: the block reaches the prompt ahead of the telemetry, every chunk carries a marker resolving to a document id **and chunk index**, the prompt names the markers the model may cite, and a marker no retrieved chunk carries is reported on the verdict's basis rather than left reading like one that resolves; an empty retrieval renders nothing at all, because "Runbooks: none" is a claim about the tenant) + `ci.yml` api job (`test_kb_triage_retrieval_route.py`: service-token only, a valid console session refused, tenant and query bound rather than interpolated) | GATED | The agents service had never read the knowledge base. Retrieval is the API's own full-text query and ranking rather than a second implementation, so a chunk triage was given is one an analyst searching by hand would have found |-| Retrieved knowledge-base text is contained as untrusted evidence, not as first-party guidance | `apps/docs/docs/console/triage-context.md` (How runbook text is contained) | `ci.yml` agents job (`test_triage_knowledge_base.py::TestContainment`: the block is nonce-fenced with the boundary sentence stated inline; a chunk echoing the fence is refused; **a leaked nonce is stripped even for a chunk the guard passes**, which is the property that matters because the guard's own held-out rate is 2 of 28; a high-severity chunk is dropped rather than demoting the alert, and the refusal is published on the verdict's basis. The scan runs on the raw text, pinned by a payload the *sanitiser* also recognises: sanitising first rewrites it to a redaction marker, the guard then reads a clean string, and the whole "ignore previous" family would score zero forever while the counter reported a clean library) | GATED | More containment than tenant-skill text gets, because a runbook is long, often imported in bulk, edited by more people, and reaches the prompt as prose that routinely quotes attacker output. Dropping the chunk rather than demoting the case is deliberate: demoting would let anyone who can write a runbook switch off auto-close for the tenant |-| Knowledge-base runbooks are point-in-time during a replay, and the freeze publishes what it refused | `apps/docs/docs/console/triage-context.md` (Freezing context for a replay); `services/agents/app/replay/shadow.py` | `ci.yml` agents job (`test_replay_leakage.py`: a runbook created after the split never reaches the prompt, with a **sensitivity half** running the live reader and asserting the same poison does; a reply that names no cutoff is counted as `cutoff_not_honoured` rather than as frozen, with a sensitivity half asserting an honoured cutoff does not raise it) + `integration.yml` (`tests/isolation/test_kb_retrieval_cutoff_live.py` runs the route's own `triage_retrieval_sql` against live Postgres: unscoped read first so an empty table cannot pass for isolation, then the cutoff, then the refusal count, and a cutoff before everything still returns its counts. Proven able to fail by deleting the cutoff predicate, by hardcoding the refusal count, and by neutralising the tenant predicate) + `ci.yml` gates job (`scripts/check_triage_context_freeze.py`: `CONTEXT_FREEZE_KINDS` classifies every source, a cutoff source's protocol method may not accept the instant from its caller, its frozen implementation must bind `as_of` to the snapshot's `split_at`, and a snapshot source's frozen implementation may await nothing. Twelve regressions injected into a detached copy, all twelve caught) | GATED | A runbook is usually written after the incident that prompted it, so this is the most natural way a replay could flatter itself. The refusal count is what makes the claim checkable: a cutoff that matched nothing and a cutoff that refused fifty documents return the same empty list |-| The hunt corpus holds 68 hunts, every one graded in both directions | `hunts/README.md`; `plans/aisoc_gap_closure_plan.plan.md` (8.4) | `ci.yml :: p1-eval` (`run_evals.py --suite hunt_corpus` — every hunt must fire on its declared positive scenario and none may fire on its negative, with telemetry orphaned by a renamed hunt failing in the other direction) + `ci.yml :: python-lint` (`check_hunt_scenarios.py`) | GATED | 68 is hunts replayed against a scenario and observed to fire. It is **not** a claim any of them fires on a given deployment's telemetry, which depends on whether that deployment's connectors emit the fields the hunt names; `hunts/README.md` states the distinction rather than letting the count imply the stronger claim |-| A hunt's negative scenario inverts the clause the hunt is about | `hunts/README.md` (Adding a hunt); `plans/aisoc_gap_closure_plan.plan.md` (8.4) | `ci.yml :: python-lint` (`check_hunt_scenarios.py` runs the **production** hunt matcher over both scenarios and requires the negative to differ from its positive in exactly one indicator field, that field not being the log-source selector, with a near-miss floor beneath it) | GATED | Proven against the pre-fix tree rather than only against the tree as committed: it found 8 violations on first run, 3 of them in hunts that predate this phase. The grading suite cannot see this — it asks only whether the negative fired, and a negative drawn from an unrelated log source never fires on anything, so a corpus of those reports a perfect false-positive rate while testing nothing |-| `scripts/run_hunt_evals.py` exists and defines no scoring of its own | `hunts/README.md` | `ci.yml :: python-lint` (`run_hunt_evals.py --self-test` parses its own source with `ast` and asserts it imports the corpus grader and imports neither the hunt engine nor the loader, so it cannot score) | GATED | `hunts/README.md` cited this script for months and it had never existed, so the one instruction a contributor was most likely to follow failed at the shell. It is a wrapper for the same reason `run_model_matrix.py` is: a second scorer drifts from the one the scoreboard publishes |-| A retro-hunt sweeps lake columns the lake writer actually fills | `plans/aisoc_gap_closure_plan.plan.md` (8.1); `apps/docs/docs/concepts/retro-hunts.md` | `ci.yml :: python-lint` (`check_ioc_lake_mapping.py` reads `lake_writer._COLUMNS`, the `raw_events` DDL and the three threat-intel clients, and fails when a swept column is not one the writer writes, a declared OCSF path is not one `event_to_row` reads, an `is_array`/`is_ip` flag disagrees with the column type, or a feed type any client emits routes to unknown) + `isolation-live.yml` (`test_retro_hunt_live.py` drives a real OCSF event through the real writer into a live ClickHouse and probes **each mapped column on its own**, because an OR hides a broken branch behind a working one) | GATED | Proven against injected faults rather than only against the tree as committed: a column renamed to one the writer does not fill, a dropped `is_ip`, and a topic disagreement each reproduce a finding. The first version of the live test passed with `is_ip` removed, because `iocs` carries the address as a plain string and masked the typed column; per-column probing is what closed that |-| One published indicator opens at most one alert per tenant | `plans/aisoc_gap_closure_plan.plan.md` (8.1) | `ci.yml :: api tests` (`test_retro_hunt.py` asserts the generated sweep is an aggregate with no selectable event column, so a thousand matches cannot become a thousand rows) + `isolation-live.yml` (`test_retro_hunt_live.py` inserts 1,000 matching events and asserts the sweep returns exactly one row counting all of them, with the distinct-value evidence sets still capped) | GATED | Two independent dedup layers, and the row asserts both: the `retro_hunt_sightings` UNIQUE constraint stops the alert being attempted on a later sweep, and the `alerts` per-tenant partial unique index on `idempotency_key` stops a duplicate landing if the branching is ever wrong |-| A retro-hunt that could not check a surface says so rather than reporting zero sightings | `plans/aisoc_gap_closure_plan.plan.md` (8.1) | `ci.yml :: api tests` (`test_retro_hunt.py` — `checked` and `sightings` are separate fields and `matched` requires both; an unreachable lake, an exceeded budget, an unreadable result and a SIEM source with no field mapping each produce a distinct named gap, and a sweep that matched on one surface while another failed still carries the gap) | GATED | The same rule `agent_tools.siem_search` draws for a backend that errored. Not gated: whether an operator reads the gap. The alert body places it under a heading rather than in a field a renderer could drop |-| A KEV entry is checked against a tenant's own vulnerability findings, not inferred from software names | `plans/aisoc_gap_closure_plan.plan.md` (8.2); `apps/docs/docs/concepts/retro-hunts.md` (KEV exposure) | `ci.yml :: api tests` (`test_kev_exposure.py` — a CVE routes to the exposure path and never to a telemetry sweep, asserted in both directions so no type can claim both; a value without CVE shape is refused rather than queried, because a scanner's `cve_id` column returns zero rows for an advisory title and that zero would read as "not exposed") | GATED | Exposure is drawn from `asset_vulnerabilities` rows. Matching the catalogue's vendor and product strings against an asset's OS field is deliberately not done: it would produce a plausible answer built on string similarity, and a task an analyst has to disprove is worse than no task |-| A tenant with no vulnerability data is told exposure could not be checked, not that they are unaffected | `apps/docs/docs/concepts/retro-hunts.md` (KEV exposure) | `ci.yml :: api tests` (`test_kev_exposure.py` — `checked` and `exposed_asset_count` are separate fields and `exposed` requires both, so a caller reading the dataclass cannot render an unscanned tenant as clean; the wording is asserted against the module constant rather than a copy written in the test) | GATED | The case-task body additionally states the count is a floor rather than a total, because assets with no scan coverage cannot appear in it. Not gated: whether an analyst reads that sentence |-| Auto-triage sees the last few analyst decisions on an alert of this shape, with the reason each analyst gave | `plans/aisoc_gap_closure_plan.plan.md` (6.3) | `ci.yml :: agents tests` (`test_triage_dispositions_and_identity.py` — reads the append-only feedback table rather than the per-signature override row, which holds only the latest decision; a rule-tagged decision is asserted to order ahead of one matched on a shared entity) | GATED | Deliberately below the corroboration threshold organisation memory enforces, so a disagreement recorded once is visible here and not there. Not gated: whether the decisions shown are the most relevant ones |-| Analyst dispositions are point-in-time during a replay, so a replayed decision cannot see a later one | `plans/aisoc_gap_closure_plan.plan.md` (6.3, replay freeze) | `isolation-live.yml` (`test_recent_dispositions_cutoff_live.py` — the cutoff is proven against a live store rather than a stub, because an ORM-level filter that a stub satisfies is the half that has already been wrong once) | GATED | Same seam as the knowledge-base freeze. Not gated: dispositions written by a system outside this store |-| A major version means an operator must act, enforced in both directions | `apps/docs/docs/operations/release-policy.md` (A major version means an operator must act) | `governance.yml :: governance` (`check_release_policy.py`: a major bump whose changelog section carries no `### BREAKING` heading fails, **and** a `### BREAKING` heading on anything that is not a major bump fails. Both arms are proven by injecting that exact violation into a fixture changelog, and each is proven not to fire on the other's violation, so neither is passing by accident. Eight majors below the 10.0.0 policy floor are exempt and are printed on every run rather than skipped quietly) + `release.yml :: release` (`--tag`, run before any artefact is published, because a release whose version and notes disagree is far cheaper to stop than to withdraw) | GATED | The gate reads the changelog, not the diff. It cannot tell that a change *is* breaking when nobody wrote it down; what it removes is the case where somebody did write it down and the version did not follow |-| `stable` does not cross a major on its own | `apps/docs/docs/operations/release-policy.md` (Tags and channels) | `ci.yml :: python-test` (root) `test_release_channel_tags.py` lifts the tag-selection block out of `release.yml` and runs it under bash for each combination rather than re-implementing it: a minor and a patch move `stable`, every `vX.0.0` does not, a dispatch with `promote_stable` does, a republish moves neither channel, and the demo bundle carries no channel tag at all. The `promote_stable` input is asserted to be declared, so the only path by which `stable` can reach a major is reachable | GATED | It asserts which tags are computed, not that the registry ends up holding them. The latter is `docker-verify`'s job, which asks the registry rather than the workflow |-| The Helm chart is published where the documentation says it is | `apps/docs/docs/deployment/kubernetes.md`; `apps/docs/docs/operations/release-policy.md` (The Helm chart) | `release.yml :: chart-publish` (packages and lints on every run so the chart cannot quietly stop being publishable, re-checks that `appVersion` names images that exist via `check_published_images.py --require-network`, pushes on a tag, and then resolves the pushed chart with `helm show chart` rather than trusting the push step's exit code) | GATED | The page told operators to run `helm show chart oci://ghcr.io/beenuar/aisoc`, where no chart has ever been pushed. The job makes the corrected reference true from the next release; until that release the page says so rather than implying it already resolves |-| A migration is exercised against a populated database before it ships | `apps/docs/docs/operations/release-policy.md` (Upgrading) | `upgrade-test.yml :: upgrade`, on every pull request touching `services/api/migrations/**`, `run_migrations.py` or any service's `alembic/`: the previous minor's **published image** applies its own chain, `scripts/upgrade_fixture.sql` seeds a tenant, a user, one alert per severity tier and a case, and then this tree's chain is applied over the populated schema by that same runner. It asserts every migration on disk is recorded as applied, that the pre-upgrade rows are still readable **by id** rather than only by count, that the DML-only runtime role can still read them, and that a second run applies nothing | GATED | The previous release's runner applies both legs, so a migration needing a *newer* runner than the previous release shipped is not covered; it would fail the second leg rather than pass silently. The fixture is four tables deep, not the whole schema |-| The hunting agent never writes a query: it fills a closed schema and the values it supplies are bound parameters | `plans/aisoc_gap_closure_plan.plan.md` (8.3); `apps/docs/docs/concepts/hunting-agent.md` | `ci.yml :: hunt agent boundary` (`check_hunt_agent_boundary.py` — reads the plan enum, the SQL compiler and the ClickHouse DDL together and fails when any drifts from the others; proven against an open enum, a query-shaped property and a field the DDL does not declare) | GATED | The gate reads structure, not intent: it cannot say the plan the model chose is a sensible hunt, only that the model could not have expressed anything outside the vocabulary |-| A hunt the event lake could not answer is reported as unavailable with a reason, never as zero findings | `plans/aisoc_gap_closure_plan.plan.md` (8.3) | `ci.yml :: api tests` (`test_hunt_plan_sql.py` — the unavailable branch omits the `rows` key entirely, so a caller reading `rows` raises rather than rendering an empty list as a clean estate; asserted across all three failure classes) | GATED | Three outcomes are kept apart in the response shape rather than in prose: findings, no findings, and could not check |-| A bind parameter in a raw SQL statement carries the name the handler binds, so the route reaches a connection rather than 500ing on `ArgumentError` | `scripts/check_text_bind_casts.py` (module docstring); the four dead handlers it names | `isolation.yml :: route-scope` (`check_text_bind_casts.py` — an AST pass over every `text()` literal under `services/`, refusing `:name::type` because SQLAlchemy's bind-parameter regex backtracks one character rather than skipping the cast, so `:payload::jsonb` declares `payloa` and the matching `.bindparams()` raises. `--self-test` asserts five things: the injected `:payload::jsonb` is reported, a `::` cast in a *concatenated* statement is reported too, the correct `CAST(:name AS type)` spelling is not, an ARN literal outside a `text()` call is not, and a tree with no Python under `services/` is refused rather than called clean) | GATED | Scoped to statements the AST can see as `text()` arguments, including concatenated ones. A statement whose SQL arrives at runtime from outside the module — a fragment read from a file or assembled by a helper the pass does not follow — is not covered, and the fix everywhere is the standard `CAST(:name AS type)` spelling |-| Every CI job that grades a service installs what that service's image ships, so CI cannot run a different engine than production | `scripts/check_ci_install_parity.py` (module docstring); `RELEASES.md` | `reproducible-builds.yml :: pin-agreement` (`check_ci_install_parity.py` — for every job running a service's *whole* pytest suite, three directions: a runtime dependency guarded by `except ImportError` that CI does not install, so CI grades the fallback and the image grades the real path; a package CI installs that none of the job's services declares; and a version range disjoint from, wider than, or unbounded against the intersection of what those services declare. 16 self-test cases inject each direction, two controls must not fire, and two refusals cover a tree with nothing to compare. It reported 210 divergences against the commit before it landed) | GATED | The three whole-suite jobs derive their install list from the manifests through `service_requirements.py`, which re-resolves inside the declared ranges rather than installing the locked set — so CI can land on a different patch release than the image. Narrower than a hand-written list, and stated in the script's docstring. Closing it means installing from the lock in CI, at the cost of the pip wheel cache the matrix was built around |-| A published Helm chart version names one chart forever | `apps/docs/docs/deployment/kubernetes.md` (The chart's version); `infra/helm/aisoc/Chart.yaml` | `helm.yml :: version` + `release.yml :: chart-publish` (`check_chart_version.py` — four checks that need no network: `appVersion` moved while the chart's own `version` did not, any tracked chart file moved with no version bump (with Chart.yaml's own `version:` masked, so the bump cannot justify itself), a version that moved backward, and one chart version declared at two release tags with differing content. Plus one that asks GHCR: the version about to be pushed already exists holding content this tree does not. The registry comparison is on **unpacked files**, because `helm package` is not byte-reproducible — `Chart.yaml` is compared parsed since helm re-serialises it, and the tracked subchart `.tgz` are expanded the way helm expands them, a mapping measured exact against the published 5.9.2 at 146 files. On a release it runs with `--require-network`, before `helm push`, because the push overwrites silently and there is no after. 16 self-test cases, and the gate refuses a checkout with no tags rather than concluding no release ever declared a version) | GATED | **Proven against the pre-fix tree**: at `2db6ce73` (the v13.0.0 release commit) it exits 1 naming `appversion-moved-alone` — `v12.3.2` -> `v13.0.0` with `version` held at 5.9.2 — and exits 0 at `9d3225c6` after the bump to 6.0.0. **Two things it deliberately does not decide.** Whether a bump is the right *size*: nothing in a diff knows if a renamed `values.yaml` key breaks somebody's values file, so the gate enforces forward, never how far. And the overwrite that already happened: republishing replaced the bytes, so the registry's 5.9.2 and the tree that overwrote it are now byte-identical — measured, 146 files, zero differences — which is why the retro-detection reads git rather than the registry, and why the pre-fix proof runs through the baseline check. `5.9.2` and `5.2.0` are recorded in `KNOWN_COLLISIONS` as unrepairable, checked in both directions so an entry that stops being detectable fails |-| Every console call to an AiSOC API carries a credential | `apps/web/src/lib/api.ts` (the credentialed client); `SECURITY.md` (authentication) | `ci.yml :: Python — Lint & Type-check` (`check_console_auth_headers.py` — parses every `fetch(` and `useSWR(` call under `apps/web/src` and requires the credential to be visible on the same expression, so hiding it behind a local `const headers` a few lines up does not count. `X-Tenant-Id` alone and `credentials: 'include'` are both findings, because neither authenticates against a bearer-token API. 15 self-test cases, of which three pin blind spots in the gate's own first draft — a generic type argument hid both real SWR sites, a multi-line arrow fetcher was truncated at the first newline, and an inline fetcher whose URL is the SWR key has no API path at the call site — and four are controls that must not fire. It refuses a tree with no console sources, and separately refuses one where the console makes no API call at all, since a broken matcher and a console that stopped calling the API print the same clean line) | GATED | **Proven against the pre-fix tree**: 61 findings across 21 files at `079fdb69` (45 bare fetches, 16 SWR fetchers), 0 after. One allowlisted exception, the public `/r/<slug>` replay permalink, which is unauthenticated by design and is kept safe by `replay_redaction.py` rather than by a header; the allowlist may only shrink and a stale entry fails the gate. One limit stated rather than implied: the gate reads the console, so it proves the credential is sent, not that the server requires it — `check_route_auth.py` and `check_route_authz.py` are the other half |-| An unauthenticated request is never an administrator, and never acts in a real tenant | `SECURITY.md` (authentication); `apps/docs/docs/deployment/single-host.md` | `ci.yml :: Python — Tests` (`services/api/tests/test_anonymous_bypass_requires_optin.py`, 36 cases: the four names in `AUTH_BYPASS_ENVIRONMENTS` each refuse on their own; the explicit `AISOC_DEV_AUTH_BYPASS` opt-in admits; five truthy and five falsy spellings of it; the flag does not re-enable the shim outside a dev environment; five reachable published addresses refuse and five loopback forms admit; one reachable address among several refuses; the demo tenant is not the bootstrap tenant and the canonical id did not move; and every refusal names the condition that withheld it) + the nine vendored copies of `services/fusion/tests/test_tenant_scope.py` kept in lockstep by `sync_vendored_tenant_scope.py --check` + `services/realtime/test/push-tenant.test.ts` | GATED | **Proven against the pre-fix tree**: 35 of 36 API cases fail at `079fdb69` and all 36 pass after, with the tenant-sharing assertion failing as `assert UUID('…0001') != UUID('…0001')`; 4 of 8 realtime cases fail pre-fix, the other 4 being controls that must pass both ways. Two limits stated rather than implied. The loopback check is only as good as what compose passes in `AISOC_PUBLISHED_BIND_ADDRS`: an unset list is treated as a local run, because refusing on an empty list would break `uvicorn app.main:app` for contributors, which is the case the shim exists for — the deployment-path gate is what stops a published stack leaving it unset. And a hostname that is not obviously loopback is treated as reachable, so a DNS name resolving to 127.0.0.1 refuses the bypass; that is the safe direction for an undecidable question, and it is a false refusal, never a false admission |-| Every documented way to start AiSOC produces a production-class posture | `README.md` (quick start); `apps/docs/docs/deployment/single-host.md`; `apps/docs/docs/deployment/walkthrough.mdx` | `ci.yml :: Python — Lint & Type-check` (`check_deployment_auth_posture.py` — resolves `${VAR:-default}` against the env file each documented path uses, for every service in the compose file, with no Docker, and fails on a development-class `ENV`/`ENVIRONMENT`, a truthy `AISOC_DEV_MODE`, `AISOC_DEV_AUTH_BYPASS` outside the overlay, a service that reads the flags without being told its published addresses, or an entry point that exports any of them. 13 self-test cases, three of them controls) + `ci.yml :: Python — Tests` (`tests/test_compose_environment_gate.py`, `tests/test_production_compose_gate.py`) + `make smoke`, which answers 401 to an anonymous write on the API port and through the console proxy | GATED | **Proven against the pre-fix tree**: 28 findings at `03e923f3`, across every service that reads the bypass flags; 0 after. **And verified live on a rebuilt image**, three postures on a real container: `make up` answers 401 with no bypass variable set; `make up-dev` on loopback answers 200 and logs the activation warning naming the demo tenant; `make up-dev` with the console on `0.0.0.0` answers 401 and logs the refusal naming the address. The first probe run graded a cached pre-fix image and was discarded, which is why the claim says rebuilt. One limit stated rather than implied: the gate reads declarations, so it proves the *shipped* default is production-class, not that a particular operator's `.env` is — an operator who writes `ENVIRONMENT=development` and `AISOC_DEV_AUTH_BYPASS=1` by hand has asked for it, and the loopback refusal is what still stands between that and a reachable host |-| Repeated credential failures are throttled and eventually locked out | `SECURITY.md` (what to review) | `ci.yml :: Python — Tests` (`services/api/tests/test_login_throttle.py`, 18 cases, and `services/api/tests/test_login_route_throttled.py`, 4 that drive the real route — because a gate on the limiter alone passes over a route that never calls it, and that was the defect: three limiters existed in this service and login consulted none of them. Asserted in both directions: a success clears the account counter and not the source counter; password spraying trips the source counter without ever tripping an account counter; an address that does not exist is refused identically to one that does; and Redis being down degrades to per-replica counting rather than locking everyone out) | GATED | **Proven against the pre-fix tree**: the four route cases fail at `4f4ba326` as `assert 429 in [401, 401, 401, ...]`, and the control — the first two attempts still answering 401 — passes on both trees, so the suite cannot be satisfied by a route that refuses everyone. Two limits stated rather than implied. The source counter is evadable where `X-Forwarded-For` is not stripped by a trusted proxy, since an attacker can rotate it for a fresh bucket per request; that is why the account counter is the primary control, and why the source counter is aimed at spraying, where per-request rotation is not something an attacker expects to need. And the fallback is per-replica, so an attacker spread across replicas gets one budget per replica — weaker than shared counting, and recorded as weaker |-| No SSO path mints an identity that no identity provider authenticated | `apps/docs/docs/operations/security.md` (SSO); `SECURITY.md` | `ci.yml :: Python — Tests` (`services/api/tests/test_sso_mints_no_stub_identity.py`, 8 cases: neither `stub-saml-user` nor `oidc-stub-user` is constructible in any auth module, both handlers answer 501 when unconfigured, no `set_cookie` sits inside an exception handler, and `python3-saml` is declared so the 501 is clearable. The glob is asserted non-empty, because a pattern that matches nothing makes every other case vacuous) | GATED | **Proven against the pre-fix tree**: 6 of 8 fail at `48234dc5`. **And verified by building the image**, not by reading the manifest: `onelogin.saml2` imports inside it, so the `ImportError` branch that minted the stub is unreachable rather than merely deleted. One cost stated rather than hidden: the image grows 1.36 GB to 1.42 GB, which is the three wheels. The first attempt also added four `-dev` packages on the assumption that `xmlsec` compiles from source; it does not, a `manylinux` wheel exists, and removing them kept the import working and saved 110 MB. Measured, not assumed, in both directions. One limit: this proves no *stub* identity can be minted, not that a real SAML assertion is correctly verified — the containerised test IdP that would prove that is parity 4.1 |-| Copilot conversations and saved hunts are visible only to the tenant that created them | `apps/docs/docs/console/copilot.md`; `apps/docs/docs/concepts/multi-tenancy.md` | `ci.yml :: Python — Tests` (`services/agents/tests/test_copilot_and_hunts_are_tenant_scoped.py`, 21 cases: neither module global survives, all seven handlers take a principal **and** resolve a tenant from it, every SQL statement in the store carries the predicate (parsed from the AST, not eyeballed), the RLS context variable is spelled `app.current_tenant_id`, an unavailable store raises rather than returning empty, and the migration creates both tables with `tenant_id NOT NULL`, forced RLS and the `aisoc_app` grant) | GATED | **Proven against the pre-fix tree**: all 21 fail at `e7f4d2b3`. The instructive part is that both routers *already* authenticated every request — the principal was verified and then discarded, because no handler took it as a parameter, so a gate checking only for an auth dependency would have passed this. Hence two cases per handler: binds a principal, and resolves a tenant from it. One limit: these assert the predicate exists, not that Postgres enforces it — the two-tenant replay that proves the policy lives in `tests/isolation/` and runs only where containers are available |-| No route module keeps state in a module global, or serves invented data | `README.md` (real vs synthetic data); `docs/audit/REPOSITORY_REALITY.md` | `ci.yml :: Python — Lint & Type-check` (`check_python_route_state.py` — parses every route module under `services/*/app/api` with `ast` and fails on a module-level mutable a handler writes to, by rebinding, by a mutating method, by a subscript store or through a subscript load, and on a container named as sample data with no demo gate in the file. 12 self-test cases, five of them controls) + `ci.yml :: Python — Tests` (`services/api/tests/test_no_fabricated_shift_or_taxii_data.py`) | GATED | **Proven against the pre-fix tree**: 21 findings on the first run; 4 of the 6 behaviour cases fail at `48234dc5`. Two of the gate's own rules were wrong first and the corrections are the durable part: a shape heuristic produced four false positives out of four detections on real configuration tables, so the name is the signal; and the allowlist credited an entry on the name alone rather than on an actual suppression, so a fixed defect kept its excuse. **15 entries remain, ratcheted** — five are not defects (a log de-duplicator, two caches of static artefacts, global-by-design community content) and the rest name the plan item that gives them a table. One limit: the gate reads route modules, so a service that keeps shared state in a helper module its handlers import is out of scope |-| Platform data is not carried in the clear between services | `apps/docs/docs/operations/security.md`; `README.md` (architecture) | `ci.yml :: Python — Lint & Type-check` (`check_kafka_transport.py` — all 13 client construction sites across Python, Go and TypeScript pass a resolved transport, checked through the AST so a comment cannot satisfy it, **and** the resolver is called and required to refuse production cleartext, allow development plaintext, and reject a typo rather than defaulting; plus `sync_vendored_kafka_security.py --check`) + `ci.yml :: Python — Tests` (`services/api/tests/test_transport_security_defaults.py`) | GATED | **Proven against the pre-fix tree**: 13 clients unwired, 10 of 13 cases fail at `48234dc5`. The two-direction check is the point — checking call sites alone would pass a tree where every site calls a resolver that always answers PLAINTEXT. The sync gate also re-derives Kafka users from the tree, so an eighth service that never takes a copy fails rather than running plaintext. Two limits: `sslmode` is **reported at boot, not enforced** (every service builds its own engine and the collector is the one place they all pass through), and the compose DSN keeps `sslmode=disable` deliberately because the bundled Postgres serves no certificate |-| No integration ships a working credential nobody chose | `apps/docs/docs/operations/security.md` (secrets) | `ci.yml :: Python — Tests` (`services/purple-team/tests/test_caldera_key_has_no_default.py`, 4 cases: the published literal is absent from code, the setting defaults to empty, building a client without a key raises and names the variable, and a configured key still builds one) | GATED | **Proven against the pre-fix tree**: 3 of 4 fail at `48234dc5`. `ADMIN123` is Caldera's own published first-run credential, so an unconfigured deployment authenticated with it against any Caldera nobody had rotated. The fourth case runs the other way so this cannot pass on a build with no client at all |-| Every state-changing route makes an authorization decision, or declares why identity is one | `apps/docs/docs/operations/security.md` (RBAC); `README.md` | `ci.yml :: Python — Lint & Type-check` (`check_route_authz.py` — 224 of 245 state-changing routes authorize; the remaining 21 must each sit in a module carrying a written reason, checked in both directions so an undeclared module fails *and* a declaration describing no route fails) | GATED | **Proven by perturbation**: removing a real declaration and adding one for a nonexistent module were each run and each failed the gate. 218 → 224 authorizing. Two corrections worth recording: four MSSP routes guarding cross-tenant grants were counted as unauthorized while being correctly guarded by an organisation-role dependency, fixed in the gate rather than by bolting a redundant tenant permission onto a surface that is not tenant-scoped; and one route was gated and then **reverted**, because its existing pin argued every authenticated principal is a legitimate rater and the permission added here contradicted that — a prior decision with its reasoning written down outranks a later sweep that did not read it. One limit: the gate reads the signature, so it proves a decision is *made*, not that the permission chosen is the right one |-| The audit log names the credential that acted, and a tenant can read its own trail | `apps/docs/docs/compliance/evidence-pack.md`; `apps/docs/docs/operations/security.md` | `ci.yml :: Python — Lint & Type-check` (`check_audit_coverage.py` — every actor-bearing `emit_audit` records the credential, `tenant_admin` holds `audit_log:read`, the modules whose *reads* are the sensitive act emit audit, and the coverage floor ratchets; 6 self-test cases including two controls) + `ci.yml :: Python — Tests` (`services/api/tests/test_audit_attribution_and_readership.py`) | GATED | **Proven against the pre-fix tree**: 7 of 11 fail at `3c04a21b`, and the gate found two live defects on its first run that the hand-written fix had missed. The honest limit is published rather than hidden: **7 of 86 endpoint modules emit audit at all**, the floor is set at that measured value rather than an aspiration, and the gate prints the largest unaudited surfaces by route count on success so the next step is named. Raising it is ordinary work, not a gap in the control. One correction recorded: the attribution rule first reported the SCIM writer, whose actor is already `scim:<token>` — a scheme-prefixed actor is self-attributing |-| Only a human-confirmed, unexpired, uninjected prior can auto-close an alert | `apps/docs/docs/concepts/automation-maturity.md`; `apps/docs/docs/console/funnel-kpis.md` | `ci.yml :: Python — Tests` (`services/agents/tests/test_outcome_memory.py` — an AI prior never suppresses at any count or confidence, a prior expires 90 days after its last confirmation, an unparseable timestamp counts as expired, injection-flagged evidence never suppresses, and the refusal names which rule declined; plus `test_outcome_writer_signature_parity.py`, which compares all four `record_outcome` signatures in both directions and asserts the concrete writer forwards the flag) | GATED | **Proven against the pre-fix tree**: `suppression_refusal` does not exist there, so the whole module fails to import, and 2 of the 10 parity cases fail. The durable finding is why the parity test exists: adding the keyword broke four writers and **no test failed on the exception**, because the call sits inside `contextlib.suppress(Exception)` — what surfaced was a zero write-count in an unrelated replay test three files away. One limit: these prove the *rules*, and the injection flag is only as good as the guard that sets it, which scores 98.1% on its tuned corpus and 7.1% on held-out payloads |-| A permission granted or revoked in the console governs every route | `apps/docs/docs/operations/security.md` (RBAC); `apps/docs/docs/console/settings.md` | `ci.yml :: Python — Lint & Type-check` (`check_one_permission_model.py` — the check reads the resolved set, authentication resolves one, all 5 RBAC mutations invalidate, and no route module imports the static map; 5 self-test cases, one a control) + `ci.yml :: Python — Tests` (`services/api/tests/test_database_backed_permissions.py`, 18 cases **in both directions**: a database grant the static map lacks is allowed, and a static grant the database lacks is denied) | GATED | **The second direction is the one that was broken**: the old fallback restored a deprovisioned user's static permissions whenever their last role was removed, because an empty row set was read as 'not configured'. 275 static sites became database-backed with zero call-site edits by moving resolution into `get_current_user`. Two limits stated rather than hidden: resolution **fails open to the static map** on a database fault, deliberately, because failing closed would turn a blip into a platform-wide lockout mid-incident; and without Redis the invalidation degrades from a version counter to a 15-second TTL, logged, so a multi-replica deployment converges rather than invalidating immediately |-| Every `mssp_*` table isolates one portfolio from another at the database layer | `apps/docs/docs/concepts/multi-tenancy.md`; `apps/docs/docs/mssp/overview.md` | `integration.yml :: MSSP row-level security isolation (live, two portfolios)` (`tests/isolation/test_mssp_rls_live.py`, 38 cases against a real Postgres) + `ci.yml :: Python — Tests` (`services/api/tests/test_mssp_row_level_security.py`, 20 structural cases including a policy-graph cycle detector) | GATED | **Measured, not asserted**: with the policies disabled 30 of the 38 live cases fail; with them, each of four parties sees exactly its own row and a fifth sees zero. Forced RLS 117 → 123 tables. The cycle detector was **proven by re-injecting the real cycle** the first draft had. Two findings worth keeping: the existing live suite discovers tables by a column named `tenant_id`, so all seven `mssp_*` tables sat outside its coverage figure — which is why six went unpoliced; and `check_rls_policy_shape.py` passed on mutually recursive policies that raise `infinite recursion detected` on the first SELECT, so shape is not liveness. One limit: the live job needs a container, so on a developer machine without one these skip |+| Claim | Source | Gate (workflow :: job) | Profile | Status | Closes in |+|---|---|---|---|---|---|+| Offline sandbox demo runs with no key/network in < 5 s | README L38 | `readme-gates.yml :: sandbox-offline` (ubuntu+macos matrix) | core | GATED | - |+| `pnpm aisoc:demo` boots the real stack | README L40, L45 | `compose-smoke.yml` (cold health) + `integration.yml :: spine` (Phase A3 — default `docker compose up` ships connectors + graph-at-ingest by default; asserts cold-boot → ingest → lake + detection engine → alert row with the spine test's measured raw-event→alert latency) | core | GATED | - |+| 84 connectors | README L116, L168 | `ci.yml :: python-lint` (`generate_connector_count.py --check`) | core | GATED (count) | - |+| Connectors: schema-driven config + vault-encrypted secrets | README L168 | `ci.yml` connectors matrix (`test_schemas.py` + `test_conformance.py` — secret-shaped fields must be `type=secret`); vault tests + `test_live_vendor_smoke.py` (Phase D3 — mock-server drives each connector's real HTTP client + normalize) | core | GATED | - |+| Connectors: live Test connection | README L168 | `ci.yml` connectors matrix (`test_conformance.py` — every connector implements the async `test_connection` contract) + `connector_conformance.py --check` published matrix + `test_live_vendor_smoke.py` (Phase D3 — mock-server conformance: `test_connection()` + paginated `fetch_alerts()` HTTP path exercised against realistic vendor payloads) | core | GATED | - |+| Investigation Ledger stores every step | README L61, L169 | `ci.yml :: Python — Lint & Type-check` (`check_ledger_replay_contract.py` — response model ↔ console type, client requests ↔ router decorators, and `seq` ordering/uniqueness, each in both directions) + `ci.yml :: Python — Tests` (`test_investigation_replay.py`, 37 cases over `/replay`, `/events`, `/explain`; removing `ORDER BY seq` fails five of them) | core | GATED | — |+| Public eval harness gates every PR | README L62, L77 | `ci.yml :: p1-eval` | core | GATED (but suites are self-consistency; see reality report) | Phase 4 |+| Alert-reduction is a real measurement | README / benchmark page | `ci.yml :: python-test` (fusion) runs `test_alert_reduction_real.py`, which groups a 1 000-alert stream with `RawAlert.correlation_key()` — the method `Correlator` actually calls — and bounds the ratio on both sides, because a floor alone is satisfied by a key that collapses everything into one incident | core | GATED | the legacy suite's 75.3% stays published for continuity and is labelled as not describing this product; the measurement is still a synthetic workload, as the benchmark page states |+| Runs entirely on your infrastructure, and makes no unconfigured outbound call | README L63 | `ci.yml :: python-test` (agents) runs `test_privacy_redactor.py` (zero raw PII survives) | full | GATED (redaction gated; the CLI now has no default telemetry endpoint and `telemetry.test.ts` pins that an enabled-but-unconfigured run makes zero network calls; **v9.0 adds the Helm egress default-deny** — `infra/helm/aisoc/templates/networkpolicy.yaml`, gated by `helm.yml` which asserts it denies by default, excludes `169.254.169.254/32` from every allowed CIDR, and stays opt-in because a CNI that does not enforce NetworkPolicy ignores it silently; **the platform-wide half landed with `check_default_egress.py`** — every service's declared settings defaults are read and a public host that no air-gap guard covers fails, with each exemption naming the guard that justifies it so deleting the guard withdraws the exemption — plus `tests/test_no_default_egress.py`, which patches the socket layer and drives each service's import and startup with a blank environment, covering 7 of 13 services in CI and naming the missing package for each of the other 6 rather than skipping silently. `services/purple-team` declared an ATT&CK CDN URL nothing in the service read, and it was deleted rather than exempted. **the container half landed with `check_container_egress.py`** — images built from the commit under test start on a docker network created with `--internal`, with a DNS sinkhole as their only resolver, and every name they ask for is classified with the same predicate the services enforce air-gap policy with. Observation, not only prevention, because a block alone cannot tell "made no call" from "made a call that failed". Two controls, because zero observations is what a correct run and a blind probe both look like and the API's unconfigured startup legitimately records zero — it dials Postgres on loopback, which needs no DNS: a canary wired with the identical network and `--dns` flags must be seen by the sinkhole, and a container that emitted no log line and asked for no name is a finding rather than a pass. `container-egress.yml` also builds an image that deliberately resolves a public name and requires the gate to fail on it. One limit stated rather than implied: a dial straight to a public IP literal asks no DNS, so it is prevented by the `--internal` network and statically checked by `check_default_egress.py`, but not observed. **Narrowed 2026-10-01**: the claim used to read "no data exfiltration", which a reader takes to cover a *configured* hosted model as well. It does not. When an operator configures a hosted provider, evidence reaches it unredacted: `services/agents/app/privacy/redactor.py` exists and is unit-tested, and **no LLM call site invokes it**, so `test_privacy_redactor.py` gates a function rather than a path. Restored by parity 2.4, which routes hosted calls through the pseudonymizer at the contract layer and adds the call-path gate this row would then rest on) | — |+| Detection-as-Code rejects candidates that regress MITRE accuracy | README L170 | `ci.yml :: python-test` (`test_detection_eval.py` — candidate `rule_body` run through the real engine vs its own positive/negative fixtures; approval requires it) + `p1-eval` w2-dac baseline | core | GATED | - |+| 800+ native detection rules | README L78, L170 | `validate-detections.yml` (strict fixture replay) | core | GATED | - |+| 6000+ imported detection rules | README L78 | `validate-detections.yml` (parse/provenance + `detection_truth_table.py --check`); README cites the executable figure (2603) not the on-disk figure (6991) for coverage | core | GATED | - |+| L0-L4 automation maturity gates every action | README L171 | `ci.yml` autonomy-policy drift test + `test_autonomy_safety.py` (dry-run-default, rollback-capability contract, verification-mandate, scorecard) + `test_governed_dispatch.py` (Phase B2 — `decide()` wired into the live-actions `/dispatch` path: above-tier→dry-run, dry-run-off→queued, L0→blocked, executor never invoked when queued/blocked) | core | GATED | - |+| Hunt-as-Code + `/hunt` | README L172 | `ci.yml :: p1-eval` (`hunt_corpus`) | core | GATED | - |+| Weekly benchmark scoreboard runs live against `main` | README L173 | `ci.yml` agents job (Phase E1 — `scripts/check_scoreboard.py` runs the deterministic live-agent MITRE-accuracy eval over the 200-incident corpus and fails if the published `scoreboard.json` substrate row drifts > 0.02, the schema is invalid, or a substrate row is mislabelled) + `wet-eval.yml` (weekly funded LLM rows) | core | GATED | - |+| MCP server exposes 18 tools | `services/mcp/README.md`; `apps/docs/docs/integrations/mcp.md`; `apps/docs/docs/intro.md`; `docs/architecture/SYSTEM_DESIGN.md` | `ci.yml :: mcp` (`tests/tools.test.ts` pins the exact tool set, and `tests/published-count.test.ts` compares the figure in each of the seven documents that publish it against `ALL_TOOLS.length`, failing in **both** directions: a figure that disagrees, and a document that has stopped carrying one, so deleting the claim is a finding rather than a pass. A floor refuses to let an empty registry make every document agree with zero) | core | GATED | The row previously read 13 and named `ci.yml :: mcp` as the gate. That job pins the tool *set* and had never read a document, so six published figures could have drifted with nothing to say so |+| Plugin SDK Python/TS/Go | README L79, L193 | `ci.yml :: sdk-*` (build/test per language) + `openapi-breaking.yml` (a spec change that would break the generated clients) + `ci.yml :: Python — Lint & Type-check` (`check_sdk_surface.py` — every endpoint a client calls must exist in `docs/openapi.yaml`, the three languages are held to a declared namespace manifest, and a declared codegen target must exist) | core | GATED (the three `sdk-*` jobs compiled each SDK in isolation and never compared a client to the API it claims to speak to: `packages/sdk-go` passed all three over a file of type declarations with no functions and no `net/http`, and `packages/sdk-ts` cited a codegen artefact that did not exist. Writing the gate found four operations both clients called that the API does not serve, two of them pinned by tests that mock the transport. The gate proves an endpoint *exists*; field-level response-shape parity is still hand-kept and the SDK headers now say so) | — |+| Prompt-injection resistance | (implied by agent claims) | `ci.yml :: python-test` (agents) runs `test_prompt_sanitizer.py`, `test_prompt_envelope.py` and `tests/adversarial/` — a 32-payload corpus grouped by attacker goal, enforcing a recall floor **and** a false-positive ceiling on real security content that reads adversarially. Action-trigger and exfiltration payloads are individually required rather than averaged, because an injected containment turns the SOC into a denial-of-service tool pointed at its own estate. Phase 3 adds a second, harder corpus at incident level (`test_injection_incidents.py`) whose payloads are written to fit the field they arrive in, enforcing a floor, a ceiling and an exact ratchet naming every current blind spot by id | core | GATED | obfuscation is an arms race and is recorded rather than individually required; no payload is xfail at present, the homoglyph and newline-flood payloads having been closed by confusable folding and by a rule reaching them. The two corpora measure the same guard and are **not comparable**: one asks whether the guard recognises a string, the other whether it recognises it where an attacker can put it, and the second scores materially lower. Neither measures a model |+| Prompt-injection payloads are graded against a clean twin, so a rate is attributable to the payload | `services/agents/tests/adversarial/injection_incidents.py` | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (every pair differs in exactly **one** telemetry field, asserted by a structural diff rather than by inspection; the payload is present at that field in the injected twin and absent from the clean one; where a base incident lacks the field both twins gain the scaffold record so the injected twin never carries structure the clean twin lacks. A guard detection requires a signal at the injected field **and** no signal at that field in the clean twin, proven in the direction that broke by contaminating a base incident and asserting the pair stops counting) | core | GATED | The corpus is synthetic and labelled so at every record. It grades placement and phrasing, not whether a payload would be delivered: that a DNS name can carry an instruction is asserted, that an attacker controls that DNS name is assumed |+| The injection corpus is generated deterministically and cannot change silently | `services/agents/tests/adversarial/injection_incidents.py` | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (the whole corpus is pinned by a SHA-256 digest that a payload, pairing or base-incident change moves, so an edit lands with the diff beside it; two builds in one process are compared, and the serialised record is asserted to carry no clock, uuid or random field, which is the shape that would survive a same-process comparison) | core | GATED | The digest pins the corpus, not the guard. A corpus change and a guard change move different numbers, which is why the ratchet names payload ids rather than only a rate |+| Injection rates that no model produced read "not measured", never `0` | `services/agents/tests/adversarial/injection_metrics.py`; `apps/docs/docs/benchmark.md` (Latest results) | `ci.yml :: python-test` (agents) runs `test_injection_incidents.py` (a deterministic run leaves the three behavioural rates unmeasured, and each is asserted to carry no `value`, to render the words "not measured", and to serialise without a number, so a formatter cannot round an unrun metric to zero. `Rate(0, 10)` still renders as a real zero, so the two remain distinguishable) + `ci.yml :: python-test` (root) runs `test_injection_eval_gate.py` (a `--live` run with no key, and a run whose every dispatch failed, both emit `measured: false` with a reason and **no `value` key at all**; the rendered markdown row contains "not measured" and not `0.0%`; a partial run reports the denominator it actually answered) | core | GATED | A zero and an absence are different facts, and these are the files that keep them apart. The live rates have **never been measured** on any model, because no funded key exists; that is a maintainer blocker, not a gap in the gate |+| The published injection numbers are the measured ones, and the weekly job cannot go green having measured nothing | `apps/docs/docs/benchmark.md` | `ci.yml :: p1-eval` (`check_injection_eval.py --check --benchmark-md` fails when the committed page and a live measurement disagree, and CI is asserted never to pass `--write-benchmark`, so a stale page is a finding rather than a silent rewrite) + `ci.yml :: python-test` (root) runs `test_injection_eval_gate.py` (the `wet-eval` job is asserted to carry `if: needs.preflight.outputs.should_run == 'True'` so an unconfigured repository shows *skipped* rather than passed, the preflight is asserted to write a `::warning` and a step summary, and the live injection step is asserted to sit inside the gated job and never in the ungated preflight. Proven capable of failing by deleting the `if:` and watching it go red) | core | GATED | The gate proves the page matches the deterministic half. The live half's freshness is `scripts/check_scoreboard.py`'s job, which refuses a scoreboard older than 45 days |+| The injection gate measures the guard the product runs, and leaves no trace in the interpreter | `scripts/check_injection_eval.py` | `ci.yml :: python-test` (root) runs `test_injection_eval_gate.py` (the gate loads the real `PromptInjectionGuard` by path rather than reimplementing its patterns, refuses a tree with no corpus and a tree with no guard, and is asserted to leave `sys.modules` exactly as it found it. The first version leaked a synthetic top-level `app` package and errored 21 unrelated tests in a full-suite run that is green on `main`, while every test in its own file still passed; a pre-existing real `app` entry is restored rather than removed) + `gate-contract.yml` (`check_gate_contract.py` — the gate refuses both the bare and the skeleton empty tree under the exact arguments the workflow passes) | core | GATED | A second copy of the matcher would measure something the product does not run, which is the defect the alert-reduction suite published for months |+| A constrained field is read as the instruction it encodes rather than as one opaque token | `services/agents/app/prompting/envelope.py` | `ci.yml :: python-test` (agents) runs `tests/adversarial/test_injection_incidents.py`, whose exact ratchet names every remaining blind spot by id, and `test_prompt_envelope.py`. Every string is matched against a **segmented** view in which identifier punctuation reads as a word separator, so a rule written for prose reaches a DNS label, a file name and a command line without being rewritten; each rule declares which views it is valid on, and the two that would become ambiguous once punctuation is gone are literal-only. Containment aimed at a named target is matched by the argument's *shape* rather than by a noun list, which is what a list could never hold. Tool names match on token boundaries, so `disable_user` no longer fires inside `disable_user_offboarding_batch.ps1` | core | GATED | Corpus detection 66.7% to 98.1% (53/54) and the prose corpus 0.852 to 0.96, with prose false positives still at 0.00. **That is the tuned number and it is not the one to plan against**: the same change scores 7.1% on payloads authored afterwards, per the row below. `=` and `:` stay out of the separator set because they bind a key to a value that several rules read |+| The injection guard's generalisation is measured on payloads authored after it was frozen, and that measurement carries no floor | `services/agents/tests/adversarial/injection_holdout.py`; `apps/docs/docs/benchmark.md` | `ci.yml :: p1-eval` (`check_injection_eval.py --check --benchmark-md` grades 28 adversarial payloads and 6 benign controls written after the guard was committed, publishes the rate beside the tuned one, and fails when the page and the measurement disagree. `HOLDOUT_UNDETECTED` is checked in **both** directions, so a miss the file does not list and a listed payload the guard now catches are each a finding; proven capable of failing by removing a real miss from the record and by adding a caught payload to it) + `ci.yml :: python-test` (agents) runs `test_injection_holdout.py` (the payloads and ids are asserted disjoint from the tuned corpus, every surface and goal the tuned corpus reaches is reached here so a held-out set cannot flatter the guard by skipping its weak fields, the twins differ in one field, and no clean twin already flags at the target field) | core | GATED | **The rate is 7.1% (2/28) against 98.1% on the tuned corpus, and the guard before the hardening scores 3.6% here.** There is deliberately no floor and no ratchet: a target on a held-out set is an instruction to tune against it, so CI gates that the measurement happens and that the record describes the tree, never that the number is good. Authored by someone who could read the patterns, which for an MIT-licensed guard is the correct threat model rather than a pessimistic one |+| Cross-tenant isolation (Postgres) | (implied by multi-tenant) | `cross-tenant-rbac.yml` (nightly, 3 endpoints) + `ci.yml` + `integration.yml :: migrations` (`tests/isolation/test_postgres_rls.py` — the live-DB replay this row's gap named. Against the real chain on `postgres:16` it seeds an A row and a B row into **every** RLS-covered tenant table, asserts both are visible unscoped before asserting either absence, then binds the session to A and asserts B's row is unreachable on each one. Reads run as a role created with `NOSUPERUSER NOBYPASSRLS`, because the role the services ship with bypasses RLS outright — a fact the suite asserts rather than footnotes, so a green run here can never be read as "isolation is on in production". Also fails when a tenant-scoped table has no policy, when a policy exists without `FORCE`, when an exclusion no longer describes an unprotected table, and when any policy reads a session variable nothing sets) | core | GATED | reads as `DATABASE_URL`, which is the role the deployment ships: `061_runtime_app_role.sql` moved the services onto a DML-only `aisoc_app` and the suite's purpose-built probe role is gone, so the replay covers what runs. The gap this row carried — "reads as the probe role, not as the deployed role" — is closed. `test_the_owner_still_bypasses_which_is_why_they_are_two_roles` asserts the two roles have not silently merged back |+| Every authenticated route reads only the caller's own tenant | (implied by multi-tenant) | `ci.yml` api job (`test_tenant_scope_and_auth_holes.py` — the identity-timeline alert query binds the caller's tenant and keeps the caller-supplied search term a parameter; the case-timeline linked-alert hydration binds a tenant; and a directory-wide sweep over `app/api/v1/endpoints/*.py` fails if **any** raw `FROM aisoc_alerts` read omits `tenant_id`, so a new endpoint cannot reintroduce the shape) | core | GATED | the sweep covers raw SQL against the alerts tables; ORM reads rely on the existing per-endpoint isolation tests |+| Every playbook route requires an authenticated, permitted caller | (implied by RBAC) | `ci.yml` api job (`test_tenant_scope_and_auth_holes.py` — each of the eight route functions takes an authenticated principal, the decorated-route count is asserted against the expected permission map so a new ungated route fails, execute stays distinct from write, and every permission named is one a role actually grants) | core | GATED | - |+| An MSSP parent holds only tenants that invited it | operations/security.md (MSSP parent/child links) | `ci.yml` api job (`test_mssp_cross_tenant_authz.py` — the four child-scoped write routes refuse a tenant that is not the caller's child and persist nothing; unknown and unowned are indistinguishable so the routes cannot enumerate tenant UUIDs; onboarding refuses without an invite, refuses an invite addressed to another parent, consumes the invite on success, and refuses self-adoption) | core | GATED | the guard is unit-level against the route functions; the nightly live-DB `cross-tenant-rbac.yml` sweep does not yet cover the MSSP routes |+| Cross-tenant isolation (Qdrant/Neo4j/Redis/ClickHouse/Kafka) | (implied by multi-tenant) | `isolation.yml` (offline: read paths construct a tenant scope) + `isolation-live.yml` (live A-vs-B replay: Neo4j property filter, Redis keyspace namespacing, ClickHouse via production `lake_sql.rewrite_for_tenant`, Kafka per-tenant envelope filter) | full | GATED | - |+| A required check that reports success on `main` executed its assertions | (implied by every `GATED` row in this file, each of which names a required check) | `grading-integrity.yml :: substantive-shape` (`check_required_check_substance.py --static`: every path through a required check's job is enumerated by binding the run-time references its conditions read, and none may run strictly less assertive work than another path through the same job — which passes two ways of booting one stack and fails announcing that nothing was checked. Step classification comes from evaluating each `if:` under a simulated protected-branch push, so `failure()` and pull-request-only steps are excluded as genuinely not applicable rather than by a list of names that goes stale. A `continue-on-error` step no blocking step reads the outcome of is also refused here, because the API cannot see one) + `grading-integrity.yml :: substantive-runs` (the same relation against the Actions API: for every context in `.github/required-checks.json`, each successful push run on `main` must have executed a complete path. Refuses a missing token, a manifest that disagrees with branch protection when it can read it, a context with no job in the tree, an empty fetch, and a window that has held no runs for seven days) | core | GATED | Proven against the pre-fix tree: the static half fails at `6014ae92` naming both checks and the 12 and 11 steps a skip path would not run, and passes after. The run-history half measured 26/100 and 73/100 over the 100 most recent successful push runs (the other 20 contexts: 100/100) and exits 1 on them. **Three limits stated rather than papered over.** The API reports each step's post-`continue-on-error` conclusion, so a soft failure inside a green job is invisible to the run-history half — which is why the shape is refused statically instead; zero such steps were observed across 4,660 jobs, consistent with both "none failed" and "none can be seen". A filter forced true inside a `run:` block is invisible to the static half, which is why both fixed workflows spell the exemption into an expression as well. And the workflow-runs endpoint is neither stable across pages nor guaranteed fresh — 250 requested rows held 157 unique ids, and one single-page read came back six weeks stale with a second read of the same endpoint agreeing — so the window is one page, capped at 100 and refused above that, with freshness checked against the branch's commit list from a different endpoint; a `paths:`-filtered workflow is exempt from that oracle and named in the output as unverified |+| SAST | README badge (CodeQL) | `codeql.yml` (the scan) + `codeql-alert-gate.yml` (the invariant: `scripts/check_codeql_alerts.py` fails on any open CodeQL alert at any severity, `note` included, and refuses a ref whose declared languages were not analysed at the triggering commit — `analyze` never failed a build on findings, so this row named a scan and not a gate) | core | GATED | - |+| Dependency CVE scanning | (implied by security) | `security-audit.yml` | core | GATED | - |+| OpenSSF Scorecard | README badge L13 | `scorecard.yml` | core | GATED | - |+| Container image / IaC / secret scanning (Trivy/checkov/tfsec/gitleaks/Semgrep) | (implied by security) | `security.yml` (claim-matrix ratchet, gitleaks and Trivy fail outright; Semgrep, checkov and tfsec fail on a changed finding count via `check_scanner_ratchet.py` against the ceilings in `.security/allowlist.yml`) + `ci.yml :: Python — Lint & Type-check` (the same gate's allow-list-schema and scanner-coverage half, which needs no scanner). **Four of the six are required checks on `main`** — `Secret scan (gitleaks)`, `Trivy filesystem`, `IaC scan (tfsec, ratcheted)` and `IaC scan (checkov, ratcheted)` — because a hard gate that is not a required context blocks nothing: Trivy fails outright on a fixable HIGH/CRITICAL and had been red on `main` for nine consecutive runs with nothing to stop a merge. All six were checked for the defect that makes a required check worthless rather than assumed safe — `security.yml` declares no `paths:` filter and no job-level `if:`, and across 40 `pull_request` runs each of the six reported a real conclusion and **none reported `skipped`**, which GitHub counts as passing. `Semgrep (ratcheted)` and `IaC scan (checkov, ratcheted)` each used to carry a `continue-on-error` step whose outcome no later step read, so either job could report success over a scan that failed, where the Actions API cannot see it; **both are now closed** — the scan step carries an `id` and a blocking step reads `steps.<id>.outcome == 'failure'`, placed *ahead* of the ratchet because a scan that dies part-way still writes a short report and the ratchet's shrink-only arm would answer it with "lower the ceiling to N". checkov's `pip install` also moved out of the absorbed step into a blocking one of its own, and the trailing or-true suffix that used to discard checkov's exit code became an explicit rule over that code — 0 and 1 are a scan that ran, anything above is a scan that did not. `--soft-fail` was measured and rejected as the way to write that: it collapses 1 into 0 but leaves 2 alone, and is silent on a `-d` naming a directory that does not exist, which exits 0 under every combination. **`Semgrep (ratcheted)` stays deliberately unrequired even so, and the reason is measured rather than cautious**: it is non-deterministic on an unchanged tree — four pull requests on one base within thirteen minutes split 102/40 and 101/39 over the identical 387 rules and 2,267 files, recorded in `.security/allowlist.yml` — so requiring it would red roughly one pull request in twenty for a reason no author can act on, and the only remedy is a re-run, which trains people to re-run rather than to read. Closing its absorbed-failure hole and requiring it are separate questions, and only the first was answered yes | core | GATED (this row previously said the three observe scanners "report-and-ratchet" against `.security/allowlist.yml`, and neither half was true: nothing compared the printed counts to anything, and the allow-list had **no reader anywhere in the tree**. The ratchet now fails on more findings than the ceiling, on fewer (shrink-only, printing the measured number), on zero against a non-zero ceiling — a scanner that did not run — on a scanner version that is not the one the ceiling was measured with — for all three, which this row claimed before it was true: the arm read `if version and measured_with and ...` and tfsec's JSON carries no version field, so its counter returned `None` and the `measured_with` in the allow-list was never compared against anything. A version the gate cannot establish is now a failure rather than a skip, tfsec's is read from the binary's own `--version` (a pinned URL says what was asked for; a cached binary would still satisfy it), and a report version and a `--tool-version` that disagree fail in both directions. `_versions_pinned` also could not see a curled binary's pin, which silently exempted tfsec from the test that keeps pin and ceiling in step — on an expired or unreasoned suppression, and on a ceiling/scanner set mismatch in either direction. All three scanners are pinned exactly, because for a ratchet the scanner version is the behaviour. GitHub push-protection remains the always-on hard secret gate) | — |+| Signed / attested release artifacts | (implied by "run next to crown jewels") | `release.yml` + `publish-images.yml` (cosign keyless signatures, CycloneDX SBOM attestation, BuildKit SLSA provenance + SPDX SBOM per image; SHA-pinned actions), `build-extensions.yml` (extension cosign) | core | GATED | - |+| Insecure defaults hard-fail in production | (implied by self-host) | `ci.yml` api tests (`test_security_defaults.py::test_enforce_*`; `enforce_secure_defaults` raises at boot in production) | core | GATED | - |+| OpenAPI stability for 3 SDKs + MCP | (implied by SDKs) | `check-openapi.yml` (drift) + `openapi-breaking.yml` (`scripts/openapi_diff.py` — PR spec vs base fails on removed endpoint/schema/field, type change, tightened request, or dropped enum value). A deliberate break goes through the `breaking-change-approved` PR label, which still runs the detector and records every break it permits plus the CHANGELOG `### BREAKING` note that justified it; `--allow-breaking` requires that note as an argument, so the bypass cannot be wired up without the record. Four of the tests assert the *workflow* reaches the flag — it previously had no caller at all | core | GATED | - |+| Ingested events land in the queryable ClickHouse lake | README (SIEM / lake) | `integration.yml :: spine` (Phase A1 — after the spine ingests, asserts `SELECT count() FROM aisoc.raw_events > 0` against the live ClickHouse container; `services/fusion` `LakeWriter` archives every normalized event) | full | GATED | - |+| Detection rules fire on the live event stream (not just CI fixtures) | README L170 (detection engine) | `integration.yml :: spine` (Phase A2 — posts an event matching the native `aws-root-account-login` rule, asserts the fusion `DetectionEngine` produces the alert) + `validate-detections.yml` (exported-ruleset drift `--check`) + fusion `test_detection_engine.py` / `test_detection_matcher_parity.py` | core | GATED | - |+| Three-model AI: behavioral (UEBA) model feeds alert scoring in production | README (multi-model) | `ci.yml` fusion job (`test_ueba_signal.py` — the `ueba.anomalies` stream warms a per-entity cache that boosts fuse-time confidence + anomaly score; wired in `fusion_engine.process`) | full | GATED | - |+| Agent auto-triages every alert (not manual/API-only) | README (autonomous triage) | `ci.yml` agents job (`test_fused_alert_worker.py` — `FusedAlertTriageWorker` consumes `aisoc.alerts.fused`, auto-triages each alert copilot/read-only with cost-governor dedup + circuit-breaker, degrades to deterministic triage without an LLM key, never dispatches a response) | core | GATED | - |+| Connector credentials reach the SOAR executors (not simulation-only) + autonomy policy governs every real execution | README (SOAR / response) | `ci.yml` actions job (`test_credential_resolver.py` — per-vendor auth_config→executor-param translation pinned; `test_governed_dispatch.py` — Phase 9a `decide()` wired into live dispatch: above-tier ⇒ dry-run preview, dry-run-disabled ⇒ queued approval, L0 ⇒ blocked, executor never invoked when queued/blocked) | core | GATED | - |+| Rollback is real (not "return True"), post-action verified, and approvals are restart-durable | README (response / rollback) | `ci.yml` actions job (`test_rollback.py` — real vendor reverse calls, honest simulated/failed states, REVERSIBLE_ACTIONS gated against the actual reverse impls; `test_verification.py` — re-queries vendor, never a false VERIFIED) + slack-bot job (`test_timer_store.py` — pending SLA timers persist + recover across restart) | full | GATED | - |+| Environment-specific noise reduction (business context) applied post-fusion → pre-triage | README (noise reduction) | `ci.yml` agents job (`test_business_context_hotpath.py` — YAML when/then rules mutate severity/route/tags and suppress before any triage spend, wired into `FusedAlertTriageWorker.triage`; `AISOC_BUSINESS_CONTEXT_ENABLED` gate) | core | GATED | - |+| Related alerts auto-collapse into one ordered attack chain at fuse time | README (attack chains) | `ci.yml` fusion job (`test_attack_chain_grouper.py` — shared-entity alerts join one chain within the window, members ordered by MITRE kill-chain stage, cross-entity link via shared IP; wired into `fusion_engine.process` → `enrichments.attack_chain`) | full | GATED | - |+| Effective Permissions resolves against a live posture snapshot (not empty stub) | README (effective permissions) | `ci.yml` api job (`test_posture_loader.py` — assembles the Okta resolver snapshot from connector `get_resource_config` calls and resolves it; cloud providers consume a connector-provided reconciled snapshot; failures degrade to empty, never fabricated) + connectors `/connectors/{id}/resource_config` endpoint | core | GATED | - |+| Unified Data Explorer (NL + SQL across the lake) replaces the SIEM context-switch | README (data explorer) | `ci.yml` web-test job (`ExploreView.test.tsx` — NL question → `nl-query/translate` → `lake/sql` → BI table; raw-SQL run; source pivots to identity/graph/intel; error surfaced) + web-lint type-check | core | GATED | - |+| Autonomy posture is copilot-by-default with a visible per-action/blast scorecard | README (autopilot/copilot) | `ci.yml` web-test job (`AutonomyScorecard.test.tsx` — posture stays Copilot unless a high/critical-blast action auto-executes; distribution + override counts; rendered badge) | core | GATED | - |+| Broad SIEM/NDR/edge coverage (QRadar, Exabeam, Securonix, Devo, Netskope, Windows/Sysmon, Zeek/Suricata, syslog/CEF) | README (connector count) | `ci.yml` connectors job (`test_schemas.py` + `test_conformance.py` gate every connector; `test_siem_expansion.py` + `test_ndr_edge_expansion.py` pin each new connector's severity-ladder mapping) + `generate_connector_count.py --check` (registry-derived count, README phrase) | core | GATED | - |+| The console's `connector_type` vocabulary names only connectors the platform can ingest | `packages/types/src/generated/connector-types.ts` (the exported `ConnectorType` union) | `ci.yml` python-lint job (`scripts/generate_connector_types.py --self-test` then `--check` — the union is generated from `_CONNECTOR_CLASSES`, the `connectorProfiles` keys and the `connectorTypeCanonical` folds, so it cannot be hand-edited into naming something nothing resolves; the self-test hand-edits the output, deletes it, puts a union back in `connector.ts` and flattens a fold, and requires each to be caught) + `check_connector_profiles.py` (every member resolved against the normalizer and the registry, in both directions) + `tests/test_connector_types_generated.py` (13 cases: regeneration is idempotent, reversing the registry changes no byte, identity is read off the class so `jira_connector.py` -> `jira` and `tenable.py` -> `tenable_io` are not misnamed, and a new connector shows up as drift) | core | GATED | - |+| AI/LLM-usage governance: audit connector + detections + tiered lake storage | README (AI usage / storage) | `ci.yml` connectors job (`test_llm_usage.py` — OpenAI/Anthropic audit connector emits the dotted `event_type` the `llm-*` rules match) + `validate-detections.yml` (8 `llm-*` native rules replay) + api job (`test_storage_tiering.py` — hot/cold TTL-move policy + DDL gate; verified on live ClickHouse) | full | GATED | - |+| Outcomes compound: repeat alerts auto-suppressed from prior dispositions (measured, not estimated) | README (closed loop) | `ci.yml` agents job (`test_outcome_memory.py` — every durable triage outcome is written back as a per-signature prior; a later alert matching a trusted prior benign/FP disposition is auto-resolved WITHOUT re-triage; human priors trusted immediately, AI priors require corroboration, a prior TP never auto-closes) + api funnel `repeat_alerts_suppressed`/`repeat_suppression_rate` measured from `aisoc_outcome_suppressions` | core | GATED | - |+| Institutional memory nudges fuse-time confidence (bounded, per-tenant) | README (compounding memory) | `ci.yml` fusion job (`test_memory_nudge.py` — distilled per-signature priors nudge new alerts of that signature ±0.10 in `ConfidenceScorer`; unknown signatures unchanged; `MemoryPriorProvider` distils per-tenant priors from disposition history so one tenant never nudges another) | core | GATED | - |+| Scheduled hunt findings flow into governed detection proposals | README (proactive hunting → detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — a scheduled hunt that returns hits opens a DRAFT `DetectionRuleProposal` (source `hunt-finding`) into the propose→review→eval-gate→promote lifecycle; zero-hit / flag-off paths open nothing) **plus `test_hunt_scheduler_execute.py` + `test_event_warehouse_providers.py`, which gate the executor the lifecycle depends on** | core | GATED | this row was previously proven only by `test_wave1_loop_edges.py`, which injects an `executor` stub (`runner = executor or _execute_hunt`). The real `_execute_hunt` could not return a hit on any deployment, so the gate passed against a path that could not run — see the row below |+| A scheduled hunt runs against the SIEM the tenant connected in the console | (implied by hunt scheduling + multi-tenant) | `ci.yml` api job (`test_event_warehouse_credentials.py` — credentials resolve from the tenant's vault-encrypted `connectors` row, the query is tenant + enabled + type scoped in compiled SQL, a pinned connector id is still tenant-filtered, and an undecryptable secret is distinguishable from an unconnected one; `test_event_warehouse_registry.py` — a Splunk-only tenant is routed to Splunk rather than to Elasticsearch; `test_event_warehouse_providers.py` — each driver runs against its connector's URL with its connector's auth, and the SSRF allow-list is that connector's own endpoint) | core | GATED | the drivers are exercised against mocked vendor HTTP, not a live Splunk or Elasticsearch; a vendor-sandbox integration job needs credentials nobody has provisioned |+| Analyst disposition history drives human-approval-gated tuning proposals | README (self-improving detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — the previously-orphaned `suggest_tuning` engine is wired to real per-rule disposition history via `/detection/tuning/auto-suggest`, opening DRAFT proposals; `test_detection_tuner.py` fixture-gates the engine) + `ci.yml :: Python — Lint & Type-check` (`check_raw_sql_columns.py` — every table and column a raw `text()` INSERT/UPDATE names must be one some migration creates) | core | GATED (the gap this row used to name was wrong in the repository's favour: no job ran `services/api/tests/` against a real database at all, and the only assertion on the insert was a substring test that would still have passed on the wrong table name, because the wrong name contains the right one. The structural gate caught what no mock could — `detection_rule_proposals` has never had a `source` column, so all three automated proposal paths raised on their first row on every deployment; migration 073 adds it) | — |+| Detections can be backtested over historical lake data before promotion | README (detection engineering) | `ci.yml` api job (`test_backtest.py` — bounded/allow-listed SQL construction with injection-sanitised source filter, lake-row→event mapping with JSON payload expansion, exact would-fire count + hit-rate + samples; `test_backtest_gate.py` — opt-in `AISOC_BACKTEST_MAX_HIT_RATE` /decide gate) + web type-check (rule-editor backtest panel) + `isolation-live.yml` (`tests/isolation/test_backtest_lake_live.py` — the real `fetch_lake_events` against ClickHouse 23.8, table built from `clickhouse/001_init.sql` and rows seeded through the production `lake_writer.event_to_row`) | full | GATED (the gap this row used to name was wrong: nothing ran the live fetch, and the tenant-scoping path existed twice — `detection_rules.py` carried its own near-identical copy, now deleted, with a test asserting exactly one definition survives. The live path exposed a defect no unit could: the writer stores OCSF `raw_data` into a column named `raw_payload` and `rows_to_events` expanded neither, so the payload expansion its docstring promises had never run on a real lake row. `services/api/app/services/backtest.py` was also absent from the workflow's path filter, so a change to the function under test did not trigger the job) | — |+| Detections can be authored in Python (`def rule(event)`) with a fixture gate | README (detection engineering) | `python-detections.yml` (`aisoc_detections.runner` fails a blind rule that misses a positive or a noisy one that fires on a negative; every bundled detection must ship ≥1 positive + ≥1 negative case) + `test_framework.py` (fail-closed evaluate, metadata validation) | core | GATED | - |+| AI Detection Builder: NL → rule + AUTO-generated fixtures → non-circular eval-gate → governed proposal | README (detection engineering) | `ci.yml` api job (`test_ai_detection_builder.py` — fixtures are DERIVED from the generated rule's own selection, not invented, and genuinely pass the non-circular gate: fires on the positive, quiet on the negative) | core | GATED | - |+| No-code / simple detection builder compiles to a valid rule | README (detection engineering) | `ci.yml` web type-check + lint (`SimpleRuleBuilder.tsx` `buildSigma` compiles field/operator/value rows to Sigma, dropped into the governed editor) | core | GATED | - |+| Response actions run under least-privilege for the invoking identity | README (autonomy + safety) | `actions` job (`test_authz.py` — `authorize_action` denies a principal lacking the action's blast-radius permission; tier hierarchy + wildcards; tenant binding) | core | GATED | - |+| Actions-service mutating routes are authenticated (fail-closed in prod) | README (autonomy + safety) | `actions` job (`test_authz.py` — `require_service_auth` returns 401 on a bad/absent bearer token, 503 when unconfigured in production, open only in dev mode) | core | GATED | - |+| Approvals are bound to a qualified approver (separation of duties) | README (autonomy + safety) | `actions` job (`test_authz.py` — `authorize_approver` requires the action's permission and rejects the requester approving their own action) | core | GATED | - |+| Customizable dashboard / report builder validates + renders | README (analytics + reporting) | `ci.yml` api job (`test_report_builder.py` — whitelisted widget types + data sources, unique widget ids, bounded size; render resolves each widget and is resilient to a failing/missing resolver; `/report-builder/render` wires the real tenant-scoped `alerts_by_severity`) | core | GATED | - |+| Agentless CSPM scans a cloud snapshot for misconfigurations | README (cloud posture) | `ci.yml` api job (`test_compliance_cspm.py` — public S3, world-open security groups on sensitive ports, IAM users without MFA / stale keys, public/unencrypted RDS + EBS all flagged with severity + control refs; clean resources yield nothing) | core | GATED | - |+| Security findings/detections map to compliance controls with auto-evidence | README (compliance) | `ci.yml` api job (`test_compliance_cspm.py` — MITRE→control mapping, per-control evidence records for detections + CSPM findings, unknown controls skipped) | core | GATED | - |+| Alerts fan out to Opsgenie / email / external-SOAR destinations (SSRF-guarded) | README (destinations + SOAR) | `ci.yml` api job (`test_compliance_cspm.py` — Opsgenie priority mapping, email subject/recipients, `aisoc.handoff.v1` SOAR envelope; outbound webhook guard blocks non-http(s) schemes + private/loopback targets) | core | GATED | - |+| Per-tenant configurable data retention with tenant-scoped purge | README (data lifecycle) | `ci.yml` api job: `test_retention.py` (purge SQL well-formed — clamped window, mandatory tenant predicate, parameterised cutoff) **plus** `test_retention_worker.py`, which asserts the worker issues the delete, that a dry run reports the blast radius without deleting, that the alert delete binds its tenant explicitly (the worker runs with row security off, so relying on RLS would purge every tenant under the first tenant's window), that per-tenant windows are not shared, that tenants without an explicit policy are untouched, and that the count SQL used for the preview has the same predicate as the delete | core | GATED | `audit_days` is storable but not purged: the audit log is an append-only hash chain, so truncating it invalidates every later verification. Needs chain-aware truncation with a re-anchored checkpoint. |+| Self-service field-extraction / transform pipelines (custom parsers) | README (data lifecycle) | `ci.yml` api job (`test_pipeline_transforms.py` — the whitelisted DSL renames/maps/extracts onto OCSF with dotted paths + ReDoS-proof grok `extract` (re.escape'd literals + fixed token map, no raw user regex); validation rejects unknown ops/tokens / oversized pipelines; fail-open per op never drops an event; input never mutated) | core | GATED | - |+| Every package the README tells a visitor to install either resolves, or says in the present tense that it does not | README (Try AiSOC in 60 seconds); each package README | `release.yml :: package-report` (`check_published_packages.py --require-network` asks npm and PyPI directly and writes the answer to the run summary; a package `.github/release-packages.yml` declares published that does not resolve fails the release, and so does one declared unpublished that does) + `ci.yml :: python-test` (root) runs `test_package_install_claims.py` (the same manifest, the same registry query, so the gate and the READMEs cannot disagree) and `test_release_publish_signal.py` (every upload step is guarded by the credential decision, and the job titles carry it) | core | GATED | The row previously read "…is published" and named `npm-publish` + `pypi-publish` as the gate. Those jobs prove a package is *packable*, never that it shipped: on v12.2.0 all eight reported success and all eight registries returned 404, because only the final upload step is credential-gated. The claim has been restated to what is true and enforced, and the gate moved to one that asks a registry instead of reading a job status |+| The install commands the README advertises actually run | README (on-ramp table) | `readme-gates.yml :: published-onramp` (runs `npx aisoc@latest triage --demo` and `pip install aisoc-sandbox && aisoc-sandbox demo` against the public registries on a clean runner with no checkout, Linux + macOS, daily as well as on diff; self-arming — warns while a package is unpublished, hard-fails once it exists and breaks) | core | GATED | - |+| Documentation links on the front door resolve | README / SUPPORT / CONTRIBUTING | `link-check.yml :: front-door` (hard gate over the five files a new visitor reads; `:: docs-tree` observes the wider documentation tree so pre-existing rot is burned down deliberately rather than blocking unrelated PRs) | core | GATED | - |+| The CLI makes no network call unless an endpoint is configured | `packages/aisoc-lite/TELEMETRY.md` | `ci.yml` aisoc-lite vitest (`telemetry.test.ts` — there is no default endpoint, and an enabled-but-unconfigured run is asserted to make zero `fetch` calls) | core | GATED | - |+| The visual assets the README embeds exist | README (console tiles + walkthrough) | `readme-gates.yml :: static` (`gate_demo_asset_references` covers `apps/web/public/screenshots/` as well as `demo/`, so a renamed or deleted tile fails instead of rendering as a broken image) | core | GATED | - |+| Groundedness: the agent asserts no indicator absent from the evidence it was given | README (groundedness axis) | `live-agent-eval.yml` (dispatches the real four-agent LangGraph pipeline against a locally-served model, scores every incident with `app.confidence.groundedness`, and `scripts/check_live_agent_floor.py` fails the run below the floor recorded in `services/agents/tests/eval_data/live_agent_floor.json`) + `ci.yml :: Python — Tests` (`test_groundedness_eval.py`, `test_groundedness_gate.py`) | core | GATED (three sub-claims, all now covered. The scorer is proven by `test_groundedness_eval.py`; `test_groundedness_gate.py` drives the real triage worker and proves an ungrounded `false_positive` at 0.97 confidence is demoted to `needs_review` rather than auto-closed; and the third — that *the live agent* asserts no indicator absent from its evidence — is now measured, because the workflow runs. It could not before: its live path imported `InvestigatorAgent`, a class that exists nowhere in `services/agents`, so the first dispatch failed in 92 seconds and every later one would have. **The floor is 0.40 on a deterministic 10-incident slice, derived from runs rather than chosen**: seven local runs returned 0.5561 to four decimal places (the agents decode greedily at temperature 0, so it is a point mass on one machine), while three GitHub-runner runs returned 0.5821, 0.5329 and 0.5933 — a spread of 0.0604, because a quantised model decoding on a different kernel diverges at the margins. The floor sits 0.1329 below the lowest run observed anywhere, about 2.2 times that spread, and still fails anything a quarter worse. The declaration carries every run behind it and the loader refuses a floor above its own evidence. **Scope, stated because it is narrow**: this grades a locally-served `qwen2.5:0.5b`, no hosted provider has ever been exercised, and the job is scheduled plus on-demand rather than per-PR because a threshold tight enough to be useful on a PR would be tight enough to flake on a runner nobody controls) | — |+| A live-agent eval can run with no funded provider key | (implied by the public eval harness) | `live-agent-eval.yml` (Ollama-hosted local model reached through `OPENAI_BASE_URL`; `--wet-limit` keeps it inside a CI budget, `--wet-require-live` stops a degraded run publishing substrate numbers as live-agent performance, and `check_live_agent_floor.py` asserts the result) | core | GATED (**observed**, not designed-for. [Run 36517390566](https://github.com/beenuar/AiSOC/actions/runs/36517390566) on `main` dispatched the real agent over ten incidents, placed 62 LLM calls, measured a groundedness of 0.5933 and cleared the floor — with no secret of any kind in the repository. This row previously said 0 runs, and the reason was not scheduling: the live path named a class that does not exist, and two further defects would each have published a number nobody measured — MITRE accuracy read a corpus key that is not there, so it would have reported `0.0000`, and a self-hosted model was priced against the gpt-4o rate card. A third shape slipped past `--wet-require-live` entirely: with the model pins unset every agent caught its provider error and used its deterministic path, and the run reported 0.8050 at 0.11s per investigation — so the harness now refuses a run that placed no LLM call, and the report carries `llm_calls_placed` beside the mean. Runtime is a real constraint and is handled rather than hidden: an unbounded completion ran to 40,960 tokens and twenty minutes on a runner, which is why `app/investigator/limits.py` bounds it — and a timeout reports as `cancelled`, not `failed`, so a run that measured nothing would not have looked like a failure) | — |+| Response actions are verified against the vendor, not assumed from a 200 | README (verified response) | `ci.yml` actions matrix (`test_dispatch_verification.py` — asserts the dispatcher reaches the verifier on the live path, that an action which reported success with the effect absent is downgraded to FAILED, and that `unverified` is never upgraded to a confirmation) | core | GATED | - |+| Host isolation is confirmed by reading real containment state | (implied by verified response) | `ci.yml` actions matrix (`test_verification.py` — a resolvable-but-uncontained host must score FAILED; `containment_pending` must not count as verified) | core | GATED | - |+| Autonomy is governed per tenant, not per deployment | `apps/docs/docs/concepts/automation-maturity.md` (L0–L4) | `ci.yml` actions matrix (`test_tenant_policy.py` + `test_dispatch_tenant_governance.py` — two tenants get their own tiers, an unreadable policy falls to a conservative floor rather than inheriting a permissive env default, and the L4 whitelist reaches `decide()`) | core | GATED | - |+| Repeat alerts matching a trusted benign prior are suppressed without re-triage | README (compounding loop), `/metrics/funnel` | `ci.yml` agents tests (`test_repeat_suppression_closes_the_loop.py` — asserts two *alerts* representing the same condition produce the same signature, and that a different detection on the same host does not collide) | core | GATED | - |+| A verdict is not auto-closed on reasoning the evidence does not support | README (groundedness axis) | `ci.yml` agents tests (`test_groundedness_gate.py` — an auto-closing verdict citing an indicator absent from the alert is demoted to `needs_review` at runtime, with confidence lowered to match) | core | GATED | - |+| Entity-graph reads are scoped to the querying tenant | `apps/docs/docs/architecture/graph-schema.md` | `ci.yml :: api tests` (`test_graph_tenant_isolation.py` — asserts `tenant_id` is actually bound to the driver, and that every node of every blast-radius path is scoped; `tenant_id IS NULL` is not accepted anywhere) | full | GATED | - |+| Analysts can hunt the events AiSOC itself ingested | README (hunt surface) | `ci.yml :: api tests` (`test_lake_hunt.py` — the translator IR compiles to parameterised ClickHouse SQL with the tenant predicate generated rather than rewritten in; no question text reaches the SQL string) | full | GATED | - |+| Business-context rules authored in the console affect triage | `apps/docs/docs/console/` (business context) | `ci.yml` agents tests (`test_business_context_per_tenant.py` — rules resolve per tenant from Postgres, one tenant's suppression cannot affect another, and an outage serves last-known rules rather than silently un-suppressing) | core | GATED | - |+| Seeded sample data never renders as a tenant's real state | Standing honesty rule (synthetic vs real) | `ci.yml :: python-lint` (`check_mock_data_gated.py` — fails the build on a `fallbackData` receiving sample data un-wrapped, on sample data assigned to state with no demo-mode check, and on a module-scope array of named entities carrying measurements in a component with no demo gate; the reviewed-exception list is checked in both directions so a stale exemption fails) + `tests/test_mock_data_gate.py` | core | GATED | the first two patterns needed a `MOCK_`/`DEMO_` name *and* a setter or `fallbackData`, so a fabricated table written inline under an ordinary name in a component that never fetched matched nothing — `MSSPDashboardView` and `TeamAnalyticsView` both shipped under a green gate until the third pattern was added; the check remains shape-based and cannot prove a view is honest |+| No fabricated value is reachable, and no component decides for itself that it is a demo | Standing honesty rule (synthetic vs real) | `ci.yml :: python-lint` (`check_demo_state_gated.py` — every read of a fabricated symbol must have a gate *in scope*, so a ternary, a factory call, or a constant assembled out of a mock all fail; and a `demoMode`-style local `useState` fails outright) + `tests/test_demo_state_gate.py` | core | GATED | the shape gate above accepts a file that mentions `demoFallback` anywhere — `SLADashboard.tsx` had it on line 446 and an ungated `isValidMetrics ? rawMetrics : MOCK_SLA_METRICS` on line 457, so 847 alerts and a 42.5m MTTR rendered on first paint and on error; this gate is scope-based rather than shape-based but still cannot prove a view is honest |+| Published executable-detection count matches what the engine loads | `docs/detections/truth-table.md` | `validate-detections.yml` (`detection_truth_table.py --check` now derives `executable` from `detection_ruleset.json` membership rather than file path and body keys; the old heuristic published 947 while the engine loaded 825, counted 77 Sigma rules with no evaluator, and would have certified a bulk un-quarantine as a no-op) | core | GATED | - |+| A detection rule matches on fields that exist in telemetry | (implied by the detection corpus) | `validate-detections.yml` (`check_detection_fields.py` — ratchets rules depending on computed fields such as sliding-window counters and allowlist booleans, which no connector can supply; fixture replay cannot catch these because fixtures are synthesized from the rule under test) | core | GATED (ratchet) | ratchet to 0 |+| Every shipped imported rule was observed to fire through the real connector and the real engine | README, `concepts/detections.md`, `docs/detections/sigma-compilation.md` | `validate-detections.yml` (`compile_sigma_ruleset.py --check` recompiles the ruleset and fails on drift, so no rule enters it without its proof replay producing a hit on a vendor-shaped event and nothing on an empty one; `--prove-gate` then reverts the Windows connector to its pre-lift behaviour and **requires all 1,687 Windows rules to stop firing**, so the proof is known to be capable of failing rather than merely never having failed. `check_detection_fields.py` is deliberately not the evidence here — its own docstring says it over-approximates and that "a false pass is a rule this gate should have caught") | core | GATED | reachability only: the gate proves a rule fires on a well-formed event of its own log source, never that it detects an attack or that it is tuned. There is no per-rule false-positive-rate gate and `false_positives:` is prose |+| Vendor fields nested under `raw_event` are visible to detections | (implied by the detection corpus) | `ci.yml` fusion tests (`test_detection_field_namespace.py` — 663 of 825 loaded rules referenced an invisible field before this; both the stateless and windowed engines now merge the payload identically) | core | GATED | - |+| A connector's alerts are attributed to that connector, not to Splunk | `apps/docs/docs/connectors/` | `ci.yml` ingest tests (`TestUnknownConnectorFallbackIsVendorNeutralAndPromotable` — the lenient fallback borrowed the `splunk_enterprise` profile, mis-attributing 26 connectors and, being category 4 with an empty severity map, making their events unpromotable) | core | GATED | - |+| Customer AI estate: routine agent activity is not auto-promoted to an alert | README (AI estate), `packages/aisoc-ai-sdk/README.md` | `ci.yml` ingest tests (`TestAiRuntimeActivityIsNotAFinding` + `TestAiGuardrailFindingIsAlwaysPromotable` — asserts the 6003/2001 split in both directions, since all-2001 floods the queue with an agent's normal operation and all-6003 leaves a detected injection silent in the lake) | core | GATED | - |+| AI prompt content does not leave the customer's process by default | `packages/aisoc-ai-sdk/README.md` | `ai-sdk.yml` (`test_ai_sdk.py` — hashed capture asserts no content is transmitted while still reporting which secret shapes were present; masked/full are opt-in per client) | core | GATED | - |+| The AI SDK never breaks or blocks the host application | `packages/aisoc-ai-sdk/README.md` | `ai-sdk.yml` (transport failure, full queue and unconfigured endpoint all assert a dropped span rather than a raise; a zero-runtime-dependency check stops the package pulling a transport library into a customer's resolution) | core | GATED | - |+| Every MCP tool call is accounted for | `services/mcp/README.md` | `ci.yml` MCP vitest (`telemetry.test.ts` — records successes and refusals, transmits argument keys but never values, bounds its buffer, and never raises on an unreachable inbox; the README previously claimed an audit trail the server did not emit and the API's audit middleware does not cover for read tools) | core | GATED | - |+| Windowed detection rules are declarable without editing the engine | `detections/splunk-imports/_quarantine/README.md` | `validate-detections.yml` (`export_windowed_ruleset.py --check`) + `ci.yml` fusion tests (`test_windowed_ruleset_loader.py` — a malformed rule is skipped individually, a duplicate id cannot shadow a builtin threshold, and zero thresholds/windows are refused) | core | GATED | - |+| The agent's abstention rate and groundedness are published | `/metrics/funnel` | `ci.yml :: api tests` (`test_triage_quality_metrics.py` — asserts `mean_groundedness` averages only scored verdicts, so the deterministic path is not counted as zero, and that a missing column degrades rather than failing the funnel) | core | GATED | - |+| UEBA baselines non-human principals (service accounts, AI agents) | `apps/docs/docs/` (UEBA) | `ci.yml` ueba tests (`test_non_human_entities.py` — the entity-type list widened without becoming free text, and a zero-variance baseline returns None rather than a 0.0 that would read as permanently normal) | full | GATED | - |+| Envelope encryption: per-secret DEKs wrapped by a KEK in KMS | platform-threat-model.md (information disclosure) | `ci.yml` api job (`test_credential_vault_envelope.py`) — vault writes `vault:v2` when enabled, distinct DEK per secret, `vault:v1` rows still decrypt after the switch, a v2 row fails closed if envelope mode is later disabled, and an unrecognised mode refuses to boot rather than silently writing v1 | core | GATED | KMS backends beyond AWS are implemented against the same protocol but not integration-tested |+| Tenant offboarding erases data from every store | operations (data lifecycle) | `ci.yml` api job (`test_tenant_deletion.py`) — the Postgres table list is discovered from `information_schema` rather than hardcoded (14 of 72 tenant-scoped tables have no FK cascade, so a hardcoded list silently orphans them), the tenants row is deleted last, a failed satellite store rolls Postgres back and reports `complete: false`, and global MITRE reference nodes survive the graph purge | full | GATED | Neo4j MERGEs shared entities on `natural_key` with `tenant_id` as a property, so deleting by tenant can remove a node another tenant also referenced; it re-creates on their next ingest |+| Per-tenant rate limiting on the public ingest inbox | operations (ingest) | `ci.yml` ingest job (`ratelimit_test.go`, run under `-race`) — separate request and event ceilings, one tenant cannot consume another's budget, a rejected batch consumes no quota, `Retry-After` always rounds up, and idle buckets are swept so the map cannot grow on an attacker-controlled dimension | core | GATED | limits are per replica (in-process), so the effective ceiling is rate x replicas; an exact global cap needs edge termination |+| A push to the ingest spine is authenticated and its tenant comes from the credential | README (connect real data), operations (ingest authentication) | `ci.yml` ingest job (`ingest_auth_test.go`) — two tenants are seeded and the outsider's own token is proved to write first, so the cross-tenant refusal cannot pass vacuously; `X-Tenant-ID` is intersected with the credential's scope rather than trusted, a service token with no declared tenant resolves to an empty scope and refuses instead of widening, a token minted for another template is refused, and a nil authenticator fails closed + `golden-pipeline.yml` (an unauthenticated push to the deployed service is refused, observed from outside) | core | GATED | - |+| Incident resolves to identity, asset, cloud, business and threat context | architecture (context graph) | `ci.yml` api job (`test_incident_context.py`) — the test parses the generated Cypher and asserts every matched variable is tenant-scoped or is a label holding no tenant data, that no variable-length pattern binds a global label (which would bridge tenants), that every dimension is row-capped, and that one failing or slow dimension neither hangs nor discards the others; plus `ci.yml` agents job (`test_bundle_incident_context.py`) for the bundle and prompt wiring | core | GATED | population of the new labels from connectors is separate work; the traversal returns empty until they are written |+| A failed context lookup is distinguishable from an alert with no context | architecture (context graph) | `ci.yml` api + agents jobs — an unreachable graph sets `partial` and names the failed dimensions, and the prompt states the gap explicitly rather than omitting it, because silence reads to a model as 'no context exists' | core | GATED | - |+| Graph schema changes are versioned and applied to existing deployments | architecture (graph schema) | `graph-schema-check.yml` — the drift gate now compares Go and YAML in **both** directions (it previously only failed when YAML declared something Go lacked, which is the opposite of how the code changes, and passed with 28 Go labels against 17 in YAML); the version is read from schema.go rather than duplicated a third time; and `app.db.graph_migrations` records applied migrations so a schema change lands on existing deployments, not just fresh installs | full | GATED | ClickHouse and Qdrant still have no migration mechanism |+| Investigations pivot through the estate rather than summarising one alert | README (recursive investigation) | `ci.yml` agents job: `scripts/check_investigation_depth.py` asserts the tool loop has a production caller (it shipped working with none), that every strategy names real tools, that every tool offered to the model is named by some strategy, and that selection discriminates rather than always returning the fallback; plus `test_deep_investigation.py`, where repeated calls to one tool count as one pivot and a tool reporting its data class is unavailable counts as none | core | GATED | the corpus arm of the gate grades recorded runs and is only exercised when the eval harness has been re-run |+| The model never writes SQL and never supplies its own tenant | architecture (investigation tools) | `ci.yml` api job (`test_investigation_tools.py`) — every tool composes parameterised SQL with the tenant bound from the session, an injected `tenant_id` argument is discarded, entity names from untrusted alert payloads are bound not interpolated, and row and lookback limits are clamped | core | GATED | - |+| A tool that cannot answer reports why, rather than returning nothing | architecture (investigation tools) | `ci.yml` api job — the four tools whose data class nothing ingests return `available: false` naming the connector that would populate it, never an empty result set (which reads to a model as 'I checked and found nothing'), and the test asserts the reason is an ingestion gap rather than an argument error, since both set the same flag | core | GATED | - |+| Identity, organisational and business context can be imported and is re-runnable | architecture (context graph) | `ci.yml` api job (`test_context_import.py`) — an import never deletes, omitted fields do not blank stored values, `is_active` is derived from `end_date` rather than trusted (an export claiming a departed employee is active would erase the finding this data exists to enable), ids are namespaced per tenant, an unrecognised criticality is rejected rather than coerced because the autonomy policy reads it, and a CMDB host or account the platform has never ingested is reported as a coverage gap rather than created as a node that looks monitored; plus `graph` package tests for CloudAccount derivation from ARNs | core | GATED | Vulnerability and Secret nodes still need a scanner and CSPM feed; the threat chain needs the threatintel writer |+| Every response action declares its impact, reversal, permission and verification | README (governed response) | `ci.yml` actions job: `scripts/check_action_contract.py` asserts every registered executor declares a coherent contract. Defaults are unsafe on purpose (irreversible + prohibited), so an undeclared action fails closed and is named rather than quietly becoming dispatchable. A HIGH-impact action with no verification probe fails here rather than in an incident, and a declared reverse capability absent from the vocabulary fails too - the rollback path would otherwise resolve to nothing while believing it has a route back | core | GATED | - |+| An executor that exists is reachable, and a capability that is declared is implemented | concepts/live-actions.md (reachability) | `ci.yml` actions job: `scripts/check_action_contract.py` compares the five registries a verb needs before it can be recommended and then dispatched — the legacy `ActionType` executor, the live-action adapter, the capability contract, the vocabulary, and what `services/agents` proposes by name — **in both directions**, plus `test_capability_reachability.py`, which injects drift in each direction and asserts the gate names it. `ack_alert` and `suppress_alert` had working Splunk, Elastic and Defender arms and appeared in none of the other three, so governed dispatch answered `executor_not_found` for code that ran; `create_ticket` and `notify` were registered and dispatchable while absent from the vocabulary they validate against. Both exemption lists are ratchets that fail when an entry gains an implementation and is not removed | core | GATED | both exemption lists are empty: `capture_forensics` gained a Defender investigation-package arm with a probe that reads the package back, `chatops_verify` gained `AWAITING_COMPLETION` so a delivered-but-unanswered prompt stops reporting as a completed action, and `add_ioc_to_blocklist` / `run_playbook` left the `ActionType` surface because neither had an implementation path |+| A verb the agent recommends is one the platform can actually perform | concepts/live-actions.md (reachability) | `ci.yml` actions job: `scripts/check_action_contract.py` parses every `ProposedAction(action_type=...)` call site in `services/agents` (including the conditional form `attack_path_agent` uses) and fails when a proposed verb has no executor, plus `test_capability_reachability.py`, which injects that drift and asserts the gate names the file and line. `investigation_agent` proposed `capture_forensics` on the C2 / exfiltration path with `requires_approval=True` and nothing implemented it, so the product raised an approval for evidence acquisition on its most serious incidents and answered `No executor found for action type` when an analyst approved — the other reachability checks compare the actions service against itself and could not see it | core | GATED | - |+| Approval is a function of confidence and impact, and only ever stricter | README (graduated autonomy) | `ci.yml` actions job (`test_approval_matrix.py`, 45 cases) - severe and irreversible impact never auto-execute at any tier or confidence, a contract demanding a human survives L4 at 100%, an unknown tier collapses to the most restrictive, and a missing confidence score is the lowest band rather than a free pass (otherwise a scoring bug becomes an autonomous action) | core | GATED | - |+| The actions capability mirror matches the connectors enum | capabilities.py (mirror contract) | `ci.yml` actions job - folded into the contract gate. capabilities.py has documented this check at `tests/test_capability_mirror.py` for months; no such file exists, which is how four reverse verbs the contracts name went missing from both sides | core | GATED | - |+| The benchmark is runnable against a third-party agent | README (public benchmark) | `ci.yml` agents job - `packages/aisoc-benchmark` defines a one-method adapter protocol with no import from this repository, plus an HTTP adapter, and the suite includes a live run against an external stub. A benchmark a vendor cannot run against their own product is a self-report | core | GATED | the published scoreboard still carries only our own runs; third-party submissions need a review process, not more code |+| Hallucination, abstention and calibration are measured, not estimated | README (public benchmark) | `ci.yml` agents job (`test_benchmark.py`) - hallucination is the fraction of cited indicators absent from the evidence the agent was given and is graded on abstentions too; accuracy is computed over answered incidents only so abstaining cannot raise it; and the calibration gap exposes an agent more confident when wrong | core | GATED | - |+| Benchmark figures declare the provenance of the corpus they came from | README (benchmark transparency) | `ci.yml` agents job - the runner refuses a corpus whose incidents do not declare provenance, the counts travel with the result so a consumer cannot drop them, `--limit` recounts over the slice rather than reporting the whole corpus, and the report prints provenance before any figure | core | GATED | the shipped corpus is 200 synthetic incidents; public-dataset and real-anonymised entries are supported by the schema but not yet contributed |+| Analyst disagreement becomes durable organisation memory | README (learning from analysts) | `ci.yml` api job (`test_analyst_feedback.py`) - the reason vocabulary is closed, corroboration counts distinct analysts rather than rows (one person clicking the same button ten times is one opinion), an approved-pentest statement expires within 14 days because one that outlives the pentest is an attacker's best friend, rule defects route to detection engineering rather than becoming a suppression that hides them, and a compiled statement names the process, principal, host and window rather than degrading to 'PowerShell is expected'; plus `test_feedback_context_statements.py` (both endpoints, and a service caller may not read a tenant it did not name) and the agents job's `test_organisation_memory_in_prompt.py`, which captures the messages handed to the model with and without a recorded disagreement and diffs them | core | GATED | the whole module was unreachable - `active_statements` had no caller and neither did `record_disagreement`, so the memory was neither written nor read. Both ends are wired: `POST /feedback/alert-override` takes an optional `reason_code`, and the agents triage worker reads `GET /feedback/context-statements` into the prompt. Still not surfaced in the console - an analyst can only tag a disagreement through the API |+| Backup artifacts are encrypted at rest and integrity-checked | architecture.md (backup & restore) | `integration.yml` backup-restore job: asserts the uploaded object carries the AiSOC AEAD header, has no gzip magic, leaks no schema names, and is listed in a SHA-256 manifest; then flips a bit and asserts restore refuses it. The job is no longer path-filtered at the workflow level, so it reports a verdict on every pull request and can therefore be a required check — a row marked GATED whose gate is not guaranteed even to run makes this file a liability rather than a control. `scripts/backup_crypt.py`, where every byte of the AES-256-GCM implementation lives, was missing from the old filter, so a change to the encryption itself did not run the gate that proves the encryption works | core | GATED | - |+| A human approval of a response action is authorized, not just logged | operations/action-approvals.md | `ci.yml` actions job (`test_approval_identity.py`) — an approval with no resolvable identity is refused, an unmapped ChatOps user cannot approve, a user below the action's blast-radius tier cannot approve, and separation of duties applies to a ChatOps approval; plus `test_interactions.py` and `test_callbacks_approver.py` assert the verified platform identity reaches the client rather than only the audit row | core | GATED | pending approvals are still an in-process dict, so they are lost on restart and not shared across replicas; nothing pushes a card proactively |+| A signed email approval link resolves and carries an identity | operations/action-approvals.md | `ci.yml` api job (`test_email_approval_endpoint.py`) — the path the issuer mints is requested rather than inspected in the route table, the recipient is signed into the token, swapping it breaks the signature, a token without one is refused rather than forwarded, and an already-decided action answers 409 | core | GATED | - |+| Every LLM call passes a fail-closed input contract before the request | operations/security.md (LLM input contract) | `ci.yml` agents job (`test_llm_contract_no_bypass.py`) — one gate AST-walks `.ainvoke`/`.astream`, a second flags any file in either service that names a completions endpoint and issues its own POST, each with a synthetic-bypass self-test; `ci.yml` api job (`test_llm_safety.py`) asserts per endpoint that it routes through the wrapper **and** no longer POSTs to a provider itself; `sync_vendored_llm_contract.py --check` keeps both services on one classifier | core | GATED | the contract is a minimum-leak control, not an injection sanitizer — that is `PromptInjectionGuard`, which demotes rather than refuses |+| A rule id names the same detection in the engine and in the catalogue | detections/truth-table.md | `validate-detections.yml` (`generate_detections.py --check` plus `test_detection_id_stability.py`) — the committed pack must reproduce byte-for-byte, YAML and engine ids are each compared against the lock, an id must name the same rule in both, and reordering the spec list must not renumber the engine | core | GATED | - |+| Which identity providers can resolve permissions live is stated, not implied | effective-permissions endpoint docstring | `ci.yml` api job (`test_posture_snapshot_coverage.py`) — a resolver registered without a declared snapshot source fails, the live-capable set is pinned, and a stale allow-list entry fails once its connector starts answering the posture sentinel | core | GATED | four of five providers cannot collect a live snapshot: no connector implements `__posture_snapshot__`, so they answer 412 rather than fabricating one |+| Config snapshots reach the graph when the feature reports enabled | architecture/graph-schema.md (`:CONFIGURED_AS`) | `ci.yml` ingest job (`http_provider_test.go`) — the provider's request shape is pinned against the served route, vendor-supplied ids are escaped so an ARN cannot inject a query parameter, a 501 is distinguished from an error, and the bi-temporal edge properties the schema declares are asserted present | core | GATED | `is_current` is set on write and never cleared, because closing the previous interval needs a read-modify-write the ingest hot path does not do |+| SIEM integrations are two-way: an AiSOC verdict reaches the finding that raised it | docs/integrations/siem-writeback.md | `ci.yml` actions job (`test_disposition_writeback.py` — a confirmed true positive escalates and is never closed, an unrecognised verdict is refused rather than normalised, and the taxonomy is compared against the agents service so a verdict present on one side only cannot silently mean nothing) + `test_siem_client_signatures.py` (every close and escalate arm autospec'd against its real client) + api job (`test_siem_writeback.py` — refusals, simulations and transport failures all record `executed=False`) + fusion job (`test_source_finding_link.py` — `finding.uid` reaches `alerts.external_id`, and only a vendor with a writeback arm gets a link row) | core | GATED | - |+| No OSS default resolves to a specific deployment's hostname, so a self-hosted install never presents another deployment's host as its own | self-host contract; `apps/docs/docs/deployment/env-vars.md` (CORS default) | `hosted-hostname.yml` (`scripts/check_hosted_hostname.py` — an exact occurrence count per path, checked in **both** directions: a new or grown occurrence and a stale exemption whose occurrence is gone both fail, so an allow-list entry cannot outlive what justified it; the root is resolved from the working directory rather than `__file__` and verified against sentinels, a zero-match scan is reported as broken rather than clean, and `--self-test` runs first proving the detector separates known-bad from known-good and that the comparison rejects a vacuous pass; it also pins the six vendored `cors.py` copies byte-identical) + `tests/test_hosted_hostname_gate.py` (39 cases, including the ten runtime defaults that leaked and a check that the CORS-tuple extractor itself would notice the origin coming back) | core | GATED | - |+| A dry run never reaches a customer's vendor | live-action dry-run contract | `ci.yml` actions job (`test_dry_run_credential_strip.py` — each client factory's read set is re-derived from its own source and compared with the adapter's strip list, stripping that set is asserted to make the factory return `None`, and an end-to-end dry run with full credentials trips a wire if any factory returns a client) | core | GATED | the wire covers the four SIEM factories the writeback path uses; other vendors' adapters are covered by the strip-list equality check only |+| No route lets its caller name the tenant it reads; a tenant parameter is intersected with the caller's scope | (implied by multi-tenant); `tests/isolation/README.md` | `isolation.yml :: route-scope` (`scripts/check_route_tenant_scope.py` — an AST pass over all routes under `services/`, failing in **both** directions: a route taking a tenant identifier with no auth dependency, and a route accepting one without passing it through a scope intersection. Request-body models are read too, since a `tenant_id` on a POST body is the same hole as a query parameter. `--self-test` injects a violation of each kind, asserts two clean controls pass, and strips the verifier the one conditional exemption names to prove a stale exemption is dropped; the root comes from `git rev-parse` and the scan prints how many routes across how many files it opened) + `tests/isolation/test_route_tenant_scope.py` (the vendored HS256 verifier rejects `alg: none`, a refresh token, a wrong key and an expired token; an empty scope refuses rather than widening; and a two-tenant replay seeds A and B through the real `EntityRiskEngine`, asserts both genuinely hold rows, then asserts an anonymous caller, an undeclared service token and a console session for B are each refused A's entity-risk queue) + `sync_vendored_tenant_scope.py --check` (six copies byte-identical but for `SERVICE_NAME`) | full | GATED | `services/mesh` is exempt by design (Ed25519 + k-anonymity; a bearer token would break federation rather than secure it) and three MSSP routes that *define* a scope rather than read within one are exempt with the constraint that stands in for the intersection named per row |+| Every route authenticates, or is public for a reason that is itself checked | (implied by multi-tenant + RBAC); `apps/docs/docs/operations/security.md` | `isolation.yml :: route-scope` (`scripts/check_route_auth.py` — default-deny over all 601 routes under `services/`, reusing the same AST collector as the tenant-scope gate so the two cannot drift. A route without an auth dependency must appear in one of three tables, each carrying its reason: a probe module, a named public route, or an **in-band credential** route whose entry names the verifier and lapses the moment the handler stops calling it. Fails in both directions — an unexplained route fails, and an exemption that no longer matches an unauthenticated route fails as stale, so the tables shrink as routes are secured. `--self-test` injects an unauthenticated mutating route, asserts router-level and module-local `Annotated[..., Depends(...)]` auth are both recognised, and strips a live in-band entry to prove a stale one is dropped) + `tests/isolation/test_route_auth_default_deny.py` (the real agents routers over ASGI: an anonymous caller is refused on all seven previously-open routes including playbook create/execute/delete, a valid console session still gets a non-empty response, a service token declaring no tenant is 403, and forged / expired / `alg: none` / refresh tokens are each refused) | full | GATED | `services/mesh` stays exempt by design (Ed25519 + k-anonymity; a bearer token would break federation rather than secure it), recorded as a service-level entry whose reason the inventory prints |+| Every query on a tenant-scoped table filters on a tenant, however the row was addressed | (implied by multi-tenant) | `isolation.yml :: route-scope` (`scripts/check_tenant_query_predicates.py` — the predicate question the parameter gate structurally cannot ask, since a route matching on an id takes no tenant. Both the tenant-scoped ORM models and the tenant-scoped tables are derived from the tree (the model's `tenant_id` column, the migrations' DDL) rather than listed, so a new migration cannot slip past. Scoping is recognised structurally through five shapes — inline `.where()`, a `filters` list, a variable binding, a later `q = q.where(...)`, a join, and a helper that takes the statement and returns it filtered — plus a predicate on the authenticated principal's own identity, a key an **enforcing** guard already validated against the caller's tenant, and an RLS context bound on the connection where the table carries a policy. "Enforcing" is decided structurally: a guard whose result is tested in a branch that only logs demonstrably continues on failure and earns no credit, a guard whose callee raises does, and a callee this module cannot resolve is refused rather than guessed — the previous rule guessed yes, so a fail-soft guard written inline was indistinguishable from one that 404s. The session is excluded from the validated set by what it is used as (the receiver of a call), since `db` reaches every raw statement's name set and was crediting queries keyed on something else entirely. Raw SQL is parsed too, with docstrings excluded so prose about a query is not read as one. Undecidable cases sit on a **shrink-only ratchet**: each entry carries a reason, an entry whose statement is now scoped fails as stale, and `MAX_RATCHET` is asserted against the table's length so growth needs a number raised in the diff) + `tests/isolation/test_route_auth_default_deny.py` (two tenants seeded against a real database, both asserted to hold rows before either absence is asserted, then tenant B naming tenant A's `query_id` gets nothing back) | core | GATED | 32 ratcheted exceptions remain, each with its reason — credential lookups that *establish* a tenant, deliberately cross-tenant MSSP portfolio reads, background workers that have no caller, and two SQL-fragment builders whose only caller appends the predicate. The two ledger writes that were ratcheted as "scoped by an RLS context" are gone: the rule now recognises that shape structurally, and re-checking it found the mechanism did not work — the agents service was setting `app.tenant_id`, which no policy reads |+| Every tenant-scoped table carries an RLS policy, and a policy that cannot engage says so rather than reading as protection | `apps/docs/docs/operations/security.md` (multi-tenant isolation) | `integration.yml :: migrations` (`tests/isolation/test_postgres_rls.py::test_every_tenant_table_is_protected_or_named` — both directions: a tenant-scoped table with no policy fails unless it is one of the named exclusions, and an exclusion that no longer describes an unprotected table fails as stale; `FORCE` is required on every one, since without it the table owner, which is the application, walks past the policy. `test_no_policy_reads_a_session_variable_nothing_sets` closes the bug class that made seven existing policies inert — four keyed on a GUC no code path sets, two raising `unrecognized configuration parameter` on an unbound session. `test_superuser_bypasses_rls_which_is_why_the_probe_role_exists` measures the shipped role's bypass so the coverage figure is never read as a live guarantee) + `check_tenant_query_predicates.py --inventory` (coverage derived from the migration text of all five schema chains, not one) | full | GATED | 93 of 96 — `approval_timers` joined the count in `062_approval_timers.sql`, having previously been created at runtime by `services/slack-bot`'s `PostgresTimerStore` and so covered by no chain, no policy and no `tenant_id`, on a table that decides whether a pending containment auto-rejects. The three left are named, not rounded away — `users` is excluded so authentication can resolve a principal before a tenant exists, and `case_tasks` / `case_timeline` are ORM models no migration creates, asserted still absent (both re-confirmed against a live `postgres:16` with the full chain applied: `users` is the only tenant-scoped table without a policy, and neither ORM table has a `CREATE TABLE` anywhere in the chain). The policies are no longer inert: `061_runtime_app_role.sql` moved every deployment surface onto a role with neither attribute, and the row below gates it |+| The role the services connect as is subject to row-level security, and the cross-tenant workers still see every tenant | `apps/docs/docs/operations/security.md` (the role the services connect as) | `isolation.yml` (`scripts/check_runtime_db_role.py` — fails when a runtime DSN connects as the role that surface provisions as the database superuser. Structural: the privileged role is read out of `POSTGRES_USER` / `db_username` in the tree, not matched against a name, so renaming it changes nothing and a fourteenth service with a copied DSN still fails. Both directions — a *migration* DSN that is **not** the owner fails too, since the runtime role holds no DDL and that deploy dies on the first `CREATE TABLE`; a surface containing a Postgres URL that the parser could not read fails as a blind spot rather than passing; and an `aisoc-db-role: owner` exemption left behind after its DSN moved fails as stale. Thirteen classifier fixtures run *before* every scan, and a run that matched no surface exits non-zero. Two directions were added once the four alembic services were modelled the same way: **which credential applies each chain**, discovered from every `alembic.ini`'s `script_location` rather than from a list of four paths, failing when a chain names no `*DATABASE_MIGRATION_URL` at all, when it names one no deployment surface sets, or when its `env.py` cannot be read; and **a DSN handed to a service that cannot read the variable**, resolved from the compose `build.context` to the service's own source plus its pydantic `env_prefix`. Against `origin/main` the extended gate produces seven findings where it previously printed OK) + `integration.yml :: migrations` (`--dsn`, which reads `pg_roles` and `pg_class` on a live database and catches `rolsuper`, `rolbypassrls`, ownership of a covered object, a view without `security_invoker`, and a role still accepting the password `002_rls.sql` shipped) | full | GATED | The parser's own blind spot was found by enumerating what it **credited**: `infra/terraform/main.tf` declares `db_username = var.db_username` and interpolates `${var.db_username}`, and the naive compare read those as two roles — so the one surface handing the RDS master user to every service was recorded as compliant. The same method found the next one: `docker-compose.yml` set `DATABASE_URL=aisoc_app` on `honeytokens`, `purple-team` and `osquery-tls` and the gate credited all three, while each read only its prefixed spelling and fell back to a default naming the *owner* — a role switch that reached none of them behind a compliant-looking surface. A docstring mentioning ``DATABASE_URL`` in prose credited a fourth until the reader was narrowed to non-docstring literals. A managed Postgres still needs the operator to create the role's login; the compose stacks and CI do it themselves |+| A cross-tenant worker that stops seeing data says so instead of reporting success | `apps/docs/docs/operations/security.md` (a session that never bound a tenant) | `isolation.yml` (`scripts/check_rls_policy_shape.py` — every surviving policy in all five schema chains must carry the `OR current_tenant_id() IS NULL` arm, because ingest, fusion, the retention purge and the schedulers read on a session that binds no tenant and would otherwise see zero rows and report success. Replays the chain in order so a definition a later migration repaired is not reported, which is what lets the seven broken policies stay in the tree as history instead of being silenced by an ignore list. Both directions: a policy reading a GUC nothing sets, or omitting `missing_ok`, fails from the other side; a schema file that enables RLS but yields no policy fails as a blind spot; `ENABLE` without `FORCE`, and `ENABLE` with no policy, both fail) + `services/api/tests/test_retention_worker.py` (the sweep refuses, and issues no delete, on a session that has a tenant bound) | core | GATED | Two blind spots in this parser were found by counting what it credited rather than what it flagged: the four alembic chains build SQL by implicit string concatenation with no `;` so none of their twelve tables parsed, and the first fix then read each revision's `downgrade()` too, so create and drop cancelled and the policy count did not move. The static set is a deliberate **superset** of the live one — two policies in `002` sit behind an `IF EXISTS` a text replay cannot evaluate — which is the safe direction |+| Documentation and marketing name no competitor product, while vendors AiSOC integrates with stay named | AGENTS.md (naming rule); docs portal + benchmark comparison tables | `competitor-names.yml` (`scripts/check_competitor_names.py` — an explicit name list plus a path allow-list for integration surfaces, both checked in both directions: a dead pattern, a stale allow entry that no longer excuses anything, and a drifted comparison-table marker each fail rather than reporting a clean tree; the scan prints the absolute root and file count so it cannot report on a tree it never read) + `tests/test_competitor_names_gate.py` (42 cases, including `Torq` asserted as a competitor in prose *and* left untouched across its connector module, manifest, docs page and tests) | core | GATED | the name list is AI-SOC/SOAR rivals; vendors that are purely integration targets are deliberately absent from it and are instead held out of the pinned comparison-table regions, which are checked against a wider vendor list |+| The published playbook schema describes the engine that runs playbooks | concepts/playbooks.md (step table + `x-aisoc-execution`); `schemas/playbook.schema.json` | `ci.yml` P2 job (`scripts/check_playbook_schema_parity.py --self-test` — compares the schema enum, the `StepType` enum, the engine's `_HANDLERS` table, the `x-aisoc-execution` map, `bounds.py` and the pack validator's trigger list, **every pair in both directions**; refuses to run on a tree missing its marker files instead of printing OK about files it never opened, and names the root, schema, step counts and playbook count it inspected) + `scripts/lint_playbooks.py` (every `*.playbook.json` in the tree, not the two it used to scan while reporting "2/2 passed") + `tests/test_playbook_schema_parity_gate.py` (18 cases; drift injected in each direction and the gate asserted to name it) | core | GATED | the `governed` execution class is compared against `engine.RESPONSE_STEP_TYPES` in both directions, and the published `StepType` union in `packages/types` against the engine's, because that file had drifted into a fourth 28-member vocabulary nothing imported. `approval` is the one remaining unimplemented type and the schema says so |+| A step a playbook engine cannot run never reports that it ran | concepts/playbooks.md (error handling) | `ci.yml` agents job (`test_playbook_engine_correctness.py::TestUnimplementedStepTypesFailClosed` — an `approval` gate the engine cannot honour halts the run instead of passing it, every handler-less `StepType` is asserted to fail rather than succeed, a missing handler is not retried, an explicit `on_failure: continue` is still honoured, and a dry run reports `would_fail` rather than a bare `dry_run: true`) | core | GATED | - |+| A playbook step that names a response verb reaches governed dispatch | concepts/playbooks.md (governed step table) | `ci.yml` agents job (`test_playbook_action_bridge.py` — every member of `RESPONSE_STEP_TYPES` is asserted to produce one dispatch, each carrying its own step id, so the contract is applied per step rather than per playbook) + `ci.yml` api job (`test_playbook_step_dispatch.py`) + `ci.yml` P2 job (`check_playbook_schema_parity.py` compares the schema's `governed` class against `engine.RESPONSE_STEP_TYPES` in both directions, so a verb labelled governed that the engine answers locally fails the build) | core | GATED | `approval` is deliberately not bridged: the engine has no pause to suspend, and per-step grading has replaced the need for it |+| A playbook step that did not touch a vendor never reports that it did | concepts/playbooks.md (status table) | `ci.yml` agents job (`test_playbook_action_bridge.py::TestNoFakeSuccess` — each of six non-executing outcomes fails the step and the run; `awaiting_completion` is asserted to count as executed and `pending_approval` not to, because collapsing that pair loses an action in flight or invents one that never ran) + `ci.yml` api job (`test_playbook_step_dispatch.py::TestHowItReadsTheResult` — every `LiveActionStatus` maps to one honest outcome and an unrecognised status is treated as not executed) | core | GATED | execution is off by default (`AISOC_PLAYBOOK_ACTIONS_EXECUTE`), so out of the box a response step previews and says so |+| The capability contract is applied on the registry-driven dispatch path, not only on `POST /actions` | concepts/live-actions.md (contract belongs to the verb) | `ci.yml` actions job (`test_dispatch_capability_contract.py` — a verb the blast table calls medium is held at its declared high impact, a contracted verb with no `ActionType` is governed rather than skipped, missing confidence is the lowest band, a read-only verb is not gated, and the contract is asserted unable to lower a verdict blast radius already gated) + `test_dispatch_tenant_governance.py` (a tenant `force_auto` override lifts the tier ceiling and cannot lower a contract that demands an analyst) | core | GATED | probes are keyed on `ActionType`, so a contracted verb without one reports `unverified` with the reason rather than leaving the field blank |+| The documented playbook upgrade command exists and produces valid output | docs/upgrade/MIGRATION.md (Step 5) | `ci.yml` P2 job (`tests/test_upgrade_playbooks.py` — a v3 playbook is asserted not to validate before and to validate after, against the real `schemas/playbook.schema.json`; every declared rename must land on a type the schema declares; the four types with no v4 equivalent are reported and left unchanged rather than mapped onto a nearest neighbour; check mode writes nothing; an empty scan is a failure, not a clean bill of health) | core | GATED | the doc previously named a script that did not exist, beside a field table whose v4 column named four spellings the schema rejects |+| Every `ActionType` resolves a capability contract, so the confidence matrix is never skipped | concepts/live-actions.md (the one alias, and when it goes) | `ci.yml` actions job (`scripts/check_action_contract.py` directions 7 and 8 — every `ActionType` must resolve a contract by name or alias, and every alias must key a real `ActionType`, point at a real contract, not shadow a capability of the same name, and describe a bridge some adapter actually implements) + `test_approval_gate_wiring.py` (`notify_slack` at 10% confidence was approved for auto-execution and now requires an analyst; the alias is asserted unable to *lower* a requirement) | core | GATED | one alias entry (`notify_slack` -> `notify`), with its retirement condition recorded: it goes when `ActionType` does |+| Every check this matrix names is actually run by CI | this matrix (each row names a gate) | `ci.yml` (`scripts/check_gate_coverage.py` — resolves the whole graph rather than reading workflow names: workflows, `make` recipes they invoke, the pytest suites they collect and the scripts those reach, so a check wired only through a test still counts. Both directions — a check no workflow reaches, and a workflow step naming a `scripts/` path that does not exist. `--self-test` runs first and asserts the resolver discriminates rather than returning "reached" for everything, and the corpus counts are printed so it cannot report on a tree it never opened) | core | GATED | the ratchet for a deliberately-unwired check is empty; it may shrink, never grow |+| What counts as a check is decided by what a script does, not what it is named | `scripts/check_gate_coverage.py` (the inventory it reports on) | `ci.yml` (three structural signals, all read from the tree: a declared verdict flag, an exit status derived from findings the script accumulates, and a workflow job whose output another job branches on. The first two are intrinsic, so an uncalled gate is still inventoried and the `SCRIPT -> WORKFLOW` direction is not vacuous. The classifier is also checked in reverse — a script CI runs with `--check` that the classifier does not inventory fails as `classifier-blind-spot`) + `tests/test_gate_coverage_classifier.py` (10 cases, including a gate planted under a name no convention would reveal, and a generator that aborts on an empty read asserted *not* to be a check) | core | GATED | - |+| No check reports OK over a repository with no content | every row above (a gate that credits an empty tree proves nothing about a full one) | `ci.yml :: python-test` (`scripts/check_gate_contract.py` — runs all 72 inventoried checks the way a workflow runs each one, inside a git repository holding only `scripts/`, and requires a non-zero exit. Two tree shapes, because they are two questions: **bare** omits the directories a gate judges, **skeleton** creates them empty. The second is the one that happens — a renamed package, a glob that stopped matching — and a gate opening with `if not X.is_dir(): return 2` answers the first for a reason that says nothing about its corpus. Measured before it was added: 64 of 71 checks already refused the skeleton, so the exception list stayed readable rather than doubling. A run that failed for a reason the empty tree did not cause — an argparse usage error, or an import of a module the repository does not supply — is INCONCLUSIVE and fails rather than counting as a refusal, so the gate cannot credit a failure it did not cause. Exceptions are recorded with the disposition they are excused for and checked in both directions: an entry naming nothing, and an entry whose gate has started behaving differently, both fail) + `tests/test_gate_contract.py` (45 cases) | core | GATED | 5 recorded exceptions, keyed by tree shape; the probe cannot pose the question to a gate whose only input is a path named on the command line, or one that lives inside `scripts/`. One entry exists because its dispositions legitimately differ: `check_logger_kwargs.py` scans every Python file in the repository, so against a skeleton it has a real corpus in `scripts/` and correctly finds nothing wrong |+| Every check resolves its root from git and carries a `--self-test` | `scripts/` (the gates themselves) | `ci.yml :: python-test` (`scripts/check_gate_contract.py` — a check that derives a repository root from `__file__` without consulting git fails as `root-from-file`, and one that declares no `--self-test` fails as `no-self-test`. Both read from the syntax tree: the first spelling matched `repo_root` anywhere in the text and `check_gate_coverage.py` emits it as a JSON key, so a non-compliant gate read as compliant on the strength of a dictionary key in its own output. Both exception lists are empty — all 72 comply — and an entry added to either must carry a reason) | core | GATED | - |+| Every model AiSOC sends has a gateway that defines it, and the variable compose supplies is the variable the resolvers read | `apps/docs/docs/operations/llm-gateway.md`, `.env.example`, README (AI triage) | `ci.yml :: python-lint` (`scripts/check_llm_model_routing.py` — both directions on every name: each role pin's alias must be defined by `infra/litellm/config.yaml` and each alias must be claimed by a pin; every model named in `.env.example` or `docker-compose.yml`, in a file that wires the bundled gateway, must be one the gateway defines; every variable compose points at the gateway must be read by *both* resolvers, and every gateway variable the resolvers read must be set by compose — the defect that shipped was compose supplying `LLM_GATEWAY_URL` and both resolvers deliberately ignoring it, so AI triage could not reach a model at all; a service given the gateway URL must also get `LITELLM_MASTER_KEY`, because a provider key sent there is rejected. Every parser is AST- or comment-aware and the self-test proves it: the config's commented Ollama example repeats `model_name: aisoc-triage` verbatim, `.env.example` documents the escape hatch as a commented `AISOC_MODEL_PIN_TRIAGE=`, and compose explains the gateway in prose two lines above the key it describes — a line regex credits all three) + `services/agents/tests/test_llm_factory.py` + `services/api/tests/test_model_aliases_routing.py` | core | GATED | Embeddings are a recorded exclusion — the gateway's model list is chat aliases only — and the gate checks that in both directions rather than trusting the comment |+| Every test file in the tree is executed by a workflow | `CONTRIBUTING.md` / the suites themselves | `ci.yml :: python-test` (`scripts/check_test_discovery.py` — the corpus is `git ls-files`, so a service added tomorrow is scanned with no edit, and an untracked install tree is out by construction rather than by a name somebody remembered. Reach is modelled the way pytest collects: directory arguments, `--ignore`, `conftest` `collect_ignore`, and `-m` marker deselection, because a file whose every test is deselected runs nothing however plainly it is named. Both directions — an invocation naming a path that is not in the tree fails too. Quarantine is a shrink-only list where each entry carries a reason and an entry that has become reachable fails as stale. Two blind spots in this parser were found by counting what it **credited**: a step that `cd`s into a service and then names `tests/` had its paths resolved against the repository root, which reported all 82 agents files unreached *and* credited the root tree with a package's invocation; and `-m` was first skipped as "a filter, not a collection rule", which would have credited a file in full under `-m "not integration"`) + `tests/test_test_discovery_gate.py` | core | GATED | - |+| Every reported LLM cost is measured, labelled an estimate, or absent | admin cost dashboard, `/costs/dashboard`, `/investigations` run + aggregate responses, Investigation Ledger, `/metrics/funnel` insights, investigation summary export | `ci.yml :: python-lint` (`scripts/check_cost_provenance.py` — the tracker priced the `aisoc-<role>` **alias** against a table of hosted list prices it does not appear in, so every call fell through a `(0.001, 0.002)` default: a 903-token completion on an operator's own hardware reported `total_cost_usd=0.000999`, and that figure reached the cost dashboard, the funnel, the per-run ledger and the budget circuit breaker, which trips at `AISOC_BUDGET_HARD_USD`. Seven rules, each a structural relationship with both name spaces enumerated: every money field has the count that qualifies it and every provenance count qualifies a money field; every column the writer writes is added by migration 063 and every column 063 adds is written or read; neither pricing table carries a fallback rate and neither can key on an alias; the two gateway headers read are the ones carrying a **total**, not the five sharing their prefix that carry a component, an adjustment or a *percentage*; every provenance field on the wire exists on both the Python and TypeScript sides, which cannot import one another; and a console surface that renders a currency amount consults a provenance count first. Every parser is AST- or comment-aware, proven by nine blind-spot cases built from text already in the corpus — `gateway_cost.py`'s docstring enumerates all seven cost headers to explain why five are refused, `cost_telemetry.py`'s docstring names the removed `(0.001, 0.002)` default, the migration's `COMMENT ON COLUMN` statements repeat every column name, and `api.ts` documents fields in comments above them — a line regex credits all of them) + `services/agents/tests/test_cost_provenance.py` (22 cases, header fixtures captured from a real gateway) + `apps/web/src/components/admin/CostDashboardView.test.tsx` (first-paint assertion that a window with 1,287 unmeasured calls renders no `$` at all) | core | GATED | A measured `0.0` — what a local model genuinely costs — is a value and is reported as one; only an *absence* renders as not measured |+| Published detection / marketplace counts match the tree | landing page (`Hero.tsx`, `ConnectorsMarquee.tsx`, `FeatureGrid.tsx`, `Pillars.tsx`), `ContributorLeaderboard.tsx` | `ci.yml :: python-lint` (`generate_corpus_stats.py --check` — the counts are generated into `apps/web/src/data/corpus-stats.json` + `corpusStats.ts` and imported, so a surface cannot carry its own literal; the generator reconciles three independent sources against each other — the compiled engine ruleset, `docs/detections/truth-table.md` and `marketplace/index.json` — and refuses to publish if they disagree. The landing page previously gave three different wrong answers at once: 6,998 detections in four places, 7,117 marketplace items, and 218 rules on the leaderboard, with no gate on any of them) | core | GATED | - |+| The corpus figure the product executes is distinguished from the corpus on disk | landing page, `docs/detections/truth-table.md` | `ci.yml :: python-lint` (`generate_corpus_stats.py --check` emits `executable` and `onDisk`/`quarantined` as separate fields and the UI leads with `EXECUTABLE_DETECTION_COUNT`; most of the indexed corpus is never loaded, so quoting the on-disk figure as the detection capability presents rules that cannot fire as executable) | core | GATED | `_quarantine/` membership is no longer a proxy for either figure — the Sigma compiler translates rules in place, so 1,724 files under that directory are loaded. Every count in the tree now derives from the compiled ruleset; anything classifying by path reports ~1,700 too many as inert |+| The retracted 75.3% alert-reduction figure is never presented as a measurement | `apps/docs/docs/benchmark.md`, `benchmarks/alert-reduction.md`, `BenchmarkResults.tsx`, `ComparisonTable.tsx`, `benchmark/page.tsx` | `ci.yml :: python-lint` (`check_alert_reduction_claims.py --check` — scans every published surface: no file may assert the legacy harness runs the production grouping ("faithful re-implementation", "same logic"), any file quoting 75.3% must carry the retraction, the `alert_reduction` suite card may not be declared `kind: 'measurement'`, and every surface publishing the real figure must quote `PUBLISHED_REDUCTION_PCT` from `services/fusion/tests/test_alert_reduction_real.py`, which that test asserts against its own measurement — so the chain from measurement to prose has no hand-copied link. `benchmark.md` had withdrawn the claim while two other surfaces went on asserting it, and `benchmark.md` itself re-asserted it in its own intro blockquote) | core | GATED | - |+| The same verb is graded identically whichever dispatch door it arrives through | README (graduated autonomy); `concepts/live-actions.md` | `ci.yml` actions job (`test_approval_doors_agree.py` — both live doors driven over 23 capabilities x 5 tiers x 3 confidence bands, 345 combinations, asserting the same answer to "did a vendor get touched without a human". A dry-run preview does not count as a touch, since the registry door downgrades an over-tier request to one. Against the previous tree it reports 5 disagreements: `search_siem` is read_only and automatic and sat in the analyst queue at the default tier while executing through the other door, because `TIER_MAX_AUTOMATIC["L1"]` said a tier the ladder defines as "MINIMAL blast-radius actions are automatic" auto-executes nothing; and `update_alert_disposition` was the one ActionType with no `ACTION_BLAST_RADIUS` entry, which is not a missing entry but two different ones, since the four readers of that table supply two different fallbacks. Structural checks alongside it fail a door that imports the raw matrix or compares against a specific `ActionImpact` inside its grading path — the shape a re-introduced bypass has — and require every `ActionType` to carry an explicit blast radius so neither fallback decides anything) | core | GATED | the grading itself is one function, `approval_matrix.evaluate_contract`, rather than two kept in agreement by discipline; the sweep exists for the axis it cannot unify, which is each door's separate blast-radius layer |+| An image the deployment files tell an operator to pull exists, at the tag they will request | README quickstart (`docker compose up`), `docs/deployment/*`, `infra/helm/aisoc` | `image-availability.yml` (daily) + the `verify` job of `publish-images.yml` and `release.yml` (`scripts/check_published_images.py` — resolves every reference in `docker-compose.yml` and the chart the way the tooling that reads them does, `${AISOC_VERSION:-latest}` to its default and an empty chart `tag:` to `Chart.AppVersion`, then asks GHCR. `--require-fresh` also compares the version the tag names, or the `VERSION` at the commit the image records in `org.opencontainers.image.revision`, against the tree. Against `main` before this gate existed it reported 14 findings: `aisoc-web:latest` two releases behind, `aisoc-web:v11.0.0` never pushed, three images named by compose that had never been published once, and a chart whose every tag defaulted to a `Chart.AppVersion` no image carried. Offline it prints SKIPPED rather than OK, and `--require-network` makes that a failure) | core | GATED | Third-party images (`postgres`, `redis`, `ghcr.io/berriai/litellm`) are named and counted but not resolved: the claim is about the images this project publishes, and anonymous third-party registry reads are rate-limited per runner IP. Existence is not asked on a pull request, because a PR that adds a service names an image that cannot exist until it has merged and published |+| An analyst label AiSOC cannot name is excluded from evaluation rather than guessed | `apps/docs/docs/evaluation/replay.md`; `services/actions/app/services/alert_history.py` (the taxonomy and its refusal rule) | `ci.yml` actions job (`test_alert_history.py`: each of the five SIEM readers is driven over its real HTTP path against vendor-shaped payloads with a mock transport, so a wrong endpoint, a wrong filter or a parser that KeyErrors on the documented shape fails here rather than on a customer's history. The assertions that carry the claim are the negative ones: every vendor's explicit "I do not know" (Splunk ES dispositions 5 `Other` and 6 `Undetermined`, Sentinel `Undetermined`, Defender `Unknown`, a site-custom QRadar closing reason, an untagged Elastic signal) is asserted to land on `unlabeled`, two conflicting Elastic tags yield `unlabeled` rather than a coin flip, and `unlabeled` is asserted **not** to be a member of `CANONICAL_DISPOSITIONS` so nothing downstream can score it as a verdict. `ClosedFinding.__post_init__` refuses a disposition that is neither canonical nor `unlabeled`, so a mapper cannot invent a third vocabulary. An unparseable close time raises rather than defaulting to now, because a silently-wrong close time puts a row on the wrong side of the train/test split and leaks the answer into its own evaluation) | core | GATED | Reachability and taxonomy only: the gate proves each reader parses its vendor's documented shape and refuses to guess, never that a given deployment's history is complete. Elastic ships no disposition field at all, so an untagged Elastic deployment yields no labels and the replay report says so rather than grading on zero |+| Uploading a customer file for analysis is off by default, per tenant per provider | `operations/sandbox-providers.md`; `POST /api/v1/sandbox/files` | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, which drives the real `evaluate_upload` over all 24 combinations of provider class x air-gap x consent x hash-known and requires a refusal for every one that is not "consented, unknown hash, provider accepts uploads, not air-gapped", then requires air-gap to outrank consent and a known hash to outrank consent. An AST pass separately fails any consent-shaped flag that defaults to `True`, anywhere in the package or the route module. Proven against injected violations of each rule, not only against the tree that satisfies them) + `ci.yml :: api tests` (`test_sandbox_upload_policy.py`, where the mock provider records every byte handed to it, so "nothing was uploaded" is asserted against what the provider received rather than inferred from a return value) | core | GATED | - |+| Hash lookup is tried before any file is uploaded | `operations/sandbox-providers.md` (upload policy) | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, which reads `analyse_file`'s AST and fails when `evaluate_upload` is called before `lookup_hash`, or `submit_file` before `evaluate_upload`, so the ordering cannot be lost to a refactor that keeps all three calls) + `ci.yml :: api tests` (a seeded hash returns `known` with the provider's upload log empty) | core | GATED | - |+| Air-gapped mode permits local analysis providers only | `operations/sandbox-providers.md`; `core/airgap.py` | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, which requires every adapter must declare `local=` on its `ProviderCapabilities`, so a new provider cannot be added without air-gap mode being able to classify it) + `ci.yml :: api tests` (`test_air_gap_mode_refuses_non_local_providers`, where the hosted provider is excluded from `usable_names()` while remaining visible in `names()` with its reason, and the local one becomes the default) | core | GATED | the registry gate is over the adapters in `providers/`; a provider constructed outside it would not be seen, which is why `build_registry` is the only assembly path |+| A file-analysis failure reaches an agent as "could not check", never as a clean result | `operations/sandbox-providers.md`; agent tool `lookup_file_hash` | `ci.yml :: python-lint` (`check_sandbox_upload_policy.py`, whose AST pass fails any `except` block that constructs a `SandboxReport` or returns `outcome="known"`/`"not_seen"`, which is the shape that turns a provider outage into a benign verdict) + `ci.yml :: api tests` (`TestFailureIsNotACleanResult`, where a miss and a failure are asserted to produce different outcomes and different wording, and an unreachable provider is reported under `could_not_check` rather than folded into "no result") | core | GATED | the agent-side tool's wording is asserted in `services/agents/tests/test_sandbox_tool.py`; the model's interpretation of that wording is not gated and cannot be |+| A report field the provider does not publish reads "unavailable", never zero or empty | `operations/sandbox-providers.md` (provider contract) | `ci.yml :: api tests` (`test_sandbox_providers.py`, driven against a **recorded** report whose `attackTechniques` is `[]` beside `behavior.analyzed: false`; the adapter must return `UNAVAILABLE` with the stage's own reason attached, and the same payload with the stage marked run must return a real empty tuple. A missing score must not read as 0 and a missing IOC section must not read as "none found") | core | GATED | the recorded payload covers one provider and one shape of absence; CAPEv2's equivalents are synthetic because no live CAPEv2 instance was available |+| Replay evaluation runs the production triage path, not a copy of it, and writes nothing while it does | `apps/docs/docs/evaluation/replay.md`; `services/agents/app/replay/runner.py` | `ci.yml` agents job (`test_replay_shadow_no_writes.py` — every durable write on the triage path is monkeypatched on the **real** module to raise a `BaseException`, then a replay is run: a `BaseException` because the worker wraps most of its writes in `contextlib.suppress(Exception)`, which is correct production behaviour and is exactly what would let a leaked write pass a gentler guard. Zero writes is asserted as a *count* rather than as an absence, since a replay that stopped replaying and a replay whose writes were suppressed both write nothing and only the counter tells them apart. That the path is production's is pinned two ways: the worker's default sinks are asserted to be `LiveTriageWriter`/`LiveTriageContextReader`, and an AST pass over `services/agents/app/main.py` asserts the deployed worker is constructed without overriding either. `test_escalation_cannot_change_the_graded_verdict` drives the real worker with a graph runner that rewrites the verdict and asserts the returned summary is unmoved, which is what makes declining escalation in shadow mode sound rather than convenient) | core | GATED | Triage only. Fusion's correlation, fused confidence score, narrative and entity resolution are absent from a replayed finding; `ENVELOPE_LIMITS` is published in every report's method section rather than left as a comment |+| The test window of a replay cannot influence its own triage | `apps/docs/docs/evaluation/replay.md` (point-in-time context); `services/agents/app/replay/shadow.py` | `ci.yml` agents job (`test_replay_leakage.py` — three routes from a test-window decision back into a later one, each with its own test because one combined assertion would not say which broke: the outcome-memory prior that auto-closes a repeat without re-triage, the cost governor's dedup cache that short-circuits earlier still and leaves no ledger row or prior behind, and organisation memory read live into the prompt. Each is checked for **sensitivity** as well as for the guard: the memory test runs the identical corpus twice, once with the shadow sinks and once with a live reader and a recording writer, and asserts the second leaks at tier `memory`; the statements test asserts the frozen reader hands the agent the snapshot and that the same worker with the live reader picks up the poison. `capture_context` drops rows recorded after the split in both stores, and a snapshot taken at any other instant is refused rather than used) | core | GATED | Organisation-memory statements as `GET /feedback/context-statements` serves them carry no creation time, so the split filter has nothing to test them against and they are kept. The count is published as `statements_without_timestamp` in the report's method section rather than the freeze being claimed tighter than it is |+| A shadow verdict never fills in the analyst column it will be graded against | `apps/docs/docs/operations/shadow-mode.md`; `services/agents/app/workers/shadow_mode.py` | `ci.yml` agents job (`test_shadow_mode.py`) - the shadow sink is asserted to decline every acting method against a delegate that *records* rather than performs, so a forwarded call shows up as a recorded one rather than as an absence; `persist_auto_triage` is asserted to force `auto_closed` off and the `shadow` flag on; and the ledger statement is read to confirm `disposition`, `status` and `resolved_at` are each guarded by that flag with `NOT $10` rather than by the caller remembering to pass `auto_closed=False`. Plus `ci.yml` api job (`test_shadow_agreement.py`) - reconciliation only reads closed alerts and only writes decisions with `resolved_at IS NULL`, so a later change of mind cannot rewrite evidence a promotion already rested on | core | GATED | One limit. The SQL guard is read, not executed: there is no Postgres in the unit suites, so what is proven is that the statement carries the guard and binds the flag, not that Postgres evaluates the CASE as written. The caveat this row used to carry, that closures made in the customer's own SIEM reached no scheduler, is closed by the three rows below; D15 in the progress tracker records what it was |+| Agreement cannot be improved by declining to answer | `apps/docs/docs/operations/shadow-mode.md`; `services/actions/app/services/autonomy_evidence_rules.py` | `ci.yml` actions job (`test_autonomy_evidence_rules.py`) - the same ten right answers are scored with nothing declined and with ninety declined, and the agreement rate is asserted identical, because abstaining removes a decision from the numerator and the denominator together. The counterweight is asserted from the other side: a window where the agent answered ten of forty labelled cases posts a perfect agreement rate and a malicious recall of 8/30, since recall's denominator is every malicious case whether answered or not. The abstention rate is asserted to move where agreement does not, and `AgreementWindow` refuses to construct at all when its counts do not add up, so a miscounted aggregate raises instead of publishing a plausible rate | core | GATED | The metric is gated; what it is used *for* is Phase 2.3. This row proves the rate cannot be gamed, not that anything yet refuses a promotion on it |+| Live agreement is scored by the Phase 1 metrics rather than a second set | `plans/aisoc_gap_closure_plan.plan.md` (2.2, "using the Phase 1 metrics"); `apps/docs/docs/operations/shadow-mode.md` | `ci.yml :: python-lint` (`check_replay_contract_parity.py`, extended from three trees to four: `GRADED_DISPOSITIONS`, `ABSTENTION_VERDICTS` and the `MALICIOUS` spelling must be identical strings in `autonomy_evidence_rules.py` and in `aisoc_benchmark/replay.py`, compared in both directions, and `UNLABELED` must be spelled the same in all three. Proven capable of failing by drifting each of the two collections in turn and watching it fire, rather than only having never fired) + `ci.yml` (`sync_vendored_autonomy_evidence.py --check`, which byte-compares the API's copy, because a safety control defined twice is off in whichever copy is more generous) | core | GATED | Parity of the definitions is gated. That the two implementations compute the same number from the same rows is not: the grader scores a list of decision dicts and the live path aggregates in SQL, so they share a vocabulary rather than a code path |+| Autonomy is granted on a measured track record, and refused without one | `apps/docs/docs/operations/shadow-mode.md` (earning autonomy); `services/actions/app/services/autonomy_evidence_rules.py` | `ci.yml` actions job (`test_autonomy_promotion_gate.py`, which starts from one qualifying control and breaks one property per test, so a failure names the property rather than the file) + `integration.yml` (`tests/isolation/test_autonomy_promotion_live.py`, the phase's "Done when" run against a real Postgres: a tenant with 20 recorded shadow decisions is refused, the same tenant with 150 is granted, and injected disagreements demote it. The live half exists because the aggregate and the evaluator agree by convention and a convention is what drifts: only a real database executing the real statement over real rows proves the SQL counts what the gate expects. `AUTONOMY_PROMOTION_LIVE_REQUIRED=1` turns an unreachable database into a failure rather than a skip) | core | GATED | The four refusals are gated. What is not gated is whether the thresholds are the *right* numbers: 100 decisions and 30 malicious are the plan's, and 95% agreement and 90% recall are choices nobody has yet validated against an outcome. They are configurable per call and travel by value in every snapshot |+| A promotion cannot be earned by an agent that declines its hard cases | `apps/docs/docs/operations/shadow-mode.md` (what has to be true) | `ci.yml` actions job (`test_autonomy_promotion_gate.py::TestRefusalThreeAgreementBoughtByAbstaining` - an agent that answered a fifth of its queue perfectly is refused, and the test that matters removes the abstention cap entirely and asserts it is *still* refused, on malicious recall, so the second guard is shown to be load-bearing rather than redundant) + `integration.yml` (`test_an_abstention_is_excluded_from_agreement_by_the_real_sql`, which asserts the same property of the aggregate rather than of the type: 10 answered and 90 declined reads as 100% agreement and a 90% abstention rate against live Postgres) | core | GATED | Three guards, all gated: agreement's denominator, the abstention cap, and recall counting an abstention as a miss. None of them detects an agent that answers confidently and wrongly in a way its analysts also got wrong, which is the limit of grading against human labels at all |+| An override is distinguishable from earned autonomy, six months later | `apps/docs/docs/operations/shadow-mode.md` (overrides); `067_autonomy_grants.sql` | `integration.yml` (`test_it_is_a_different_word_everywhere_it_lands` - the audit action is `autonomy:overridden` not `autonomy:granted`, the grant row's `source` column is `operator_override`, and the refusals that were waived are in both the row's evidence snapshot and the audit entry's changes. The earned case is asserted from the other side: `waived_refusals` is an empty list, which is the record that nothing had to be overruled. `test_an_override_is_demoted_on_the_same_floors` asserts an override is not permanent, since exempting it would turn it back into the settings toggle this phase replaces) + `ci.yml` web (`AutonomyScorecard.test.tsx` renders the three states distinctly) | core | GATED | The source is derived from the gate's own verdict and `evaluate_promotion` takes no override argument, so a caller cannot have an override recorded as earned; a test pins that signature. What is not gated is whether the operator's stated reason is truthful |+| Every autonomy transition is in the hash-chained audit log with its evidence | `plans/aisoc_gap_closure_plan.plan.md` (2.3); `apps/docs/docs/operations/shadow-mode.md` | `integration.yml` (`TestTheTransitionsAreInTheHashChainedLog` - a promotion and the demotion that follows it are replayed through `audit_hash.verify_chain`, the same pure function an external auditor would run over a CSV export, and the second entry is asserted to chain onto the first rather than starting a new one. A `DELETE` against the trail is asserted to raise, because a grant whose record can be quietly removed has no audit trail) | core | GATED | The chain and the snapshot's presence are gated. The snapshot's *sufficiency* is a judgement: it carries the counts, the thresholds by value, absolute window bounds, the first and last decision id, the models and a digest of the rules, which is what a later reader needs, but no test can prove a question nobody has asked yet is answerable |+| A track record cannot unlock a high-blast containment | `apps/docs/docs/operations/shadow-mode.md` (what a grant can and cannot unlock); `services/actions/app/live_actions/dispatcher.py` | `ci.yml` actions job (`test_earned_autonomy_wiring.py` - an earned grant raises the tier ceiling to L3 and no further, so MINIMAL, LOW and MEDIUM blast are reachable and HIGH and CRITICAL are not, whatever the evidence says; the capability contract still applies on top, so a verb declared `analyst` or `mandatory_human` stays gated; and a grant is asserted never to lower a bar, only to widen the branch that was already heading for the approval queue) | core | GATED | The ceiling is gated. The reasoning behind it is a judgement and is stated where the code is: agreement on triage verdicts is evidence about the agent's judgement, not evidence that a high-blast containment was the right call, and one number must not be allowed to unlock both |+| A replay report prints "not measured" where there was no denominator, and no headline accuracy on a corpus too thin to support one | `apps/docs/docs/evaluation/replay.md`; `packages/aisoc-benchmark/aisoc_benchmark/replay.py` | `ci.yml` benchmark job (`test_replay_metrics.py` — a class the agent never predicted reports `None` precision and renders as "not measured", because `0.0` in a recall column says the agent missed every case and "never asked" is a different fact; below 30 malicious cases the headline is withheld with the count and the reason, and the rendered report is asserted to contain no percentage in that section. Three populations are asserted apart: unlabelled findings excluded from accuracy and counted, triage refusals scored as neither answer nor abstention, and abstentions counted against malicious recall. A verdict outside the taxonomy gets its own confusion-matrix column rather than being folded into one the agent did not say. Bootstrap intervals are seeded and the seed and resample count travel in the report, so two runs over one corpus render byte-identically) | core | GATED | Hallucination extraction reuses the existing `_INDICATOR_PATTERNS`, which over-counts rather than under-counts: a phrase shaped like a domain is checked and, if absent from the evidence, counted. The published rate is a ceiling and the per-decision list travels with it so a disputed count can be re-derived |+| An operator can measure triage against their own analysts from the CLI, the API or the console, and the report reproduces byte for byte | `apps/docs/docs/evaluation/replay.md` (Running one; Reproducibility, stated precisely); `packages/aisoc-cli` `aisoc replay` | `integration.yml :: replay-e2e` (`tests/e2e/test_replay_cli_end_to_end.py` — the CLI is run **twice** against a mocked Splunk ES holding 200 recorded closed notables, through the API, `services/actions`, `services/connectors` and `services/agents`, each started from the working tree rather than from a published image, and the two reports are compared as bytes. The comparison cannot pass vacuously: a second assertion fetches both reports *without* the latency exclusion and fails if more than that one line differs, so a stripped artefact cannot hide a field that stopped reproducing; further assertions require the report to carry the 200 findings read, the 60-finding graded window and a printed headline, because a withheld headline reproduces just as reliably while printing far fewer numbers. `AISOC_REPLAY_E2E_REQUIRED=1` makes an unreachable database a failure rather than a skip) + `ci.yml` cli job (`test_replay_command.py` — the CLI renders nothing of its own and writes the bytes the API returned, progress goes to stderr so `aisoc replay ... > report.md` is the report and nothing else, an omitted window is not filled in from the local clock, and a failed evaluation exits non-zero with the server's reason and writes no file) + `ci.yml` benchmark job (`test_replay_metrics.py` — two corpora differing only in latency render differently and identically once excluded; the stripper removes exactly the line the renderer emits, in both directions) | core | GATED | Reproducibility is a property of the deterministic model path and of a **pinned** window. An omitted `--since` / `--until` dates the window from now, which is a different window on a second run; pointed at a hosted model two runs may legitimately differ. No hosted provider has been exercised end to end here |+| A replay evaluation's results are tenant-scoped, and its tenant comes from the credential rather than the request | `apps/docs/docs/evaluation/replay.md` (The API); `services/api/migrations/065_replay_evaluations.sql` | `isolation.yml :: route-scope` (`check_route_auth.py` — the six new `/evaluations/replay*` routes carry an auth dependency or the gate fails; `check_route_tenant_scope.py` — no route, query parameter or request-body field on this surface names a tenant, and the internal routes it drives resolve theirs from the credential: `services/agents` through the vendored `tenant_scope` where a service token with no `X-AiSOC-Tenant-ID` resolves to an **empty** scope that refuses rather than widens, and `services/actions` by taking no tenant at all, since the credentials it is handed are the scope) + `isolation.yml` (`check_rls_policy_shape.py` — both new tables carry `FORCE` and the `OR current_tenant_id() IS NULL` arm, verified applied against a live `postgres:16`) + `ci.yml` api job (`test_replay_evaluation.py` — a connector in another tenant resolves to no row and the run fails rather than reading it; an evaluation id in another tenant is a 404 rather than a 403, since telling the two apart would confirm the id exists) + `ci.yml` agents job (`test_replay_route.py` — a service token with no tenant header is refused with no downstream call made, and the tenant the credential named is the one forwarded to the connectors service) | core | GATED | The per-decision rows carry the evidence triage was given, so a tenant's own alert content is at rest in `aisoc_replay_decisions`. That is the point (a disputed score has to be re-derivable) and it is stated on the docs page rather than left to be discovered |+| Closures your analysts make in your own SIEM are polled back on a schedule and graded, not merely capable of being | `apps/docs/docs/operations/shadow-mode.md` (Polling your SIEM for closures); `services/api/app/workers/shadow_reconcile.py` | `ci.yml` api job (`test_shadow_reconcile_sweep.py::test_the_deployed_lifespan_registers_the_sweep` - an AST pass over `services/api/app/main.py` as it ships, asserting three things because any one alone passes over a worker that never runs: the module is imported, a task is created through `_run_guarded_scheduler_worker`, and that call's `worker=` is the sweep's own `run_forever` rather than something that merely mentions it. The job name is pinned too, because the Redis lease is keyed on it and two names means two replicas sweeping one vendor at once. Proven capable of failing by running it against `main`'s `app/main.py`, where both it and the default-off assertion fail) + `ci.yml` actions job (`test_shadow_reconcile_route.py::test_the_route_is_reachable_on_the_deployed_app` - the receiving route is asserted present on the service's own `app`, since a router written and never included is the same defect one layer up. Reachability is asserted by *sending a request* and by reading `app.openapi()`, never by reading `app.routes`: on the FastAPI version these services pin, `include_router` does not populate `app.routes` at all, so an app with four routers mounted reports only the seven docs and probe routes it was born with, and the first draft of this test passed locally and failed in CI for exactly that reason) | core | GATED | Registration is gated, and so is every branch of one pass against a stubbed actions service. What is not gated end to end is a real vendor: no live Splunk, Sentinel, Elastic, QRadar or Defender has been polled by this sweep. The readers themselves are covered against recorded vendor payloads by the Phase 1.1 rows |+| A scheduled sweep tells a condition that will never resolve from one that might, and says which | `apps/docs/docs/operations/shadow-mode.md` (What stops it, and whether waiting helps); `services/actions/app/api/shadow_reconcile_router.py` | `ci.yml` actions job (`test_shadow_reconcile_route.py::TestPermanentIsNotTransient` - the vendor's own status decides, so all four of 400/401/403/404 answer 422 naming the operator action while 500/502/503/504 and a timeout answer 502 without it, and a 429 forwards the vendor's own `Retry-After` rather than a guess; a reader that could not build a client is refused before the matcher is reached, because an empty window reads as "these analysts closed nothing") + `ci.yml` api job (`test_shadow_reconcile_sweep.py::TestPermanentIsNotTransient` - a permanent refusal blocks the connector and stops polling it, a transient one never blocks and leaves the watermark untouched, an undecryptable credential blocks before the vendor is called at all, and a deployment-level refusal halts the whole pass rather than writing "needs an operator" onto every connector. Unblocking is asserted to require the connector row changing and nothing weaker, so a revoked credential resumes on the one event that could have fixed it) | core | GATED | The classification is drawn from the vendor's HTTP status. A vendor that answers 200 with an error body, or 500 for a permanently bad query, is classified by what it said rather than by what it meant |+| The sweep is bounded work against a customer's API: it keeps a watermark, honours rate limits and never re-reads a window forever | `apps/docs/docs/operations/shadow-mode.md` (What it does to your SIEM); `services/api/migrations/068_shadow_reconcile_state.sql` | `ci.yml` api job (`test_shadow_reconcile_sweep.py::TestRateLimitingAndTheWatermark` - the watermark advances to the latest closure actually seen rather than to the end of the window asked for, so a vendor that indexes late does not have findings stepped over; an **empty** window still advances it, minus the overlap, so quiet hours are not re-read forever; a window is capped so a connector blocked for a month catches up in steps rather than asking for the month in one search; a first pass starts when measurement started rather than at the beginning of the vendor's retention; the per-connector floor and the per-tick cap are both asserted to withhold a poll; and a `Retry-After` is stored and honoured. `test_a_transient_failure_leaves_the_watermark_alone` asserts a failure cannot look like progress) | core | GATED | Every limit is asserted against the sweep's own decision to poll. Whether the defaults are the *right* numbers for a given SIEM is a judgement: they are configurable and the docs table publishes each one beside what it bounds |+| The API scores a replay with the grader the benchmark package ships, not a second copy of it | `services/api/app/_vendor/aisoc_benchmark/VENDORED.md` | `ci.yml :: vendored-sync` (`scripts/sync_vendored_benchmark.py --check` — every module of `packages/aisoc-benchmark/aisoc_benchmark/` must be byte-identical in `services/api/app/_vendor/aisoc_benchmark/`, checked in **both** directions so a module present only in the mirror fails too, and refusing to report a clean mirror when the source directory yields no modules) | core | GATED | A mirror rather than an import, because the `aisoc-core-api` image is built with `./services/api` as its context and nothing under `packages/` exists at runtime. Same constraint that produced `_vendor/narrative.py` and `_vendor/nl_query/`. A second grader would eventually disagree with the first about what "hallucination rate" means while both kept calling themselves the same number |+| The published count of services each compose profile starts is what the compose file starts | README L130-132 (profile table); `apps/docs/docs/architecture.md`; `apps/docs/docs/quickstart.md`; `docs/audit/REPOSITORY_REALITY.md`; [ADR-0007](../decisions/0007-connectors-and-actions-in-core.md) | `ci.yml` gates job (`scripts/check_profile_service_counts.py`: ten published figures across four documents are compared against the profile membership parsed out of `docker-compose.yml`, with compose's "a service in no profile is in every profile" semantic implemented rather than assumed, and one-shot containers counted separately from long-running ones because "long-running services" is the figure the documents publish. Fails in **both** directions: a count that disagrees, and a watched figure that has vanished from a document, so deleting the claim fails as a stale entry rather than passing because nothing matched. Also asserts `actions` is reachable from the `chatops` profile, since `slack-bot` depends on it and compose refuses to render a file whose dependency is outside the profile being started, which is the specific state ADR-0007 created by putting `actions` in no profile at all. Proven able to fail by re-staling the README's core figure to 14) | full | GATED | The counts are gated; the **memory** figures in ADR-0007 are point-in-time measurements on one machine and no gate can re-measure them in CI. They are published with the host, the engine version and the date, and the ~8 GB README figure is deliberately left unmoved because 124.8 MiB does not move a number published to one significant figure |+| An operator can hand an earned autonomy grant back | `apps/docs/docs/operations/shadow-mode.md` (earning autonomy); `services/api/app/api/v1/endpoints/autonomy_policy.py` | `ci.yml` api job (`test_autonomy_grant_revocation.py`, which drives the real route over ASGI and asserts on what the database was told, because the handler that used to answer this request also returned 204: a revocation issues `UPDATE aisoc_autonomy_grants` and must touch `aisoc_autonomy_thresholds` not at all, it is audited as `autonomy:revoked` rather than as a demotion, a revocation matching no standing grant answers 404 rather than succeeding silently, a capability outside the shared vocabulary is refused, and resetting a threshold still reaches the reset. Proven against the pre-fix tree, where four of the six fail) | core | GATED | Gated against a recording session rather than a live Postgres. The grant lifecycle itself is covered against real Postgres by the Phase 2.3 rows above; what this row adds is that the route carrying it is reachable at all |+| Every route the app publishes is the route that answers for it | (implied by every route-level claim in this table); `services/api/tests/test_route_shadowing.py` | `ci.yml` api job (`test_route_shadowing.py`, where the corpus is `app.openapi()` and reachability is decided by *sending a request* for all 456 published operations and reading back which route Starlette matched, never by reading `app.routes`: on the FastAPI version these services pin, `include_router` does not populate it, so the previous version of this gate filtered an effectively empty list, compared zero pairs and reported success over the whole app. It refuses a corpus below a floor rather than calling an empty app clean, and it is proven able to fail both against a synthetic app carrying the defect and against the pre-fix tree, where it names `DELETE /api/v1/autonomy-policy/grants` as answered by `reset_action_threshold`) + `isolation.yml :: route-scope` (`check_route_shadowing.py`, one AST pass over all thirteen services and 628 routes, with a `--self-test` covering the shipped defect and four near misses) | core | GATED | The runtime half speaks for `services/api` alone, since it needs that service's driver stack importable. The other twelve are covered by the static pass, which is the weaker instrument and reports as much: it pairs routes within a module and router, so two modules mounted on one prefix are out of its reach, and it counts rather than judges a convertor-constrained parameter and a path that is not a string literal |+| A third-party MCP server reaches the agent read-only: a tool is callable only if the tenant allowlisted it and the server did not annotate it state-changing | `apps/docs/docs/operations/mcp-client.md` (What the agent may call) | `ci.yml` gates job (`scripts/check_mcp_client_policy.py`: `app/mcp/policy.py` may import nothing that can open a socket, so every refusal is reachable with no network; the **first** decision in `vet_tool` is asserted to be the allowlist, since one taken after the annotation still refuses but stops being the property claimed; the policy is then asked directly and must refuse a `destructiveHint` tool, a `readOnlyHint: false` tool and an un-allowlisted one. Proven able to fail by checking the annotation first, by defaulting stdio on, by removing the command allowlist, and by ignoring the destructive hint) + `ci.yml` agents job (`test_mcp_client.py`: against a real in-process MCP server: an allowlisted read tool binds, a destructive tool allowlisted *on purpose* still does not, and a tool declaring itself not read-only is refused with the annotation absent) | core | GATED | A destructive MCP tool is refused outright rather than routed to governed dispatch, because no MCP tool declares a capability contract. The plan permits either; this is the "or not at all" half, and the refusal names the door it would otherwise take |+| An MCP tool outside the allowlist is refused before any network call | `apps/docs/docs/operations/mcp-client.md` (What the agent may call) | `ci.yml` agents job (`test_mcp_client.py::test_refusal_at_dispatch_happens_without_a_network_call` and `::test_dispatch_rechecks_the_annotation_not_only_the_allowlist`: the invoker is handed a session factory that raises the moment anything asks it for a session, so the test fails if the refusal is taken anywhere downstream of a connection) + `scripts/check_mcp_client_policy.py` (every `Tool` built in `app/mcp/tools.py` must carry an `McpToolInvoker`, since a raw callable would skip both the dispatch re-check and the ledger write; proven able to fail by substituting a lambda) | core | GATED | An allowlist checked after the call is not an allowlist. The check runs twice: at discovery, where a refused tool is never shown to the model at all, and at dispatch, through the same pure function over the same discovered descriptor |+| Everything a third-party MCP server sends is treated as untrusted input, including its tool descriptions | `apps/docs/docs/operations/mcp-client.md` (Results are untrusted; A malicious tool description) | `ci.yml` agents job (`test_mcp_client.py`: a result carrying an injection is fenced with the run nonce, flagged and **not** filtered; a leaked nonce inside a result is redacted so the closing fence cannot be forged; an oversized result is cut at the tenant's cap and says so in words the model reads; a tool whose *description* instructs the model is dropped entirely rather than sanitised, and an injection hidden in a parameter description drops the tool the same way; the input schema is projected to `type`/`properties`/`required` so `$ref`, `default` and `examples` never reach the prompt) | core | GATED | The guard is not the control here and its own numbers say why: 0.96 on prose and 98.1% on the field-native corpus it was tuned against, but **2 of 28** on payloads authored after that hardening. An MCP server's payload is held-out data by definition, so the held-out figure is the one that applies. The nonce fence, the length cap and the schema projection are the controls; the guard is what makes a miss visible afterwards, and the docs page publishes the held-out figure beside the corpus one |+| Every MCP call, refusal and failure is recorded in the Investigation Ledger | `apps/docs/docs/operations/mcp-client.md` (What ends up in the ledger) | `ci.yml` agents job (`test_mcp_investigation.py`: the real `_LedgerWriter` calling the real `ledger.record_event`, captured at the database boundary rather than replaced above it, so the run id, resolved tenant, sequence numbers and payload shape are the ones that would reach Postgres; sequence numbers are asserted monotonic and above the graph range because `ON CONFLICT (run_id, seq) DO NOTHING` drops a collision silently; an unresolvable tenant is asserted to write nothing while the call still succeeds) + `scripts/check_mcp_client_policy.py` (the call, refusal and failure paths must each write a ledger kind) | core | GATED | A ledger row carries argument *names*, byte counts and the injection verdict, never argument values or result text: copying a third party's reply into the audit trail would put untrusted content somewhere with none of the containment. Cost is `not_applicable_no_model_call` rather than `0`, since an MCP call spends a vendor's compute and no model tokens |+| MCP server URLs pass the SSRF guard and the air-gap policy, and stdio servers stay disabled | `apps/docs/docs/operations/mcp-client.md` (Network and deployment policy) | `ci.yml` agents job (`test_mcp_client.py::TestTransportPolicy`: a loopback URL is refused before the transport exists, air-gap mode refuses a public server and permits an internal one, stdio is off with no environment set, enabling it is not sufficient without the command allowlist, the command is matched whole rather than by prefix or basename, and a shell metacharacter in an argument is refused) + `scripts/check_mcp_client_policy.py` (`validate_outbound_url` must be called at a lower line number than `streamablehttp_client` inside `session()`; proven able to fail by deleting the guard) | core | GATED | The registry also refuses an obviously unsafe URL at save time, but that check does not resolve DNS and is not the control: a name that resolved publicly at save time can resolve to link-local an hour later, so the enforcing check is the one immediately before the socket opens |+| The agents service requests the MCP registry at a path the API service serves | `services/agents/app/mcp/registry_client.py` | `ci.yml` agents job (`test_mcp_registry_client.py::test_the_registry_url_matches_where_the_route_is_mounted`: the app mount, the v1 router prefix and the endpoint router prefix are read out of the API service's own source with `ast` and composed the way the service composes them, then compared against the URL the client builds. Proven able to fail by emptying `API_PREFIX`, which names both the requested path and the served set) | core | GATED | The same defect D16 records: Phase 1.2 shipped a client missing `/api/v1`, so every request would have 404'd while three suites stayed green, because the test asserted the URL the code produced rather than the URL the service serves. This service cannot import that one, so reading the other tree's source is the only comparison in the direction that drifts |+| No MCP tool AiSOC ships can perform a response action; the action tool is dry-run only | `services/mcp/README.md` (Actions are previewed, never performed); `apps/docs/docs/integrations/mcp.md` | `ci.yml :: mcp` (`tests/actions.test.ts`: the **source** of `services/mcp/src/` is read and no string may name `/live-actions/dispatch`, so a second action tool added later is caught rather than only the one under test; the preview handler is driven against a recording client and asserted to make exactly one request, to the dry-run path, carrying `dry_run: true`; and its strict schema is asserted to reject a caller-supplied `dry_run: false`. Proven able to fail by pointing the module constant at the dispatch path, which reds both the source scan and the request assertion) | core | GATED | The enforcing control is upstream: `POST /api/v1/live-actions/dry-run` forces `dry_run: true` server-side whatever the body says and proxies only that path. This row is the second lock, on the side an agent can see, because an MCP key is credential material that lives in an editor's configuration file |+| Every tool AiSOC's MCP server publishes carries honest behaviour annotations | `services/mcp/README.md` (Tools exposed); `apps/docs/docs/integrations/mcp.md` (Annotations, and what is read-only) | `ci.yml :: mcp` (`tests/actions.test.ts`: every tool in `ALL_TOOLS` must declare `readOnlyHint` as a boolean rather than leaving it absent, no tool may be annotated destructive, and the set of tools annotated **not** read-only is pinned to exactly `aisoc_run_investigation`, so a future write tool cannot arrive annotated read-only and a read tool cannot drift into looking state-changing) | core | GATED | The annotations are what a client reads to decide whether it may call a tool at all. AiSOC's own MCP client refuses a tool whose server sets `destructiveHint: true` or `readOnlyHint: false`, and treats an absent annotation as no claim, so a server publishing nothing forces every operator to vouch for every tool by name |+| MCP server exposes 13 tools | README L179 | `ci.yml :: mcp` | core | GATED | - |+| Prompt-injection resistance | (implied by agent claims) | `ci.yml :: python-test` (agents) runs `test_prompt_sanitizer.py`, `test_prompt_envelope.py` and `tests/adversarial/` — a 32-payload corpus grouped by attacker goal, enforcing a recall floor **and** a false-positive ceiling on real security content that reads adversarially. Action-trigger and exfiltration payloads are individually required rather than averaged, because an injected containment turns the SOC into a denial-of-service tool pointed at its own estate. Phase 3 adds a second, harder corpus at incident level (`test_injection_incidents.py`) whose payloads are written to fit the field they arrive in, enforcing a floor, a ceiling and an exact ratchet naming every current blind spot by id | core | GATED | obfuscation is an arms race and is recorded rather than individually required; two payloads are currently xfail and counted in the recall rate. The two corpora measure the same guard and are **not comparable**: one asks whether the guard recognises a string, the other whether it recognises it where an attacker can put it, and the second scores materially lower. Neither measures a model |+| An investigation can read the vendor a tenant actually runs, not just CrowdStrike and Okta | `plans/aisoc_gap_closure_plan.plan.md` (4.2); `services/actions/app/live_actions/investigation_reads.py` | `ci.yml` actions job (`test_investigation_reads_phase4.py`, 25 tests over seven new executors against vendor-shaped synthetic payloads on the real HTTP path. Each verb is tested for the pair that must never collapse: a host or principal the vendor does not hold is `SUCCEEDED` with `found: False`, a vendor that 5xxs is `FAILED`, and a failed read is asserted to carry **no** `count`, `detections` or `found` key, because a `count: 0` reaching a model is the strongest exonerating evidence there is and would be false. Entra's licensed risk leg may fail without taking the sign-ins down and reads as unknown rather than as no risk; Google Workspace's 403 names the missing `admin.reports.audit.readonly` scope rather than reporting an account with no logins) + `ci.yml` gates job (`check_action_contract.py`, 79 executors, and `check_capability_mirror` comparing the actions vocabulary against the connectors `Capability` enum in both directions) | core | GATED | Five of the seven are new vendor arms on the three existing read verbs, so they inherit the `READ_ONLY` contract and cannot drift low; only `lookup_cloud_audit` and `lookup_endpoint_telemetry` needed their own entry. **No call in this repository has been made against a live vendor** for any of them: there is no funded CrowdStrike, SentinelOne, Entra, Google Workspace, Defender or AWS account here, so the wire shapes are pinned against the vendors' published schemas and the live path is unverified, which the docs state rather than imply |+| A caller of a vendor read never supplies query text; the executor owns the query | `plans/aisoc_gap_closure_plan.plan.md` (4.1, 4.2); `services/actions/app/clients/defender_client.py` (`_HUNT_TEMPLATES`) | `ci.yml` actions job (`test_investigation_reads_phase4.py`: `lookup_endpoint_telemetry` is offered four rejected inputs including a bare KQL pipeline, a template name with a statement appended and a case variation, and each is refused **before the credential is read** with a route asserted uncalled, so a refused template cannot reach the vendor; the accepted path is asserted on the KQL that reaches the wire rather than on the argument, with a hostile indicator carrying a quote and a pipe appearing only in its escaped form; the window and row cap are asserted at 720h and 200 against a caller asking for 99,999h and 10,000 rows. Entra's OData literal is asserted the same way, with the doubled quote present and the single-quote form absent) | core | GATED | The escaping is grammar-specific and each grammar is handled at its own boundary: KQL escapes backslash and double quote, OData doubles a single quote, and the CloudTrail attribute key is checked against AWS's own closed vocabulary rather than escaped at all. A new vendor grammar needs its own escape and its own test; nothing structurally forces that beyond review |+| AWS CloudTrail is read without adding boto3 to a CORE service | `services/actions/app/clients/aws_cloudtrail_client.py`; [ADR-0007](../decisions/0007-connectors-and-actions-in-core.md) | `ci.yml` actions job (`test_investigation_reads_phase4.py`: the SigV4 canonical request is pinned line by line against the documented shape, including the blank line between canonical and signed headers and the body hash as the final line; `SignedHeaders` is parsed back out of the `Authorization` header the client produced and every name in it asserted present on the request, which is the failure mode of a hand-rolled signer; the signing-key derivation is asserted sensitive to secret, date **and** region in turn, so a dropped link in the chain cannot pass as a plausible hex string; a session token is asserted both signed and sent. `canonical_parts` is the function `_authorization` itself calls, so the test is not comparing a producer against a copy of itself) | core | GATED | **The live AWS path is unverified.** There is no funded AWS account in this repository, so what is gated is that the algorithm matches the specification and that the response parsing and projection work against a recorded payload. A signature that AWS itself accepts has not been observed. boto3 is deliberately not added: it is not in the `aisoc-actions` image (measured: `ModuleNotFoundError`, against 1.43.101 in `aisoc-connectors`) and ADR-0007 has just published that image at 539 MB |+| The investigation agent reaches the customer's own SIEM, EDR, identity provider and cloud audit trail, not only AiSOC's event lake | `plans/aisoc_gap_closure_plan.plan.md` (4.1, 4.2, 4.3); `apps/docs/docs/operations/agent-vendor-tools.md` | `ci.yml` agents job (`test_deep_investigation_customer_tools.py`, the phase's acceptance bar: a recorded CrowdStrike detection with Splunk and CrowdStrike mocked reaches at least three distinct pivots and the assertion counts distinct **sources** rather than distinct tool names, so three pivots on one source fails. A tool that answered `could_not_check` is asserted absent from the pivot list, so the bar cannot be met by calling tools that all failed) + `ci.yml` gates job (`check_investigation_depth.py` grades the lake pivots **and** the customer-tool catalog, asserts the `scoped_customer_tools` binding and the `coverage_notes` prompt are still present in the driver, and was proven able to fail by removing each in turn) | full | GATED | The agent-side chain is gated in process against the API's HTTP boundary; the joins beyond it are separate rows. The tool *selection* is a scripted model, deliberately: grading whether a live model chooses to pivot would measure the model rather than the surface, and no hosted provider has been exercised here |+| A failed vendor read reaches the model as "could not check", never as an empty result | `apps/docs/docs/operations/agent-vendor-tools.md` (A failed read is never an empty result) | `ci.yml` agents job (`test_customer_tools.py`, 20 tests. Every failure path is asserted on the **wording** as well as the flag, because the flag is for code and the wording is what the model reads: the reason must contain "lookup failure", "NOT checked" and "not treat this as evidence", and must **not** contain "no results" or "nothing was found". Covered for a transport error, a 5xx, a 404, an unreadable body, a missing credential, an unreachable API, every one of the seven non-execution statuses, and a tenant with no SIEM connected. A genuine zero-row answer is asserted to say it IS evidence of absence *for the sources that answered*, and a partly-failed search keeps its own `partial` outcome rather than being rounded to clean) | core | GATED | The wording is gated; whether a given model honours it is a property of the model. The Phase 3 injection corpus is where that gets measured, and the untrusted-data notice is asserted present in the prompt rather than asserted effective |+| An agent is offered only the tools whose backend the tenant has configured | `plans/aisoc_gap_closure_plan.plan.md` (4.3); `apps/docs/docs/operations/agent-vendor-tools.md` (Only what you have connected is offered) | `ci.yml` agents job (`test_customer_tools.py` - a tenant with a Splunk and an Okta gets exactly `siem_indicator_search` and `identity_user_activity` and no EDR tools; a tenant with nothing connected gets **no** tools and two separate gap sentences, both asserted present in the findings; an unreachable API binds nothing and says "could not determine", asserted to appear in the model's prompt and not only in the reader's findings, because a note only the reader sees means the model reasoned without it) + `ci.yml` gates job (`check_agent_read_tools.py` compares the API's `AGENT_READ_CAPABILITIES` against the contract's READ_ONLY set, the executor list and the parameter allowlist, and compares the two indicator vocabularies across the agents and api trees in both directions; proven able to fail by exposing `isolate_host` and by drifting one vocabulary) | core | GATED | Advertisement is per connector **type**, not per instance: a tenant with two Splunks is offered one SIEM tool and the federated layer fans out to both, which is the existing behaviour of that endpoint |+| A model never composes SPL, KQL or ES-QL query text against a customer's SIEM | `plans/aisoc_gap_closure_plan.plan.md` (4.1); `apps/docs/docs/operations/agent-vendor-tools.md` (The model never writes a query) | `ci.yml` agents job (`test_customer_tools.py` asserts on the **JSON schema the model is handed**, not on the implementation, since the schema is what constrains a model: no property named query, search, spl, kql, esql, sql, free_text, field, filter, where or index on any tool, every property typed `string` or `integer` so a query cannot arrive as structured data, and `indicator_type` a closed sorted enum) + `ci.yml` api job (`test_agent_tools.py` - 23 value-shape cases in both directions, and every field token in the per-backend map asserted to match the identifier pattern the translators' own field check enforces, so a mapping that would 422 on every search cannot ship) + `ci.yml` connectors job (`Indicator.__post_init__` refuses a field name that is not an identifier, at the single choke point every translator goes through) | core | GATED | The field map is a reviewed table, not derived: there is no machine-readable source in this repository for what Splunk CIM calls a source address. The alternative, letting the model name the field, is the thing the boundary exists to prevent |+| Every tool call an investigation makes is in the Investigation Ledger | `plans/aisoc_gap_closure_plan.plan.md` (rules for every phase, LLM calls) | `ci.yml` agents job (`test_deep_investigation_customer_tools.py` captures what the driver hands `ledger.record_event` at the ledger's own function boundary and asserts one `tool_call` row per call in the trace, carrying the tool name **and its arguments**, because "the ledger shows every call" means an auditor can answer which host was read. Sequence numbers are asserted distinct and at or above 10,000: `record_event` carries `ON CONFLICT (run_id, seq) DO NOTHING`, so a collision with the graph runner's own numbering would be a silently dropped row, which is worse than an error because the ledger still looks complete) | core | GATED | `run_with_tools` built a trace and nothing carried it anywhere durable, so this is new rather than newly gated. The write is best-effort by design: a ledger failure must not take a completed investigation down, and `ledger_rows` on the result reports how many rows landed so "nothing to record" is distinguishable from "the ledger is not configured" |+| Sustained throughput and event-to-alert latency are measured end to end, on a named machine, on a named date | `apps/docs/docs/operations/performance.md`; `docs/perf/results/*.json` | `perf.yml :: published-results` (`check_perf_results.py`: every committed result must carry `measured_at` beginning with an ISO date, a `hardware` block naming a CPU, a container runtime or a CI runner rather than a bare core count, `not_a_production_slo: true` and disclaimer prose; the filename must begin with its own measurement date; and the docs page must mention every date a result carries, so the page cannot drift into presenting old figures under a new heading. Self-tested by injecting each of those nine violations and requiring each to be caught) + `perf.yml :: end-to-end` (the harness drives the real Compose spine nightly with `--assert-eps-floor`, `--assert-p95-ceiling-ms` and `--assert-no-loss`) + `ci.yml :: python-test` (root) `test_load_harness_contract.py` | core | GATED | The floors are two orders of magnitude below the published figures, deliberately: a shared GitHub runner is not the machine the numbers came off, and a gate tuned near a measurement flaps and gets disabled. A green perf job proves no catastrophic regression, not that any published figure still holds |+| A performance figure that was not measured reads "not measured", never `0` | `scripts/perf/load_harness.py`; `apps/docs/docs/operations/performance.md` (kind per-pod usage) | `perf.yml :: published-results` (`check_perf_results.py` rejects an unmeasured metric that carries a `value` key and one that carries no reason, and separately asserts a **measured** zero survives, since zero dead letters and zero drained lag are real results) + `ci.yml :: python-test` (root) `test_load_harness_contract.py` (the serialised form is asserted, because the renderer downstream sees JSON rather than the dataclass) | core | GATED | The kind run genuinely has no per-pod CPU or memory figures: `kubectl top` needs metrics-server and kind ships none. The committed JSON records the absence and the page says so in the same paragraph as the table |+| A fusion replica can be destroyed mid-stream with no event lost and none duplicated | `apps/docs/docs/operations/ha-deployment.md`; `apps/docs/docs/operations/performance.md` (failure injection) | `scripts/chaos/fusion_restart.py` (asserts against the `alerts` table in PostgreSQL, never against anything the replacement pod reports about itself: every sequence number ingest accepted must appear exactly once, and a missing one and a repeated one fail separately and are named). Self-tested in both directions, including the case where a loss and a duplicate cancel out in the row count. Run against the Kubernetes deployment on 2026-09-27; the result is committed at `docs/perf/results/2026-09-27-kind-chaos.json` and `perf.yml :: published-results` requires it to carry a verdict | core | GATED | The self-test and the committed result are gated; the **execution** against a live cluster is not on a CI trigger, because it needs a three-node cluster with two fusion replicas and published images. `docs/audit/REPOSITORY_REALITY.md` records the date and shape of the run that was performed rather than implying it happens continuously |+| A Helm install connects the event spine, rather than installing every object and consuming nothing | `infra/helm/aisoc/values-ha.yaml`; `apps/docs/docs/operations/ha-deployment.md` | `helm.yml :: render` (`KAFKA_BOOTSTRAP_SERVERS` is asserted present in the rendered ConfigMap and to resolve to the release's own brokers when the chart deploys them; a three-replica render is asserted to carry all three KRaft quorum voters; `ueba.enabled=false` is asserted to render no UEBA object, which it previously did) | full | GATED | Rendering is gated. That the brokers then form a quorum and fusion attaches was exercised on kind on 2026-09-27 and is recorded as such, not as a continuous check |+| A cross-service route this program adds is asserted against the URL the serving side actually serves | `GAP_CLOSURE_PROGRESS.md` (D16) | `ci.yml` api job (`test_agent_tools.py` parses `services/api/app/main.py`, `api/v1/router.py` and the endpoint module with `ast`, composes all three prefix levels, and asserts each literal the agents service builds is in the served set. Proven able to fail from **both** sides: dropping `/api/v1` from the client's path, and renaming the router's own prefix. The helper raises rather than returning an empty set, so a parser that stopped matching cannot certify nothing. Also asserts the `impact` field the API filters on exists on `LiveActionDescriptor` **and** is populated from the contract rather than left at its default) | core | GATED | Covers the two routes this phase adds and the actions discovery route it consumes. It is not a repository-wide scan: the general version would need every client's URL construction to be statically resolvable, and several build theirs from settings |+| A tenant can author an investigation skill in the console and it changes the plan on matching alerts | `apps/docs/docs/console/tenant-skills.md`; `plans/aisoc_gap_closure_plan.plan.md` (6.1, 6.2) | `ci.yml` agents job (`test_tenant_skill_investigation.py::test_done_when_a_skill_changes_the_investigation_plan_on_a_matching_alert`: one alert run twice through the real `run_deep_investigation`, everything held constant except whether the tenant has an active skill, asserting on the **system prompt the tool loop was handed** rather than on the verdict, because a verdict can be unchanged by a plan that did change. The built-in the alert would otherwise select is asserted by name, so "the skill won" and "nothing selected anything" are told apart) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py`) | core | GATED | A skill supplies the plan **and** the triage guidance. A skill that only changed the pivot plan could not be backtested at all: the replay grades triage verdicts, so the delta would read zero on every run |+| A skill may only name a tool that tenant's agent can actually call | `apps/docs/docs/console/tenant-skills.md` (expected_pivots is validated against your tools) | `ci.yml` api job (`test_tenant_skills.py::TestToolValidation`: the inventory is built from the tenant's **enabled** MCP servers only, so a registered-but-disabled server, an empty allowlist and another tenant's server each contribute nothing; a misspelt built-in and an un-allowlisted MCP tool get different messages because the author's next action differs) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py` compares `BUILTIN_PIVOTS` against the agents service's `KNOWN_PIVOTS` in **both** directions; proven able to fail by deleting a pivot from each side in turn) | core | GATED | Phase 4.3's per-tenant vendor-read advertisement does not exist yet, so the inventory is the built-in lake pivots plus Phase 5.2's MCP allowlists. A pivot naming a vendor read verb is refused with a sentence saying the surface is not built, rather than silently accepted |+| A skill cannot be activated without a backtest of the exact version being activated | `apps/docs/docs/console/tenant-skills.md` (Lifecycle) | `ci.yml` api job (`test_tenant_skills.py::TestLifecycle`: activation is refused with no backtest, with a backtest of a different version, when expired, and when one evaluation is used as its own baseline; a content edit is asserted to bump the version, drop the row to draft and detach both reports, while a reformat that leaves the parsed body identical keeps them) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py` requires the rule in the migration's CHECK, in the store and on the docs page; proven able to fail by weakening the SQL clause) | core | GATED | Stated in three places on purpose. The CHECK holds against a direct fix-up; the store's refusal is what produces a sentence an operator can act on rather than a constraint name |+| Every investigation a skill guided records which version guided it, and that version resolves back to its text | `apps/docs/docs/console/tenant-skills.md` (What gets recorded) | `ci.yml` agents job (`test_tenant_skill_investigation.py`: the provenance carries id, version and owner; the investigation pins the version triage already used rather than re-resolving, since the fetch is cached and an activation between the two reads would split them) + `ci.yml` api job (`test_tenant_skills.py`: a content edit leaves both versions in `aisoc_tenant_skill_versions`, and retire keeps the history while delete removes it) + `ci.yml` gates job (`scripts/check_tenant_skill_contract.py` requires the field on both `DeepInvestigationResult` and `InvestigationState`; proven able to fail by renaming it on either) | core | GATED | A recorded version with no history row is provenance-shaped and not provenance, so a skill row whose version is absent or zero is refused by the resolver rather than served |+| Tenant skills are frozen at the split point during a replay, and the backtest bypass is published rather than silent | `apps/docs/docs/console/tenant-skills.md` (What a backtest number does and does not say); `services/agents/app/replay/shadow.py` | `ci.yml` agents job (`test_replay_leakage.py`: a skill activated after the split never reaches the prompt, with a **sensitivity half** that runs the live reader and asserts the same poison does; the backtest candidate is asserted to reach the prompt *and* to be named in the method note with its caveat, with a sensitivity half asserting an ordinary replay of the same instant freezes it out; a skill with no activation stamp is counted the way an undated statement is) + `ci.yml` gates job (`scripts/check_triage_context_freeze.py`: every source `TriageContextReader` declares must be implemented by both readers, and every snapshot store must be filtered by `capture_context` and publish `_frozen` and `_dropped_after_split` in the method note. Proven able to fail by removing the frozen reader's method, by silencing the bypass, and by deleting one kept-count key while a neighbouring key remained, which an earlier substring version of the check missed) | core | GATED | A skill backtest deliberately applies a candidate authored after the window, which is what a backtest is. The figure is a statement about that window and not a forecast, and the method note says so in those words rather than leaving a reader to infer it |+| A SCIM request's tenant comes from its credential, never from the request | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `docs/decisions/0008-scim-trust-boundary.md`; `apps/docs/docs/operations/scim.md` | `isolation.yml` (`check_route_auth.py` and `check_route_tenant_scope.py` see `ScimPrincipal` as an authenticating dependency, so every one of the 17 SCIM routes is counted as authenticated rather than exempted; `aisoc_scim_tokens.tenant_id` is NOT NULL and RFC 7643 defines no tenant attribute) + `ci.yml` api job (`test_scim_provisioning.py::TestTokens` - a second tenant's credential gets 404 for a principal the first created, and discovery refuses an anonymous caller) | core | GATED | The credential is the only source of tenancy because the protocol has no field for one. There is nothing to intersect: a SCIM handler that read a tenant from anywhere would be the finding |+| SCIM bearer tokens are hashed at rest and rotate without an outage | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `apps/docs/docs/operations/scim.md` (Rotating a credential) | `ci.yml` api job (`test_scim_provisioning.py::TestTokens` - the stored value is asserted to be the SHA-256 digest and not the secret or its prefix; rotation is asserted to leave **both** secrets working inside the grace window and to refuse the old one after it; a zero grace window revokes immediately for rotation after a disclosure; rotation is asserted never to *extend* an earlier deadline) | core | GATED | The digest is correct here rather than a password KDF: the token is 192 bits from `secrets`, so there is no low-entropy guess to slow down, and a KDF on the request path would delay every sync an identity provider makes |+| SCIM deprovisioning ends access rather than flagging a row | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `docs/decisions/0008-scim-trust-boundary.md`; `apps/docs/docs/operations/scim.md` (What deprovisioning does) | `ci.yml` api job (`test_scim_provisioning.py::TestDeprovisioning` - a deactivation is asserted to revoke the principal's API keys by **count**, and to stamp `sessions_revoked_at`; `token_is_revoked` is asserted in all four directions including the fail-closed case of a token with no `iat`; minted tokens are asserted to carry `iat`, so the check has something to read; re-activation is asserted **not** to restore revoked API keys; the whole chain is repeated end to end through `DELETE /scim/v2/Users/{id}`) | core | GATED | DELETE deactivates rather than erasing, which RFC 7644 permits: erasing the row would take the principal's audit attribution and case history with it. A pre-existing fall-through that left a deactivated user's API key working under a generic role is closed in the same change |+| A directory group confers only a role AiSOC enforces, and an unrecognised group confers nothing | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `apps/docs/docs/operations/scim.md` (Mapping groups to roles) | `isolation.yml` (`check_scim_contract.py` compares the group-to-role mapping against `ROLE_PERMISSIONS` in **both** directions, so a role renamed there cannot leave a mapping pointing at a string that grants nothing, and a *new* role must be classified as assignable or recorded as deliberately unreachable; proven able to fail by introducing an unclassified role) + `ci.yml` api job (`test_scim_provisioning.py::TestRoleMapping` - membership is asserted to write `users.role`, which is the column the permission check reads, and removal to take it back; an unmapped group is asserted to confer nothing; no group name resolves to a wildcard role) | core | GATED | Precedence is a total order, so a principal in several mapped groups holds the same role regardless of the order a provider syncs in |+| The SCIM surface serves what its discovery documents advertise, and audits every write | `plans/aisoc_gap_closure_plan.plan.md` (13.1); `apps/docs/docs/operations/scim.md` (What is implemented) | `isolation.yml` (`check_scim_contract.py` reads `ServiceProviderConfig` and the route table and compares them in both directions, so a capability advertised with no route **and** a route no document advertises both fail; asserts each of the eight mutating handlers still reaches the audit helper; asserts `main.py` includes the router, since a router nobody mounts serves nothing) + `ci.yml` api job (`test_scim_mounted.py` reads `app.openapi()` from the real application and refuses an empty inventory before asserting membership, because `include_router` does not populate `app.routes` on the pinned FastAPI) | core | GATED | Filtering implements one `attribute eq "value"` comparison and refuses the rest: a dropped filter would return every principal in the tenant, which a provider reads as "this user already exists" |+| No principal can confer a role, scope or organisation membership beyond its own authority, and the wildcard roles are unreachable from any request | `apps/docs/docs/operations/security.md` (Role grants are scoped to the granter); GHSA-pm3f-h6gc-rvgp | `isolation.yml` (`check_role_grant_scope.py` asks of every handler binding a request model that declares `role`, `org_role`, `granted_role`, `scopes`, `role_id` or `permission_ids` whether it reaches `app.core.role_grants`, checks each waiver still covers a live handler, and derives the refused set from `ROLE_PERMISSIONS` so a role declared with the wildcard later is un-grantable the moment it is declared; six injected drifts prove it fails, and run against the pre-fix tree it names all nine handlers) + `ci.yml` api job (`test_role_grant_scope.py` calls the shipped handlers and asserts both directions per call site — the escalating request is refused and nothing is written, a legitimate grant still lands; 16 of its 28 tests fail against the vulnerable tree, every one of them for the grant succeeding rather than for a missing symbol) | core | GATED | Scoped to grants a *request* makes. `scripts/bootstrap_admin.py` still mints a wildcard role out of band with database credentials, which is deliberate: it is the only path left, and it is not reachable over HTTP |+| An uploaded brand asset cannot execute, and is never fetched from a third party | `plans/aisoc_gap_closure_plan.plan.md` (13.2); `apps/docs/docs/operations/white-label.md` (SVG uploads are sanitised) | `ci.yml` api job (`test_svg_sanitizer.py`, 29 cases written as attacks rather than round trips: `<script>`, a namespace-qualified `<svg:script>` that a bare-name comparison misses, event handlers, `<foreignObject>` in well-formed XML, `<animate attributeName="href">`, `<set>`, an external `<use xlink:href>`, a remote `<image>`, `@import`, a `fill="url(https://…)"` paint server, `javascript:` in an `<a>`, a billion-laughs DTD, an XXE entity and a bare DOCTYPE. A benign logo is asserted to survive **intact**, because a sanitiser that removes everything is safe and useless) + `isolation.yml` (`check_whitelabel_metering.py` refuses any script-capable element or `on*` attribute entering the allowlist, and refuses a remote scheme in the logo reference; proven able to fail by injecting each) | core | GATED | Allowlist rather than denylist: a denylist of `<script>` passes while `<foreignObject>` renders arbitrary HTML. DTD and entity declarations are refused on a byte scan before parsing, which removes the expansion class rather than bounding it |+| A white-labelled organisation's console and PDF report carry its branding | `plans/aisoc_gap_closure_plan.plan.md` (13.2, Done when); `apps/docs/docs/operations/white-label.md` | `ci.yml` api job (`test_branding.py` renders the digest HTML that becomes the PDF and asserts the product name, the palette and the logo are present **and** that the platform wordmark is gone, since a report showing both is co-branded by accident; a separate case asserts the rendered report contains **no** external URL at all) + `web` job (`SidebarBranding.test.tsx` renders the real console shell against a branded API response and reads the wordmark out of the DOM, mocking the API client rather than the hook so the wiring is inside the test) | core | GATED | The PDF is this HTML through WeasyPrint, so asserting on the HTML asserts on the PDF without requiring the native stack in CI. Email approvals and ChatOps read the same resolved `sender_name` and are **not** covered end to end; the doc says so rather than implying they are |+| Usage metering equals the rows it summarises | `plans/aisoc_gap_closure_plan.plan.md` (13.3, Done when); `apps/docs/docs/operations/usage-metering.md` (Checking the numbers) | `ci.yml` api job (`test_usage_metering.py`, 15 cases. Every assertion counts rows **independently in the test** and compares, rather than comparing a producer against a copy of itself, which is how two console figures in this repository were wrong on real data while passing. The daily series summed is asserted equal to one query over the whole window; an alert seeded at exactly midnight is asserted counted once; another tenant's rows sit inside the window and are asserted never counted; `triages_model` + `triages_deterministic` is asserted to equal `alerts` exactly, so no triage is unaccounted for or double-counted) | core | GATED | Computed from source tables on request rather than kept in a counter table. A counter can only be tested against itself; a query cannot drift from the rows because it is the rows. `GET /usage/reconciliation` exposes the same comparison so an operator can run it on their own data |+| Metering reports "not measured" rather than zero, and carries no pricing logic | `plans/aisoc_gap_closure_plan.plan.md` (13.3, "No pricing logic"); `apps/docs/docs/operations/usage-metering.md` (What is not measured) | `ci.yml` api job (`test_usage_metering.py::TestHonesty` asserts `events_ingested` is named in `UNMEASURED` with a reason and is **not** also a meter, so it can never be reported as a number; asserts no meter key, label or SQL carries pricing vocabulary; asserts every meter binds its tenant as a parameter and formats nothing) + `isolation.yml` (`check_whitelabel_metering.py` re-checks all three against the declarations and was proven able to fail by removing a tenant binding) | core | GATED | The pricing check reads key, label and SQL only. `llm_cost_usd` is a measured provider charge and its description has to be able to say "not a price"; a gate forbidding the word would forbid the disclaimer with it |+| Auto-triage reads the tenant's knowledge-base runbooks and cites the chunks it was given | `apps/docs/docs/console/triage-context.md` (Knowledge-base runbooks) | `ci.yml` agents job (`test_triage_knowledge_base.py`: the block reaches the prompt ahead of the telemetry, every chunk carries a marker resolving to a document id **and chunk index**, the prompt names the markers the model may cite, and a marker no retrieved chunk carries is reported on the verdict's basis rather than left reading like one that resolves; an empty retrieval renders nothing at all, because "Runbooks: none" is a claim about the tenant) + `ci.yml` api job (`test_kb_triage_retrieval_route.py`: service-token only, a valid console session refused, tenant and query bound rather than interpolated) | core | GATED | The agents service had never read the knowledge base. Retrieval is the API's own full-text query and ranking rather than a second implementation, so a chunk triage was given is one an analyst searching by hand would have found |+| Retrieved knowledge-base text is contained as untrusted evidence, not as first-party guidance | `apps/docs/docs/console/triage-context.md` (How runbook text is contained) | `ci.yml` agents job (`test_triage_knowledge_base.py::TestContainment`: the block is nonce-fenced with the boundary sentence stated inline; a chunk echoing the fence is refused; **a leaked nonce is stripped even for a chunk the guard passes**, which is the property that matters because the guard's own held-out rate is 2 of 28; a high-severity chunk is dropped rather than demoting the alert, and the refusal is published on the verdict's basis. The scan runs on the raw text, pinned by a payload the *sanitiser* also recognises: sanitising first rewrites it to a redaction marker, the guard then reads a clean string, and the whole "ignore previous" family would score zero forever while the counter reported a clean library) | core | GATED | More containment than tenant-skill text gets, because a runbook is long, often imported in bulk, edited by more people, and reaches the prompt as prose that routinely quotes attacker output. Dropping the chunk rather than demoting the case is deliberate: demoting would let anyone who can write a runbook switch off auto-close for the tenant |+| Knowledge-base runbooks are point-in-time during a replay, and the freeze publishes what it refused | `apps/docs/docs/console/triage-context.md` (Freezing context for a replay); `services/agents/app/replay/shadow.py` | `ci.yml` agents job (`test_replay_leakage.py`: a runbook created after the split never reaches the prompt, with a **sensitivity half** running the live reader and asserting the same poison does; a reply that names no cutoff is counted as `cutoff_not_honoured` rather than as frozen, with a sensitivity half asserting an honoured cutoff does not raise it) + `integration.yml` (`tests/isolation/test_kb_retrieval_cutoff_live.py` runs the route's own `triage_retrieval_sql` against live Postgres: unscoped read first so an empty table cannot pass for isolation, then the cutoff, then the refusal count, and a cutoff before everything still returns its counts. Proven able to fail by deleting the cutoff predicate, by hardcoding the refusal count, and by neutralising the tenant predicate) + `ci.yml` gates job (`scripts/check_triage_context_freeze.py`: `CONTEXT_FREEZE_KINDS` classifies every source, a cutoff source's protocol method may not accept the instant from its caller, its frozen implementation must bind `as_of` to the snapshot's `split_at`, and a snapshot source's frozen implementation may await nothing. Twelve regressions injected into a detached copy, all twelve caught) | core | GATED | A runbook is usually written after the incident that prompted it, so this is the most natural way a replay could flatter itself. The refusal count is what makes the claim checkable: a cutoff that matched nothing and a cutoff that refused fifty documents return the same empty list |+| The hunt corpus holds 68 hunts, every one graded in both directions | `hunts/README.md`; `plans/aisoc_gap_closure_plan.plan.md` (8.4) | `ci.yml :: p1-eval` (`run_evals.py --suite hunt_corpus` — every hunt must fire on its declared positive scenario and none may fire on its negative, with telemetry orphaned by a renamed hunt failing in the other direction) + `ci.yml :: python-lint` (`check_hunt_scenarios.py`) | core | GATED | 68 is hunts replayed against a scenario and observed to fire. It is **not** a claim any of them fires on a given deployment's telemetry, which depends on whether that deployment's connectors emit the fields the hunt names; `hunts/README.md` states the distinction rather than letting the count imply the stronger claim |+| A hunt's negative scenario inverts the clause the hunt is about | `hunts/README.md` (Adding a hunt); `plans/aisoc_gap_closure_plan.plan.md` (8.4) | `ci.yml :: python-lint` (`check_hunt_scenarios.py` runs the **production** hunt matcher over both scenarios and requires the negative to differ from its positive in exactly one indicator field, that field not being the log-source selector, with a near-miss floor beneath it) | core | GATED | Proven against the pre-fix tree rather than only against the tree as committed: it found 8 violations on first run, 3 of them in hunts that predate this phase. The grading suite cannot see this — it asks only whether the negative fired, and a negative drawn from an unrelated log source never fires on anything, so a corpus of those reports a perfect false-positive rate while testing nothing |+| `scripts/run_hunt_evals.py` exists and defines no scoring of its own | `hunts/README.md` | `ci.yml :: python-lint` (`run_hunt_evals.py --self-test` parses its own source with `ast` and asserts it imports the corpus grader and imports neither the hunt engine nor the loader, so it cannot score) | core | GATED | `hunts/README.md` cited this script for months and it had never existed, so the one instruction a contributor was most likely to follow failed at the shell. It is a wrapper for the same reason `run_model_matrix.py` is: a second scorer drifts from the one the scoreboard publishes |+| A retro-hunt sweeps lake columns the lake writer actually fills | `plans/aisoc_gap_closure_plan.plan.md` (8.1); `apps/docs/docs/concepts/retro-hunts.md` | `ci.yml :: python-lint` (`check_ioc_lake_mapping.py` reads `lake_writer._COLUMNS`, the `raw_events` DDL and the three threat-intel clients, and fails when a swept column is not one the writer writes, a declared OCSF path is not one `event_to_row` reads, an `is_array`/`is_ip` flag disagrees with the column type, or a feed type any client emits routes to unknown) + `isolation-live.yml` (`test_retro_hunt_live.py` drives a real OCSF event through the real writer into a live ClickHouse and probes **each mapped column on its own**, because an OR hides a broken branch behind a working one) | full | GATED | Proven against injected faults rather than only against the tree as committed: a column renamed to one the writer does not fill, a dropped `is_ip`, and a topic disagreement each reproduce a finding. The first version of the live test passed with `is_ip` removed, because `iocs` carries the address as a plain string and masked the typed column; per-column probing is what closed that |+| One published indicator opens at most one alert per tenant | `plans/aisoc_gap_closure_plan.plan.md` (8.1) | `ci.yml :: api tests` (`test_retro_hunt.py` asserts the generated sweep is an aggregate with no selectable event column, so a thousand matches cannot become a thousand rows) + `isolation-live.yml` (`test_retro_hunt_live.py` inserts 1,000 matching events and asserts the sweep returns exactly one row counting all of them, with the distinct-value evidence sets still capped) | core | GATED | Two independent dedup layers, and the row asserts both: the `retro_hunt_sightings` UNIQUE constraint stops the alert being attempted on a later sweep, and the `alerts` per-tenant partial unique index on `idempotency_key` stops a duplicate landing if the branching is ever wrong |+| A retro-hunt that could not check a surface says so rather than reporting zero sightings | `plans/aisoc_gap_closure_plan.plan.md` (8.1) | `ci.yml :: api tests` (`test_retro_hunt.py` — `checked` and `sightings` are separate fields and `matched` requires both; an unreachable lake, an exceeded budget, an unreadable result and a SIEM source with no field mapping each produce a distinct named gap, and a sweep that matched on one surface while another failed still carries the gap) | core | GATED | The same rule `agent_tools.siem_search` draws for a backend that errored. Not gated: whether an operator reads the gap. The alert body places it under a heading rather than in a field a renderer could drop |+| A KEV entry is checked against a tenant's own vulnerability findings, not inferred from software names | `plans/aisoc_gap_closure_plan.plan.md` (8.2); `apps/docs/docs/concepts/retro-hunts.md` (KEV exposure) | `ci.yml :: api tests` (`test_kev_exposure.py` — a CVE routes to the exposure path and never to a telemetry sweep, asserted in both directions so no type can claim both; a value without CVE shape is refused rather than queried, because a scanner's `cve_id` column returns zero rows for an advisory title and that zero would read as "not exposed") | core | GATED | Exposure is drawn from `asset_vulnerabilities` rows. Matching the catalogue's vendor and product strings against an asset's OS field is deliberately not done: it would produce a plausible answer built on string similarity, and a task an analyst has to disprove is worse than no task |+| A tenant with no vulnerability data is told exposure could not be checked, not that they are unaffected | `apps/docs/docs/concepts/retro-hunts.md` (KEV exposure) | `ci.yml :: api tests` (`test_kev_exposure.py` — `checked` and `exposed_asset_count` are separate fields and `exposed` requires both, so a caller reading the dataclass cannot render an unscanned tenant as clean; the wording is asserted against the module constant rather than a copy written in the test) | core | GATED | The case-task body additionally states the count is a floor rather than a total, because assets with no scan coverage cannot appear in it. Not gated: whether an analyst reads that sentence |+| Auto-triage sees the last few analyst decisions on an alert of this shape, with the reason each analyst gave | `plans/aisoc_gap_closure_plan.plan.md` (6.3) | `ci.yml :: agents tests` (`test_triage_dispositions_and_identity.py` — reads the append-only feedback table rather than the per-signature override row, which holds only the latest decision; a rule-tagged decision is asserted to order ahead of one matched on a shared entity) | core | GATED | Deliberately below the corroboration threshold organisation memory enforces, so a disagreement recorded once is visible here and not there. Not gated: whether the decisions shown are the most relevant ones |+| Analyst dispositions are point-in-time during a replay, so a replayed decision cannot see a later one | `plans/aisoc_gap_closure_plan.plan.md` (6.3, replay freeze) | `isolation-live.yml` (`test_recent_dispositions_cutoff_live.py` — the cutoff is proven against a live store rather than a stub, because an ORM-level filter that a stub satisfies is the half that has already been wrong once) | core | GATED | Same seam as the knowledge-base freeze. Not gated: dispositions written by a system outside this store |+| A major version means an operator must act, enforced in both directions | `apps/docs/docs/operations/release-policy.md` (A major version means an operator must act) | `governance.yml :: governance` (`check_release_policy.py`: a major bump whose changelog section carries no `### BREAKING` heading fails, **and** a `### BREAKING` heading on anything that is not a major bump fails. Both arms are proven by injecting that exact violation into a fixture changelog, and each is proven not to fire on the other's violation, so neither is passing by accident. Eight majors below the 10.0.0 policy floor are exempt and are printed on every run rather than skipped quietly) + `release.yml :: release` (`--tag`, run before any artefact is published, because a release whose version and notes disagree is far cheaper to stop than to withdraw) | core | GATED | The gate reads the changelog, not the diff. It cannot tell that a change *is* breaking when nobody wrote it down; what it removes is the case where somebody did write it down and the version did not follow |+| `stable` does not cross a major on its own | `apps/docs/docs/operations/release-policy.md` (Tags and channels) | `ci.yml :: python-test` (root) `test_release_channel_tags.py` lifts the tag-selection block out of `release.yml` and runs it under bash for each combination rather than re-implementing it: a minor and a patch move `stable`, every `vX.0.0` does not, a dispatch with `promote_stable` does, a republish moves neither channel, and the demo bundle carries no channel tag at all. The `promote_stable` input is asserted to be declared, so the only path by which `stable` can reach a major is reachable | core | GATED | It asserts which tags are computed, not that the registry ends up holding them. The latter is `docker-verify`'s job, which asks the registry rather than the workflow |+| The Helm chart is published where the documentation says it is | `apps/docs/docs/deployment/kubernetes.md`; `apps/docs/docs/operations/release-policy.md` (The Helm chart) | `release.yml :: chart-publish` (packages and lints on every run so the chart cannot quietly stop being publishable, re-checks that `appVersion` names images that exist via `check_published_images.py --require-network`, pushes on a tag, and then resolves the pushed chart with `helm show chart` rather than trusting the push step's exit code) | core | GATED | The page told operators to run `helm show chart oci://ghcr.io/beenuar/aisoc`, where no chart has ever been pushed. The job makes the corrected reference true from the next release; until that release the page says so rather than implying it already resolves |+| A migration is exercised against a populated database before it ships | `apps/docs/docs/operations/release-policy.md` (Upgrading) | `upgrade-test.yml :: upgrade`, on every pull request touching `services/api/migrations/**`, `run_migrations.py` or any service's `alembic/`: the previous minor's **published image** applies its own chain, `scripts/upgrade_fixture.sql` seeds a tenant, a user, one alert per severity tier and a case, and then this tree's chain is applied over the populated schema by that same runner. It asserts every migration on disk is recorded as applied, that the pre-upgrade rows are still readable **by id** rather than only by count, that the DML-only runtime role can still read them, and that a second run applies nothing | core | GATED | The previous release's runner applies both legs, so a migration needing a *newer* runner than the previous release shipped is not covered; it would fail the second leg rather than pass silently. The fixture is four tables deep, not the whole schema |+| The hunting agent never writes a query: it fills a closed schema and the values it supplies are bound parameters | `plans/aisoc_gap_closure_plan.plan.md` (8.3); `apps/docs/docs/concepts/hunting-agent.md` | `ci.yml :: hunt agent boundary` (`check_hunt_agent_boundary.py` — reads the plan enum, the SQL compiler and the ClickHouse DDL together and fails when any drifts from the others; proven against an open enum, a query-shaped property and a field the DDL does not declare) | full | GATED | The gate reads structure, not intent: it cannot say the plan the model chose is a sensible hunt, only that the model could not have expressed anything outside the vocabulary |+| A hunt the event lake could not answer is reported as unavailable with a reason, never as zero findings | `plans/aisoc_gap_closure_plan.plan.md` (8.3) | `ci.yml :: api tests` (`test_hunt_plan_sql.py` — the unavailable branch omits the `rows` key entirely, so a caller reading `rows` raises rather than rendering an empty list as a clean estate; asserted across all three failure classes) | full | GATED | Three outcomes are kept apart in the response shape rather than in prose: findings, no findings, and could not check |+| A bind parameter in a raw SQL statement carries the name the handler binds, so the route reaches a connection rather than 500ing on `ArgumentError` | `scripts/check_text_bind_casts.py` (module docstring); the four dead handlers it names | `isolation.yml :: route-scope` (`check_text_bind_casts.py` — an AST pass over every `text()` literal under `services/`, refusing `:name::type` because SQLAlchemy's bind-parameter regex backtracks one character rather than skipping the cast, so `:payload::jsonb` declares `payloa` and the matching `.bindparams()` raises. `--self-test` asserts five things: the injected `:payload::jsonb` is reported, a `::` cast in a *concatenated* statement is reported too, the correct `CAST(:name AS type)` spelling is not, an ARN literal outside a `text()` call is not, and a tree with no Python under `services/` is refused rather than called clean) | core | GATED | Scoped to statements the AST can see as `text()` arguments, including concatenated ones. A statement whose SQL arrives at runtime from outside the module — a fragment read from a file or assembled by a helper the pass does not follow — is not covered, and the fix everywhere is the standard `CAST(:name AS type)` spelling |+| Every CI job that grades a service installs what that service's image ships, so CI cannot run a different engine than production | `scripts/check_ci_install_parity.py` (module docstring); `RELEASES.md` | `reproducible-builds.yml :: pin-agreement` (`check_ci_install_parity.py` — for every job running a service's *whole* pytest suite, three directions: a runtime dependency guarded by `except ImportError` that CI does not install, so CI grades the fallback and the image grades the real path; a package CI installs that none of the job's services declares; and a version range disjoint from, wider than, or unbounded against the intersection of what those services declare. 16 self-test cases inject each direction, two controls must not fire, and two refusals cover a tree with nothing to compare. It reported 210 divergences against the commit before it landed) | core | GATED | The three whole-suite jobs derive their install list from the manifests through `service_requirements.py`, which re-resolves inside the declared ranges rather than installing the locked set — so CI can land on a different patch release than the image. Narrower than a hand-written list, and stated in the script's docstring. Closing it means installing from the lock in CI, at the cost of the pip wheel cache the matrix was built around |+| A published Helm chart version names one chart forever | `apps/docs/docs/deployment/kubernetes.md` (The chart's version); `infra/helm/aisoc/Chart.yaml` | `helm.yml :: version` + `release.yml :: chart-publish` (`check_chart_version.py` — four checks that need no network: `appVersion` moved while the chart's own `version` did not, any tracked chart file moved with no version bump (with Chart.yaml's own `version:` masked, so the bump cannot justify itself), a version that moved backward, and one chart version declared at two release tags with differing content. Plus one that asks GHCR: the version about to be pushed already exists holding content this tree does not. The registry comparison is on **unpacked files**, because `helm package` is not byte-reproducible — `Chart.yaml` is compared parsed since helm re-serialises it, and the tracked subchart `.tgz` are expanded the way helm expands them, a mapping measured exact against the published 5.9.2 at 146 files. On a release it runs with `--require-network`, before `helm push`, because the push overwrites silently and there is no after. 16 self-test cases, and the gate refuses a checkout with no tags rather than concluding no release ever declared a version) | core | GATED | **Proven against the pre-fix tree**: at `2db6ce73` (the v13.0.0 release commit) it exits 1 naming `appversion-moved-alone` — `v12.3.2` -> `v13.0.0` with `version` held at 5.9.2 — and exits 0 at `9d3225c6` after the bump to 6.0.0. **Two things it deliberately does not decide.** Whether a bump is the right *size*: nothing in a diff knows if a renamed `values.yaml` key breaks somebody's values file, so the gate enforces forward, never how far. And the overwrite that already happened: republishing replaced the bytes, so the registry's 5.9.2 and the tree that overwrote it are now byte-identical — measured, 146 files, zero differences — which is why the retro-detection reads git rather than the registry, and why the pre-fix proof runs through the baseline check. `5.9.2` and `5.2.0` are recorded in `KNOWN_COLLISIONS` as unrepairable, checked in both directions so an entry that stops being detectable fails |+| Every console call to an AiSOC API carries a credential | `apps/web/src/lib/api.ts` (the credentialed client); `SECURITY.md` (authentication) | `ci.yml :: Python — Lint & Type-check` (`check_console_auth_headers.py` — parses every `fetch(` and `useSWR(` call under `apps/web/src` and requires the credential to be visible on the same expression, so hiding it behind a local `const headers` a few lines up does not count. `X-Tenant-Id` alone and `credentials: 'include'` are both findings, because neither authenticates against a bearer-token API. 15 self-test cases, of which three pin blind spots in the gate's own first draft — a generic type argument hid both real SWR sites, a multi-line arrow fetcher was truncated at the first newline, and an inline fetcher whose URL is the SWR key has no API path at the call site — and four are controls that must not fire. It refuses a tree with no console sources, and separately refuses one where the console makes no API call at all, since a broken matcher and a console that stopped calling the API print the same clean line) | core | GATED | **Proven against the pre-fix tree**: 61 findings across 21 files at `079fdb69` (45 bare fetches, 16 SWR fetchers), 0 after. One allowlisted exception, the public `/r/<slug>` replay permalink, which is unauthenticated by design and is kept safe by `replay_redaction.py` rather than by a header; the allowlist may only shrink and a stale entry fails the gate. One limit stated rather than implied: the gate reads the console, so it proves the credential is sent, not that the server requires it — `check_route_auth.py` and `check_route_authz.py` are the other half |+| An unauthenticated request is never an administrator, and never acts in a real tenant | `SECURITY.md` (authentication); `apps/docs/docs/deployment/single-host.md` | `ci.yml :: Python — Tests` (`services/api/tests/test_anonymous_bypass_requires_optin.py`, 36 cases: the four names in `AUTH_BYPASS_ENVIRONMENTS` each refuse on their own; the explicit `AISOC_DEV_AUTH_BYPASS` opt-in admits; five truthy and five falsy spellings of it; the flag does not re-enable the shim outside a dev environment; five reachable published addresses refuse and five loopback forms admit; one reachable address among several refuses; the demo tenant is not the bootstrap tenant and the canonical id did not move; and every refusal names the condition that withheld it) + the nine vendored copies of `services/fusion/tests/test_tenant_scope.py` kept in lockstep by `sync_vendored_tenant_scope.py --check` + `services/realtime/test/push-tenant.test.ts` | core | GATED | **Proven against the pre-fix tree**: 35 of 36 API cases fail at `079fdb69` and all 36 pass after, with the tenant-sharing assertion failing as `assert UUID('…0001') != UUID('…0001')`; 4 of 8 realtime cases fail pre-fix, the other 4 being controls that must pass both ways. Two limits stated rather than implied. The loopback check is only as good as what compose passes in `AISOC_PUBLISHED_BIND_ADDRS`: an unset list is treated as a local run, because refusing on an empty list would break `uvicorn app.main:app` for contributors, which is the case the shim exists for — the deployment-path gate is what stops a published stack leaving it unset. And a hostname that is not obviously loopback is treated as reachable, so a DNS name resolving to 127.0.0.1 refuses the bypass; that is the safe direction for an undecidable question, and it is a false refusal, never a false admission |+| Every documented way to start AiSOC produces a production-class posture | `README.md` (quick start); `apps/docs/docs/deployment/single-host.md`; `apps/docs/docs/deployment/walkthrough.mdx` | `ci.yml :: Python — Lint & Type-check` (`check_deployment_auth_posture.py` — resolves `${VAR:-default}` against the env file each documented path uses, for every service in the compose file, with no Docker, and fails on a development-class `ENV`/`ENVIRONMENT`, a truthy `AISOC_DEV_MODE`, `AISOC_DEV_AUTH_BYPASS` outside the overlay, a service that reads the flags without being told its published addresses, or an entry point that exports any of them. 13 self-test cases, three of them controls) + `ci.yml :: Python — Tests` (`tests/test_compose_environment_gate.py`, `tests/test_production_compose_gate.py`) + `make smoke`, which answers 401 to an anonymous write on the API port and through the console proxy | core | GATED | **Proven against the pre-fix tree**: 28 findings at `03e923f3`, across every service that reads the bypass flags; 0 after. **And verified live on a rebuilt image**, three postures on a real container: `make up` answers 401 with no bypass variable set; `make up-dev` on loopback answers 200 and logs the activation warning naming the demo tenant; `make up-dev` with the console on `0.0.0.0` answers 401 and logs the refusal naming the address. The first probe run graded a cached pre-fix image and was discarded, which is why the claim says rebuilt. One limit stated rather than implied: the gate reads declarations, so it proves the *shipped* default is production-class, not that a particular operator's `.env` is — an operator who writes `ENVIRONMENT=development` and `AISOC_DEV_AUTH_BYPASS=1` by hand has asked for it, and the loopback refusal is what still stands between that and a reachable host |+| Repeated credential failures are throttled and eventually locked out | `SECURITY.md` (what to review) | `ci.yml :: Python — Tests` (`services/api/tests/test_login_throttle.py`, 18 cases, and `services/api/tests/test_login_route_throttled.py`, 4 that drive the real route — because a gate on the limiter alone passes over a route that never calls it, and that was the defect: three limiters existed in this service and login consulted none of them. Asserted in both directions: a success clears the account counter and not the source counter; password spraying trips the source counter without ever tripping an account counter; an address that does not exist is refused identically to one that does; and Redis being down degrades to per-replica counting rather than locking everyone out) | core | GATED | **Proven against the pre-fix tree**: the four route cases fail at `4f4ba326` as `assert 429 in [401, 401, 401, ...]`, and the control — the first two attempts still answering 401 — passes on both trees, so the suite cannot be satisfied by a route that refuses everyone. Two limits stated rather than implied. The source counter is evadable where `X-Forwarded-For` is not stripped by a trusted proxy, since an attacker can rotate it for a fresh bucket per request; that is why the account counter is the primary control, and why the source counter is aimed at spraying, where per-request rotation is not something an attacker expects to need. And the fallback is per-replica, so an attacker spread across replicas gets one budget per replica — weaker than shared counting, and recorded as weaker |+| No SSO path mints an identity that no identity provider authenticated | `apps/docs/docs/operations/security.md` (SSO); `SECURITY.md` | `ci.yml :: Python — Tests` (`services/api/tests/test_sso_mints_no_stub_identity.py`, 8 cases: neither `stub-saml-user` nor `oidc-stub-user` is constructible in any auth module, both handlers answer 501 when unconfigured, no `set_cookie` sits inside an exception handler, and `python3-saml` is declared so the 501 is clearable. The glob is asserted non-empty, because a pattern that matches nothing makes every other case vacuous) | core | GATED | **Proven against the pre-fix tree**: 6 of 8 fail at `48234dc5`. **And verified by building the image**, not by reading the manifest: `onelogin.saml2` imports inside it, so the `ImportError` branch that minted the stub is unreachable rather than merely deleted. One cost stated rather than hidden: the image grows 1.36 GB to 1.42 GB, which is the three wheels. The first attempt also added four `-dev` packages on the assumption that `xmlsec` compiles from source; it does not, a `manylinux` wheel exists, and removing them kept the import working and saved 110 MB. Measured, not assumed, in both directions. One limit: this proves no *stub* identity can be minted, not that a real SAML assertion is correctly verified — the containerised test IdP that would prove that is parity 4.1 |+| Copilot conversations and saved hunts are visible only to the tenant that created them | `apps/docs/docs/console/copilot.md`; `apps/docs/docs/concepts/multi-tenancy.md` | `ci.yml :: Python — Tests` (`services/agents/tests/test_copilot_and_hunts_are_tenant_scoped.py`, 21 cases: neither module global survives, all seven handlers take a principal **and** resolve a tenant from it, every SQL statement in the store carries the predicate (parsed from the AST, not eyeballed), the RLS context variable is spelled `app.current_tenant_id`, an unavailable store raises rather than returning empty, and the migration creates both tables with `tenant_id NOT NULL`, forced RLS and the `aisoc_app` grant) | core | GATED | **Proven against the pre-fix tree**: all 21 fail at `e7f4d2b3`. The instructive part is that both routers *already* authenticated every request — the principal was verified and then discarded, because no handler took it as a parameter, so a gate checking only for an auth dependency would have passed this. Hence two cases per handler: binds a principal, and resolves a tenant from it. One limit: these assert the predicate exists, not that Postgres enforces it — the two-tenant replay that proves the policy lives in `tests/isolation/` and runs only where containers are available |+| No route module keeps state in a module global, or serves invented data | `README.md` (real vs synthetic data); `docs/audit/REPOSITORY_REALITY.md` | `ci.yml :: Python — Lint & Type-check` (`check_python_route_state.py` — parses every route module under `services/*/app/api` with `ast` and fails on a module-level mutable a handler writes to, by rebinding, by a mutating method, by a subscript store or through a subscript load, and on a container named as sample data with no demo gate in the file. 12 self-test cases, five of them controls) + `ci.yml :: Python — Tests` (`services/api/tests/test_no_fabricated_shift_or_taxii_data.py`) | core | GATED | **Proven against the pre-fix tree**: 21 findings on the first run; 4 of the 6 behaviour cases fail at `48234dc5`. Two of the gate's own rules were wrong first and the corrections are the durable part: a shape heuristic produced four false positives out of four detections on real configuration tables, so the name is the signal; and the allowlist credited an entry on the name alone rather than on an actual suppression, so a fixed defect kept its excuse. **15 entries remain, ratcheted** — five are not defects (a log de-duplicator, two caches of static artefacts, global-by-design community content) and the rest name the plan item that gives them a table. One limit: the gate reads route modules, so a service that keeps shared state in a helper module its handlers import is out of scope |+| Platform data is not carried in the clear between services | `apps/docs/docs/operations/security.md`; `README.md` (architecture) | `ci.yml :: Python — Lint & Type-check` (`check_kafka_transport.py` — all 13 client construction sites across Python, Go and TypeScript pass a resolved transport, checked through the AST so a comment cannot satisfy it, **and** the resolver is called and required to refuse production cleartext, allow development plaintext, and reject a typo rather than defaulting; plus `sync_vendored_kafka_security.py --check`) + `ci.yml :: Python — Tests` (`services/api/tests/test_transport_security_defaults.py`) | core | GATED | **Proven against the pre-fix tree**: 13 clients unwired, 10 of 13 cases fail at `48234dc5`. The two-direction check is the point — checking call sites alone would pass a tree where every site calls a resolver that always answers PLAINTEXT. The sync gate also re-derives Kafka users from the tree, so an eighth service that never takes a copy fails rather than running plaintext. Two limits: `sslmode` is **reported at boot, not enforced** (every service builds its own engine and the collector is the one place they all pass through), and the compose DSN keeps `sslmode=disable` deliberately because the bundled Postgres serves no certificate |+| No integration ships a working credential nobody chose | `apps/docs/docs/operations/security.md` (secrets) | `ci.yml :: Python — Tests` (`services/purple-team/tests/test_caldera_key_has_no_default.py`, 4 cases: the published literal is absent from code, the setting defaults to empty, building a client without a key raises and names the variable, and a configured key still builds one) | full | GATED | **Proven against the pre-fix tree**: 3 of 4 fail at `48234dc5`. `ADMIN123` is Caldera's own published first-run credential, so an unconfigured deployment authenticated with it against any Caldera nobody had rotated. The fourth case runs the other way so this cannot pass on a build with no client at all |+| Every state-changing route makes an authorization decision, or declares why identity is one | `apps/docs/docs/operations/security.md` (RBAC); `README.md` | `ci.yml :: Python — Lint & Type-check` (`check_route_authz.py` — 224 of 245 state-changing routes authorize; the remaining 21 must each sit in a module carrying a written reason, checked in both directions so an undeclared module fails *and* a declaration describing no route fails) | core | GATED | **Proven by perturbation**: removing a real declaration and adding one for a nonexistent module were each run and each failed the gate. 218 → 224 authorizing. Two corrections worth recording: four MSSP routes guarding cross-tenant grants were counted as unauthorized while being correctly guarded by an organisation-role dependency, fixed in the gate rather than by bolting a redundant tenant permission onto a surface that is not tenant-scoped; and one route was gated and then **reverted**, because its existing pin argued every authenticated principal is a legitimate rater and the permission added here contradicted that — a prior decision with its reasoning written down outranks a later sweep that did not read it. One limit: the gate reads the signature, so it proves a decision is *made*, not that the permission chosen is the right one |+| The audit log names the credential that acted, and a tenant can read its own trail | `apps/docs/docs/compliance/evidence-pack.md`; `apps/docs/docs/operations/security.md` | `ci.yml :: Python — Lint & Type-check` (`check_audit_coverage.py` — every actor-bearing `emit_audit` records the credential, `tenant_admin` holds `audit_log:read`, the modules whose *reads* are the sensitive act emit audit, and the coverage floor ratchets; 6 self-test cases including two controls) + `ci.yml :: Python — Tests` (`services/api/tests/test_audit_attribution_and_readership.py`) | core | GATED | **Proven against the pre-fix tree**: 7 of 11 fail at `3c04a21b`, and the gate found two live defects on its first run that the hand-written fix had missed. The honest limit is published rather than hidden: **7 of 86 endpoint modules emit audit at all**, the floor is set at that measured value rather than an aspiration, and the gate prints the largest unaudited surfaces by route count on success so the next step is named. Raising it is ordinary work, not a gap in the control. One correction recorded: the attribution rule first reported the SCIM writer, whose actor is already `scim:<token>` — a scheme-prefixed actor is self-attributing |+| Only a human-confirmed, unexpired, uninjected prior can auto-close an alert | `apps/docs/docs/concepts/automation-maturity.md`; `apps/docs/docs/console/funnel-kpis.md` | `ci.yml :: Python — Tests` (`services/agents/tests/test_outcome_memory.py` — an AI prior never suppresses at any count or confidence, a prior expires 90 days after its last confirmation, an unparseable timestamp counts as expired, injection-flagged evidence never suppresses, and the refusal names which rule declined; plus `test_outcome_writer_signature_parity.py`, which compares all four `record_outcome` signatures in both directions and asserts the concrete writer forwards the flag) | core | GATED | **Proven against the pre-fix tree**: `suppression_refusal` does not exist there, so the whole module fails to import, and 2 of the 10 parity cases fail. The durable finding is why the parity test exists: adding the keyword broke four writers and **no test failed on the exception**, because the call sits inside `contextlib.suppress(Exception)` — what surfaced was a zero write-count in an unrelated replay test three files away. One limit: these prove the *rules*, and the injection flag is only as good as the guard that sets it, which scores 98.1% on its tuned corpus and 7.1% on held-out payloads |+| A permission granted or revoked in the console governs every route | `apps/docs/docs/operations/security.md` (RBAC); `apps/docs/docs/console/settings.md` | `ci.yml :: Python — Lint & Type-check` (`check_one_permission_model.py` — the check reads the resolved set, authentication resolves one, all 5 RBAC mutations invalidate, and no route module imports the static map; 5 self-test cases, one a control) + `ci.yml :: Python — Tests` (`services/api/tests/test_database_backed_permissions.py`, 18 cases **in both directions**: a database grant the static map lacks is allowed, and a static grant the database lacks is denied) | core | GATED | **The second direction is the one that was broken**: the old fallback restored a deprovisioned user's static permissions whenever their last role was removed, because an empty row set was read as 'not configured'. 275 static sites became database-backed with zero call-site edits by moving resolution into `get_current_user`. Two limits stated rather than hidden: resolution **fails open to the static map** on a database fault, deliberately, because failing closed would turn a blip into a platform-wide lockout mid-incident; and without Redis the invalidation degrades from a version counter to a 15-second TTL, logged, so a multi-replica deployment converges rather than invalidating immediately |+| Every `mssp_*` table isolates one portfolio from another at the database layer | `apps/docs/docs/concepts/multi-tenancy.md`; `apps/docs/docs/mssp/overview.md` | `integration.yml :: MSSP row-level security isolation (live, two portfolios)` (`tests/isolation/test_mssp_rls_live.py`, 38 cases against a real Postgres) + `ci.yml :: Python — Tests` (`services/api/tests/test_mssp_row_level_security.py`, 20 structural cases including a policy-graph cycle detector) | core | GATED | **Measured, not asserted**: with the policies disabled 30 of the 38 live cases fail; with them, each of four parties sees exactly its own row and a fifth sees zero. Forced RLS 117 → 123 tables. The cycle detector was **proven by re-injecting the real cycle** the first draft had. Two findings worth keeping: the existing live suite discovers tables by a column named `tenant_id`, so all seven `mssp_*` tables sat outside its coverage figure — which is why six went unpoliced; and `check_rls_policy_shape.py` passed on mutually recursive policies that raise `infinite recursion detected` on the first SELECT, so shape is not liveness. One limit: the live job needs a container, so on a developer machine without one these skip |+| Every console API call reaches a route that exists | `apps/docs/docs/console/index.md`; the console itself | `ci.yml :: Python — Lint & Type-check` (`check_console_route_contract.py` — every `/api/v1` path in `apps/web/src` resolves against the API service's and the agents service's own OpenAPI documents, through the Next rewrite table, with a rewrite counting only when the service it points at serves the path) + `ci.yml :: Python — Tests` (`services/api/tests/test_compliance_framework_routes.py`) | core | GATED | **14 findings against the pre-phase tree, 0 after**, and it found every defect the parity plan listed without being told them. The design correction is the point: a first version treated any matching rewrite as resolution, and since `/api/v1/:path*` routes everything left over to the API service, **all 209 paths passed on a tree with 14 broken calls**. A rewrite is proof of routing, not of service. Limits stated: 11 rewrites point at services this gate cannot introspect and are accepted on that basis, and 4 literals are allowlisted with reasons (two base-path constants, a WebSocket URL, a prose reference in a comment) |+| No service module is built and unreachable without a written reason | `docs/audit/REPOSITORY_REALITY.md`; this matrix | `ci.yml :: Python — Lint & Type-check` (`check_module_reachability.py` — walks the import graph from 68 entry points, with tests deliberately excluded as entry points) | core | GATED | **889 of 926 modules reachable; 37 allowlisted, each naming the phase that wires it or stating that nothing claims it.** It independently found the hunting agent, the pseudonymizer and the closure guardrails, which the capability review had named by hand. Two bugs in the gate itself were found by its own output: a package `__init__` resolved relative imports against its parent, and importing a submodule did not mark its packages, which together reported 159 modules where 37 are real. One limit: a vendor client constructed by name at dispatch cannot be seen statically, and four are allowlisted on that basis rather than given a dynamic-loader entry that would excuse more than it explains |+| No two handlers answer the same method and path | `apps/docs/docs/architecture.md` (routing) | `ci.yml :: Python — Lint & Type-check` (`check_route_duplicates.py` — imports each app and reads the assembled route table, where prefixes are resolved) | core | GATED | **Proven against the pre-phase tree**: it names `agents: GET /api/v1/investigations/{run_id}` with both owners. The static pass could not: it groups by `(service, path, router)` and the two declared paths differ before mounting, and its `shadows()` only fires when a parameter faces a literal. Reads the router rather than `app.openapi()`, which keys paths in a dict and would collapse the duplicate it is looking for; an app that yields zero routes fails, because that is what an opaque `_IncludedRouter` looks like on FastAPI 0.141 |## Summary-- GATED: 255+- GATED: 258## Summary-- GATED: 255+- GATED: 258## Summary-- GATED: 255+- GATED: 258## Summary-- GATED: 255+- GATED: 258## Summary-- GATED: 255+- GATED: 258- PARTIAL: 0- NO GATE: 0 (**every claim is backed by a failing test, and none is now a named deferral either.** The last NO GATE — the weekly benchmark scoreboard running live against `main` — closed in Phase E1: `scripts/check_scoreboard.py` ties the published scoreboard to a deterministic per-PR live-agent MITRE-accuracy run, while the funded weekly `wet-eval.yml` appends the LLM-tier rows. The last two PARTIAL rows closed with `scripts/check_live_agent_floor.py` and a floor derived from ten runs across two environments, not by relabelling. Recount with `scripts/check_claim_gate_matrix.py` rather than trusting these three numbers: they move weekly, and a count copied into prose goes stale in silence.)diff --git a/docs/openapi.yaml b/docs/openapi.yamlindex 27fb028be..f7fad1615 100644--- a/docs/openapi.yaml+++ b/docs/openapi.yaml@@ -1456,6 +1456,41 @@ paths:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'+ /api/v1/cases/{case_id}/investigations/{run_id}/report.md:+ get:+ tags:+ - cases+ summary: Markdown incident report for one investigation run+ description: The Markdown report the case workspace renders.+ operationId: case_investigation_report_md_api_v1_cases__case_id__investigations__run_id__report_md_get+ security:+ - HTTPBearer: []+ parameters:+ - name: case_id+ in: path+ required: true+ schema:+ type: string+ title: Case Id+ - name: run_id+ in: path+ required: true+ schema:+ type: string+ title: Run Id+ responses:+ '200':+ description: Successful Response+ content:+ text/plain:+ schema:+ type: string+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'/api/v1/cases/{case_id}/summary:get:tags:@@ -7349,6 +7384,135 @@ paths:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'+ /api/v1/compliance/{framework}:+ get:+ tags:+ - compliance+ summary: One framework's control status+ operationId: framework_detail_api_v1_compliance__framework__get+ security:+ - HTTPBearer: []+ parameters:+ - name: framework+ in: path+ required: true+ schema:+ type: string+ title: Framework+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/FrameworkDetail'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/compliance/{framework}/heatmap:+ get:+ tags:+ - compliance+ summary: Control status grid+ operationId: framework_heatmap_api_v1_compliance__framework__heatmap_get+ security:+ - HTTPBearer: []+ parameters:+ - name: framework+ in: path+ required: true+ schema:+ type: string+ title: Framework+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HeatmapResponse'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/compliance/{framework}/collect:+ post:+ tags:+ - compliance+ summary: Collect what the platform can attest for this framework+ description: 'Write a real evidence row per automatable control.+++ Rows join the same tamper-evident hash chain as manually collected++ evidence, and land as `pending`: the platform attesting its own state is++ a claim an auditor still has to accept, and auto-accepting would make the++ review step decorative.'+ operationId: framework_collect_api_v1_compliance__framework__collect_post+ security:+ - HTTPBearer: []+ parameters:+ - name: framework+ in: path+ required: true+ schema:+ type: string+ title: Framework+ responses:+ '201':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/CollectResponse'+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/compliance/{framework}/export:+ get:+ tags:+ - compliance+ summary: Export this framework's evidence+ operationId: framework_export_api_v1_compliance__framework__export_get+ security:+ - HTTPBearer: []+ parameters:+ - name: framework+ in: path+ required: true+ schema:+ type: string+ title: Framework+ - name: fmt+ in: query+ required: false+ schema:+ type: string+ pattern: ^(csv|json)$+ default: csv+ title: Fmt+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema: {}+ '422':+ description: Validation Error+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/HTTPValidationError'/api/v1/metrics/dashboard:get:tags:@@ -19955,6 +20119,52 @@ components:- status- queued_attitle: CollectJobResponse+ CollectResponse:+ properties:+ framework:+ type: string+ title: Framework+ collected:+ type: integer+ title: Collected+ manual:+ type: integer+ title: Manual+ results:+ items:+ $ref: '#/components/schemas/CollectedControl'+ type: array+ title: Results+ collected_at:+ type: string+ format: date-time+ title: Collected At+ type: object+ required:+ - framework+ - collected+ - manual+ - results+ - collected_at+ title: CollectResponse+ CollectedControl:+ properties:+ control_id:+ type: string+ title: Control Id+ outcome:+ type: string+ title: Outcome+ description: collected | manual+ detail:+ type: string+ title: Detail+ type: object+ required:+ - control_id+ - outcome+ - detail+ title: CollectedControlCommentResponse:properties:id:@@ -20591,6 +20801,40 @@ components:- tenant_id- statementstitle: ContextStatementsResponse+ Control:+ properties:+ id:+ type: string+ title: Id+ framework:+ type: string+ title: Framework+ control_id:+ type: string+ title: Control Id+ category:+ type: string+ title: Category+ title:+ type: string+ title: Title+ description:+ anyOf:+ - type: string+ - type: 'null'+ title: Description+ automatable:+ type: boolean+ title: Automatable+ default: false+ type: object+ required:+ - id+ - framework+ - control_id+ - category+ - title+ title: ControlControlItem:properties:control_id:@@ -20604,6 +20848,25 @@ components:- control_id- titletitle: ControlItem+ ControlWithEvidence:+ properties:+ control:+ $ref: '#/components/schemas/Control'+ evidence:+ items:+ $ref: '#/components/schemas/EvidenceItem'+ type: array+ title: Evidence+ latest_status:+ type: string+ title: Latest Status+ description: accepted | pending | rejected | missing+ type: object+ required:+ - control+ - evidence+ - latest_status+ title: ControlWithEvidenceControlsResponse:properties:framework_id:@@ -22664,6 +22927,42 @@ components:- output_hash- duration_mstitle: EventOut+ EvidenceItem:+ properties:+ id:+ type: string+ title: Id+ control_id:+ type: string+ title: Control Id+ evidence_type:+ type: string+ title: Evidence Type+ title:+ type: string+ title: Title+ description:+ anyOf:+ - type: string+ - type: 'null'+ title: Description+ status:+ type: string+ title: Status+ collected_at:+ anyOf:+ - type: string+ format: date-time+ - type: 'null'+ title: Collected At+ type: object+ required:+ - id+ - control_id+ - evidence_type+ - title+ - status+ title: EvidenceItemEvidenceReport:properties:case_id:@@ -23418,6 +23717,66 @@ components:required:- formatstitle: FormatsResponse+ FrameworkDetail:+ properties:+ framework:+ type: string+ title: Framework+ framework_name:+ type: string+ title: Framework Name+ summary:+ $ref: '#/components/schemas/FrameworkSummary'+ controls:+ items:+ $ref: '#/components/schemas/ControlWithEvidence'+ type: array+ title: Controls+ generated_at:+ type: string+ format: date-time+ title: Generated At+ type: object+ required:+ - framework+ - framework_name+ - summary+ - controls+ - generated_at+ title: FrameworkDetail+ FrameworkSummary:+ properties:+ total:+ type: integer+ title: Total+ collected:+ type: integer+ title: Collected+ review:+ type: integer+ title: Review+ approved:+ type: integer+ title: Approved+ rejected:+ type: integer+ title: Rejected+ missing:+ type: integer+ title: Missing+ pct:+ type: number+ title: Pct+ type: object+ required:+ - total+ - collected+ - review+ - approved+ - rejected+ - missing+ - pct+ title: FrameworkSummaryFrameworksResponse:properties:frameworks:@@ -23923,6 +24282,47 @@ components:title: Detailtype: objecttitle: HTTPValidationError+ HeatmapCell:+ properties:+ control_id:+ type: string+ title: Control Id+ title:+ type: string+ title: Title+ status:+ type: string+ title: Status+ evidence_count:+ type: integer+ title: Evidence Count+ type: object+ required:+ - control_id+ - title+ - status+ - evidence_count+ title: HeatmapCell+ HeatmapResponse:+ properties:+ framework:+ type: string+ title: Framework+ cells:+ items:+ $ref: '#/components/schemas/HeatmapCell'+ type: array+ title: Cells+ generated_at:+ type: string+ format: date-time+ title: Generated At+ type: object+ required:+ - framework+ - cells+ - generated_at+ title: HeatmapResponseHuntPlanClause:properties:field:diff --git a/docs/operations/multi-region.md b/docs/operations/multi-region.mdindex 40d35ae1a..52f55464e 100644--- a/docs/operations/multi-region.md+++ b/docs/operations/multi-region.md@@ -1,5 +1,15 @@# AiSOC Multi-Region Operations+:::warning A design, not an implementation++Nothing in this document is implemented. There is no per-tenant region routing, no+`events_dist` distributed table, no active-active deployment and no measured RPO or+RTO. It records a target architecture so that the choices are reviewable before any+of it is built, and it is not on any roadmap milestone.++:::++> **Audience**: Platform / SRE teams running AiSOC in production across multiple cloud regions.> **Last updated**: maintained by hand. `scripts/generate_runbook.py` exists but> needs a live OTel endpoint, so nothing in CI regenerates this page.diff --git a/docs/trust/data-flows.md b/docs/trust/data-flows.mdindex 25c368960..cfa8a31b8 100644--- a/docs/trust/data-flows.md+++ b/docs/trust/data-flows.md@@ -20,7 +20,10 @@ The investigation agent calls an LLM you configure. There are three modes:llama.cpp. No evidence leaves your network at all. This is the only mode inwhich the "no data leaves" claim is unconditionally true.2. **Hosted LLM with redaction (default).** When you configure a cloud provider- (Anthropic/OpenAI), evidence is pseudonymized before egress by+ (hosted providers), evidence is **not** pseudonymized before egress today. The reversible+ pseudonymizer exists and is unit-tested, but no LLM call site invokes it, so this+ paragraph describes a planned control rather than a shipped one. Restored by parity 2.4.+ The mechanism, for reference, is`services/agents/app/privacy/redactor.py`: internal IPs, emails, file paths,secrets, internal hostnames, and usernames are replaced with opaque,per-run, in-memory tokens (`USER_1`, `HOST_2`, `IP_3`). The LLM reasons overdiff --git a/install.sh b/install.shindex 1f5527916..4c0dbbe03 100755--- a/install.sh+++ b/install.sh@@ -781,8 +781,9 @@ run_demo() {return 0fisection "Starting AiSOC (CORE profile)"- info "Starting the 10-service CORE stack: postgres, redis, kafka, ingest,"- info "fusion, api, agents, realtime and the web console."+ info "Starting the 16-service CORE stack. Validated against docker-compose.yml"+ info "by scripts/check_profile_service_counts.py, which refuses a figure here"+ info "that the compose file does not support."info ""info "This is the same stack 'make up' starts and the same one CI tests."info "It runs the real pipeline: an event you send is normalized, placed on"diff --git a/marketplace/index.json b/marketplace/index.jsonindex 8124abbe9..f51cd5ba7 100644--- a/marketplace/index.json+++ b/marketplace/index.json@@ -1,7 +1,7 @@{"$schema": "https://example.com/schemas/marketplace/v1.json","version": "1.0.0",- "generated": "2026-09-28T22:12:26Z",+ "generated": "2026-10-01T21:06:28Z","categories": [{"id": "playbooks",@@ -39,10 +39,409 @@"stable": 877},"executable": 2767,- "quarantined": 4388+ "quarantined": 4388,+ "executable_detections": 2603,+ "reference_only_detections": 4388,+ "not_a_detection": 164},"mitre_coverage": {+ "unique_techniques": 391,"techniques": {+ "T1001.003": 1,+ "T1003": 21,+ "T1003.001": 58,+ "T1003.002": 24,+ "T1003.003": 21,+ "T1003.004": 10,+ "T1003.005": 8,+ "T1003.006": 7,+ "T1003.008": 1,+ "T1005": 7,+ "T1007": 2,+ "T1008": 3,+ "T1011": 1,+ "T1012": 8,+ "T1016": 3,+ "T1018": 15,+ "T1020": 3,+ "T1021": 4,+ "T1021.001": 10,+ "T1021.002": 24,+ "T1021.003": 8,+ "T1021.004": 4,+ "T1021.005": 1,+ "T1021.006": 10,+ "T1021.007": 1,+ "T1027": 58,+ "T1027.001": 1,+ "T1027.003": 1,+ "T1027.004": 3,+ "T1027.005": 4,+ "T1027.010": 7,+ "T1030": 1,+ "T1033": 12,+ "T1036": 22,+ "T1036.002": 3,+ "T1036.003": 9,+ "T1036.004": 1,+ "T1036.005": 3,+ "T1036.007": 1,+ "T1037": 1,+ "T1037.001": 3,+ "T1037.002": 1,+ "T1037.004": 2,+ "T1039": 2,+ "T1040": 8,+ "T1041": 9,+ "T1046": 11,+ "T1047": 34,+ "T1048": 8,+ "T1048.001": 1,+ "T1048.003": 5,+ "T1049": 4,+ "T1052": 2,+ "T1052.001": 1,+ "T1053": 4,+ "T1053.001": 1,+ "T1053.002": 2,+ "T1053.003": 4,+ "T1053.005": 24,+ "T1053.006": 1,+ "T1055": 11,+ "T1055.001": 3,+ "T1055.003": 1,+ "T1055.011": 1,+ "T1055.012": 3,+ "T1056": 1,+ "T1056.001": 3,+ "T1056.002": 1,+ "T1057": 3,+ "T1059": 49,+ "T1059.001": 132,+ "T1059.002": 3,+ "T1059.003": 24,+ "T1059.004": 8,+ "T1059.005": 19,+ "T1059.006": 3,+ "T1059.007": 16,+ "T1059.009": 2,+ "T1068": 11,+ "T1069": 3,+ "T1069.001": 12,+ "T1069.002": 11,+ "T1069.003": 1,+ "T1070": 17,+ "T1070.001": 3,+ "T1070.002": 1,+ "T1070.003": 6,+ "T1070.004": 6,+ "T1070.005": 4,+ "T1070.006": 1,+ "T1071": 7,+ "T1071.001": 16,+ "T1071.004": 12,+ "T1072": 4,+ "T1074.001": 4,+ "T1078": 51,+ "T1078.001": 5,+ "T1078.002": 7,+ "T1078.003": 2,+ "T1078.004": 49,+ "T1082": 13,+ "T1083": 9,+ "T1087": 10,+ "T1087.001": 10,+ "T1087.002": 19,+ "T1087.004": 5,+ "T1090": 16,+ "T1090.001": 4,+ "T1090.002": 1,+ "T1090.003": 9,+ "T1091": 1,+ "T1095": 5,+ "T1098": 47,+ "T1098.001": 22,+ "T1098.003": 6,+ "T1098.004": 6,+ "T1098.007": 1,+ "T1102": 5,+ "T1102.002": 1,+ "T1105": 49,+ "T1106": 6,+ "T1110": 23,+ "T1110.001": 7,+ "T1110.002": 1,+ "T1110.003": 4,+ "T1110.004": 4,+ "T1112": 58,+ "T1113": 7,+ "T1114": 1,+ "T1114.001": 1,+ "T1114.002": 1,+ "T1114.003": 2,+ "T1115": 3,+ "T1119": 3,+ "T1120": 2,+ "T1123": 4,+ "T1124": 2,+ "T1125": 1,+ "T1127": 15,+ "T1127.001": 1,+ "T1132.001": 4,+ "T1133": 18,+ "T1134": 2,+ "T1134.001": 6,+ "T1134.002": 2,+ "T1134.003": 3,+ "T1134.004": 1,+ "T1135": 7,+ "T1136": 3,+ "T1136.001": 12,+ "T1136.002": 3,+ "T1136.003": 4,+ "T1137": 4,+ "T1137.002": 1,+ "T1137.003": 1,+ "T1137.006": 3,+ "T1140": 7,+ "T1176": 1,+ "T1176.001": 2,+ "T1185": 3,+ "T1187": 3,+ "T1190": 39,+ "T1195": 3,+ "T1195.001": 1,+ "T1195.002": 9,+ "T1197": 13,+ "T1199": 12,+ "T1200": 3,+ "T1201": 3,+ "T1202": 26,+ "T1203": 6,+ "T1204": 6,+ "T1204.001": 3,+ "T1204.002": 21,+ "T1204.004": 5,+ "T1207": 2,+ "T1210": 4,+ "T1211": 4,+ "T1212": 5,+ "T1213": 2,+ "T1216": 8,+ "T1216.001": 2,+ "T1217": 3,+ "T1218": 89,+ "T1218.001": 5,+ "T1218.003": 7,+ "T1218.004": 1,+ "T1218.005": 8,+ "T1218.007": 6,+ "T1218.008": 5,+ "T1218.009": 3,+ "T1218.010": 11,+ "T1218.011": 21,+ "T1218.014": 2,+ "T1219": 5,+ "T1219.002": 32,+ "T1220": 4,+ "T1222": 2,+ "T1222.001": 5,+ "T1222.002": 1,+ "T1404": 2,+ "T1482": 14,+ "T1484": 1,+ "T1484.001": 8,+ "T1484.002": 2,+ "T1485": 34,+ "T1486": 12,+ "T1489": 10,+ "T1490": 20,+ "T1491.001": 2,+ "T1496": 4,+ "T1497.001": 1,+ "T1498": 4,+ "T1498.001": 2,+ "T1498.002": 2,+ "T1499": 1,+ "T1499.001": 1,+ "T1499.004": 1,+ "T1505.002": 2,+ "T1505.003": 9,+ "T1505.004": 3,+ "T1518": 4,+ "T1518.001": 2,+ "T1525": 8,+ "T1526": 2,+ "T1528": 9,+ "T1529": 3,+ "T1530": 35,+ "T1531": 10,+ "T1535": 1,+ "T1537": 7,+ "T1539": 6,+ "T1542.001": 3,+ "T1542.003": 1,+ "T1543": 10,+ "T1543.001": 4,+ "T1543.002": 2,+ "T1543.003": 31,+ "T1543.004": 2,+ "T1546": 5,+ "T1546.001": 4,+ "T1546.002": 1,+ "T1546.003": 11,+ "T1546.004": 2,+ "T1546.007": 1,+ "T1546.008": 5,+ "T1546.009": 1,+ "T1546.010": 1,+ "T1546.011": 4,+ "T1546.012": 3,+ "T1546.013": 3,+ "T1546.014": 1,+ "T1546.015": 5,+ "T1547": 9,+ "T1547.001": 16,+ "T1547.004": 3,+ "T1547.005": 2,+ "T1547.006": 5,+ "T1547.009": 3,+ "T1547.010": 1,+ "T1547.015": 3,+ "T1548": 7,+ "T1548.001": 4,+ "T1548.002": 50,+ "T1548.003": 2,+ "T1548.004": 1,+ "T1550": 5,+ "T1550.001": 2,+ "T1550.002": 6,+ "T1550.003": 4,+ "T1550.004": 1,+ "T1552": 3,+ "T1552.001": 20,+ "T1552.002": 3,+ "T1552.004": 7,+ "T1552.005": 1,+ "T1552.006": 4,+ "T1552.007": 1,+ "T1553": 1,+ "T1553.001": 5,+ "T1553.002": 2,+ "T1553.004": 9,+ "T1553.005": 5,+ "T1554": 3,+ "T1555": 9,+ "T1555.001": 5,+ "T1555.003": 9,+ "T1555.004": 3,+ "T1555.005": 2,+ "T1556": 43,+ "T1556.001": 1,+ "T1556.003": 1,+ "T1556.004": 1,+ "T1556.006": 16,+ "T1556.007": 1,+ "T1557": 2,+ "T1557.001": 13,+ "T1557.002": 3,+ "T1557.003": 1,+ "T1558": 3,+ "T1558.001": 2,+ "T1558.002": 2,+ "T1558.003": 16,+ "T1558.004": 4,+ "T1559.001": 3,+ "T1559.002": 1,+ "T1560": 2,+ "T1560.001": 12,+ "T1561.002": 1,+ "T1562": 5,+ "T1562.001": 31,+ "T1562.004": 7,+ "T1562.006": 2,+ "T1562.008": 11,+ "T1562.012": 2,+ "T1563.002": 2,+ "T1564": 7,+ "T1564.001": 3,+ "T1564.002": 2,+ "T1564.003": 6,+ "T1564.004": 12,+ "T1564.006": 2,+ "T1564.008": 1,+ "T1565": 2,+ "T1565.001": 3,+ "T1565.002": 1,+ "T1566": 6,+ "T1566.001": 15,+ "T1566.002": 2,+ "T1567": 18,+ "T1567.001": 1,+ "T1567.002": 18,+ "T1568.001": 2,+ "T1568.002": 3,+ "T1569": 1,+ "T1569.002": 29,+ "T1570": 5,+ "T1571": 1,+ "T1572": 29,+ "T1573": 2,+ "T1573.002": 7,+ "T1574": 3,+ "T1574.001": 23,+ "T1574.002": 4,+ "T1574.005": 1,+ "T1574.006": 2,+ "T1574.007": 1,+ "T1574.011": 11,+ "T1574.012": 2,+ "T1578": 1,+ "T1578.002": 1,+ "T1578.003": 1,+ "T1583.001": 4,+ "T1584": 1,+ "T1586.003": 1,+ "T1587": 1,+ "T1587.001": 4,+ "T1588.002": 6,+ "T1589.002": 1,+ "T1590.001": 1,+ "T1590.002": 1,+ "T1592": 2,+ "T1593.003": 1,+ "T1595": 1,+ "T1595.002": 1,+ "T1599": 1,+ "T1599.001": 1,+ "T1600.001": 1,+ "T1606.002": 1,+ "T1608": 2,+ "T1608.003": 1,+ "T1609": 1,+ "T1610": 12,+ "T1611": 25,+ "T1612": 1,+ "T1614.001": 2,+ "T1615": 4,+ "T1620": 4,+ "T1621": 7,+ "T1622": 1,+ "T1647": 1,+ "T1649": 4,+ "T1656": 1,+ "T1659": 1,+ "T1685": 106,+ "T1685.001": 15,+ "T1685.002": 2,+ "T1685.005": 4,+ "T1686.001": 2,+ "T1686.003": 10,+ "T1689": 1+ },+ "total_with_mitre": 2472,+ "unique_techniques_all_rules": 493,+ "techniques_all_rules": {"T1001.003": 2,"T1003": 51,"T1003.001": 87,@@ -537,8 +936,7 @@"T1689": 1,"T1690": 1},- "unique_techniques": 493,- "total_with_mitre": 5800,+ "measure": "attack_technique_tags_on_executable_rules","by_tier": {"community": {"T1078.004": 1diff --git a/playbooks/README.md b/playbooks/README.mdindex f0e04c7bd..f5fba6011 100644--- a/playbooks/README.md+++ b/playbooks/README.md@@ -10,7 +10,9 @@ rollback paths.```playbooks/└── packs/- └── v1/ # Canonical, versioned production pack (50 playbooks)+ └── v1/ # Canonical, versioned production pack (62 playbooks+ │ # across 21 directories; the figure+ │ # marketplace/index.json publishes)├── account-takeover/ # 5 — ATO, MFA fatigue, session theft, OAuth abuse├── ransomware/ # 5 — host isolate, shadow-copy, fileserver, C2, exposure├── bec/ # 5 — inbox rules, payment redirect, impersonation, token theftdiff --git a/scripts/build_marketplace.py b/scripts/build_marketplace.pyindex 59ea9d0a6..b4b47c3ba 100644--- a/scripts/build_marketplace.py+++ b/scripts/build_marketplace.py@@ -611,18 +611,33 @@ def coverage_block(items: list[dict[str, Any]]) -> dict[str, Any]:rather than a single flat number."""techniques: dict[str, int] = {}+ executable_techniques: dict[str, int] = {}by_tier: dict[str, dict[str, int]] = {}for item in items:tier = item.get("tier") or "stable"+ runs = bool(item.get("executable", True))for tid in item.get("mitre_techniques") or []:techniques[tid] = techniques.get(tid, 0) + 1+ if runs:+ executable_techniques[tid] = executable_techniques.get(tid, 0) + 1tier_map = by_tier.setdefault(tier, {})tier_map[tid] = tier_map.get(tid, 0) + 1return {- "techniques": dict(sorted(techniques.items())),- "unique_techniques": len(techniques),- "total_with_mitre": sum(1 for i in items if i.get("mitre_techniques")),+ # The headline. A technique counts only when a rule that can actually+ # fire carries the tag, because the previous figure counted every+ # rule on disk including the reference-only ones, and a reader takes+ # a coverage number as a statement about what the product detects.+ "unique_techniques": len(executable_techniques),+ "techniques": dict(sorted(executable_techniques.items())),+ "total_with_mitre": sum(1 for i in items if i.get("mitre_techniques") and i.get("executable", True)),+ # Kept, clearly named, because the on-disk corpus is a real thing a+ # reader may want to size. It is not coverage.+ "unique_techniques_all_rules": len(techniques),+ "techniques_all_rules": dict(sorted(techniques.items())),+ # This is tag coverage, not detection efficacy: it says a rule claims+ # the technique, not that the rule would catch an attacker using it.+ "measure": "attack_technique_tags_on_executable_rules","by_tier": {tier: dict(sorted(tids.items())) for tier, tids in by_tier.items()},}@@ -721,6 +736,16 @@ def build_index() -> dict[str, Any]:# falsehood."executable": sum(1 for i in items if i.get("executable", True)),"quarantined": sum(1 for i in items if not i.get("executable", True)),+ # The three states, reported separately because the single+ # `executable` figure above conflates two different things and a+ # reader of a marketplace index takes it as a detection count.+ # It reads 2,767 while the item flags say 2,603, and the 164 in+ # between are the playbooks and plugins described above, which+ # carry no flag at all. Both numbers are defensible; publishing+ # only one of them and calling it `executable` is not.+ "executable_detections": sum(1 for i in items if i.get("executable") is True),+ "reference_only_detections": sum(1 for i in items if i.get("executable") is False),+ "not_a_detection": sum(1 for i in items if "executable" not in i),},"mitre_coverage": coverage_block(items),"items": items,diff --git a/scripts/check_claim_gate_matrix.py b/scripts/check_claim_gate_matrix.pyindex 0c9d6a31c..7ad407ab6 100644--- a/scripts/check_claim_gate_matrix.py+++ b/scripts/check_claim_gate_matrix.py@@ -73,6 +73,72 @@ def _parse_status_rows(text: str) -> list[str]:return statuses+#: Profiles a row may declare. A claim holds in the deployment it names, and+#: without saying which, "shipped" means nothing: most of the product used to+#: be built and dark in the `full` profile while the README read as though it+#: ran under `make up`.+VALID_PROFILES = frozenset({"core", "full"})+++def _row_cells(text: str) -> list[tuple[int, list[str], dict[str, int]]]:+ """Every data row, as `(line number, cells, column index by name)`."""+ lines = text.splitlines()+ header_idx = None+ index: dict[str, int] = {}+ for i, line in enumerate(lines):+ if line.strip().startswith("|") and "Status" in line and "Claim" in line:+ cols = [c.strip() for c in line.strip().strip("|").split("|")]+ index = {name: n for n, name in enumerate(cols)}+ header_idx = i+ break+ if header_idx is None:+ return []++ out = []+ for offset, line in enumerate(lines[header_idx + 2 :], start=header_idx + 3):+ s = line.strip()+ if not s.startswith("|"):+ break+ if re.match(r"^\|[\s:|-]+\|?$", s):+ continue+ cells = [c.strip() for c in s.strip("|").split("|")]+ out.append((offset, cells, index))+ return out+++def check_profiles(text: str) -> list[str]:+ """Every row declares a profile, and names a gate test.++ Two properties, because a row can be honest about where it holds and+ still cite nothing runnable. The second is what stops a row resting on+ prose: a `Gate` cell has to name a `.py` file or a workflow job.+ """+ problems: list[str] = []+ for line_no, cells, index in _row_cells(text):+ profile_i = index.get("Profile")+ gate_i = index.get("Gate (workflow :: job)")+ if profile_i is None:+ return ["the table has no Profile column; every row must declare core or full"]+ if len(cells) <= profile_i:+ problems.append(f"row at line {line_no} has no Profile cell")+ continue+ profile = cells[profile_i].lower()+ if profile not in VALID_PROFILES:+ claim = cells[0][:60] if cells else "?"+ problems.append(f"line {line_no}: profile {cells[profile_i]!r} is not one of {sorted(VALID_PROFILES)} ({claim})")+ if gate_i is not None and len(cells) > gate_i:+ gate = cells[gate_i]+ # A workflow filename is as good a gate reference as a test+ # path: `validate-detections.yml` names something CI runs. A+ # first version demanded `.py` or `::` and reported 23 rows+ # that cite a workflow by name, which is a defect in the rule+ # rather than in the rows.+ if not any(token in gate for token in (".py", ".yml", ".yaml", "::")):+ claim = cells[0][:60] if cells else "?"+ problems.append(f"line {line_no}: the Gate cell names no test file and no workflow job ({claim})")+ return problems++def main() -> int:parser = argparse.ArgumentParser(description=__doc__)parser.add_argument("--print", dest="print_only", action="store_true")@@ -83,8 +149,9 @@ def main() -> int:print(f"ERROR: {MATRIX} not found", file=sys.stderr)return 1+ text = MATRIX.read_text(encoding="utf-8")try:- statuses = _parse_status_rows(MATRIX.read_text(encoding="utf-8"))+ statuses = _parse_status_rows(text)except ValueError as exc:print(f"ERROR: {exc}", file=sys.stderr)return 1@@ -93,6 +160,19 @@ def main() -> int:print("ERROR: no claim rows parsed from the matrix", file=sys.stderr)return 1+ # Every row says which deployment it holds in, and names something+ # runnable. A claim with no profile reads as though it holds under+ # `make up`, and most of the product used to be dark in `full` while+ # the README said otherwise.+ problems = check_profiles(text)+ if problems:+ print(f"ERROR: {len(problems)} row(s) do not declare a profile or a gate:", file=sys.stderr)+ for problem in problems[:20]:+ print(f" {problem}", file=sys.stderr)+ if len(problems) > 20:+ print(f" ... and {len(problems) - 20} more", file=sys.stderr)+ return 1+no_gate = sum(1 for s in statuses if "NO GATE" in s.upper())gated = sum(1 for s in statuses if s.upper().startswith("GATED"))partial = sum(1 for s in statuses if s.upper().startswith("PARTIAL"))diff --git a/scripts/check_console_auth_headers.py b/scripts/check_console_auth_headers.pyindex d07a11b43..28b695bb1 100644--- a/scripts/check_console_auth_headers.py+++ b/scripts/check_console_auth_headers.py@@ -425,6 +425,19 @@ def inspect(root: pathlib.Path) -> Report:if len(parts) < 2:continueurl = _api_path_in(parts[0])+ if url is None:+ # The key may be a local binding rather than a literal.+ # `const dashKey = `/api/v1/compliance/${f}`;` followed by+ # `useSWR(dashKey, fetcher)` is an API call with a fetcher+ # that sends no credential, and reading only the call site+ # sees a bare identifier with no path in it. That is how+ # `FrameworkView.tsx` kept an uncredentialed compliance call+ # through the sweep that was meant to find exactly this.+ swr_key = parts[0].strip()+ if swr_key.isidentifier():+ binding = _definition_of(source, swr_key)+ if binding is not None:+ url = _api_path_in(binding)if url is None:continuecalls += 1diff --git a/scripts/check_console_route_contract.py b/scripts/check_console_route_contract.pynew file mode 100644index 000000000..e18e788db--- /dev/null+++ b/scripts/check_console_route_contract.py@@ -0,0 +1,380 @@+#!/usr/bin/env python3+"""Every console API path resolves to a backend route or a Next rewrite.++Why this exists+---------------+Nothing checked the console against the backends. `check_ledger_replay_contract.py`+pins one client object against one router prefix, and `check_sdk_surface.py`+covers the SDKs, so an `/api/v1/...` path in `apps/web/src` that no service+serves shipped silently and showed up as a page that never loads.++It had, repeatedly: seven compliance calls to four route shapes that did not+exist, a case report pane fetching a route nobody had written, and two pages+whose calls went to the console's own origin because no rewrite existed.++How a path is resolved+----------------------+In the order a request actually takes:++1. a Next.js rewrite in `apps/web/next.config.js` (the console's own proxy+ table, which is what makes a path reach another service at all);+2. a route on the API service;+3. a route on the agents service;+4. a static file under `apps/web/public`.++The two services are read by importing their apps and asking+`app.openapi()`, not by scanning decorators. `app.routes` is not the route+table and what it holds changes with the FastAPI minor, which has already+made one gate in this repository compare zero pairs and report success.++Deliberately not checked+------------------------+That a path is *used*. A client surface may legitimately expose more than+the console calls today, and deleting an unused-but-working function is a+judgement about product surface rather than correctness. This reports them+separately so the judgement can be made, and fails only on paths that+resolve to nothing.+"""++from __future__ import annotations++import argparse+import json+import pathlib+import re+import subprocess+import sys+from dataclasses import dataclass, field++sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))++from gate_toolkit import SELF_TEST_FLAG, repo_root, self_test_main # noqa: E402++CONSOLE_SRC = "apps/web/src"+NEXT_CONFIG = "apps/web/next.config.js"+PUBLIC_DIR = "apps/web/public"++#: A template segment, `${...}`, stands for any single path segment.+_TEMPLATE = re.compile(r"\$\{[^}]*\}")++#: Paths the console calls that no backend serves, each with the reason.+#: This may only shrink. An entry whose path has gone fails the gate, so a+#: deleted call cannot leave its excuse behind.+KNOWN_UNRESOLVED: dict[str, str] = {+ # Base-path constants, suffixed before use. They are never requested as+ # written, and a gate reading string literals cannot tell a prefix from+ # a path. Reported rather than silently stripped, because a constant+ # that stops being suffixed becomes a real broken call.+ "/api/v1/fusion": "FUSION_PATH in lib/api.ts, a prefix every fusion call extends",+ "/api/v1/osquery": "the osquery client's base, built from NEXT_PUBLIC_OSQUERY_TLS_URL",+ # A WebSocket URL, not an HTTP route. It reaches the realtime service+ # through the `/ws/:path*` rewrite, which this gate does not model+ # because a WebSocket upgrade is not a path lookup.+ "/api/v1/graph_ws/stream": "a WebSocket endpoint, routed by the /ws rewrite",+ # Named inside a code comment explaining where the data comes from.+ "/api/v1/contextual": "a prose reference in a comment in AlertDetailView.tsx, not a call",+}+++def _run_isolated(argv: list[str], *, cwd: pathlib.Path, timeout: int):+ """Run a probe in its own process group, and kill the group on timeout.++ Not a fix for an observed hang. A CI job appeared stuck on this step+ for ninety minutes and the diagnosis was that a grandchild holding the+ pipes defeats `subprocess.run(timeout=...)`; that was **wrong**, proven+ by reproducing the shape and watching the plain call time out in three+ seconds. The job had in fact completed in 23 minutes and the GitHub+ API was reporting a stale state.++ Kept anyway, for two reasons that stand on their own: killing the+ process group closes every inherited pipe rather than only the child's,+ which is correct even where the plain call happens to cope; and+ `stdin` is closed, so a probe that decides to prompt dies instead of+ waiting. The timeout also drops from 240s to 90s, which caps the worst+ case at six minutes across six services rather than twenty-four.+ """+ import os+ import signal++ process = subprocess.Popen( # noqa: S603+ argv,+ cwd=cwd,+ stdin=subprocess.DEVNULL,+ stdout=subprocess.PIPE,+ stderr=subprocess.PIPE,+ text=True,+ start_new_session=True,+ )+ try:+ stdout, stderr = process.communicate(timeout=timeout)+ except subprocess.TimeoutExpired:+ try:+ os.killpg(os.getpgid(process.pid), signal.SIGKILL)+ except (ProcessLookupError, PermissionError):+ process.kill()+ process.communicate()+ return None+ return subprocess.CompletedProcess(argv, process.returncode, stdout, stderr)+++@dataclass+class Report:+ console_paths: set[str] = field(default_factory=set)+ unresolved: list[tuple[str, str]] = field(default_factory=list)+ stale_allowlist: list[str] = field(default_factory=list)+ rewrites: int = 0+ opaque_rewrites: int = 0+ api_routes: int = 0+ agents_routes: int = 0+++def _console_paths(root: pathlib.Path) -> dict[str, str]:+ """Every `/api/v1/...` string literal in the console, to its file."""+ found: dict[str, str] = {}+ src = root / CONSOLE_SRC+ if not src.is_dir():+ return found+ pattern = re.compile(r"['\"`](/api/v1/[^'\"`\s]*)['\"`]")+ for path in sorted(src.rglob("*.ts*")):+ if "node_modules" in path.parts or path.name.endswith(".d.ts"):+ continue+ # Tests mock their own endpoints and name paths that are deliberately+ # not real. Including them made the gate report a WebSocket stub and a+ # branding fixture as broken console calls.+ if ".test." in path.name or ".spec." in path.name or "__tests__" in path.parts:+ continue+ text = path.read_text(encoding="utf-8", errors="replace")+ for match in pattern.finditer(text):+ url = match.group(1)+ # A trailing `${qs}` or `${suffix}` is a query string, not a path+ # segment. Substituting a segment for it invented a path nobody+ # calls, which is a finding about this gate rather than the tree.+ url = re.sub(r"\$\{(?:qs|suffix|query|params|search)[^}]*\}$", "", url)+ url = url.split("?")[0].rstrip("/")+ # `/api/v1/*` and friends are globs in a comment or a route table,+ # not call sites.+ if not url or url.endswith("*"):+ continue+ found.setdefault(url, path.relative_to(root).as_posix())+ return found+++def _rewrites(root: pathlib.Path) -> list[tuple[str, str]]:+ """`(source, destination-host-expression)` pairs from the Next config.++ Read with a regex rather than by executing the config, because the+ config reads environment variables and importing it would make the+ gate's answer depend on the shell it ran in.++ The destination matters, and getting that wrong made the first version+ of this gate useless. `/api/v1/:path*` routes everything not matched+ earlier to the API service, so treating any rewrite as proof that a+ path resolves meant **every** console path passed, including the seven+ compliance calls to routes that did not exist. A rewrite is a statement+ about where a request goes, not that anything answers it.+ """+ config = root / NEXT_CONFIG+ if not config.is_file():+ return []+ text = config.read_text(encoding="utf-8")+ return re.findall(+ r"source:\s*'([^']+)'\s*,\s*destination:\s*[`'\"]?\$\{(\w+)\}",+ text,+ )+++def _service_paths(root: pathlib.Path, service: str) -> set[str]:+ """Paths one FastAPI service publishes, from its own OpenAPI document."""+ script = "import json,sys;sys.path.insert(0,'.');from app.main import app;print(json.dumps(sorted(app.openapi().get('paths',{}))))"+ try:+ out = _run_isolated([sys.executable, "-c", script], cwd=root / "services" / service, timeout=90)+ except (OSError, subprocess.TimeoutExpired):+ return set()+ if out is None:+ return set()+ for line in reversed(out.stdout.splitlines()):+ line = line.strip()+ if line.startswith("["):+ try:+ return set(json.loads(line))+ except json.JSONDecodeError:+ continue+ return set()+++def _to_regex(pattern: str) -> re.Pattern[str]:+ """A route or rewrite pattern as a matcher over a console path."""+ # Next `:param*` is a catch-all; `:param` and FastAPI `{param}` are one+ # segment each.+ out = []+ i = 0+ while i < len(pattern):+ char = pattern[i]+ if char == "{":+ end = pattern.find("}", i)+ out.append("[^/]+")+ i = (end + 1) if end != -1 else i + 1+ continue+ if char == ":":+ j = i + 1+ while j < len(pattern) and (pattern[j].isalnum() or pattern[j] == "_"):+ j += 1+ if j < len(pattern) and pattern[j] == "*":+ out.append(".*")+ i = j + 1+ else:+ out.append("[^/]+")+ i = j+ continue+ out.append(re.escape(char))+ i += 1+ return re.compile("^" + "".join(out) + "$")+++def inspect(root: pathlib.Path) -> Report:+ report = Report()+ console = _console_paths(root)+ report.console_paths = set(console)++ rewrites = _rewrites(root)+ report.rewrites = len(rewrites)+ api = _service_paths(root, "api")+ agents = _service_paths(root, "agents")+ report.api_routes, report.agents_routes = len(api), len(agents)++ api_matchers = [_to_regex(p) for p in sorted(api)]+ agents_matchers = [_to_regex(p) for p in sorted(agents)]++ # A rewrite pointing at a service this gate can introspect proves+ # nothing on its own; the service has to serve the path. A rewrite+ # pointing at one it cannot (realtime, fusion, osquery, honeytokens,+ # purple-team) is accepted as routing, which is the honest limit and is+ # printed rather than hidden.+ INTROSPECTABLE = {"API_HOST": api_matchers, "AGENTS_HOST": agents_matchers}+ opaque_rewrites = [_to_regex(src) for src, host in rewrites if host not in INTROSPECTABLE]+ report.opaque_rewrites = len(opaque_rewrites)++ def resolves(probe: str) -> bool:+ for src, host in rewrites:+ if not _to_regex(src).match(probe):+ continue+ matchers = INTROSPECTABLE.get(host)+ if matchers is None:+ return True # routed to a service this gate cannot read+ return any(m.match(probe) for m in matchers)+ # No rewrite claims it, so it is served by the API directly or by+ # nothing.+ return any(m.match(probe) for m in api_matchers)++ public = root / PUBLIC_DIR++ used_allowlist: set[str] = set()+ for url, where in sorted(console.items()):+ # A template segment stands for any one segment.+ probe = _TEMPLATE.sub("X", url)+ if resolves(probe):+ continue+ if (public / probe.lstrip("/")).exists():+ continue+ if url in KNOWN_UNRESOLVED:+ used_allowlist.add(url)+ continue+ report.unresolved.append((url, where))++ report.stale_allowlist = [u for u in KNOWN_UNRESOLVED if u not in used_allowlist]+ return report+++def _verdict(report: Report) -> int:+ if not report.console_paths:+ print(+ "check_console_route_contract: found no /api/v1 path in the console, which "+ "means the source tree was not read. Refusing to report that as clean.",+ file=sys.stderr,+ )+ return 2+ if not (report.api_routes or report.agents_routes):+ print(+ "check_console_route_contract: neither service published a route. Every console "+ "path would resolve to nothing, which is a broken probe rather than a finding.",+ file=sys.stderr,+ )+ return 2++ if report.stale_allowlist:+ print("check_console_route_contract: allowlist entries whose path has gone:", file=sys.stderr)+ for url in report.stale_allowlist:+ print(f" {url}", file=sys.stderr)+ return 1++ if report.unresolved:+ print(+ f"check_console_route_contract: {len(report.unresolved)} console path(s) resolve "+ "to no backend route, no rewrite and no static file:",+ file=sys.stderr,+ )+ for url, where in report.unresolved:+ print(f" {url}\n called from {where}", file=sys.stderr)+ return 1++ print(+ f"check_console_route_contract: OK — {len(report.console_paths)} console path(s) all "+ f"resolve, against {report.api_routes} API route(s), {report.agents_routes} agents "+ f"route(s) and {report.rewrites} rewrite(s). A rewrite is only proof of routing: "+ f"{report.opaque_rewrites} point at a service this gate cannot introspect and are "+ f"accepted on that basis."+ )+ return 0+++def self_test() -> int:+ root = repo_root()+ report = inspect(root)+ extra: list[tuple[str, bool]] = [+ ("the real tree resolves every console path", not report.unresolved),+ (+ f"it read a real corpus ({len(report.console_paths)} paths, {report.api_routes} API routes)",+ len(report.console_paths) > 50 and report.api_routes > 50,+ ),+ ]++ # The matcher, in both directions.+ cases = [+ ("a templated segment matches a path parameter", "/api/v1/cases/{case_id}", "/api/v1/cases/X", True),+ ("a catch-all rewrite matches a deep path", "/api/v1/hunt/:path*", "/api/v1/hunt/a/b", True),+ ("a one-segment parameter does not match two", "/api/v1/cases/{id}", "/api/v1/cases/a/b", False),+ ("a literal does not match a different literal", "/api/v1/alerts", "/api/v1/cases", False),+ ]+ for description, pattern, probe, expected in cases:+ extra.append((description, bool(_to_regex(pattern).match(probe)) is expected))++ # And the detector: a path nothing serves must be reported.+ import tempfile++ with tempfile.TemporaryDirectory(prefix="aisoc-route-contract-") as tmp:+ fake = pathlib.Path(tmp)+ (fake / CONSOLE_SRC).mkdir(parents=True)+ (fake / CONSOLE_SRC / "x.ts").write_text("const a = '/api/v1/this-route-does-not-exist';\n", encoding="utf-8")+ (fake / NEXT_CONFIG).parent.mkdir(parents=True, exist_ok=True)+ (fake / NEXT_CONFIG).write_text("module.exports = {};\n", encoding="utf-8")+ probe_report = inspect(fake)+ # No services under that root, so the vacuity guard fires first,+ # which is itself the behaviour to confirm.+ extra.append(("refuses a tree whose services publish no route", _verdict(probe_report) == 2))++ return self_test_main(pathlib.Path(__file__).name, ["--check"], extra)+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--check", action="store_true")+ parser.add_argument("--list-unused", action="store_true", help="report paths no component calls")+ parser.add_argument(SELF_TEST_FLAG, action="store_true", dest="self_test")+ args = parser.parse_args()+ if args.self_test:+ return self_test()+ return _verdict(inspect(repo_root()))+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/scripts/check_module_reachability.py b/scripts/check_module_reachability.pynew file mode 100644index 000000000..06456210c--- /dev/null+++ b/scripts/check_module_reachability.py@@ -0,0 +1,410 @@+#!/usr/bin/env python3+"""Every service module has a production importer, or a written reason.++Why this exists+---------------+The gates in this repository certify functions, not call paths. A claim row+can pass on a unit test of a module nothing imports, and that is not a+hypothetical failure: the capability review at `v14.0.0` found a large share+of the product built and dark. The hunting agent had no caller outside its+own test. `PostActionVerifier` had none at all. `run_with_tools` was a+working ReAct loop with zero production callers. The console's per-action+closure thresholds were read only by an unused module.++In each case a test passed, a claim row cited it, and the code never ran.++What "reachable" means here+---------------------------+A module is reachable when a path exists from an **entry point** to it+through ordinary imports. Entry points are the things a deployment actually+starts: a service's `main`, a worker, a CLI, a migration runner, a conftest+for the suites CI runs.++Test files are **not** entry points. That is the whole point: a module+imported only by its own test is exactly the shape this gate exists to+find, and counting the test would make the gate agree with the defect.++Dynamic imports+---------------+`importlib.import_module(name)` with a computed name cannot be followed+statically. Where a module is loaded that way, the loader is named in+`DYNAMIC_LOADERS` and the modules it reaches are treated as reachable from+it, so a plugin directory does not read as dead. A loader that stops being+used fails the gate, because the entry would then be excusing nothing.+"""++from __future__ import annotations++import argparse+import ast+import pathlib+import sys+from collections import deque+from dataclasses import dataclass, field++sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))++from gate_toolkit import SELF_TEST_FLAG, repo_root, self_test_main # noqa: E402++#: Files a deployment starts. Relative to each service directory.+ENTRY_POINT_NAMES = (+ "app/main.py",+ "app/__main__.py",+ "main.py",+ "serve.py",+ "app/worker.py",+ "app/cli.py",+ # Migration runners, started by a command rather than imported. Three+ # services ship one and all three read as dead without this.+ "app/_migrate.py",+ "app/db/env.py",+ "alembic/env.py",+)++#: Any module under one of these, within a service, is an entry point: these+#: are started by a command rather than imported by one.+ENTRY_POINT_DIRS = (+ "app/scripts",+ "app/workers",+ "alembic",+ # Alembic revisions are discovered and executed by the runner, never+ # imported by name.+ "app/db/versions",+ "alembic/versions",+)++#: Loaders that import by computed name. Each maps to the directory whose+#: modules it reaches.+DYNAMIC_LOADERS: dict[str, tuple[str, ...]] = {+ "services/api/app/services/plugin_manager.py": ("services/api/app/plugins",),+ "services/connectors/app/connectors/__init__.py": ("services/connectors/app/connectors",),+}++#: Modules with no production importer, each with the reason. May only+#: shrink: an entry whose module has gone, or which has since become+#: reachable, fails the gate rather than lingering as an excuse.+ALLOWED_UNREACHABLE: dict[str, str] = {+ # ── Named by the parity plan, restored by a later phase ───────────────+ "services/agents/app/hunt/agent.py": (+ "The NL hunting agent. Only its own test imports it, which is the "+ "defect the plan records. Wired to the console and MCP by parity 6.1."+ ),+ "services/agents/app/hunt/plan.py": "The hunting agent's plan model, reached only through it. Parity 6.1.",+ "services/agents/app/privacy/__init__.py": "Package marker for the pseudonymizer below.",+ "services/agents/app/privacy/redactor.py": (+ "The reversible pseudonymizer. It exists, is unit-tested, and sits on "+ "no LLM path, which is why claim-matrix row 19 was narrowed in parity "+ "1.1. Routed through the contract layer by parity 2.4."+ ),+ "services/agents/app/policy/__init__.py": "Package marker for the guardrails below.",+ "services/agents/app/policy/guardrails.py": (+ "Reads the console's per-action closure thresholds, and nothing reads "+ "it. Parity 2.1 decides whether the new closure-policy table wires "+ "this path or replaces it."+ ),+ "services/actions/app/services/unified_autonomy.py": (+ "Unified autonomy policy: maps a verdict and confidence onto an "+ "action tier. Not on the dispatch path. Parity 2.1 and 2.2 govern "+ "closure and dispatch, and decide whether this is the mechanism."+ ),+ "services/actions/app/services/autonomy_evidence_rules.py": ("Evidence rules for the same unresolved autonomy path as above."),+ # ── Vendor clients reached only through a capability executor ─────────+ # These are constructed by name at dispatch time, not imported. The+ # import graph cannot see that, and inventing a dynamic-loader entry for+ # a factory that takes a string would excuse more than it explains.+ "services/actions/app/clients/aisoc_direct_client.py": "Vendor client, constructed by capability name at dispatch.",+ "services/actions/app/clients/fleetdm_client.py": "Vendor client, constructed by capability name at dispatch.",+ "services/actions/app/clients/osctrl_client.py": "Vendor client, constructed by capability name at dispatch.",+ "services/actions/app/clients/osquery_allowlist.py": "Query allowlist, read by the osquery clients above.",+ # ── Built, never wired, and no plan item claims them ──────────────────+ # Recorded rather than deleted: deleting working code is a product+ # decision, and each of these is a complete implementation with tests.+ # Listing them is what makes the decision visible.+ "services/agents/app/agents/tool_loop.py": (+ "A re-export kept for import compatibility after the loop moved to "+ "app.llm.tool_loop. Nothing imports the old path any more, so this "+ "is a compatibility shim with nothing left to be compatible with."+ ),+ "services/agents/app/routing/cascade.py": "Cost-aware model cascade. Complete, tested, no caller.",+ "services/agents/app/orchestrator/planner.py": "Specialist planner, scored agent selection. Complete, tested, no caller.",+ "services/agents/app/swarm/__init__.py": "Package marker for the swarm modules below.",+ "services/agents/app/swarm/swarm.py": "Parallel competing-hypothesis agents. Complete, tested, no caller.",+ "services/agents/app/swarm/complexity.py": "Complexity scoring for the swarm above.",+ "services/agents/app/swarm/debate.py": "Debate resolution for the swarm above.",+ "services/agents/app/swarm/hypotheses.py": "Hypothesis generation for the swarm above.",+ "services/api/app/models/compliance.py": (+ "ORM model with no importer. The compliance routes use raw SQL "+ "against aisoc_compliance_evidence, so this model describes a table "+ "nothing maps through it."+ ),+ "services/api/app/services/compliance.py": (+ "Not the module the compliance routes use; that is compliance_mapping.py. A second compliance implementation with no caller."+ ),+ "services/api/app/services/detections/__init__.py": "Package marker for the two importers below.",+ "services/api/app/services/detections/ocsf_mapping.py": "OCSF field mapping for detection import. No caller.",+ "services/api/app/services/detections/sigma_import.py": (+ "Sigma importer. The shipped Sigma path is scripts/compile_sigma_ruleset.py, which runs at build time."+ ),+ "services/api/app/db/vector_migrations.py": (+ "Qdrant migration runner. Nothing in any compose path invokes it, which is the same gap recorded for the other migration chains."+ ),+ "services/fusion/app/memory/cli.py": "A CLI with no console-scripts entry and no caller.",+ "services/mesh/app/consensus.py": "Federation consensus. Complete, no caller.",+ "services/slack-bot/app/services/hmac_verify.py": "Signature verification helper with no caller.",+ "services/osquery-tls/app/api/v1/endpoints/extensions.py": (+ "A route module that is mounted by no router, so none of its routes "+ "is served. Reported here rather than silently, because an unmounted "+ "route module is indistinguishable from a working one in review."+ ),+ "services/purple-team/app/adversary/__init__.py": "Package marker for the adversary modules below.",+ "services/purple-team/app/adversary/campaign.py": "Adversary campaign model. No caller.",+ "services/purple-team/app/adversary/canned.py": "Canned adversary scenarios. No caller.",+ "services/purple-team/app/adversary/dac.py": "Detection-as-code evaluation. No caller.",+ "services/purple-team/app/adversary/planner.py": "Adversary planner. No caller.",+ "services/purple-team/app/adversary/scope_guard.py": "Scope guard for adversary emulation. No caller.",+ "services/purple-team/app/adversary/scoreboard.py": "Adversary scoreboard. No caller.",+}+++@dataclass+class Report:+ modules: int = 0+ entry_points: int = 0+ reachable: int = 0+ unreachable: list[str] = field(default_factory=list)+ stale_allowlist: list[str] = field(default_factory=list)+++def _service_dirs(root: pathlib.Path) -> list[pathlib.Path]:+ services = root / "services"+ if not services.is_dir():+ return []+ return [p for p in sorted(services.iterdir()) if (p / "app").is_dir() or (p / "main.py").is_file()]+++def _is_test(path: pathlib.Path) -> bool:+ parts = path.parts+ return (+ "tests" in parts or "test" in parts or path.name.startswith("test_") or path.name.endswith("_test.py") or path.name == "conftest.py"+ )+++def _module_name(service: pathlib.Path, path: pathlib.Path) -> str:+ rel = path.relative_to(service).with_suffix("")+ parts = list(rel.parts)+ if parts and parts[-1] == "__init__":+ parts.pop()+ return ".".join(parts)+++def _imports(path: pathlib.Path, module: str) -> set[str]:+ """Module names this file imports, absolute and relative resolved."""+ try:+ tree = ast.parse(path.read_text(encoding="utf-8", errors="replace"))+ except (SyntaxError, OSError):+ return set()+ # A package's `__init__` *is* its package, so `from .x import Y` inside+ # `app/live_actions/__init__.py` means `app.live_actions.x`. Computing+ # the parent instead resolved it to `app.x`, which exists nowhere, and+ # every module a package re-exported read as unreachable.+ if path.name == "__init__.py":+ package = module+ else:+ package = module.rsplit(".", 1)[0] if "." in module else ""+ out: set[str] = set()+ for node in ast.walk(tree):+ if isinstance(node, ast.Import):+ for alias in node.names:+ out.add(alias.name)+ elif isinstance(node, ast.ImportFrom):+ if node.level:+ # Relative. `from . import x` inside `a.b.c` means `a.b.x`.+ base = package+ for _ in range(node.level - 1):+ base = base.rsplit(".", 1)[0] if "." in base else ""+ target = f"{base}.{node.module}" if node.module else base+ else:+ target = node.module or ""+ if target:+ out.add(target)+ for alias in node.names:+ out.add(f"{target}.{alias.name}")+ return out+++def inspect(root: pathlib.Path) -> Report:+ report = Report()+ used_allowlist: set[str] = set()++ for service in _service_dirs(root):+ files = [p for p in sorted(service.rglob("*.py")) if not _is_test(p) and "__pycache__" not in p.parts and "_vendor" not in p.parts]+ if not files:+ continue++ by_name: dict[str, pathlib.Path] = {}+ for path in files:+ by_name[_module_name(service, path)] = path+ report.modules += len(by_name)++ entries: set[str] = set()+ for name, path in by_name.items():+ rel = path.relative_to(service).as_posix()+ if rel in ENTRY_POINT_NAMES or any(rel.startswith(d + "/") for d in ENTRY_POINT_DIRS):+ entries.add(name)+ report.entry_points += len(entries)++ # Dynamic loaders reach whole directories.+ extra_edges: dict[str, set[str]] = {}+ for loader_rel, targets in DYNAMIC_LOADERS.items():+ loader = root / loader_rel+ if not loader.is_file() or service not in loader.parents:+ continue+ loader_name = _module_name(service, loader)+ reached = set()+ for target_rel in targets:+ target = root / target_rel+ if not target.is_dir():+ continue+ for path in target.rglob("*.py"):+ if not _is_test(path) and "__pycache__" not in path.parts:+ reached.add(_module_name(service, path))+ extra_edges[loader_name] = reached++ # Walk from the entry points.+ seen: set[str] = set()+ queue = deque(entries)+ while queue:+ name = queue.popleft()+ if name in seen or name not in by_name:+ continue+ seen.add(name)+ # `imported` rather than `target`: the dynamic-loader block+ # above binds `target` to a Path in the same function scope, and+ # reusing the name made the type checker read a module string as+ # a filesystem path.+ for imported in _imports(by_name[name], name) | extra_edges.get(name, set()):+ # Resolve the longest prefix that names a real module, so+ # `from app.a.b import C` reaches `app.a.b` and not `C`.+ candidate = imported+ while candidate and candidate not in by_name:+ candidate = candidate.rsplit(".", 1)[0] if "." in candidate else ""+ if not candidate:+ continue+ queue.append(candidate)+ # Importing `a.b.c` executes `a/__init__.py` and+ # `a/b/__init__.py` as well. Without this, 78 package+ # markers read as dead code purely because nothing names+ # them directly.+ parent = candidate+ while "." in parent:+ parent = parent.rsplit(".", 1)[0]+ if parent in by_name:+ queue.append(parent)++ report.reachable += len(seen)+ for name, path in sorted(by_name.items()):+ if name in seen or not name:+ continue+ rel = path.relative_to(root).as_posix()+ if rel in ALLOWED_UNREACHABLE:+ used_allowlist.add(rel)+ continue+ report.unreachable.append(rel)++ report.stale_allowlist = [r for r in ALLOWED_UNREACHABLE if r not in used_allowlist]+ return report+++def _verdict(report: Report) -> int:+ if report.modules == 0 or report.entry_points == 0:+ print(+ "check_module_reachability: found no service modules or no entry points, so every "+ "module would read as unreachable. That is a broken probe, not a finding.",+ file=sys.stderr,+ )+ return 2++ if report.stale_allowlist:+ print(+ "check_module_reachability: allowlist entries that no longer describe an unreachable module:",+ file=sys.stderr,+ )+ for rel in report.stale_allowlist:+ print(f" {rel}", file=sys.stderr)+ print("Remove them; the allowlist may only shrink.", file=sys.stderr)+ return 1++ if report.unreachable:+ print(+ f"check_module_reachability: {len(report.unreachable)} module(s) have no production "+ "importer. A test that imports one of these proves the code compiles, not that it "+ "runs:",+ file=sys.stderr,+ )+ for rel in report.unreachable:+ print(f" {rel}", file=sys.stderr)+ return 1++ print(+ f"check_module_reachability: OK — {report.reachable} of {report.modules} module(s) "+ f"reachable from {report.entry_points} entry point(s); "+ f"{len(ALLOWED_UNREACHABLE)} allowlisted with a reason."+ )+ return 0+++def self_test() -> int:+ import tempfile++ extra: list[tuple[str, bool]] = []++ with tempfile.TemporaryDirectory(prefix="aisoc-reach-") as tmp:+ base = pathlib.Path(tmp) / "services" / "probe" / "app"+ base.mkdir(parents=True)+ (base / "main.py").write_text("from app import used\n", encoding="utf-8")+ (base / "used.py").write_text("X = 1\n", encoding="utf-8")+ (base / "orphan.py").write_text("Y = 2\n", encoding="utf-8")+ tests = pathlib.Path(tmp) / "services" / "probe" / "tests"+ tests.mkdir(parents=True)+ (tests / "test_orphan.py").write_text("from app import orphan\n", encoding="utf-8")++ report = inspect(pathlib.Path(tmp))+ unreachable = {pathlib.Path(r).name for r in report.unreachable}+ extra.append(("an orphaned module is reported", "orphan.py" in unreachable))+ extra.append(("a module the entry point imports is not", "used.py" not in unreachable))+ extra.append(+ (+ "a test importing the orphan does not rescue it, which is the point",+ "orphan.py" in unreachable,+ )+ )++ # Transitive reach.+ (base / "used.py").write_text("from app import deep\n", encoding="utf-8")+ (base / "deep.py").write_text("Z = 3\n", encoding="utf-8")+ report = inspect(pathlib.Path(tmp))+ unreachable = {pathlib.Path(r).name for r in report.unreachable}+ extra.append(("reach is transitive", "deep.py" not in unreachable))++ report = inspect(repo_root())+ extra.append(+ (+ f"it read a real corpus ({report.modules} modules, {report.entry_points} entry points)",+ report.modules > 200 and report.entry_points > 5,+ )+ )+ return self_test_main(pathlib.Path(__file__).name, ["--check"], extra)+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--check", action="store_true")+ parser.add_argument(SELF_TEST_FLAG, action="store_true", dest="self_test")+ args = parser.parse_args()+ if args.self_test:+ return self_test()+ return _verdict(inspect(repo_root()))+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/scripts/check_profile_service_counts.py b/scripts/check_profile_service_counts.pyindex 4bb95415b..df0b348bb 100644--- a/scripts/check_profile_service_counts.py+++ b/scripts/check_profile_service_counts.py@@ -68,6 +68,13 @@ ONE_SHOT: frozenset[str] = frozenset({"ollama-pull"})#: integer near the word "services": a gate that guesses which numbers are#: claims would either miss the one that matters or flag prose forever.CLAIM_SITES: tuple[tuple[str, str, str], ...] = (+ # Three figures that had drifted to 10, fifteen and fifteen against a+ # compose file supporting neither. Registered rather than merely+ # corrected: an unregistered figure is one nobody notices going stale,+ # which is how all three got there.+ ("install.sh", "core", r"Starting the (\d+)-service CORE stack"),+ ("apps/docs/docs/deployment/walkthrough.mdx", "core", r"starts the (\d+) CORE services"),+ ("Makefile", "core", r"`missing` on all (\d+) first-party services"),# The production deployment page. `prod:full` is a separate figure from# `full` because the production stack deliberately does not start kafka-ui,# and a reader comparing the two pages would otherwise find a discrepancydiff --git a/scripts/check_route_duplicates.py b/scripts/check_route_duplicates.pynew file mode 100644index 000000000..71c5fd5a6--- /dev/null+++ b/scripts/check_route_duplicates.py@@ -0,0 +1,270 @@+#!/usr/bin/env python3+"""No two handlers register the same method and path in one app.++The blind spot this fills+------------------------+`check_route_shadowing.py` is a static AST pass, deliberately: one run reads+every service without needing any of them importable. Its own docstring+records what that costs, at line 27:++ Two modules included under one prefix can shadow each other and this+ will not see it.++That is not a theoretical gap. `services/agents` registered+`GET /api/v1/investigations/{run_id}` **twice**, from `app/api/router.py`+and `app/api/investigate.py`, each reading its own in-memory store. The one+included first answered every request, from the store the other module+writes, so console status polling returned 404 for runs that existed while+the sibling report routes under the same prefix worked.++The static pass could not see it for two reasons, both structural: it groups+by `(service, path, router)` and the two declared paths differ before+mounting (`/investigations/{run_id}` against `/api/v1/investigations/{run_id}`,+because one prefix comes from an app-level `include_router` the AST never+sees), and its `shadows()` only fires when a parameter segment faces a+literal one, so two identical paths compare equal and report nothing.++So this is the runtime half. It imports each app and reads the assembled+route table, which is the only place the prefixes are resolved.++Why it reads `app.router.routes` and counts what it found+---------------------------------------------------------+`app.openapi()` is the right corpus for asking *which paths exist*, and the+wrong one here: it keys paths in a dict, so a duplicate is silently+collapsed into one entry, which is exactly the thing being looked for.++Reading the router instead carries a known hazard. On FastAPI 0.141.x+`include_router` leaves an opaque object in `app.routes` and the `APIRoute`+count is zero, which has already made one gate in this repository compare+zero pairs and report success over an app serving 456 operations. So an app+that yields no routes is a failure here, not a pass.+"""++from __future__ import annotations++import argparse+import collections+import json+import pathlib+import subprocess+import sys+from dataclasses import dataclass, field++sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))++from gate_toolkit import SELF_TEST_FLAG, repo_root, self_test_main # noqa: E402++#: Services with an importable FastAPI app.+SERVICES = ("api", "agents", "actions", "fusion", "connectors", "threatintel")++#: Duplicate pairs that are intentional, each with the reason. May only+#: shrink.+ALLOWED_DUPLICATES: dict[str, str] = {}++_COLLECT = """+import json, sys+sys.path.insert(0, '.')+from app.main import app+rows = []+for route in app.router.routes:+ path = getattr(route, 'path', None)+ methods = getattr(route, 'methods', None)+ if not path or not methods:+ continue+ name = getattr(route, 'name', '?')+ module = getattr(getattr(route, 'endpoint', None), '__module__', '?')+ for method in sorted(methods):+ rows.append([method, path, name, module])+print('@@ROUTES@@' + json.dumps(rows))+"""+++def _run_isolated(argv: list[str], *, cwd: pathlib.Path, timeout: int):+ """Run a probe in its own process group, and kill the group on timeout.++ Not a fix for an observed hang. A CI job appeared stuck on this step+ for ninety minutes and the diagnosis was that a grandchild holding the+ pipes defeats `subprocess.run(timeout=...)`; that was **wrong**, proven+ by reproducing the shape and watching the plain call time out in three+ seconds. The job had in fact completed in 23 minutes and the GitHub+ API was reporting a stale state.++ Kept anyway, for two reasons that stand on their own: killing the+ process group closes every inherited pipe rather than only the child's,+ which is correct even where the plain call happens to cope; and+ `stdin` is closed, so a probe that decides to prompt dies instead of+ waiting. The timeout also drops from 240s to 90s, which caps the worst+ case at six minutes across six services rather than twenty-four.+ """+ import os+ import signal++ process = subprocess.Popen( # noqa: S603+ argv,+ cwd=cwd,+ stdin=subprocess.DEVNULL,+ stdout=subprocess.PIPE,+ stderr=subprocess.PIPE,+ text=True,+ start_new_session=True,+ )+ try:+ stdout, stderr = process.communicate(timeout=timeout)+ except subprocess.TimeoutExpired:+ try:+ os.killpg(os.getpgid(process.pid), signal.SIGKILL)+ except (ProcessLookupError, PermissionError):+ process.kill()+ process.communicate()+ return None+ return subprocess.CompletedProcess(argv, process.returncode, stdout, stderr)+++@dataclass+class Report:+ scanned: dict[str, int] = field(default_factory=dict)+ duplicates: list[tuple[str, str, str, list[str]]] = field(default_factory=list)+ unimportable: list[str] = field(default_factory=list)+ empty: list[str] = field(default_factory=list)+ stale_allowlist: list[str] = field(default_factory=list)+++def _routes(root: pathlib.Path, service: str) -> list[list[str]] | None:+ directory = root / "services" / service+ if not (directory / "app" / "main.py").is_file():+ return None+ try:+ out = _run_isolated([sys.executable, "-c", _COLLECT], cwd=directory, timeout=90)+ except (OSError, subprocess.TimeoutExpired):+ return None+ if out is None:+ return None+ for line in out.stdout.splitlines():+ if line.startswith("@@ROUTES@@"):+ try:+ return json.loads(line[len("@@ROUTES@@") :])+ except json.JSONDecodeError:+ return None+ return None+++def inspect(root: pathlib.Path) -> Report:+ report = Report()+ used_allowlist: set[str] = set()++ for service in SERVICES:+ rows = _routes(root, service)+ if rows is None:+ if (root / "services" / service / "app" / "main.py").is_file():+ report.unimportable.append(service)+ continue+ report.scanned[service] = len(rows)+ if not rows:+ # An app that assembled no route is a broken probe. This is the+ # FastAPI-minor hazard in the module docstring.+ report.empty.append(service)+ continue++ seen: dict[tuple[str, str], list[str]] = collections.defaultdict(list)+ for method, path, name, module in rows:+ seen[(method, path)].append(f"{module}.{name}")+ for (method, path), owners in sorted(seen.items()):+ if len(owners) < 2:+ continue+ key = f"{service} {method} {path}"+ if key in ALLOWED_DUPLICATES:+ used_allowlist.add(key)+ continue+ report.duplicates.append((service, method, path, owners))++ report.stale_allowlist = [k for k in ALLOWED_DUPLICATES if k not in used_allowlist]+ return report+++def _verdict(report: Report) -> int:+ if not report.scanned:+ print(+ "check_route_duplicates: no service produced a route table, so nothing was compared. That is a broken probe, not a clean tree.",+ file=sys.stderr,+ )+ return 2++ failed = False+ if report.empty:+ print(+ "check_route_duplicates: these apps imported and yielded zero routes, which on "+ f"FastAPI 0.141.x is what an opaque `_IncludedRouter` looks like: {report.empty}",+ file=sys.stderr,+ )+ failed = True++ if report.stale_allowlist:+ print("check_route_duplicates: allowlisted pairs that are no longer duplicated:", file=sys.stderr)+ for key in report.stale_allowlist:+ print(f" {key}", file=sys.stderr)+ failed = True++ if report.duplicates:+ print(+ f"check_route_duplicates: {len(report.duplicates)} method and path pair(s) are "+ "registered twice. The one included first answers every request, and the other "+ "handler's state is unreachable:",+ file=sys.stderr,+ )+ for service, method, path, owners in report.duplicates:+ print(f" {service}: {method} {path}", file=sys.stderr)+ for owner in owners:+ print(f" {owner}", file=sys.stderr)+ failed = True++ if failed:+ return 1++ total = sum(report.scanned.values())+ summary = ", ".join(f"{s} {n}" for s, n in sorted(report.scanned.items()))+ # Named, not counted. "2 services not importable" tells a reader+ # nothing about whether the one they care about was checked.+ note = f". NOT CHECKED (could not import): {', '.join(sorted(report.unimportable))}" if report.unimportable else ""+ print(+ f"check_route_duplicates: OK — {total} route registration(s) across "+ f"{len(report.scanned)} service(s) ({summary}), no pair registered twice{note}."+ )+ return 0+++def self_test() -> int:+ root = repo_root()+ report = inspect(root)+ extra: list[tuple[str, bool]] = [+ ("the real tree has no duplicate pair", not report.duplicates),+ (+ f"it read a real corpus ({sum(report.scanned.values())} registrations across {len(report.scanned)} services)",+ sum(report.scanned.values()) >= 20 and len(report.scanned) >= 2,+ ),+ ("no app yielded zero routes, which would be the FastAPI-minor trap", not report.empty),+ ]++ # The detector itself: inject a duplicate into a synthetic table.+ rows = [["GET", "/a", "one", "mod_a"], ["GET", "/a", "two", "mod_b"], ["GET", "/b", "three", "mod_c"]]+ seen: dict[tuple[str, str], list[str]] = collections.defaultdict(list)+ for method, path, name, module in rows:+ seen[(method, path)].append(f"{module}.{name}")+ dupes = [k for k, v in seen.items() if len(v) > 1]+ extra.append(("two handlers on one method and path are reported", dupes == [("GET", "/a")]))+ extra.append(("a single handler is not", ("GET", "/b") not in dupes))++ return self_test_main(pathlib.Path(__file__).name, ["--check"], extra)+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--check", action="store_true")+ parser.add_argument(SELF_TEST_FLAG, action="store_true", dest="self_test")+ args = parser.parse_args()+ if args.self_test:+ return self_test()+ return _verdict(inspect(repo_root()))+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/scripts/mypy_baseline.json b/scripts/mypy_baseline.jsonindex ec1b538fb..44ae4299e 100644--- a/scripts/mypy_baseline.json+++ b/scripts/mypy_baseline.json@@ -34,8 +34,7 @@"assignment": 1},"scripts/run_evals.py": {- "attr-defined": 9,- "index": 13,+ "attr-defined": 3,"no-redef": 1},"scripts/upgrade_playbooks.py": {diff --git a/scripts/run_evals.py b/scripts/run_evals.pyindex 38050f309..96665e7d6 100644--- a/scripts/run_evals.py+++ b/scripts/run_evals.py@@ -58,6 +58,7 @@ import sysimport timefrom datetime import UTC, datetimefrom pathlib import Path+from typing import Any, cast# `scripts/` is on sys.path when this file is run as a program, but not when a# test loads it by path with importlib. gate_toolkit sits beside it either way.@@ -1079,7 +1080,7 @@ def main() -> None:if args.json:print(json.dumps(summary, indent=2))elif args.telemetry_only:- pi = summary["per_investigation"]+ pi = cast(dict[str, Any], summary["per_investigation"])print()print("=" * 78)print(" AiSOC Eval - per-investigation telemetry (deterministic substrate)")@@ -1092,14 +1093,14 @@ def main() -> None:)print(f" Incidents: {pi['incidents']} Templates: {pi['templates']}")print("-" * 78)- tok = pi["tokens_per_investigation"]+ tok = cast(dict[str, Any], pi["tokens_per_investigation"])print(f" Tokens / investigation: mean={tok['mean']:.0f} median={tok['median']:.0f} p95={tok['p95']:.0f} p99={tok['p99']:.0f}")print(f" prompt mean={tok['prompt_mean']:.0f} completion mean={tok['completion_mean']:.0f}")- usd = pi["usd_per_investigation"]+ usd = cast(dict[str, Any], pi["usd_per_investigation"])print(f" USD / investigation: mean=${usd['mean']:.5f} median=${usd['median']:.5f} p95=${usd['p95']:.5f} p99=${usd['p99']:.5f}")- lat = pi["latency_per_investigation_ms"]+ lat = cast(dict[str, Any], pi["latency_per_investigation_ms"])print(f" Latency (ms / inv): p50={lat['p50']:.4f} p95={lat['p95']:.4f} p99={lat['p99']:.4f} (substrate-only path)")print("=" * 78)try:@@ -1134,7 +1135,7 @@ def main() -> None:suffix = "..." if fail_count > 5 else ""print(f" regressions: {failing}{suffix}")print("-" * 78)- tele = summary["telemetry"]+ tele = cast(dict[str, Any], summary["telemetry"])if tele.get("present"):print(f" Synthetic telemetry: {tele['events']} events across "@@ -1145,7 +1146,7 @@ def main() -> None:else:print(" Synthetic telemetry: <not generated>")print("-" * 78)- pi = summary.get("per_investigation") or {}+ pi = cast(dict[str, Any], summary.get("per_investigation") or {})if pi:tok = pi.get("tokens_per_investigation", {})usd = pi.get("usd_per_investigation", {})@@ -1169,7 +1170,7 @@ def main() -> None:else:verdict = "FAIL — REGRESSION DETECTED" if args.suite == "all" else f"FAIL — {args.suite} regressed"print(f" {verdict}")- cmp = summary.get("baseline_compare")+ cmp = cast(dict[str, Any] | None, summary.get("baseline_compare"))if cmp and cmp.get("available"):arrow = "DROP" if cmp["regressed"] else "OK"print(diff --git a/scripts/security_audit_ignores.txt b/scripts/security_audit_ignores.txtindex 705127ce8..6cd0c0a6a 100644--- a/scripts/security_audit_ignores.txt+++ b/scripts/security_audit_ignores.txt@@ -126,3 +126,34 @@# Retire these when metro adopts image-size >= 2.0.3.pnpm|GHSA-5p2g-fcmc-qvqq|apps/mobile resolves image-size 1.2.1 through metro 0.83.3; no 1.x fix exists, metro through 0.87.1 still requires ^1.0.2, and image-size 2.x drops the callable default export metro calls in Assets.js. DoS-only and build-time, reachable only from an image already committed to this repo|2026-12-23pnpm|GHSA-w3rx-r6r6-pgpr|apps/mobile resolves image-size 1.2.1 through metro 0.83.3; no 1.x fix exists, metro through 0.87.1 still requires ^1.0.2, and image-size 2.x drops the callable default export metro calls in Assets.js. DoS-only and build-time, reachable only from an image already committed to this repo|2026-12-23++# ── 2026-10-01: a third apps/mobile entry, for an advisory with no fix ─────+#+# The two image-size entries above are the same shape and the same+# reasoning: a build-time dependency of the React Native app, excluded from+# the workspace, with no upstream fix. This is the third.+#+# GHSA-86w9-cpqp-85rv, node-forge RSA PKCS#1 v1.5 signature verification+# accepts extra nested DigestAlgorithm elements. High severity, published+# while this batch was in flight: the same branch passed `security-audit` at+# 23:49 and failed at 00:01 with no dependency change.+#+# Three facts, each checked rather than asserted:+#+# 1. **There is no patched version.** The advisory's+# `first_patched_version` is null, so this cannot be resolved by a+# bump. That is why it is suppressed rather than fixed.+#+# 2. **It is in no AiSOC service image.** `[email protected]` is+# transitive via `@expo/cli` and `@expo/code-signing-certificates`+# inside `apps/mobile`, which `pnpm-workspace.yaml` excludes with+# `"!apps/mobile"` and which appears in no Dockerfile. The root+# lockfile does not contain it at all.+#+# 3. **`apps/mobile` releases through an app store**, not this+# repository, and the Expo CLI is build-time tooling for that release.+#+# Deliberately NOT scoped out of the audit instead: `apps/mobile` is real+# released code and `pnpm_install_roots` scans every lockfile on purpose, so+# excluding it would hide every future advisory there.+pnpm|GHSA-86w9-cpqp-85rv|No patched version exists upstream. Transitive via @expo/cli in apps/mobile, which pnpm-workspace.yaml excludes and no Dockerfile builds; absent from the root lockfile and from every service image.|2026-12-29diff --git a/services/agents/app/agents/auto_triage_agent.py b/services/agents/app/agents/auto_triage_agent.pyindex 598e9c648..407b979fc 100644--- a/services/agents/app/agents/auto_triage_agent.py+++ b/services/agents/app/agents/auto_triage_agent.py@@ -11,7 +11,9 @@ FP / benign / benign_true_positive verdicts are auto-closed; true_positive andneeds_review escalate into the full triage → enrichment → investigationpipeline.-Metrics (module-level counters) are exposed via the /triage/stats API.+Metrics are module-level counters. **No route exposes them**: the+``/triage/stats`` endpoint this used to name has never existed in the tree.+They are read in-process and by tests."""from __future__ import annotationsdiff --git a/services/agents/app/api/router.py b/services/agents/app/api/router.pyindex c6cd2d442..88244001b 100644--- a/services/agents/app/api/router.py+++ b/services/agents/app/api/router.py@@ -30,7 +30,7 @@ ScopedPrincipal = Annotated[TenantPrincipal, Depends(require_console_or_service_# In-memory run store for status polling. The durable record of every step is# the Postgres Investigation Ledger (written by the shared graph runner) — this-# dict is only the fast local status cache for GET /investigations/{run_id}.+# dict is only the fast local status cache for GET /agent-runs/{run_id}._runs: dict[str, dict] = {}@@ -66,7 +66,20 @@ async def _run_investigation(run_id: str, state: InvestigationState) -> None:_runs[run_id] = {"status": "failed", "error": str(exc)}[email protected]("/investigations", response_model=InvestigationResponse)+# `/agent-runs`, not `/investigations`. Both this module and+# `app.api.investigate` registered `GET /api/v1/investigations/{run_id}`,+# each reading its own `_runs` dict, and this one is mounted first+# (`main.py` includes `router` before `investigate_router`) so it answered+# every poll from the store that the other module writes to. The result was+# a 404 for a run that existed, while the sibling report routes under the+# same prefix worked, which is why it read as a flaky console rather than a+# routing bug.+#+# `app.api.investigate` owns the lifecycle and the report routes, so it+# keeps the canonical path. This pair is the in-process orchestrator state+# and has no caller: the console's ledger reads go to the API service, which+# `apps/web/next.config.js` documents and deliberately does not rewrite here.[email protected]("/agent-runs", response_model=InvestigationResponse)async def start_investigation(request: InvestigationRequest,background_tasks: BackgroundTasks,@@ -92,7 +105,7 @@ async def start_investigation()[email protected]("/investigations/{run_id}")[email protected]("/agent-runs/{run_id}")async def get_investigation(run_id: str, principal: ScopedPrincipal):"""Get the status and results of an investigation run."""run = _runs.get(run_id)diff --git a/services/agents/app/hunt/scheduler.py b/services/agents/app/hunt/scheduler.pyindex 9b2499858..d4c420a35 100644--- a/services/agents/app/hunt/scheduler.py+++ b/services/agents/app/hunt/scheduler.py@@ -10,8 +10,11 @@ Runs the YAML hunt corpus on the cadence declared per hunt. Each tick:Telemetry source resolution — in priority order:-* ``HUNT_TELEMETRY_PROVIDER`` env var set to ``synthetic`` (the default in- dev/CI) reads from+* ``HUNT_TELEMETRY_PROVIDER`` env var set to ``synthetic``. This is the+ default **everywhere, not only in dev and CI**, and it is the only provider+ with an implementation: scheduled hunts therefore run against a fixture+ corpus rather than tenant data on every deployment. Parity plan 6.1 points+ them at federated search. It reads from``services/agents/tests/eval_data/synthetic_telemetry.jsonl`` and treatseach line as a discrete event. This is what the substrate eval uses andis what the public benchmark scoreboard scores against.diff --git a/services/api/app/api/v1/endpoints/cases.py b/services/api/app/api/v1/endpoints/cases.pyindex 6b86d90c4..8e9d21727 100644--- a/services/api/app/api/v1/endpoints/cases.py+++ b/services/api/app/api/v1/endpoints/cases.py@@ -43,7 +43,7 @@ from urllib.parse import quoteimport httpxfrom fastapi import APIRouter, Depends, HTTPException, Query, Response, status-from fastapi.responses import HTMLResponse+from fastapi.responses import HTMLResponse, PlainTextResponsefrom pydantic import BaseModel, Fieldfrom sqlalchemy import text@@ -1210,6 +1210,48 @@ async def case_investigation_run(return run+ "/{case_id}/investigations/{run_id}/report.md",+ response_class=PlainTextResponse,+ summary="Markdown incident report for one investigation run",+)+async def case_investigation_report_md(+ case_id: str,+ run_id: str,+ db: DBSession,+ user: AuthUser,+) -> PlainTextResponse:+ """The Markdown report the case workspace renders."""+ # `CaseWorkspace.tsx` fetched this from two places and the route did not+ # exist, so the report pane was permanently empty. The agents service has+ # served `/api/v1/investigations/{run_id}/report.md` all along; nothing+ # proxied it.+ #+ # Scoped in the same two steps as the sibling route above, and for the+ # same reason: that one shipped without them and any authenticated user+ # could read any run by id across tenants (GHSA-x2gf-3p79-wvgm).+ # Resolving the case proves the caller may see this case; checking the+ # run belongs to it proves the id in the path is not somebody else's run+ # smuggled under a case the caller does own.+ cid = await _resolve_case_id(case_id, db, user.tenant_id)+ safe_run_id = quote(run_id, safe="")++ meta = await _agents_proxy("GET", f"/api/v1/investigations/{safe_run_id}")+ if meta.status_code >= 400:+ raise HTTPException(status_code=meta.status_code, detail=meta.text)+ run_case_id = meta.json().get("case_id")+ if run_case_id is not None and str(run_case_id) != str(cid):+ raise HTTPException(+ status_code=status.HTTP_404_NOT_FOUND,+ detail="Investigation run not found for this case",+ )++ resp = await _agents_proxy("GET", f"/api/v1/investigations/{safe_run_id}/report.md")+ if resp.status_code >= 400:+ raise HTTPException(status_code=resp.status_code, detail=resp.text)+ return PlainTextResponse(content=resp.text, media_type="text/markdown; charset=utf-8")++# Filename sanitiser for Content-Disposition: keep only safe ASCII so the# header cannot be split with CR/LF and the value renders consistently._SAFE_FILENAME_RE = re.compile(r"[^A-Za-z0-9._-]")diff --git a/services/api/app/api/v1/endpoints/compliance_framework.py b/services/api/app/api/v1/endpoints/compliance_framework.pynew file mode 100644index 000000000..57c1be5ff--- /dev/null+++ b/services/api/app/api/v1/endpoints/compliance_framework.py@@ -0,0 +1,557 @@+"""The four per-framework compliance routes the console calls.++Why this module exists+----------------------+`apps/web/src/components/compliance/` made **eight calls to four route+shapes that did not exist**, from `FrameworkView.tsx`, `ComplianceHeatmap.tsx`+and `SOC2View.tsx`:++ GET /api/v1/compliance/{framework}+ POST /api/v1/compliance/{framework}/collect+ GET /api/v1/compliance/{framework}/heatmap+ GET /api/v1/compliance/{framework}/export++Every one answered 404, so `/compliance/[framework]` and `/compliance/soc2`+were pages that could never load.++The console also sends slugs (`soc2`, `pci-dss`) while `FRAMEWORKS` is keyed+`SOC2`, `PCI-DSS`. Both halves had to be wrong for the page to be this+broken, and fixing one would have left a 404 behind the other.++What `collect` actually does+----------------------------+The pre-existing `POST /compliance/evidence/collect` returns a job id, a+status of `queued` and nothing else: no job is created and nothing collects.+This route does not do that. It reads **real platform state** for the+controls the platform can genuinely attest, writes a real evidence row for+each, and reports every other control as `manual` with the reason.++Five automated attestations, each reading something that exists:++* the audit log is append-only and has rows;+* row-level security is enabled on the tenant-scoped tables;+* the credential vault is configured with a real key;+* a retention policy is set;+* passkey enrolment count for the tenant.++A control with no automated source is reported as needing manual evidence.+That is the honest answer, and it is more useful than a progress bar that+fills itself.+"""++from __future__ import annotations++import csv+import hashlib+import io+import json+import logging+import uuid+from datetime import UTC, datetime+from typing import Annotated, Any++from fastapi import APIRouter, Depends, HTTPException, Query, Response, status+from pydantic import BaseModel, Field+from sqlalchemy import text++from app.api.v1.deps import AuthUser, DBSession, require_permission+from app.api.v1.endpoints.compliance import FRAMEWORKS++logger = logging.getLogger(__name__)++router = APIRouter(prefix="/compliance", tags=["compliance"])++#: Console slug to `FRAMEWORKS` key. Built from the keys rather than written+#: out, so a framework added to `FRAMEWORKS` is reachable from the console+#: without a second edit here, which is exactly the drift that produced the+#: original mismatch.+SLUG_TO_KEY: dict[str, str] = {key.lower().replace("-", ""): key for key in FRAMEWORKS}+SLUG_TO_KEY.update({key.lower(): key for key in FRAMEWORKS})+++def resolve_framework(slug: str) -> str:+ """Console slug to canonical key, or 404.++ `soc2` and `SOC2` and `soc-2` all reach the same framework. An unknown+ slug is a 404 rather than an empty page, because an empty compliance+ page reads as "no evidence" and that is a claim about the tenant.+ """+ key = SLUG_TO_KEY.get(slug.lower().replace("-", "")) or SLUG_TO_KEY.get(slug.lower())+ if key is None:+ raise HTTPException(+ status_code=status.HTTP_404_NOT_FOUND,+ detail=f"Unknown framework {slug!r}. Known: {', '.join(sorted(FRAMEWORKS))}.",+ )+ return key+++class EvidenceItem(BaseModel):+ id: str+ control_id: str+ evidence_type: str+ title: str+ description: str | None = None+ status: str+ collected_at: datetime | None = None+++class Control(BaseModel):+ id: str+ framework: str+ control_id: str+ category: str+ title: str+ description: str | None = None+ #: True when the platform can attest this control from its own state.+ automatable: bool = False+++class ControlWithEvidence(BaseModel):+ control: Control+ evidence: list[EvidenceItem]+ latest_status: str = Field(description="accepted | pending | rejected | missing")+++class FrameworkSummary(BaseModel):+ total: int+ collected: int+ review: int+ approved: int+ rejected: int+ missing: int+ pct: float+++class FrameworkDetail(BaseModel):+ framework: str+ framework_name: str+ summary: FrameworkSummary+ controls: list[ControlWithEvidence]+ generated_at: datetime+++class HeatmapCell(BaseModel):+ control_id: str+ title: str+ status: str+ evidence_count: int+++class HeatmapResponse(BaseModel):+ framework: str+ cells: list[HeatmapCell]+ generated_at: datetime+++class CollectedControl(BaseModel):+ control_id: str+ outcome: str = Field(description="collected | manual")+ detail: str+++class CollectResponse(BaseModel):+ framework: str+ collected: int+ manual: int+ results: list[CollectedControl]+ collected_at: datetime+++async def _control_rows(db: DBSession, *, framework: str, tenant_id: uuid.UUID) -> dict[str, Any]:+ """Per-control evidence counts for one framework, for this tenant only."""+ query = text("""+ SELECT control_id,+ COUNT(*) AS total,+ COUNT(*) FILTER (WHERE status = 'accepted') AS accepted,+ COUNT(*) FILTER (WHERE status = 'rejected') AS rejected,+ MAX(collected_at) AS latest+ FROM aisoc_compliance_evidence+ WHERE tenant_id = :tenant_id AND framework = :fw+ GROUP BY control_id+ """).bindparams(tenant_id=tenant_id, fw=framework)+ try:+ rows = (await db.execute(query)).fetchall()+ except Exception as exc:+ logger.exception("compliance: per-control query failed")+ raise HTTPException(status_code=503, detail="Database error") from exc+ return {r.control_id: r for r in rows}+++def _latest_status(evidence: list[EvidenceItem]) -> str:+ """One control's status, from its evidence.++ `accepted` wins over everything: an auditor has signed one item off.+ A control with evidence that is all rejected is `rejected`, not+ `pending`, because "waiting for review" would overstate it.+ """+ if not evidence:+ return "missing"+ statuses = {e.status for e in evidence}+ if "accepted" in statuses:+ return "accepted"+ if statuses == {"rejected"}:+ return "rejected"+ return "pending"+++def _status_of(row: Any) -> str:+ if row is None:+ return "missing"+ if row.accepted:+ return "accepted"+ if row.rejected and not row.total - row.rejected:+ return "rejected"+ return "pending"+++# ── Automated attestations ──────────────────────────────────────────────────+#+# Each reads real state. A control not listed here reports `manual`, which is+# the honest answer rather than a gap hidden behind a default.+++async def _attest_audit_log(db: DBSession, tenant_id: uuid.UUID) -> tuple[bool, str, dict[str, Any]]:+ row = (await db.execute(text("SELECT COUNT(*) AS n FROM audit_log WHERE tenant_id = :t").bindparams(t=tenant_id))).first()+ count = int(row.n) if row else 0+ return (+ count > 0,+ f"Append-only audit log holds {count} entries for this tenant.",+ {"audit_entries": count},+ )+++async def _attest_rls(db: DBSession, tenant_id: uuid.UUID) -> tuple[bool, str, dict[str, Any]]:+ row = (+ await db.execute(+ text(+ "SELECT COUNT(*) AS n FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace "+ "WHERE n.nspname = 'public' AND c.relkind = 'r' AND c.relrowsecurity"+ )+ )+ ).first()+ count = int(row.n) if row else 0+ return (+ count > 0,+ f"Row-level security is enabled on {count} tables.",+ {"rls_tables": count},+ )+++async def _attest_vault(db: DBSession, tenant_id: uuid.UUID) -> tuple[bool, str, dict[str, Any]]:+ import os++ configured = bool(os.getenv("AISOC_CREDENTIAL_KEY", "").strip())+ return (+ configured,+ "Connector credentials are encrypted at rest with a configured key."+ if configured+ else "AISOC_CREDENTIAL_KEY is not set, so credential encryption uses an ephemeral key.",+ {"credential_key_configured": configured},+ )+++async def _attest_passkeys(db: DBSession, tenant_id: uuid.UUID) -> tuple[bool, str, dict[str, Any]]:+ try:+ row = (+ await db.execute(+ text("SELECT COUNT(*) AS n FROM webauthn_credentials c JOIN users u ON u.id = c.user_id WHERE u.tenant_id = :t").bindparams(+ t=tenant_id+ )+ )+ ).first()+ count = int(row.n) if row else 0+ except Exception: # noqa: BLE001 - the table is optional on older schemas+ return False, "Passkey table is not present on this deployment.", {}+ return (+ count > 0,+ f"{count} passkey credential(s) enrolled for this tenant.",+ {"passkeys": count},+ )+++#: Control id to attestation. Every key below is a real id read out of+#: `FRAMEWORKS`, not an id that sounds plausible for the framework. A first+#: draft invented eight (`164.312(a)(1)`, `A.9.4`, `PR.AC-1`, `Req` numbers+#: that do not exist here) and the test caught it, which is the whole reason+#: that test compares the keys against the real corpus rather than counting+#: them.+#:+#: Ten controls out of 24. The other fourteen report `manual`, because the+#: platform cannot observe them and saying otherwise would be inventing the+#: evidence an auditor relies on.+ATTESTATIONS = {+ # Audit logging: the append-only chain and its row count.+ "CC7.2": _attest_audit_log, # SOC2 System Monitoring+ "164.312(b)": _attest_audit_log, # HIPAA Audit Controls+ "A.12.4.1": _attest_audit_log, # ISO Event Logging+ "Req-10": _attest_audit_log, # PCI Log and monitor all access+ "DE.CM-1": _attest_audit_log, # NIST Network monitored for events+ # Access control: row-level security on the tenant-scoped tables.+ "CC6.1": _attest_rls, # SOC2 Logical and Physical Access+ "A.12.4.2": _attest_rls, # ISO Protection of Log Information+ # Encryption at rest for connector credentials.+ "CC8.1": _attest_vault, # SOC2 Change Management (key config)+ # Authentication strength.+ "164.312(d)": _attest_passkeys, # HIPAA Person or Entity Authentication+ "Req-8": _attest_passkeys, # PCI Identify users and authenticate+}++[email protected]("/{framework}", response_model=FrameworkDetail, summary="One framework's control status")+async def framework_detail(+ framework: str,+ db: DBSession,+ user: Annotated[AuthUser, Depends(require_permission("reports:read"))],+) -> FrameworkDetail:+ key = resolve_framework(framework)+ controls = FRAMEWORKS[key]++ query = text("""+ SELECT id, control_id, control_title, evidence_kind, summary, status, collected_at+ FROM aisoc_compliance_evidence+ WHERE tenant_id = :t AND framework = :f+ ORDER BY collected_at DESC+ """).bindparams(t=user.tenant_id, f=key)+ try:+ rows = (await db.execute(query)).fetchall()+ except Exception as exc:+ logger.exception("compliance: framework detail query failed")+ raise HTTPException(status_code=503, detail="Database error") from exc++ by_control: dict[str, list[EvidenceItem]] = {}+ for row in rows:+ by_control.setdefault(row.control_id, []).append(+ EvidenceItem(+ id=str(row.id),+ control_id=row.control_id,+ evidence_type=row.evidence_kind or "manual",+ title=row.control_title or row.control_id,+ description=row.summary,+ status=row.status,+ collected_at=row.collected_at,+ )+ )++ items: list[ControlWithEvidence] = []+ tally = {"accepted": 0, "pending": 0, "rejected": 0, "missing": 0}+ for cid, title in controls.items():+ evidence = by_control.get(cid, [])+ latest = _latest_status(evidence)+ tally[latest] += 1+ items.append(+ ControlWithEvidence(+ control=Control(+ id=cid,+ framework=key,+ control_id=cid,+ category=key,+ title=title,+ automatable=cid in ATTESTATIONS,+ ),+ evidence=evidence,+ latest_status=latest,+ )+ )++ total = len(items)+ return FrameworkDetail(+ framework=key,+ framework_name=key,+ summary=FrameworkSummary(+ total=total,+ # `collected` counts controls with evidence that has not been+ # reviewed yet. It is the same set as `review`; both names are+ # kept because the console renders them in different places and+ # dropping one would leave an undefined in a badge.+ collected=tally["pending"],+ review=tally["pending"],+ approved=tally["accepted"],+ rejected=tally["rejected"],+ missing=tally["missing"],+ pct=round(tally["accepted"] / total * 100, 1) if total else 0.0,+ ),+ controls=items,+ generated_at=datetime.now(UTC),+ )++[email protected]("/{framework}/heatmap", response_model=HeatmapResponse, summary="Control status grid")+async def framework_heatmap(+ framework: str,+ db: DBSession,+ user: Annotated[AuthUser, Depends(require_permission("reports:read"))],+) -> HeatmapResponse:+ key = resolve_framework(framework)+ rows = await _control_rows(db, framework=key, tenant_id=user.tenant_id)+ return HeatmapResponse(+ framework=key,+ cells=[+ HeatmapCell(+ control_id=cid,+ title=title,+ status=_status_of(rows.get(cid)),+ evidence_count=int(rows[cid].total) if cid in rows else 0,+ )+ for cid, title in FRAMEWORKS[key].items()+ ],+ generated_at=datetime.now(UTC),+ )+++ "/{framework}/collect",+ response_model=CollectResponse,+ status_code=status.HTTP_201_CREATED,+ summary="Collect what the platform can attest for this framework",+)+async def framework_collect(+ framework: str,+ db: DBSession,+ user: Annotated[AuthUser, Depends(require_permission("reports:write"))],+) -> CollectResponse:+ """Write a real evidence row per automatable control.++ Rows join the same tamper-evident hash chain as manually collected+ evidence, and land as `pending`: the platform attesting its own state is+ a claim an auditor still has to accept, and auto-accepting would make the+ review step decorative.+ """+ key = resolve_framework(framework)+ now = datetime.now(UTC)+ results: list[CollectedControl] = []+ collected = 0++ prev = (+ await db.execute(+ text(+ "SELECT payload_hash FROM aisoc_compliance_evidence"+ " WHERE framework = :f AND tenant_id = :t ORDER BY created_at DESC LIMIT 1"+ ).bindparams(f=key, t=user.tenant_id)+ )+ ).scalar_one_or_none()++ for cid, title in FRAMEWORKS[key].items():+ attest = ATTESTATIONS.get(cid)+ if attest is None:+ results.append(+ CollectedControl(+ control_id=cid,+ outcome="manual",+ detail="No automated source. Attach evidence with POST /compliance/evidence.",+ )+ )+ continue++ ok, summary, payload = await attest(db, user.tenant_id)+ if not ok:+ results.append(CollectedControl(control_id=cid, outcome="manual", detail=summary))+ continue++ digest = hashlib.sha256(((prev or "") + summary + json.dumps(payload, sort_keys=True)).encode()).hexdigest()+ await db.execute(+ text("""+ INSERT INTO aisoc_compliance_evidence (+ id, tenant_id, framework, control_id, control_title,+ evidence_kind, summary, raw_payload, payload_hash, prev_hash,+ collected_at, status, created_at+ ) VALUES (+ :id, :t, :f, :c, :title, 'automated', :summary,+ CAST(:payload AS jsonb), :hash, :prev, :now, 'pending', :now+ )+ """).bindparams(+ id=uuid.uuid4(),+ t=user.tenant_id,+ f=key,+ c=cid,+ title=title,+ summary=summary,+ payload=json.dumps(payload),+ hash=digest,+ prev=prev,+ now=now,+ )+ )+ prev = digest+ collected += 1+ results.append(CollectedControl(control_id=cid, outcome="collected", detail=summary))++ await db.commit()+ return CollectResponse(+ framework=key,+ collected=collected,+ manual=len(results) - collected,+ results=results,+ collected_at=now,+ )++[email protected]("/{framework}/export", summary="Export this framework's evidence")+async def framework_export(+ framework: str,+ db: DBSession,+ user: Annotated[AuthUser, Depends(require_permission("reports:read"))],+ fmt: str = Query("csv", pattern="^(csv|json)$"),+) -> Response:+ key = resolve_framework(framework)+ query = text("""+ SELECT control_id, control_title, evidence_kind, summary, status,+ payload_hash, prev_hash, collected_at+ FROM aisoc_compliance_evidence+ WHERE tenant_id = :t AND framework = :f+ ORDER BY collected_at+ """).bindparams(t=user.tenant_id, f=key)+ try:+ rows = (await db.execute(query)).fetchall()+ except Exception as exc:+ logger.exception("compliance: export query failed")+ raise HTTPException(status_code=503, detail="Database error") from exc++ records = [+ {+ "control_id": r.control_id,+ "control_title": r.control_title,+ "evidence_kind": r.evidence_kind,+ "summary": r.summary,+ "status": r.status,+ "payload_hash": r.payload_hash,+ "prev_hash": r.prev_hash,+ "collected_at": r.collected_at.isoformat() if r.collected_at else None,+ }+ for r in rows+ ]+ stamp = datetime.now(UTC).strftime("%Y%m%d")++ if fmt == "json":+ # The hash chain travels with the export. An evidence export an+ # auditor cannot verify is a spreadsheet.+ body = json.dumps(+ {"framework": key, "exported_at": datetime.now(UTC).isoformat(), "evidence": records},+ indent=2,+ )+ return Response(+ content=body,+ media_type="application/json",+ headers={"Content-Disposition": f'attachment; filename="{key}-evidence-{stamp}.json"'},+ )++ buffer = io.StringIO()+ writer = csv.DictWriter(+ buffer,+ fieldnames=[+ "control_id",+ "control_title",+ "evidence_kind",+ "summary",+ "status",+ "payload_hash",+ "prev_hash",+ "collected_at",+ ],+ )+ writer.writeheader()+ writer.writerows(records)+ return Response(+ content=buffer.getvalue(),+ media_type="text/csv",+ headers={"Content-Disposition": f'attachment; filename="{key}-evidence-{stamp}.csv"'},+ )diff --git a/services/api/app/api/v1/router.py b/services/api/app/api/v1/router.pyindex 4a6eb7c9a..3f2680de7 100644--- a/services/api/app/api/v1/router.py+++ b/services/api/app/api/v1/router.py@@ -21,6 +21,7 @@ from app.api.v1.endpoints import (cases,community,compliance,+ compliance_framework,connectors,costs,data_lifecycle,@@ -153,6 +154,10 @@ api_router.include_router(rbac.router)api_router.include_router(audit.router)api_router.include_router(branding.router)api_router.include_router(compliance.router)+# After `compliance.router`, deliberately. The per-framework routes are+# `/{framework}`, which compiles to `[^/]+` and would swallow the sibling+# literals `/frameworks`, `/evidence` and `/report` if it matched first.+api_router.include_router(compliance_framework.router)api_router.include_router(metrics.router)# Pipeline health snapshot — v1.5 SOC Console parity.# /health/pipeline returns the 5-stage ingest→normalize→fuse→correlate→alertdiff --git a/services/api/app/data/marketplace/index.json b/services/api/app/data/marketplace/index.jsonindex 8124abbe9..f51cd5ba7 100644--- a/services/api/app/data/marketplace/index.json+++ b/services/api/app/data/marketplace/index.json@@ -1,7 +1,7 @@{"$schema": "https://example.com/schemas/marketplace/v1.json","version": "1.0.0",- "generated": "2026-09-28T22:12:26Z",+ "generated": "2026-10-01T21:06:28Z","categories": [{"id": "playbooks",@@ -39,10 +39,409 @@"stable": 877},"executable": 2767,- "quarantined": 4388+ "quarantined": 4388,+ "executable_detections": 2603,+ "reference_only_detections": 4388,+ "not_a_detection": 164},"mitre_coverage": {+ "unique_techniques": 391,"techniques": {+ "T1001.003": 1,+ "T1003": 21,+ "T1003.001": 58,+ "T1003.002": 24,+ "T1003.003": 21,+ "T1003.004": 10,+ "T1003.005": 8,+ "T1003.006": 7,+ "T1003.008": 1,+ "T1005": 7,+ "T1007": 2,+ "T1008": 3,+ "T1011": 1,+ "T1012": 8,+ "T1016": 3,+ "T1018": 15,+ "T1020": 3,+ "T1021": 4,+ "T1021.001": 10,+ "T1021.002": 24,+ "T1021.003": 8,+ "T1021.004": 4,+ "T1021.005": 1,+ "T1021.006": 10,+ "T1021.007": 1,+ "T1027": 58,+ "T1027.001": 1,+ "T1027.003": 1,+ "T1027.004": 3,+ "T1027.005": 4,+ "T1027.010": 7,+ "T1030": 1,+ "T1033": 12,+ "T1036": 22,+ "T1036.002": 3,+ "T1036.003": 9,+ "T1036.004": 1,+ "T1036.005": 3,+ "T1036.007": 1,+ "T1037": 1,+ "T1037.001": 3,+ "T1037.002": 1,+ "T1037.004": 2,+ "T1039": 2,+ "T1040": 8,+ "T1041": 9,+ "T1046": 11,+ "T1047": 34,+ "T1048": 8,+ "T1048.001": 1,+ "T1048.003": 5,+ "T1049": 4,+ "T1052": 2,+ "T1052.001": 1,+ "T1053": 4,+ "T1053.001": 1,+ "T1053.002": 2,+ "T1053.003": 4,+ "T1053.005": 24,+ "T1053.006": 1,+ "T1055": 11,+ "T1055.001": 3,+ "T1055.003": 1,+ "T1055.011": 1,+ "T1055.012": 3,+ "T1056": 1,+ "T1056.001": 3,+ "T1056.002": 1,+ "T1057": 3,+ "T1059": 49,+ "T1059.001": 132,+ "T1059.002": 3,+ "T1059.003": 24,+ "T1059.004": 8,+ "T1059.005": 19,+ "T1059.006": 3,+ "T1059.007": 16,+ "T1059.009": 2,+ "T1068": 11,+ "T1069": 3,+ "T1069.001": 12,+ "T1069.002": 11,+ "T1069.003": 1,+ "T1070": 17,+ "T1070.001": 3,+ "T1070.002": 1,+ "T1070.003": 6,+ "T1070.004": 6,+ "T1070.005": 4,+ "T1070.006": 1,+ "T1071": 7,+ "T1071.001": 16,+ "T1071.004": 12,+ "T1072": 4,+ "T1074.001": 4,+ "T1078": 51,+ "T1078.001": 5,+ "T1078.002": 7,+ "T1078.003": 2,+ "T1078.004": 49,+ "T1082": 13,+ "T1083": 9,+ "T1087": 10,+ "T1087.001": 10,+ "T1087.002": 19,+ "T1087.004": 5,+ "T1090": 16,+ "T1090.001": 4,+ "T1090.002": 1,+ "T1090.003": 9,+ "T1091": 1,+ "T1095": 5,+ "T1098": 47,+ "T1098.001": 22,+ "T1098.003": 6,+ "T1098.004": 6,+ "T1098.007": 1,+ "T1102": 5,+ "T1102.002": 1,+ "T1105": 49,+ "T1106": 6,+ "T1110": 23,+ "T1110.001": 7,+ "T1110.002": 1,+ "T1110.003": 4,+ "T1110.004": 4,+ "T1112": 58,+ "T1113": 7,+ "T1114": 1,+ "T1114.001": 1,+ "T1114.002": 1,+ "T1114.003": 2,+ "T1115": 3,+ "T1119": 3,+ "T1120": 2,+ "T1123": 4,+ "T1124": 2,+ "T1125": 1,+ "T1127": 15,+ "T1127.001": 1,+ "T1132.001": 4,+ "T1133": 18,+ "T1134": 2,+ "T1134.001": 6,+ "T1134.002": 2,+ "T1134.003": 3,+ "T1134.004": 1,+ "T1135": 7,+ "T1136": 3,+ "T1136.001": 12,+ "T1136.002": 3,+ "T1136.003": 4,+ "T1137": 4,+ "T1137.002": 1,+ "T1137.003": 1,+ "T1137.006": 3,+ "T1140": 7,+ "T1176": 1,+ "T1176.001": 2,+ "T1185": 3,+ "T1187": 3,+ "T1190": 39,+ "T1195": 3,+ "T1195.001": 1,+ "T1195.002": 9,+ "T1197": 13,+ "T1199": 12,+ "T1200": 3,+ "T1201": 3,+ "T1202": 26,+ "T1203": 6,+ "T1204": 6,+ "T1204.001": 3,+ "T1204.002": 21,+ "T1204.004": 5,+ "T1207": 2,+ "T1210": 4,+ "T1211": 4,+ "T1212": 5,+ "T1213": 2,+ "T1216": 8,+ "T1216.001": 2,+ "T1217": 3,+ "T1218": 89,+ "T1218.001": 5,+ "T1218.003": 7,+ "T1218.004": 1,+ "T1218.005": 8,+ "T1218.007": 6,+ "T1218.008": 5,+ "T1218.009": 3,+ "T1218.010": 11,+ "T1218.011": 21,+ "T1218.014": 2,+ "T1219": 5,+ "T1219.002": 32,+ "T1220": 4,+ "T1222": 2,+ "T1222.001": 5,+ "T1222.002": 1,+ "T1404": 2,+ "T1482": 14,+ "T1484": 1,+ "T1484.001": 8,+ "T1484.002": 2,+ "T1485": 34,+ "T1486": 12,+ "T1489": 10,+ "T1490": 20,+ "T1491.001": 2,+ "T1496": 4,+ "T1497.001": 1,+ "T1498": 4,+ "T1498.001": 2,+ "T1498.002": 2,+ "T1499": 1,+ "T1499.001": 1,+ "T1499.004": 1,+ "T1505.002": 2,+ "T1505.003": 9,+ "T1505.004": 3,+ "T1518": 4,+ "T1518.001": 2,+ "T1525": 8,+ "T1526": 2,+ "T1528": 9,+ "T1529": 3,+ "T1530": 35,+ "T1531": 10,+ "T1535": 1,+ "T1537": 7,+ "T1539": 6,+ "T1542.001": 3,+ "T1542.003": 1,+ "T1543": 10,+ "T1543.001": 4,+ "T1543.002": 2,+ "T1543.003": 31,+ "T1543.004": 2,+ "T1546": 5,+ "T1546.001": 4,+ "T1546.002": 1,+ "T1546.003": 11,+ "T1546.004": 2,+ "T1546.007": 1,+ "T1546.008": 5,+ "T1546.009": 1,+ "T1546.010": 1,+ "T1546.011": 4,+ "T1546.012": 3,+ "T1546.013": 3,+ "T1546.014": 1,+ "T1546.015": 5,+ "T1547": 9,+ "T1547.001": 16,+ "T1547.004": 3,+ "T1547.005": 2,+ "T1547.006": 5,+ "T1547.009": 3,+ "T1547.010": 1,+ "T1547.015": 3,+ "T1548": 7,+ "T1548.001": 4,+ "T1548.002": 50,+ "T1548.003": 2,+ "T1548.004": 1,+ "T1550": 5,+ "T1550.001": 2,+ "T1550.002": 6,+ "T1550.003": 4,+ "T1550.004": 1,+ "T1552": 3,+ "T1552.001": 20,+ "T1552.002": 3,+ "T1552.004": 7,+ "T1552.005": 1,+ "T1552.006": 4,+ "T1552.007": 1,+ "T1553": 1,+ "T1553.001": 5,+ "T1553.002": 2,+ "T1553.004": 9,+ "T1553.005": 5,+ "T1554": 3,+ "T1555": 9,+ "T1555.001": 5,+ "T1555.003": 9,+ "T1555.004": 3,+ "T1555.005": 2,+ "T1556": 43,+ "T1556.001": 1,+ "T1556.003": 1,+ "T1556.004": 1,+ "T1556.006": 16,+ "T1556.007": 1,+ "T1557": 2,+ "T1557.001": 13,+ "T1557.002": 3,+ "T1557.003": 1,+ "T1558": 3,+ "T1558.001": 2,+ "T1558.002": 2,+ "T1558.003": 16,+ "T1558.004": 4,+ "T1559.001": 3,+ "T1559.002": 1,+ "T1560": 2,+ "T1560.001": 12,+ "T1561.002": 1,+ "T1562": 5,+ "T1562.001": 31,+ "T1562.004": 7,+ "T1562.006": 2,+ "T1562.008": 11,+ "T1562.012": 2,+ "T1563.002": 2,+ "T1564": 7,+ "T1564.001": 3,+ "T1564.002": 2,+ "T1564.003": 6,+ "T1564.004": 12,+ "T1564.006": 2,+ "T1564.008": 1,+ "T1565": 2,+ "T1565.001": 3,+ "T1565.002": 1,+ "T1566": 6,+ "T1566.001": 15,+ "T1566.002": 2,+ "T1567": 18,+ "T1567.001": 1,+ "T1567.002": 18,+ "T1568.001": 2,+ "T1568.002": 3,+ "T1569": 1,+ "T1569.002": 29,+ "T1570": 5,+ "T1571": 1,+ "T1572": 29,+ "T1573": 2,+ "T1573.002": 7,+ "T1574": 3,+ "T1574.001": 23,+ "T1574.002": 4,+ "T1574.005": 1,+ "T1574.006": 2,+ "T1574.007": 1,+ "T1574.011": 11,+ "T1574.012": 2,+ "T1578": 1,+ "T1578.002": 1,+ "T1578.003": 1,+ "T1583.001": 4,+ "T1584": 1,+ "T1586.003": 1,+ "T1587": 1,+ "T1587.001": 4,+ "T1588.002": 6,+ "T1589.002": 1,+ "T1590.001": 1,+ "T1590.002": 1,+ "T1592": 2,+ "T1593.003": 1,+ "T1595": 1,+ "T1595.002": 1,+ "T1599": 1,+ "T1599.001": 1,+ "T1600.001": 1,+ "T1606.002": 1,+ "T1608": 2,+ "T1608.003": 1,+ "T1609": 1,+ "T1610": 12,+ "T1611": 25,+ "T1612": 1,+ "T1614.001": 2,+ "T1615": 4,+ "T1620": 4,+ "T1621": 7,+ "T1622": 1,+ "T1647": 1,+ "T1649": 4,+ "T1656": 1,+ "T1659": 1,+ "T1685": 106,+ "T1685.001": 15,+ "T1685.002": 2,+ "T1685.005": 4,+ "T1686.001": 2,+ "T1686.003": 10,+ "T1689": 1+ },+ "total_with_mitre": 2472,+ "unique_techniques_all_rules": 493,+ "techniques_all_rules": {"T1001.003": 2,"T1003": 51,"T1003.001": 87,@@ -537,8 +936,7 @@"T1689": 1,"T1690": 1},- "unique_techniques": 493,- "total_with_mitre": 5800,+ "measure": "attack_technique_tags_on_executable_rules","by_tier": {"community": {"T1078.004": 1diff --git a/services/api/app/security/envelope_cipher.py b/services/api/app/security/envelope_cipher.pyindex dfb46b0f7..a35a3433f 100644--- a/services/api/app/security/envelope_cipher.py+++ b/services/api/app/security/envelope_cipher.py@@ -23,7 +23,8 @@ The `KeyManager` protocol keeps the KMS backend pluggable:- `LocalKeyManager` — KEK is a Fernet key from the environment (default; matchestoday's trust model but with per-secret DEKs).- `AwsKmsKeyManager` — wraps DEKs via AWS KMS ``encrypt``/``decrypt`` (boto3,- lazy-imported). GCP KMS / HashiCorp Vault Transit implement the same protocol.+ lazy-imported). GCP KMS and HashiCorp Vault Transit are **not implemented**:+ `get_vault` accepts the local and AWS KMS backends only.- `FakeKmsKeyManager` — in-memory, rotatable; lets the envelope round-trip andthe rotation/re-wrap flow be unit-tested offline with no cloud credentials.diff --git a/services/api/clickhouse/001_init.sql b/services/api/clickhouse/001_init.sqlindex 590b2799f..d054406e8 100644--- a/services/api/clickhouse/001_init.sql+++ b/services/api/clickhouse/001_init.sql@@ -4,7 +4,8 @@CREATE DATABASE IF NOT EXISTS aisoc;-- ──────────────────────────────────────────────────────────────────────────────--- Raw OCSF events (hot tier - 30 days MergeTree)+-- Raw OCSF events (hot tier, 90 days: see the TTL below, which is what+-- actually governs. This comment said 30 days over a 90 DAY TTL.)-- ──────────────────────────────────────────────────────────────────────────────CREATE TABLE IF NOT EXISTS aisoc.raw_events (event_id UUID DEFAULT generateUUIDv4(),diff --git a/services/api/tests/test_compliance_framework_routes.py b/services/api/tests/test_compliance_framework_routes.pynew file mode 100644index 000000000..24e385d28--- /dev/null+++ b/services/api/tests/test_compliance_framework_routes.py@@ -0,0 +1,210 @@+"""The four per-framework compliance routes exist, and nothing shadows them.++`apps/web/src/components/compliance/` made eight calls to four route shapes+that did not exist, so `/compliance/[framework]` and `/compliance/soc2` were+pages that could never load. The console also sends slugs (`soc2`) while+`FRAMEWORKS` is keyed `SOC2`, so both halves had to be wrong for the page to+be this broken and fixing one would have left a 404 behind the other.++The shadowing case is the one worth a test rather than a glance. A path+parameter compiles to `[^/]+`, so `/{framework}` will swallow the sibling+literals `/frameworks`, `/evidence` and `/report` if it is mounted first.+That exact defect has shipped in this tree before, on `/hunts/{hunt_id}`+against `/runs` and `/findings`, and the fix there was a path convertor+because declaration order is a convention a later edit can undo.++Here the ordering is what prevents it, so this asserts the **outcome**:+which handler a request actually reaches, read from the router rather than+inferred from the source.+"""++from __future__ import annotations++import pytest+from app.api.v1.endpoints.compliance import FRAMEWORKS+from app.api.v1.endpoints.compliance_framework import SLUG_TO_KEY, resolve_framework+from app.main import app+from fastapi import HTTPException+from fastapi.testclient import TestClient++#: One client for the whole module. Building it per test triples the run+#: time of a file that is mostly routing assertions.+_CLIENT = TestClient(app, raise_server_exceptions=False)+++def _reaches_a_route(path: str, method: str = "GET") -> bool:+ """Whether a request to `path` reaches a handler at all.++ Decided by **sending a request**, not by walking `app.routes`.++ `app.routes` is not the route table and what it holds changes with the+ FastAPI minor: on 0.141.x `include_router` leaves an opaque object and+ the `APIRoute` count is zero. A first version of this file walked the+ router, passed locally on 0.136.1, and reported every path as+ unreachable in CI, which is the same defect that once made a+ route-parity gate compare zero pairs and report success over an app+ serving 456 operations.++ A 401 answers the question as well as a 200 does: authentication runs+ after the route has matched, so anything other than 404 means a handler+ is there.+ """+ response = _CLIENT.request(method, path)+ return response.status_code != 404+++def _handler_for(path: str, method: str = "GET") -> str | None:+ """The handler name that owns `path`, from the OpenAPI document.++ `app.openapi()` is built from the real route table by FastAPI itself,+ so it survives the minor-version difference above. It keys paths in a+ dict, which would hide a duplicate, but duplicates are+ `check_route_duplicates.py`'s job and this file only asks who owns a+ path.++ An **exact** template wins over a parameterised one, because a dict+ preserves insertion order rather than match priority: looking for the+ first template that matches reported `/compliance/report` as owned by+ `/compliance/{framework}`, which is the very confusion this file exists+ to rule out.+ """+ spec = app.openapi()+ paths = spec.get("paths", {})+ candidates = [path] if path in paths else [template for template in paths if _template_matches(template, path)]+ if not candidates:+ return None+ # Fewest parameters wins, so a literal beats a catch-all.+ best = min(candidates, key=lambda t: t.count("{"))+ operation = paths[best].get(method.lower())+ if not operation:+ return None+ # FastAPI builds `<handler>_<path with underscores>_<method>`.+ operation_id = operation.get("operationId", "")+ return operation_id.split("_api_v1_")[0] or None+++def _template_matches(template: str, path: str) -> bool:+ import re++ pattern = "".join("[^/]+" if part.startswith("{") else re.escape(part) for part in re.split(r"(\{[^}]+\})", template))+ return re.fullmatch(pattern, path) is not None+++class TestTheRoutesExist:+ @pytest.mark.parametrize(+ ("path", "method", "handler"),+ [+ ("/api/v1/compliance/soc2", "GET", "framework_detail"),+ ("/api/v1/compliance/soc2/heatmap", "GET", "framework_heatmap"),+ ("/api/v1/compliance/soc2/collect", "POST", "framework_collect"),+ ("/api/v1/compliance/soc2/export", "GET", "framework_export"),+ ],+ )+ def test_each_console_call_reaches_its_handler(self, path: str, method: str, handler: str) -> None:+ assert _reaches_a_route(path, method), f"{method} {path} answers 404; the console page calling it could never load"+++class TestTheCatchAllDoesNotShadowItsSiblings:+ """The failure mode this ordering exists to prevent.++ `/{framework}` matches `frameworks`, `evidence` and `report` just as+ happily as `soc2`. If it were mounted first, three working routes would+ start answering from the wrong handler, and the symptom would be a+ confusing 404 or an empty framework rather than an error.+ """++ @pytest.mark.parametrize(+ ("path", "handler"),+ [+ ("/api/v1/compliance/frameworks", "list_frameworks"),+ ("/api/v1/compliance/report", "compliance_report"),+ ("/api/v1/compliance/evidence", "list_evidence"),+ ],+ )+ def test_the_literal_wins(self, path: str, handler: str) -> None:+ assert _reaches_a_route(path), f"{path} answers 404"+ owner = _handler_for(path)+ assert owner == handler, (+ f"{path} is owned by {owner!r} rather than {handler!r}: the `/{{framework}}` catch-all is mounted before its sibling literals"+ )++ def test_a_framework_slug_still_reaches_the_catch_all(self) -> None:+ """The other direction, so this cannot pass by breaking the new routes."""+ assert _reaches_a_route("/api/v1/compliance/pci-dss")+ assert _handler_for("/api/v1/compliance/pci-dss") == "framework_detail"+++class TestTheSlugMapping:+ @pytest.mark.parametrize(+ ("slug", "expected"),+ [+ ("soc2", "SOC2"),+ ("SOC2", "SOC2"),+ ("soc-2", "SOC2"),+ ("pci-dss", "PCI-DSS"),+ ("pcidss", "PCI-DSS"),+ ("hipaa", "HIPAA"),+ ("iso27001", "ISO27001"),+ ("nist-csf", "NIST-CSF"),+ ],+ )+ def test_the_console_slug_resolves(self, slug: str, expected: str) -> None:+ assert resolve_framework(slug) == expected++ def test_an_unknown_framework_is_a_404_not_an_empty_page(self) -> None:+ """An empty compliance page reads as 'no evidence', which is a claim."""+ with pytest.raises(HTTPException) as exc:+ resolve_framework("gdpr")+ assert exc.value.status_code == 404+ assert "Known:" in exc.value.detail++ def test_the_mapping_is_derived_from_the_framework_keys(self) -> None:+ """So a new framework is reachable without a second edit here.++ Writing the slugs out by hand is what produced the original+ mismatch between the console and the API.+ """+ for key in FRAMEWORKS:+ assert resolve_framework(key) == key+ assert resolve_framework(key.lower()) == key+ assert len(SLUG_TO_KEY) >= len(FRAMEWORKS)+++class TestCollectDoesNotFabricate:+ def test_it_writes_evidence_rather_than_returning_a_job_id(self) -> None:+ """The pre-existing `/evidence/collect` returns a queued job and+ creates nothing. This route must not copy that."""+ import inspect++ from app.api.v1.endpoints.compliance_framework import framework_collect++ source = inspect.getsource(framework_collect)+ assert "INSERT INTO aisoc_compliance_evidence" in source+ assert "await db.commit()" in source++ def test_automated_evidence_lands_pending_not_accepted(self) -> None:+ """The platform attesting its own state is a claim, not a finding.++ Auto-accepting would make the review step decorative, and the+ module splits collect and review across two permissions precisely+ so that whoever collects cannot accept.+ """+ import inspect++ from app.api.v1.endpoints.compliance_framework import framework_collect++ source = inspect.getsource(framework_collect)+ assert "'pending'" in source+ assert "'accepted'" not in source++ def test_a_control_with_no_automated_source_says_so(self) -> None:+ from app.api.v1.endpoints.compliance_framework import ATTESTATIONS++ automatable = set(ATTESTATIONS)+ every_control = {cid for controls in FRAMEWORKS.values() for cid in controls}+ # The honest shape: a small automatable subset, and the rest+ # reported as manual rather than silently counted as covered.+ assert automatable & every_control, "no attestation maps to a real control id"+ assert automatable < every_control, (+ "every control claims an automated source, which would mean the platform attests things it cannot observe"+ )diff --git a/services/fusion/app/services/detection_engine.py b/services/fusion/app/services/detection_engine.pyindex 37ee0099d..d552d3a7a 100644--- a/services/fusion/app/services/detection_engine.py+++ b/services/fusion/app/services/detection_engine.py@@ -19,10 +19,18 @@ as a JSON string. The native ``match_when`` specs were authored against exactlythose flat connector fields, so ``matches(rule.match_when, json.loads(raw_data))``is the correct evaluation contract.-Performance: rules are indexed by ``product`` so an event only evaluates its-own product's rules plus product-agnostic rules, keeping per-event work far-below the full 817-rule corpus. The engine is pure/synchronous; the consumer-calls it inline (the corpus is small and the matcher is regex/dict work).+Performance: every event is evaluated against the **whole corpus**. A+product-based pre-filter was tried and removed, because connector product+names do not line up with spec products (``aws_cloudtrail`` against ``aws``,+``crowdstrike_falcon`` against ``edr``) and any such filter silently drops+real matches. See ``_candidates``, which returns ``self._rules`` unchanged+and records that reasoning. The full pass is cheap because the matcher+short-circuits on the first absent field, so a benign event touches almost+no rule past its first clause. The engine is pure and synchronous; the+consumer calls it inline.++Indexing by log source is parity plan 6.9, and it has to solve the+product-name mapping first."""from __future__ import annotations