Commit c74a99c
fix(scripts): stop pruning run-log entries with non-ISO run_id, fix Windows test path (#519)
append-run-log.mjs pruned entries with new Date(obj.run_id).getTime()
and dropped any that came back NaN-or-too-old. JS's Date constructor is
lenient: a non-ISO run_id (a numeric GitHub run id, a custom slug like
"run-1") doesn't reliably parse to NaN, it can parse into a spurious
in-range-looking date instead ("run-1" -> 2001-01-01 in local time),
which then reads as 30+ days old and gets silently deleted on the very
next append -- even though the entry was just written. loop-metrics
already handles this same run_id shape correctly (keep on unparseable
rather than drop); this script did the opposite. Now only strings
shaped like an ISO date are parsed as timestamps at all, so a non-ISO
run_id is always kept.
Also fixes append-run-log.test.mjs's own SCRIPT path, which used
new URL(...).pathname -- on Windows that yields a leading-slash path
("/D:/...") that node's CLI mis-resolves relative to the current
drive instead of as absolute, the same class of bug already fixed for
tools/loop/test/files.test.mjs. Switched to fileURLToPath(), which is
what let this fix's own regression test actually run and confirm the
behavior locally.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent 50eb9d0 commit c74a99c
2 files changed
Lines changed: 35 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
10 | 19 | | |
11 | 20 | | |
12 | 21 | | |
| |||
40 | 49 | | |
41 | 50 | | |
42 | 51 | | |
43 | | - | |
44 | | - | |
| 52 | + | |
| 53 | + | |
45 | 54 | | |
46 | 55 | | |
47 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
0 commit comments