Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Spot shortcut tells and name their later cost
card 5 of 6
Three tells in one 'flaky test' fix
builds on: Making a failing test pass by weakening it, Hardcoding the answer the test expects, Silent fallbacks that hide bugs, Rust tells: unwrap, clone and RefCell to appease the compiler, Sleeps, retries and longer timeouts as 'fixes', Duplicating code instead of reusing it, Overbuilt code: speculative abstraction and defensive clutter, Placeholders passed off as implementations
There are three tells, each with its own cost. `_ = s.flush()` swallows the error, so a failed flush vanishes and records are lost with nothing logged. `time.Sleep` is a timing band-aid: the race is still there and comes back on a loaded runner or in production. `got < 1` loosens the assertion: the test now passes with 1 of 3 records synced, so the suite vouches for data loss.
// Go
--- a/sync/worker.go
+++ b/sync/worker.go
- if err := s.flush(); err != nil {
- return err
- }
+ _ = s.flush()
+ time.Sleep(200 * time.Millisecond)
--- a/sync/worker_test.go
+++ b/sync/worker_test.go
- if got != 3 {
+ if got < 1 {
t.Fatalf("synced %d, want 3", got)
Terms on this card
- flaky test
- A test that sometimes passes and sometimes fails on the same code, often because of timing or ordering.
- race
- A bug whose outcome depends on which of two concurrent operations happens first.
- assertion
- A check in a test that fails the test when a value is not what was expected.
- timing band-aid
- A sleep, retry or longer timeout that hides a timing or ordering bug instead of fixing it.
- time.Sleep
- Go function that pauses the current goroutine (Go's lightweight thread) for the given duration.
Lesson goal: Read agent code in any of the five languages and identify shortcuts: weakened tests, hardcoded answers, swallowed errors, silent fallbacks, type escapes, Rust unwraps and clones, timing band-aids, duplication, overbuilt code, placeholders and symptom patches. For each, state the concrete damage it will do after merge. ·
the whole lesson