promptdojo_

Why schemas eat prompts — the boundary contract pattern — step 8 of 8

Checkpoint

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's name to 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's min with key= preserves stable order).

Scoring rules are unchanged from the previous step:

  • 25 points per True for 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

full-screen editor opens — close anytime to keep reading.