A corrupt or future ci_wait_started silently disables the CI wait budget #473
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#473
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found triaging IW-437 (raised in phase 3 code review; pre-existing, deliberately not fixed there).
CiGate.startOfWait (core/model/CiGate.scala:352-361) has two ways to make the total timeout stop enforcing, both silent:
UNPARSEABLE VALUE. A present but unparseable ci_wait_started is swallowed (catch case _: Exception => None) and replaced by
now. Every resumed invocation then recomputes startedAtMs as approximately now, so the budget resets instead of expiring.FUTURE VALUE. A parseable but future ci_wait_started makes (now - startedAtMs) negative, which never exceeds timeoutMs.
Either yields an unbounded wait, with no warning to the operator. The wait that was supposed to be capped simply never caps.
AGE. This is unchanged from baseline
81826a3. That revision's startOfWait already carried the identicalcatch case _: Exception => Noneplus.getOrElse(now)fallback, and a far-future ci_deadline produced the same negative-elapsed result via (deadline - timeoutMs). IW-437 phase 3 renamed the field and changed how the start is derived; it neither introduced nor widened this behaviour. The scaladoc documents the fallback deliberately: "Absent, or unreadable, means this invocation is the beginning of the wait."THE DECISION TO MAKE. Absent is legitimately the beginning of a wait. Present-but-corrupt is not the same thing, and neither is present-but-future. What should each do - fail loud, or fall back to a bounded value? The "a typo must fail loudly" principle IW-423 raised for --needs-attention argues for the former on a corrupt value.
RELATED. Nothing enforces the schema's declared date-time format on this field, which is how an unparseable value reaches the card in the first place - see the companion issue on timestamp validation. That makes case 1 reachable through an ordinary bad write, not only through file corruption.
The companion issue referenced above is #474 — enforce the schema's declared
date-timeformat inReviewStateValidator, for every timestamp field on the card.Fixed in PR #501 (merge
d1eba9c4).CiGate.startOfWaitnow returns a bounded start plus a warning: an unparseable value falls back to now, a future value is clamped to now, andci-gate,phase-prandphase-mergeprint the reason to stderr. An absent value is unchanged and silent. The wait is bounded in every case.