{"slug":"triage/12-ACCEPTANCE_TESTS","title":"12 — Acceptance Tests","section":"triage","sectionLabel":"Triage","status":"canon","type":"document","path":"triage/12-ACCEPTANCE_TESTS.mdx","bytes":4397,"description":"Acceptance tests that prove triage classification, governance boundaries, and promotion behavior.","updated":"2026-08-24","source":"integratewise/Integratewise-docs-wiki","content":"\n\nThe 10 canonical acceptance tests for the triage system. All must pass for triage to be considered active.\n\n## Test 1: AI-Generated Candidate Is Visible in Staging\n\n**Given:** An AI generates a knowledge item through MCP, conversation, or agent\n**When:** The item passes through triage\n**Then:** The candidate is visible in `triage_results` with `approval_status = 'pending'`\n**And:** It appears in the Triage Inbox (`GET /v1/knowledge/inbox`)\n\n## Test 2: Candidate Is Not Visible to Governed Org Memory Queries While Pending\n\n**Given:** A triage candidate exists with `approval_status = 'pending'`\n**When:** Queried through organizational memory endpoints\n**Then:** The candidate is NOT returned\n**And:** Only `approval_status = 'approved'` items appear in org memory\n\n## Test 3: Reject Leaves No Published Memory\n\n**Given:** A triage candidate exists\n**When:** A human rejects it (`PATCH /v1/knowledge/triage/:id` with `action: \"discard\"`)\n**Then:** `approval_status` changes to `'discarded'`\n**And:** No `org_memory` row is created\n**And:** No AI Search index entry exists\n**And:** The rejection is audit-logged\n\n## Test 4: Defer Leaves No Published Memory and Can Return to Review\n\n**Given:** A triage candidate exists\n**When:** A human defers it (`action: \"defer\"`)\n**Then:** `approval_status` changes to `'deferred'`\n**And:** No `org_memory` row is created\n**And:** The item reappears in the Triage Inbox\n**And:** It can later be approved or discarded\n\n## Test 5: Approve Records Approver Identity/Time and Triggers Exactly One Promotion\n\n**Given:** A triage candidate exists with `approval_status = 'pending'`\n**When:** A human approves it (`action: \"approve\"`)\n**Then:** `approval_status` changes to `'approved'`\n**And:** `approved_by` records the approver's identity\n**And:** `approved_at` records the approval timestamp\n**And:** Exactly one consolidation queue message is sent\n**And:** The approval is audit-logged with full context\n\n## Test 6: Promotion Creates Provenance/Lineage and an Outbox Event\n\n**Given:** An approved triage item is processed by the Memory Consolidator\n**When:** The Pipeline promotion engine scores and promotes it\n**Then:** An `org_memory` row is created with:\n- `lineage_ref` linking to the source entity\n- `metadata` containing source, signals, and classification\n- `governance_state` set to 'staging' or 'approved'\n**And:** A `memory_promotion_audit` row records the decision\n**And:** An outbox event is emitted for downstream consumers\n\n## Test 7: Search/Index Receives Only Published Memory\n\n**Given:** Both pending and approved triage items exist\n**When:** AI Search is queried\n**Then:** Only `governance_state = 'approved'` items are returned\n**And:** Pending items are NOT in the search index\n**And:** Rejected items are NOT in the search index\n\n## Test 8: Twin Reads Published Memory Through Bounded Context Projection\n\n**Given:** Approved organizational memory exists\n**When:** The Twin reasons about a work item\n**Then:** It receives memory through the AI Operational Sandbox\n**And:** The sandbox is bounded by tenant, user, role, and task\n**And:** The Twin never queries canonical storage directly\n**And:** Freshness, completeness, and authority markers are present\n\n## Test 9: Canonical Direct Writes from Triage Are Impossible Through Runtime Credentials/Bindings\n\n**Given:** The triage runtime is deployed\n**When:** Attempted to write directly to `org_memory` from triage context\n**Then:** The write fails or is rejected\n**And:** Triage bindings do not include write access to canonical storage\n**And:** The only path to `org_memory` is through the Pipeline promotion engine\n\n## Test 10: Reconciliation Confirms the Published Record Is Retrievable After Promotion\n\n**Given:** A triage item has been approved and promoted\n**When:** The `org_memory` table is queried directly\n**Then:** The row exists with correct:\n- `id`, `tenant_id`, `topic`, `category`, `content`\n- `governance_state = 'approved'`\n- `confidence` score\n- `lineage_ref` linking to source\n- `created_at` and `updated_at` timestamps\n**And:** The AI Search index contains the corresponding document\n**And:** The memory is retrievable through search with matching metadata\n"}