Why schemas eat prompts — the boundary contract pattern — step 8 of 8
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill. Synthesize the boundary-audit method into a triage
tool: triage_systems(systems) that takes a list of system
profiles and returns a tuple (verdicts, riskiest):
verdicts: dict mapping each system'snameto its verdict string (same four verdicts as the previous step:"hardened","mostly-safe","leaky","trust-everything")riskiest: string, the name of the system with the LOWEST score — the one most likely to ship a customer-visible failure first. On a tie, return the FIRST one in the input list (Python'sminwithkey=preserves stable order).
Scoring rules are unchanged from the previous step:
- 25 points per
Truefor each of the four boundary fields (validates_model_output,validates_user_input,validates_external_api_returns,validates_db_reads) - Verdicts:
>=75 hardened,>=50 mostly-safe,>=25 leaky,<25 trust-everything
Five systems run. Expected output:
verdicts: {'BillingApp': 'hardened', 'MailerBot': 'hardened', 'AnalyticsDash': 'mostly-safe', 'ChatWidget': 'leaky', 'PrototypeX': 'trust-everything'}
riskiest: PrototypeX
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill. Synthesize the boundary-audit method into a triage
tool: triage_systems(systems) that takes a list of system
profiles and returns a tuple (verdicts, riskiest):
verdicts: dict mapping each system'snameto its verdict string (same four verdicts as the previous step:"hardened","mostly-safe","leaky","trust-everything")riskiest: string, the name of the system with the LOWEST score — the one most likely to ship a customer-visible failure first. On a tie, return the FIRST one in the input list (Python'sminwithkey=preserves stable order).
Scoring rules are unchanged from the previous step:
- 25 points per
Truefor each of the four boundary fields (validates_model_output,validates_user_input,validates_external_api_returns,validates_db_reads) - Verdicts:
>=75 hardened,>=50 mostly-safe,>=25 leaky,<25 trust-everything
Five systems run. Expected output:
verdicts: {'BillingApp': 'hardened', 'MailerBot': 'hardened', 'AnalyticsDash': 'mostly-safe', 'ChatWidget': 'leaky', 'PrototypeX': 'trust-everything'}
riskiest: PrototypeX
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.