The ratchet — every mistake becomes a rule — step 9 of 9
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final ratchet drill. Combine the audit + the leverage assessment
into one function: triage_ratchet(rules).
Each rule is a dict with date (YYYY-MM-DD), rule (string), and
model_native_in_year (int, 9999 if never).
Return a dict with three fields:
kept_count: int, rules still earning their place (model_native_in_year > 2025)remove_count: int, rules to retire (model_native_in_year <= 2025)highest_leverage: string, the rule with the MOST RECENTdateamong the kept rules (the rule that most recently earned its place is the highest-leverage rule still in the harness)
On a tie for the most recent date, return the LAST one in input
order (Python's max is stable).
Five rules run. Expected output:
{'kept_count': 3, 'remove_count': 2, 'highest_leverage': 'use structlog, not stdlib logging'}
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final ratchet drill. Combine the audit + the leverage assessment
into one function: triage_ratchet(rules).
Each rule is a dict with date (YYYY-MM-DD), rule (string), and
model_native_in_year (int, 9999 if never).
Return a dict with three fields:
kept_count: int, rules still earning their place (model_native_in_year > 2025)remove_count: int, rules to retire (model_native_in_year <= 2025)highest_leverage: string, the rule with the MOST RECENTdateamong the kept rules (the rule that most recently earned its place is the highest-leverage rule still in the harness)
On a tie for the most recent date, return the LAST one in input
order (Python's max is stable).
Five rules run. Expected output:
{'kept_count': 3, 'remove_count': 2, 'highest_leverage': 'use structlog, not stdlib logging'}
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.