Worked examples
See the controls in action.
Two small, runnable implementations connect architecture decisions to observable behavior. Each includes source, captured output, validation results, and lessons you can apply.
LAB-230-01 · Synthetic prototype
Private retrieval that respects document permissions.
The same finance question should produce different results for a permitted finance user and an HR user without access.
- 01Identify the user
- 02Filter by permissions
- 03Retrieve active documents
- 04Sanitize untrusted text
- 05Validate source citations
- 06Record versioned evidence
Permitted user · fiona.finance
Finance budget requests above 50000 credits require CFO approval and a recorded risk review.
Citation: FIN-BUDGET-2026 v3.0
User without access · harper.hr
No permitted source supports an answer to this question.
0 citations · 0 documents in context

Inspect complete validation output
test_every_citation_resolves_to_an_active_exact_version (test_citations.CitationTests.test_every_citation_resolves_to_an_active_exact_version) ... ok test_deleted_document_is_absent_from_index_context_and_citations (test_no_answer.NoAnswerAndDeletionTests.test_deleted_document_is_absent_from_index_context_and_citations) ... ok test_unsupported_question_uses_approved_no_answer (test_no_answer.NoAnswerAndDeletionTests.test_unsupported_question_uses_approved_no_answer) ... ok test_denied_finance_document_never_enters_hr_context (test_permissions.PermissionTests.test_denied_finance_document_never_enters_hr_context) ... ok test_permitted_finance_user_receives_current_version (test_permissions.PermissionTests.test_permitted_finance_user_receives_current_version) ... ok test_retrieved_instruction_is_detected_and_removed (test_prompt_injection.PromptInjectionTests.test_retrieved_instruction_is_detected_and_removed) ... ok ---------------------------------------------------------------------- Ran 6 tests in 0.005s OK
Source fingerprint
SHA-256: 55c96fd2d12b02f70480cc72e044a35dd12a7d0b7a7f947ce4f8b1af216dbda4
Digest of sorted relative source paths and their contents in the downloadable lab.
Reproduce the result
Extract the source archive. With Python 3.11 or newer, open a terminal in the extracted LAB-230-01 folder. No third-party Python packages or model downloads are required.
python scripts/validate.py
python -m app.serverValidation writes evidence/latest-validation.json. The server exposes /query on port 8080; the included README shows the request format. Run times and timestamps will vary.
Implementation lesson
Filter documents before relevance scoring and context assembly. A citation should identify the exact active source version. The tests also check deleted documents, unsupported questions, and a small set of injected instruction patterns.
This lab uses lexical retrieval and deterministic answer assembly. It does not measure LLM answer quality, production latency, or comprehensive prompt-injection resistance.
Explore the private RAG architectureLAB-250-01 · Synthetic prototype
A release gate that holds when evidence is incomplete.
A passing test suite can verify that a release gate correctly blocks a release. This example makes that distinction visible.
- 01Load control catalog
- 02Link evidence records
- 03Build traceability matrix
- 04Check required evidence
- 05Apply valid exceptions
- 06Issue release recommendation
Recorded recommendation
HOLD
1 uncovered finding: CTRL-INJECTION-01 lacks required integrity evidence. A valid exception covers the deletion-control gap, but the unresolved injection finding still blocks release.

Inspect complete validation output
test_complete_evidence_control_has_no_finding (test_evidence_quality.EvidenceQualityTests.test_complete_evidence_control_has_no_finding) ... ok test_evidence_missing_a_required_field_is_flagged (test_evidence_quality.EvidenceQualityTests.test_evidence_missing_a_required_field_is_flagged) ... ok test_evidence_record_missing_required_field_is_not_silently_treated_as_complete (test_evidence_quality.EvidenceQualityTests.test_evidence_record_missing_required_field_is_not_silently_treated_as_complete) ... ok test_every_evidence_record_references_a_known_control (test_passport_linkage.PassportLinkageTests.test_every_evidence_record_references_a_known_control) ... ok test_every_exception_references_a_known_control (test_passport_linkage.PassportLinkageTests.test_every_exception_references_a_known_control) ... ok test_every_referenced_control_exists_in_the_catalog (test_passport_linkage.PassportLinkageTests.test_every_referenced_control_exists_in_the_catalog) ... ok test_passport_links_controls_by_id_rather_than_duplicating_their_text (test_passport_linkage.PassportLinkageTests.test_passport_links_controls_by_id_rather_than_duplicating_their_text) ... ok test_covered_finding_yields_approve_with_conditions (test_release_gate.ReleaseGateTests.test_covered_finding_yields_approve_with_conditions) ... ok test_expired_exception_yields_hold_and_is_reported (test_release_gate.ReleaseGateTests.test_expired_exception_yields_hold_and_is_reported) ... ok test_missing_owner_yields_reject_even_with_complete_evidence (test_release_gate.ReleaseGateTests.test_missing_owner_yields_reject_even_with_complete_evidence) ... ok test_no_findings_yields_approve (test_release_gate.ReleaseGateTests.test_no_findings_yields_approve) ... ok test_shipped_dataset_holds_on_the_uncovered_injection_finding (test_release_gate.ReleaseGateTests.test_shipped_dataset_holds_on_the_uncovered_injection_finding) ... ok test_uncovered_finding_yields_hold (test_release_gate.ReleaseGateTests.test_uncovered_finding_yields_hold) ... ok test_control_without_evidence_is_marked_covered_not_silently_passed (test_traceability.TraceabilityTests.test_control_without_evidence_is_marked_covered_not_silently_passed) ... ok test_every_catalog_control_appears_exactly_once_in_the_matrix (test_traceability.TraceabilityTests.test_every_catalog_control_appears_exactly_once_in_the_matrix) ... ok test_every_control_has_a_named_owner_and_reviewer (test_traceability.TraceabilityTests.test_every_control_has_a_named_owner_and_reviewer) ... ok ---------------------------------------------------------------------- Ran 16 tests in 0.003s OK
Source fingerprint
SHA-256: 881d0d1adecce814b28a03ecb5ecbf96ab3801aeb1cc96412515bee1f8b2fff3
Digest of sorted relative source paths and their contents in the downloadable lab.
Reproduce the result
Extract the source archive. With Python 3.11 or newer, open a terminal in the extracted LAB-250-01 folder. No third-party Python packages or model downloads are required.
python scripts/validate.py
python -m app.cliValidation writes evidence/latest-validation.json. The CLI prints the traceability matrix, findings, exceptions, and release recommendation. Run times and timestamps will vary.
Implementation lesson
Keep controls, evidence, ownership, and exceptions traceable by ID. Count an exception only when it has the required compensating control and approval and has not expired. The tests cover approve, conditional approval, hold, and reject decisions.
The catalog and evidence are synthetic. These are local reproduction results, not an independent audit or a production approval. The sample uses the lab's configured assessment date; it does not assess a live system.
Start your own system passportYour next step
Apply the pattern to your own boundary.
Use the starting-point guide to find a relevant solution, or bring your requirements to an architecture review.