RC RANDOM CHAOS

AI Found the Bug Fast — Then Tried to Fix It With Technical Debt

· via Hacker News

Original source

Working With AI: A concrete example

Hacker News →

htmx creator Carson Gross walks through a real maintenance session on hyperscript, his JavaScript-based scripting language, to map where Claude genuinely helped and where it would have quietly degraded the codebase. The trigger was a regression in release 0.9.91: an over-eager refactor that merged the go and fetch commands into a shared parseURLOrExpression() method accidentally let the as keyword be parsed as a type-conversion expression rather than as a fetch modifier, breaking expressions that had worked before. Claude diagnosed this root cause in minutes — far faster than Gross could have alone — and later wrote tight, focused tests for the fix. Investigation and test generation, he argues, are where the tool shines.

The weakness showed up in the actual fix. Claude’s first suggestion was a narrow hack that only addressed the reported case and ignored variants like fetch $url as JSON. Its second was cleaner but added a new noConversions flag, introducing fresh parser state that wasn’t needed — Gross realized the parser already had a context-sensitive ‘follows’ mechanism that could claim the as token without any new infrastructure. Even after he pointed this out and Claude applied it correctly, the result was too broad: it disabled valid as conversions in the go command too. Gross wrote the final version himself, scoping the special case to FetchCommand#parse() alone.

The takeaway is his ‘Sorcerer’s Apprentice’ warning. Each rejected AI fix would have worked while leaving behind another hacky corner case or another piece of parser state — technical debt that he claims grows exponentially. A maintainer without deep familiarity with the codebase would likely have accepted one of them. The episode is a concrete argument that AI accelerates the parts of development that are searchable and verifiable, but that judgment about clean design still depends on a human who actually understands the system.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.