Phase 5 — AI Governance Substrate: Consolidated Rollup (5.0 → 5.3)
Status: 5.0 ✅ closed · 5.1 ✅ closed · 5.2 ✅ closed · 5.3 ✅ shipped (pipe live, awaiting first integrator) · 5.4 ⏸ on hold pending Tech-debt #8 business decision (see chapter 14).
Audience: Internal audit, external auditors (ISO/IEC 27001 lead auditor, ISO/IEC 42001 assessor), supervisory authorities reviewing AI governance readiness, customer second-line risk teams reviewing Regurai before integration.
Frame: This chapter is the audit-grade record of Phase 5. It mirrors the format of chapter 12 (Phase 2.1 close-out) and discharges the record-keeping obligations under ISO/IEC 27001 A.5.34 (privacy and PII) and A.8.16 (monitoring activities). Engineering changelog detail lives in
MANUAL_META.revisions; this chapter is the standards-mapped narrative.
1. Scope and objectives
Phase 5 had a single conceptual objective: bring the AI-governance surface of Regurai from "front-end first, demo data behind the scenes" to a state where the platform's monitoring claims are backed by real substrate.
That objective was decomposed into five sub-phases against the Phase 5 audit:
| Sub-phase | Objective | Standards anchor |
|---|---|---|
| 5.0 | Inventory every AI-governance surface and label each as live-backed, partially-backed, or mock-only. | NIST AI RMF MAP-1, MAP-3 (context / categorisation of AI systems in scope). |
| 5.1 | Backfill explicit EU AI Act classification on ai_models (no silent low-risk defaults). | EU AI Act Art.6 + Annex III (high-risk classification). ISO/IEC 42001 §6.1.2 (risk assessment of AI systems). |
| 5.2 | Replace the chatbot's weak inline guardrails with the project-wide llmGuard ruleset; create tenant-scoped llm_guard_events for evidentiary audit trail. | NIST AI RMF MEASURE-2.6, MEASURE-2.7 (safety / security testing of AI systems in production). ISO/IEC 23894 §6.5.5 (controls for input and output). |
| 5.3 | Build the ingestion path for real client-AI decision telemetry; gate the Transparency Report behind statistical floors so demo data cannot leak into evidence packs. | NIST AI RMF MANAGE-2.3, MANAGE-4.1 (post-deployment monitoring, third-party reporting). EU AI Act Art.9, Art.13–15 (risk management, transparency, human oversight). GDPR Art.9 (special-category data handling). |
| 5.4 | Approval-flow integrity (approver_id enforcement). | ISO/IEC 27001 A.5.3 (segregation of duties). NIST AI RMF GOVERN-2.1, GOVERN-3.2. Held pending business decision — see chapter 14. |
2. Findings register (cumulative across Phase 5)
Severity values use the same CVSS-aware framing as chapter 12. "Closed" means a code-and-evidence remediation has shipped; "open" means the gap is documented but not yet engineered shut.
| ID | Severity | Title | Class | Status |
|---|---|---|---|---|
| #7 | High | Transparency PDF export rendered seed data as audit-styled evidence. | Evidence-integrity / misrepresentation | Closed (compensating) — UI disabled; re-enablement gates implemented and wired to live-data substrate (closure deferred until first integrator produces real telemetry, gate-controlled). |
| #8 | Medium | Three production routes (Fairness / AI Workforce / AI Assessments) rendered 100 % seed data with no visible distinction from live records. | Evidence-integrity / misrepresentation | Partially closed — Fairness surface backed by live read path in 5.3 (LiveFairnessPanel); persistent demo banner on remaining seeded sections; full closure of AI Workforce + Assessments tracked outside Phase 5. |
| #9 | High (operational) | chatbot-message hardcoded to claude-sonnet-4-5, no longer served by the AI gateway → every non-attack chatbot call failed silently with HTTP 502. | Operational regression | Closed — migrated to google/gemini-2.5-flash, end-to-end verified, Tech-debt #11 logged for synthetic health probe to prevent recurrence. |
| #10 | High (architectural) | The platform's core monitoring premise had no real data path. Every fairness chart, parity Δ, SHAP attribution, and Transparency Report was derived from a client-side synthetic generator. | Architectural / platform-maturity | Closed for Fairness domain — HMAC-authenticated webhook + per-tenant secret store + Zod allow-list + PII regex sweep shipped. Pipe is intentionally empty until first integrator. AI Workforce + Assessments domains carry the equivalent gap forward outside Phase 5. |
3. Per-sub-phase narrative
Phase 5.0 — Inventory (NIST AI RMF MAP)
A full pass over the AI-governance surface labelled every route by data backing. The output became the basis for Findings #7 and #8 and reframed Phase 5 around the conceptual gap that became Finding #10. The inventory's most important property is that it surfaced the misrepresentation risk before any client screenshot could enter an evidence pack.
Phase 5.1 — EU AI Act classification backfill (Art.6 / Annex III)
A migration added eu_ai_act_class to ai_models and flagged every existing row for explicit compliance review rather than guessing a low-risk default. This is a deliberate choice under ISO/IEC 42001 §6.1.2 — unset is a safer state than silently assumed low-risk, because the latter creates audit-trail evidence of a classification that no human ever made. The accompanying UI (/app/ai-models) surfaces unclassified rows prominently so compliance officers cannot ignore them.
Phase 5.2 — Chatbot guardrails (NIST AI RMF MEASURE-2.6/2.7; ISO/IEC 23894 §6.5.5)
chatbot-message now wraps the shared llmGuard ruleset on both directions (input and model output), replacing five inline injection regexes with the project-wide 8 injection/jailbreak + 5 PII + 3 secret-key + URL-exfil sweep, plus length caps and platform-host allow-list. Tenant-scoped llm_guard_events records every inspection (one row per direction) as evidentiary audit trail — append-only by absence of UPDATE/DELETE policies, RLS aligned with chatbot_audit_log, registered in the isolation harness from day one.
Phase 5.3 — Ingestion substrate (GDPR Art.9 + EU AI Act Art.9–15)
The headline deliverable of Phase 5. POST /api/public/hooks/fairness-decisions accepts signed payloads from external AI systems:
- Authentication: per-tenant HMAC-SHA256 over the raw body, secret stored in
public.fairness_ingest_secrets(admin-only RLS;secretcolumn stripped from authenticatedSELECTvia column-level grants — service-role-only readable). - Schema gate (GDPR Art.9 boundary):
protected_groupmust match a hard allow-list of pre-coarsened labels (age_band_*,gender_*,ethnicity_band_*,region_*,income_band_*,tenure_band_*,employment_status_*). Raw special-category attributes are rejected at the schema layer, not at a downstream filter — the integration contract makes it physically impossible to deliver raw DOB / ethnicity / etc. to Regurai. - Defence-in-depth PII sweep: the full payload is scanned for SSN / IBAN / email / credit-card / raw date shapes (added after a live-verification finding — see §4 below). Anything matching is rejected with HTTP 422.
- Caps: 500 rows per batch, 1 MB body, all writes
is_seed=false(DB default; explicit in code so a future schema change cannot silently flip ingested data into the seed pool). - Read path:
LiveFairnessPanelreadsfairness_decisions WHERE is_seed=falseunder tenant-scoped RLS. Zero non-seed rows → explicit onboarding empty state, never a silent fallback to demo data. - Transparency Report re-enablement gates:
evaluatePdfGates()requires ≥ 200 decisions in 90 days, ≥ 30 per protected group, ≤ 14-day recency, zero seed contamination in the report window. These are engineering defaults (Tech-debt #12), not regulatory floors — they exist to ensure the PDF cannot be generated from statistically meaningless data, matching theminSampleSizePerGroupconcept from the fairness metrics design.
Phase 5.4 — Approval-flow integrity (held)
See chapter 14 for the decision-ready brief. Phase 5 will not close this item silently; it requires a Product + Compliance decision on the delegated-approval model.
4. Live verification record
Per the discipline established in Phase 2, claims of closure are backed by a recorded end-to-end run, not by expected behaviour. The Phase 5.3 verification produced:
| Test | Result |
|---|---|
| Correctly-signed valid payload | HTTP 200, row landed with is_seed=false, last_used_at updated. |
Tampered signature (0 × 64) | HTTP 401 signature verification failed. |
Raw protected attribute as group label (date_of_birth_*) | HTTP 400, Zod allow-list rejection at the schema layer. |
Raw email inside features_redacted | HTTP 422, PII regex rejection. |
Raw ISO date ("1990-05-12") inside features_redacted | Initially: HTTP 200 accepted — defence-in-depth gap surfaced. Logged as Tech-debt #14, fixed in v1.16.2 by adding YYYY-MM-DD, DD/MM/YYYY, DD.MM.YYYY, and MM/DD/YYYY patterns to the PII sweep. Re-verified: HTTP 422 for all three date formats; allow-listed age_band_25_34 label confirmed not a false-positive. |
The honest reporting of the c3 finding (rather than a quiet patch) matches the Phase 2.1 standard: surface, log, fix, re-verify.
5. Tenant-isolation harness — additions made in Phase 5
| Table | Added in | Result |
|---|---|---|
llm_guard_events | 5.2 | 4/4 PASS (append-only). |
fairness_decisions | 5.3 | 4/4 PASS (append-only). |
fairness_ingest_secrets | 5.3 follow-up | 4/4 PASS — admin-gated (is_admin, not is_tenant_member) covered by the existing fixture without harness extension, since user A is owner of tenant A and not a member of tenant B. |
The harness now covers 34 tables / 134 isolation checks, all green on the latest --all run.
6. Open items as of Phase 5 close
| ID | What | Why still open | Owner |
|---|---|---|---|
| Tech-debt #8 | approver_id enforcement on ai_approvals + access_request_approvals. | Requires Product + Compliance decision on delegated-approval model — see chapter 14 decision brief. | Product + Compliance |
| Tech-debt #11 | Synthetic chatbot health probe. | Deferred to Phase 7 (Operations doc pass) alongside Tech-debt #9 cron wiring. | Platform Security + Operations |
| Tech-debt #12 | Transparency PDF re-enablement thresholds are engineering defaults, not regulatory floors. | Re-validate against typical decision volumes once first integrator is live. | AI Governance |
| Tech-debt #13 | Admin CreateIngestSecretDialog. | Deferred until first real integrator is being onboarded; manual DB-insert path acceptable while the pipe is empty by design. | Engineering / AI Governance |
| Tech-debt #14 | Raw-date PII regex in the ingestion webhook. | Closed in v1.16.2 — three date formats added, re-verified. Stays in the register as evidence of the surface→log→fix→re-verify cycle. | AI Governance (closed) |
| Finding #7 re-enablement | Transparency PDF stays UI-disabled until live telemetry meets the §3 gates. | Correct state; will close in the same change that flips the gate for the first integrator. | AI Governance |
| Finding #8 (full remediation) | AI Workforce + Assessments domains. | Outside Phase 5 scope; tracked separately. | AI Governance |
| Finding #10 (final closure) | Pipe exists but stays empty. | Closes when first real client integrates. | AI Governance + Sales |
7. Standards mapping (audit reference)
| Standard | Clause / article | Where addressed in Phase 5 |
|---|---|---|
| ISO/IEC 27001 | A.5.34 (Privacy & PII) | §5.3 protected-attribute allow-list; PII regex sweep; secret column-grant restriction on fairness_ingest_secrets. |
| ISO/IEC 27001 | A.8.16 (Monitoring activities) | llm_guard_events + fairness_decisions append-only evidentiary tables, both harness-covered. |
| ISO/IEC 27001 | A.5.3 (Segregation of duties) | Open under Tech-debt #8 — see chapter 14. |
| ISO/IEC 42001 | §6.1.2 (AI risk assessment) | 5.1 EU AI Act classification backfill (no silent low-risk defaults). |
| ISO/IEC 42001 | §8.3 (Operational controls) | 5.3 ingestion webhook (signed, validated, capped, RLS-tenant-scoped writes). |
| ISO/IEC 23894 | §6.5.5 (Input/output controls for AI systems) | 5.2 chatbot guardrails (both directions, with redaction). |
| NIST AI RMF | MAP-1, MAP-3 | 5.0 inventory. |
| NIST AI RMF | MEASURE-2.6, 2.7 | 5.2 chatbot guardrails + llm_guard_events evidence trail. |
| NIST AI RMF | MANAGE-2.3, 4.1 | 5.3 ingestion + Transparency Report gating. |
| NIST AI RMF | GOVERN-2.1, 3.2 | Open under Tech-debt #8 — see chapter 14. |
| EU AI Act | Art.6, Annex III | 5.1 classification backfill. |
| EU AI Act | Art.9 (risk management), Art.10 (data governance), Art.13–15 (transparency, oversight, accuracy) | 5.3 ingestion contract + gated Transparency Report. |
| GDPR | Art.9 (special category data) | 5.3 protected-attribute allow-list and PII regex sweep (defence-in-depth, including dates). |
8. Manual version history relevant to Phase 5
| Version | Date | What |
|---|---|---|
| 1.14.2 | 2026-06-11 | Phase 5.0 inventory; Findings #7 and #8 logged in chapter 12; compensating control on /app/ai-assessments. |
| 1.15.0 | 2026-06-11 | Phase 5.2: llmGuard wrapped on both directions, llm_guard_events created and harness-registered. |
| 1.15.1 | 2026-06-11 | Incident #9 fixed (MODEL_ID regression), chatbot renamed to Regur, Tech-debt #11 logged. |
| 1.16.0 | 2026-06-11 | Phase 5.3 shipped: ingestion route, secret store, live read path, demo banner, PDF re-enablement gates; Finding #10 logged. |
| 1.16.1 | 2026-06-11 | Phase 5.3 live verification; fairness_ingest_secrets harness-registered; Tech-debt #13 and #14 logged. |
| 1.16.2 | 2026-06-11 | Tech-debt #14 closed: raw-date PII patterns added to the ingestion webhook's defence-in-depth sweep; re-verified end-to-end. This chapter (13) and the Tech-debt #8 decision brief (chapter 14) added. |
9. What Phase 5 deliberately did NOT do
Stated here so it cannot be silently absorbed later. Each item is framed as a standards-aligned scoping decision, not an engineering deferral:
- No client-side SDK or batch importer. Deferred to Phase 5.6 (Client AI Connectors). Defensible under ISO/IEC 42001 §6.1.2 (risk-based scoping — SDK design surface is materially shaped by the first real integrator's runtime, language, batching cadence, and back-pressure profile; building it ahead of that creates abandonment risk) and ISO/IEC 42001 §8.3 (staged operational planning — the webhook contract is the operational primitive; SDKs are convenience adapters layered on that primitive, sequenced after the primitive is in production).
- No AI Workforce or Assessments-domain rebuild. Outside Phase 5 scope; tracked separately. Defensible under ISO/IEC 42001 §6.1.2 (risk-based scoping — these surfaces carry an explicit demo-data label across the product and do not generate regulator-facing artefacts, so they sit lower in the risk-ranked Phase queue than the Fairness ingestion substrate, which does).
- No regulatory validation of the Transparency PDF re-enablement thresholds. The 200 / 30 / 14d / zero-seed floors are engineering defaults (Tech-debt #12), revisited once real volumes exist. Defensible under ISO/IEC 23894 §6.5.5 (monitoring data sufficiency — a statistical floor calibrated against zero live decisions is itself a guess; the standard requires the floor to be set against actual operational distributions, which by definition do not exist until the first integrator is live).
- Tech-debt #8 (
approver_idenforcement). Resolved as of v1.16.3 (this revision). Originally held under NIST AI RMF GOVERN-2.1 (a documented governance decision is required before enforcing a control that materially constrains a real or anticipated business workflow — strict self-approval forecloses delegate-during-leave, a named Tier-1 expectation). The decision recorded in chapter 14 §9 (Option A+ — strict enforcement now, delegation routed through the existingaccess_grantstime-bounded role mechanism) satisfies GOVERN-2.1 and unblocks closure. Migration shipped, harness 4/4 PASS, runbook entry added to chapter 3.
10. Sign-off
Phase 5.0, 5.1, 5.2, and 5.3 are closed as engineered. Phase 5.4 is on hold, with a decision-ready brief in chapter 14. The platform now distinguishes, in code and in UI, between "demo surface" and "live monitored substrate" — and the Transparency Report cannot be generated from the former. This is the milestone Phase 5 was scoped to deliver.