Skip to content

fix(cli): fail verify when the time limit leaves gate checks unrun - #260

Merged
adityankale190895 merged 3 commits into
DiffCI:mainfrom
FredApps:fix/verify-checks-out-of-time
Nov 18, 2026
Merged

adityankale190895 merged 3 commits into
DiffCI:mainfrom
FredApps:fix/verify-checks-out-of-time

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #259

Changed behavior

When the --timeout-ms budget runs out before a gate check starts, verify no longer runs the tests with no time limit and reports passed. It now stops before the tests, records a timed-out execution, and fails the verdict with the reason gate check(s) <ids> did not run within the <N>ms time limit; tests were not run. The failure baseline is not compared in that case, as with a failed check.

Behavior is unchanged when every check runs.

Validation

  • New tests/client/verify-check-timeout.test.ts: a failing gate check with timeoutMs: 0. It fails on main (verification is passed) and passes with this change.
  • node --import tsx --test tests/client/verify-*.test.ts tests/client/gate-checks.test.ts: 47 passed.
  • tsc --noEmit -p packages/diffci-cli: clean.
  • The new test file is listed in release-files.json.

Checks that use the whole budget (follow-up)

Every check can run and still use the whole --timeout-ms budget, for example a failing check whose base rerun (--baseline-on-failure) shows it also fails at the base. The tests then started with a limit of Math.max(..., 0) = 0, which means no limit. Now:

  • When the checks ran and no time is left, the tests do not start. The verdict fails with gate checks used the whole <N>ms time limit (<M>ms); tests were not run, and the failure baseline is not compared.
  • A check's base rerun with no time left is reported as unknown ("the time limit ran out before the base run") instead of running with no limit.

Two cases are added to tests/client/verify-check-timeout.test.ts. They mock Date.now so that the check uses the whole budget once it has run, because real time cannot reliably reproduce an overrun the check's own timeout caps. Both fail without this change: the first reports passed, and the second reruns the check at the base (preexisting).

Conflict with #276: checksOutOfTime now sits after checkSummary instead of at the spot where #276 adds redactReceipt, so the two merge in either order.

runChecks marks checks not_run when the budget is used up, but verify
ignored outOfTime, ran the tests with no limit and reported the checks
as skipped. Stop before the tests and fail the verdict instead.

Fixes DiffCI#259

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

Cross-review (FredApps, head 1ec51e3). Not an approval.

Checked

Fixed: nothing pushed.

Open

  • Gap, not fixed here: every check can run and still use the whole budget. For example, the last check fails, its --baseline-on-failure rerun is pre-existing, and the base rerun plus worktree setup eat the rest.
  • Then outOfTime is false and the tests still start with timeoutMs: Math.max(... , 0) = 0, i.e. no limit.
  • Checking options.timeoutMs - checkRun.wallMs <= 0 before running the tests would close it. I didn't add it because a reliable regression test needs a timed baseline fixture.
  • verify.ts conflicts with fix(cli): plan verify --redact-paths with real paths, redact the receipt #276 (both add a helper after verifyCommitRange). Whichever lands second needs main merged in.

Every check could run and still use the whole --timeout-ms budget, for
example a failing check whose base rerun shows it also fails at the base.
The tests then started with a 0ms limit, which means no limit. They now do
not start and the verdict fails. A base rerun with no time left is
reported as unknown instead of running with no limit.

Fixes DiffCI#259

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

Follow-up on the open point in the cross-review: checks that run but use the whole budget.

Real. On this branch before the fix, a failing check whose base rerun showed it also fails at the base used the whole --timeout-ms budget. The tests then started with Math.max(..., 0) = 0, which means no limit, and the verdict was passed. The base rerun itself had the same gap: checkAtBaseline got Math.max(remainingMs, 0).

Fixed in 977110d

  • When the checks ran and no time is left, the tests do not start. The verdict fails with gate checks used the whole <N>ms time limit (<M>ms); tests were not run, and the failure baseline is skipped.
  • A base rerun with no time left is reported as unknown ("the time limit ran out before the base run") instead of running with no limit.
  • Two new cases in tests/client/verify-check-timeout.test.ts mock Date.now, so that the check uses the whole budget once it has run. Real time can't reproduce this reliably, because the check's own timeout caps it. Both fail without the fix: one reports passed, and the other reruns at the base and gets preexisting. Both pass with it.
  • verify-*.test.ts and gate-checks.test.ts: 49 passed. Typecheck is clean.

CI: all checks pass on 977110d.

Still open: verify.ts still conflicts with #276. Whichever lands second needs main merged in.

… cleanly with DiffCI#276

No behavior change. DiffCI#276 adds redactReceipt at the same spot after verifyCommitRange, which made the two PRs conflict.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 01:19
@adityankale190895
adityankale190895 merged commit ca294d2 into DiffCI:main Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

verify: a gate check the time limit left no room for is skipped and the verdict passes

2 participants