The ratchet — every mistake becomes a rule — step 7 of 9
Write add_to_ratchet(log, failure) that appends a new entry to a
ratchet log and returns a NEW list (don't mutate the input).
Rules:
logis a list of dicts, each with keys:date(YYYY-MM-DD),failure,rule,remove_when.failureis a dict with the same four keys.- Return a new list with the new entry inserted, sorted by
dateascending. - Do NOT mutate the original
log.
Two failures appended in sequence. Expected output:
After first add:
2026-02-20: use Tailwind, never inline styles
2026-03-15: never skip failing tests
2026-04-02: no force push to main
After second add:
2026-02-20: use Tailwind, never inline styles
2026-03-15: never skip failing tests
2026-04-02: no force push to main
2026-05-01: use structlog, not stdlib logging
⌘↵ runs the editor.read, then continue.
Write add_to_ratchet(log, failure) that appends a new entry to a
ratchet log and returns a NEW list (don't mutate the input).
Rules:
logis a list of dicts, each with keys:date(YYYY-MM-DD),failure,rule,remove_when.failureis a dict with the same four keys.- Return a new list with the new entry inserted, sorted by
dateascending. - Do NOT mutate the original
log.
Two failures appended in sequence. Expected output:
After first add:
2026-02-20: use Tailwind, never inline styles
2026-03-15: never skip failing tests
2026-04-02: no force push to main
After second add:
2026-02-20: use Tailwind, never inline styles
2026-03-15: never skip failing tests
2026-04-02: no force push to main
2026-05-01: 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.