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.
Text, time and money: classic data traps card 5 of 6

The order summary, three traps

builds on: Why agents fill gaps with plausible guesses
This one diff has three tells. First, `.length` and `slice(0, 40)` count UTF-16 code units, so an emoji that straddles position 40 becomes a lone surrogate, shown as �. Second, `price * qty` multiplies and sums binary floats. `toFixed(2)` hides the drift on screen, yet `(1.005).toFixed(2)` is `"1.00"`, not `"1.01"`. Third, `30 * 86_400_000` ms is exactly 720 hours, but across a DST change 30 local days are 719 or 721 hours. An order placed at 00:00 comes due at 01:00, or at 23:00 the day before. BETTER: truncate by graphemes with `Intl.Segmenter`, sum integer cents, and add 30 calendar days in a named zone with `Temporal.ZonedDateTime` or a zone-aware date library.
// TypeScript
--- a/src/orders/summary.ts
+++ b/src/orders/summary.ts
@@ -12,1 +12,8 @@ export function summarize(
-  return { note, total: 0 };
+  const preview = note.length > 40
+    ? note.slice(0, 40) + "…" : note;
+  const total = items.reduce(
+    (s, i) => s + i.price * i.qty, 0);
+  const due = new Date(
+    created.getTime() + 30 * 86_400_000);
+  return { preview, due,
+    total: total.toFixed(2) };
Terms on this card
diff
The change under review in unified format: '-' lines are removed, '+' lines are added, and unprefixed lines are context.
UTF-16 code units
The 16-bit pieces that JS and Java strings are made of. Most emoji need two of them, called a surrogate pair.
lone surrogate
Half of a UTF-16 surrogate pair left behind when a string is cut between the two halves. It is not a valid character and shows as �.
graphemes
What a reader sees as one character. It can be several code points, such as a flag or an emoji with a skin tone.
ZonedDateTime
Java date-time tied to a named zone, so it knows that zone's DST rules.
Learn this step by step on Bytewise
Lesson goal: Spot agent code that is wrong for real-world data: string length, slicing or case-folding that breaks on non-ASCII text, naive datetimes and DST or time-zone shifts, and floating-point arithmetic for money. Name the safe type or library in each language (for example Decimal or BigDecimal, integer cents, zone-aware datetimes). · the whole lesson