{"data":{"kind":"file","path":"README.md","version_id":"c88ys6e3g7axut881cclc5uy","entry":{"name":"README.md","path":"README.md","is_directory":false,"size":3298,"modified_at":"2026-08-05T05:58:54.175000","content_hash":"a48bcf29e5c041093b2b7b7e99c9fffa04792a8938bb844cded90f6ee6527eba"},"entries":[],"content":"# iso8601-recurrence\n\nExpand an ISO 8601 repeating interval — `R<count>/<start>/<duration>` — into the list of\ninstants at which its occurrences start.\n\n### Why this task\n\nAn earlier environment of mine asked a model to *recognise* whether a string conformed to a\nfully-stated grammar. A free 120B model scored 44/44. Applying a published spec is not where\ncurrent models fail.\n\nThis targets **arithmetic that does not commute**:\n\n```\nR4/2026-08-31T00:00:00Z/P1M\n  -> 2026-08-31, 2026-09-30, 2026-10-30, 2026-11-30\n```\n\n31 August + 1 month is 31 September, which does not exist, so the day **clamps to 30**. Each\noccurrence steps from the *previous* one, so the clamp compounds and the series never returns\nto the 31st. A solver that anchors every occurrence to the original start gets three of four\npositions right and one wrong — **5 of the 21 valid cases separate the two algorithms.**\n\nThe second discriminator is **component order**. `P1M1D` on 2026-01-30 is (+1 month → clamp to\n02-28) then (+1 day) = **03-01**. Day-first gives 01-31 then +1 month = 02-28. Same duration,\nsame start, different answer. Both rules are stated in the prompt — this is fairness, not a\ntrick; the work is applying them, not guessing them.\n\n### Task\n\nSingle-turn. Reply with one JSON object:\n\n```json\n{\"valid\": true, \"occurrences\": [\"2026-01-31T00:00:00Z\", \"...\"], \"violation\": null}\n```\n\n`violation` is the **first** applicable code in a fixed precedence order: `shape` →\n`repeat-count` → `timestamp` → `duration-empty` → `week-mixed` → `fraction`.\n\n### Dataset\n\n**42 constructed cases** (21 valid / 21 invalid), not sampled — compounding month-end clamps,\nleap-year clamping on a yearly step, `P1M1D` ordering, week/day/clock arithmetic, fractional\nseconds and canonical trimming, `R0` and `R1` degenerate counts, a non-UTC start, and shape\ntraps (lowercase designators, `P1S`, `PT1D`, `P1Y2W3D`).\n\n### Grading\n\n| function | weight | meaning |\n| --- | --- | --- |\n| `exact_match` | **1.0** | all three fields correct; type-aware, elementwise, order-significant |\n| `parses_as_contract` | **0.0** | diagnostic only |\n\nThe format reward is weighted **zero** deliberately: a well-formed-but-wrong answer scoring\nabove zero is a gradient a model can climb without getting a single interval right.\n\n### Ground truth is double-sourced\n\nEvery case carries a **hand-written** expected answer; `_reference_expand()` re-derives the same\nspec independently. Neither is authoritative — the control asserts they agree on all 42 and\nfails loudly on disagreement. A generator that emits both an input and its own answer cannot\ndetect its own bug.\n\n### Control\n\n```bash\nuv run python selftest.py\n```\n\n**85 assertions, 0 failures, 9 planted defects, all caught.** Oracle 1.0000; the best constant\nanswer scores **0.1667**, measured across all 8 constant strategies rather than assumed.\n\n> One planted defect is documented as an *equivalent mutation* and deliberately excluded:\n> \"anchored expansion\" written as repeated `_add` is literally the iterative algorithm, and it\n> survived every probe. Measuring showed 5 of 21 valid cases do separate the two, so the mutant\n> was rewritten to multiply the duration and add once. A control that cannot distinguish\n> *detected* from *never ran* is not a control.\n","encoding":"utf-8","truncated":false,"total_bytes":3298},"status":null}