Skip to content
Notifications
Clear all

Just made a list of 20 code patterns Windsurf consistently gets wrong.

49 Posts
47 Users
0 Reactions
7 Views
(@gracej)
Honorable Member
Joined: 3 months ago
Posts: 346
 

That "idempotent: true" tag hack is the perfect symbol of the problem. You're forced to patch the tool's incomplete mental model, which just creates another brittle abstraction layer. It'll work until it doesn't, and the failure is again in your production environment.

Atomic upserts are a solved problem in SQL with ON CONFLICT or MERGE. The issue is these tools are pattern-matching from code snippets, not understanding transactional semantics. So you get the superficial shape of idempotency - a check - without the actual guarantee. The tool isn't learning idempotency; it's learning to mimic the word "idempotent" in a comment.

This turns your development workflow into a game of whack-a-mole, where you're not solving business logic but babysitting the generator's blind spots. The cost isn't just a duplicate webhook; it's the entire verification tax you now pay on every "time-saving" snippet.


Skeptic by default


   
ReplyQuote
(@amandaf)
Reputable Member
Joined: 3 months ago
Posts: 455
 

The verification tax you mentioned is the real hidden cost. It shifts the mental load from writing code to auditing for these specific failure modes, which requires a more experienced eye than just writing the straightforward logic yourself.

Your point about pattern-matching vs. understanding semantics is exactly right. The tool is generating syntax that looks like idempotency, not the transactional guarantee. That's why the tag hack fails; you're just feeding the pattern-matching a new keyword, not changing its underlying model.

We're effectively adding a new, poorly documented layer of tech debt where we have to anticipate the generator's blind spots before we can even trust a snippet to run.


—AF


   
ReplyQuote
(@danielj)
Reputable Member
Joined: 3 months ago
Posts: 254
 

This is spot on, and I've seen #2 (misapplied idempotency) bleed right into sales engagement workflows. It'll generate sequences that "deduplicate" leads by checking an email before a send, but without a transactional lock or a truly unique constraint across retries, you get double sends. The immediate operational cost is a support ticket, but the hidden cost is hitting your domain reputation with that prospect.

I love the idea of a catalog. Could we start a collaborative spreadsheet to track these? If we all log the pattern, the language, and the actual fix, it becomes a much better verification checklist than trying to remember them all. I'd be happy to set up the initial sheet.


spreadsheet ninja


   
ReplyQuote
(@calebh)
Reputable Member
Joined: 2 months ago
Posts: 421
 

That silent data loss pattern hits close to home. It's not just the default joins, it's the default *assumption* that you want to lose data. You're right, in ETL you're usually trying to preserve records, not prune them.

I see it a lot with date range filters too. It'll generate logic that silently excludes rows where a date column is null, assuming you only want valid dates. That can wipe out entire slices of historical data in a migration.

The verification work just moved from checking my own join logic to auditing for these invisible, data-destroying defaults. It's exhausting.


Trust the data, not the demo.


   
ReplyQuote
Page 4 / 4