Commit 8ff84ae
fix(trace-recent): structured :bad-arg on non-integer window, no Java stack
Closes #16. trace-recent-op called Integer/parseInt on the first
positional arg outside any try/catch. Passing a stray flag (e.g.
trace-recent.sh --limit 25) leaked a NumberFormatException stack to
stderr — violating the skill's "every script returns structured EDN"
contract and giving agents nothing translatable to the user.
Now: parse is wrapped; on failure, dies with
{:reason :bad-arg :got <input> :hint "..."} explaining that the
window is in milliseconds (not a count, the natural mistake) and
showing the correct usage.
Adds a :bad-arg row to docs/skill/troubleshooting.md so agents have a
known mapping.
2 new deftests cover both branches: non-integer arg surfaces :bad-arg
via die; valid integer proceeds past parse without dying.
Note: 5 sibling parse sites have the same Integer/Long parseInt-without-
try shape (watch-op flags --window-ms / --count / --idle-ms / --hard-ms
/ --poll-ms; tail-build's --wait-ms; the predicate parser's --timing-ms
already handles bad input via parse-predicate-args). A sweep fixing
those is worth filing as a follow-up but out of scope for this bug
which was specifically against trace-recent.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e953b5c commit 8ff84ae
3 files changed
Lines changed: 46 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1386 | 1386 | | |
1387 | 1387 | | |
1388 | 1388 | | |
1389 | | - | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
1390 | 1398 | | |
1391 | 1399 | | |
1392 | 1400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1260 | 1260 | | |
1261 | 1261 | | |
1262 | 1262 | | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
1263 | 1299 | | |
1264 | 1300 | | |
1265 | 1301 | | |
| |||
0 commit comments