repo-mailbox/scripts
Kjell Tore Guttormsen 5316688844 fix(orders): a pending order's age comes from the filename, not the mtime
`coord-order-done --return` rewrites the order file's mtime, and both age
surfaces read mtime, so putting an order back reset the very reading that
says how long it has waited. An order returned three times could never look
old - on the one surface that exists precisely so a repo nobody opens still
shows something.

Found by reading the board right after this repo returned an order of its
own, not by looking for it: a file whose name says 2026-09-02 rendered
`ORDRE 1:0d` and `pending, 0d old` minutes later. Verified live after the
fix: the same order now reads 1d.

Two questions, two sources, and only one of them moved. A PENDING order's
age is "how long has this sat with no owner" = now - delivery time, which
only the filename carries and nothing rewrites. A CLAIMED order's age is
"how long has it been in flight", which is the claim's own mtime and was
already right. So oldest_pending_age() sits BESIDE oldest_order_age(), and
pending_age_of() beside age_of() - switching FLY to the filename would
answer the delivery question in the column that asks the flight question.
An unparseable filename yields "?" for the whole reading, never a
fabricated 0, because an unmeasured order could be the oldest one.

TDD, red first: orders-selftest section 11 (110 -> 116) and board-selftest
section 30 (360 -> 368), each asserting its own ground truth before
anything depends on it, with controls that a freshly delivered order still
reads 0d and that FLY did not move. Mutation-verified in both files:
restoring the mtime read turns exactly the defect checks red and leaves
every control green.

Section 28's fixtures were rewritten as part of this rather than
incidentally: they encoded their ages in `touch -t` while their filenames
held fixed 2026-01/2026-08 dates, which a filename-based reading makes both
wrong and time-dependent. They now compute their stems from `date -v` and
the section asserts two ground truths, the filename for ORDRE and the mtime
for FLY.

Order 20260903T185736Z-1290610855 (.claude). Version 0.32.1 across all
seven files; no catalog change in this session.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-03 22:17:26 +02:00
..
board-selftest.sh fix(orders): a pending order's age comes from the filename, not the mtime 2026-09-03 22:17:26 +02:00
board.sh fix(orders): a pending order's age comes from the filename, not the mtime 2026-09-03 22:17:26 +02:00
brief-nightly.sh feat(brief): render the nightly cross-repo briefing without a model 2026-08-01 22:38:46 +02:00
coord-count.sh fix(infra): a failed measurement must never render as a reassuring value 2026-08-26 12:15:05 +02:00
coord-done.sh feat(engine): make a bulk close state what Rule 7 says must be stated 2026-07-31 15:48:42 +02:00
coord-inbox.sh feat(engine): let a message say it needs no answer, and count debt without losing sight of the rest 2026-07-31 15:46:14 +02:00
coord-order-claim.sh fix(orders): call the order-verbs by absolute path, not bare PATH names 2026-08-18 09:16:59 +02:00
coord-order-done.sh fix(orders): narrow the return-reason escape so a plain arrow survives 2026-08-17 21:24:37 +02:00
coord-order-inbox.sh fix(orders): a pending order's age comes from the filename, not the mtime 2026-09-03 22:17:26 +02:00
coord-order-send.sh fix(coord): refuse a control character in --to instead of sanitizing it 2026-08-18 17:00:34 +02:00
coord-selftest.sh fix(infra): a failed measurement must never render as a reassuring value 2026-08-26 12:15:05 +02:00
coord-send.sh fix(coord): refuse a control character in --to instead of sanitizing it 2026-08-18 17:00:34 +02:00
coord-sweep.sh fix(coord-send): stop rejecting dot-prefixed repo names 2026-08-09 21:09:23 +02:00
orders-selftest.sh fix(orders): a pending order's age comes from the filename, not the mtime 2026-09-03 22:17:26 +02:00
route-selftest.sh fix(route): --last-model learns Fable 5.1, and the set stays closed 2026-09-01 21:42:28 +02:00
route.sh fix(route): --last-model learns Fable 5.1, and the set stays closed 2026-09-01 21:42:28 +02:00
state-line-guard-selftest.sh fix(infra): a failed measurement must never render as a reassuring value 2026-08-26 12:15:05 +02:00