Skip to content

< all problems34 · Level 05, Agents

Repair: article URLs are full of dashes

medium · repair session · Agents

Published URLs contain runs of dashes and end in a dash.

The CMS builds article URLs from titles with slug.slugify. Titles with punctuation produce ugly, sometimes duplicate, URLs:

>>> from slug import slugify
>>> slugify("Hello -- World!")
'hello----world-'

Expected 'hello-world'. Simple titles like "Hello World" are fine. Two articles, "Q&A: Caching" and "Q & A: Caching", should share one URL and currently do not. The repo's own tests in tests/ are failing.

A published URL never changes: published.PUBLISHED records the slug every live article went out under, and the README lists the rules that produced them.

Done when

  • Runs of separators collapse to one dash, with none at either end.
  • slugify follows every rule in the README and reproduces every slug in published.PUBLISHED.
  • tests/ are untouched.

You have a coding agent with tools to list, read and edit files and run the tests. It has been given the report above, and nothing else: not the README, not what "done" means. Prompt it. It is graded on the repo it leaves behind: the repo's tests, hidden ones, and whether it left tests/ alone, and ranked on model calls.