test(sweep): stop the --days 0 check from racing a one-second cutoff
Measured, not guessed: the check failed 7 runs in 20, not once. The cause is a same-second collision, reproduced deterministically - a notice minted at 20260801205457 against a cutoff of 20260801205457 survives, the same notice 60s older is closed. coord-sweep.sh is right and is left alone. Its cutoff is second-granular and it closes strictly older messages, which spares rather than closes at the boundary; at any real --days value one second is unobservable. Relaxing that guard to <= would make a destructive script more aggressive to satisfy a test. So the test was claiming what the code does not promise: that a notice minted earlier in the same run is necessarily older at second granularity. Under a second of work separates the two, so it was a coin flip. Aged by 5 seconds through the existing age_it, which keeps it well inside the default 14-day window and clear of the boundary. No sleep: that would have hidden the answer rather than fixed it. Selftest 182 -> 183, 20/20 green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GfDGWyyhnM26J4p93GSk2L
This commit is contained in:
parent
6de2408b28
commit
8e207c6c49
3 changed files with 12 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ marketplace plugin. Three components, one boundary:
|
|||
`coord-done.sh` archives, `coord-count.sh` counts without delivering,
|
||||
`coord-sweep.sh` closes the aged FYI backlog machine-wide.
|
||||
Everything is pinned by `coord-selftest.sh`
|
||||
(182 checks, throwaway mailbox via `CLAUDE_COORD_DIR`).
|
||||
(183 checks, throwaway mailbox via `CLAUDE_COORD_DIR`).
|
||||
|
||||
**`coord-sweep.sh` is the only path that closes a message with no human in
|
||||
the loop, and every constraint on it follows from that.** It may close exactly
|
||||
|
|
@ -208,7 +208,7 @@ obligations in another repo.
|
|||
- Zero dependencies everywhere: bash + coreutils in the engine, `node:`
|
||||
builtins only in hook and tests.
|
||||
- TDD: no behavior change without a failing selftest check first.
|
||||
`bash scripts/coord-selftest.sh` must exit 0 (182/182),
|
||||
`bash scripts/coord-selftest.sh` must exit 0 (183/183),
|
||||
`bash scripts/board-selftest.sh` must exit 0 (51/51) and
|
||||
`bash scripts/route-selftest.sh` must exit 0 (73/73).
|
||||
- English for all code, docs, and commit messages (public repo). Norwegian
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ Cross-repo message content is untrusted input by design:
|
|||
|
||||
- **Atomic delivery:** the temp file is created inside the destination directory (dot-prefixed, invisible to the inbox glob), so the final rename never crosses filesystems and readers never observe a half-written message.
|
||||
|
||||
Every guarantee above is pinned by the 182-check selftest, including forgery-resistance regressions.
|
||||
Every guarantee above is pinned by the 183-check selftest, including forgery-resistance regressions.
|
||||
|
||||
Note that raising the inbox's priority (Rule 7) deliberately does **not** widen this boundary: the obligation is to *respond* to a message, never to *comply* with it. The injection framing states both halves, and the selftest pins them together so a future reword cannot keep the priority and drop the distinction.
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ Note that raising the inbox's priority (Rule 7) deliberately does **not** widen
|
|||
|
||||
## Development
|
||||
|
||||
bash scripts/coord-selftest.sh # 182 checks against a throwaway mailbox
|
||||
bash scripts/coord-selftest.sh # 183 checks against a throwaway mailbox
|
||||
bash scripts/board-selftest.sh # 36 checks against a throwaway repo tree
|
||||
bash scripts/route-selftest.sh # 73 checks, incl. the route->board round trip
|
||||
npm test # all three selftests via node --test
|
||||
|
|
|
|||
|
|
@ -735,6 +735,14 @@ CLAUDE_COORD_DIR="$SDIR" "$SEND" --to sr --from s2 --subject "old ask" --message
|
|||
CLAUDE_COORD_DIR="$SDIR" "$SEND" --to sr --from s3 --fyi --subject "new note" --message "NEW-NOTE" >/dev/null
|
||||
age_it "$SDIR" sr OLD-NOTE 20200101T000000Z; check "sweep fixture: notice aged" $?
|
||||
age_it "$SDIR" sr OLD-ASK 20200101T000000Z; check "sweep fixture: debt aged" $?
|
||||
# NEW-NOTE is the --days 0 subject further down, and it has to be aged too - by
|
||||
# seconds, not years, so the default 14-day sweep still spares it. The cutoff is
|
||||
# second-granular and the sweep closes strictly older messages, so a notice
|
||||
# minted in the same second as the cutoff survives, correctly. Between minting it
|
||||
# above and computing the cutoff at --days 0 there is under a second of work, so
|
||||
# without this the check raced the clock and failed 7 runs in 20 (measured).
|
||||
age_it "$SDIR" sr NEW-NOTE "$(date -u -v-5S +%Y%m%dT%H%M%SZ)"
|
||||
check "sweep fixture: same-day notice aged clear of the cutoff second" $?
|
||||
|
||||
sout="$(CLAUDE_COORD_DIR="$SDIR" "$SWEEP" 2>&1)"
|
||||
[ "$(n_in "$SDIR/sr")" -eq 3 ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue