Skip to content

fix(watchers): cap cron deadlines at the supported timer limit - #1148

Merged
scttbnsn merged 1 commit into
dev/v1.6from
fix/v1.6-cron-deadline
Sep 8, 2026
Merged

scttbnsn merged 1 commit into
dev/v1.6from
fix/v1.6-cron-deadline

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fix the long-cron timer overflow found during images-manager QA. A monthly or longer schedule makes twice the interval exceed Node's timer ceiling. Node then schedules the deadline after 1 ms, clears the running scan guard, and logs a false stall.

Cap the deadline at 2147483647 ms. Keep the existing ten-minute floor and interval-based behavior below that ceiling. Add a real-timer monthly regression and boundary tests. The regressions fail against the old implementation, and all 33 watcher tests pass with the fix.

The full pre-push gate and backend build pass, including app and UI coverage. Add the fix to the not-yet-published rc.11 notes. This holds the maintenance cut until the fix is merged and both exact-source release workflows pass again. Forward ports are prepared for 1.7 and 1.8.

Threat model: ordinary operator cron configuration in a Docker-management service. No hostile local user or new scheduling subsystem is involved.

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deployment failed for project drydock-website with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/codeswhat?upgradeToPro=build-rate-limit

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: b740f3a1-b70f-403a-bcaa-8322b04bde15

📥 Commits

Reviewing files that changed from the base of the PR and between 0ec74b3 and 27845d5.

⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by !CHANGELOG.md
📒 Files selected for processing (2)
  • app/watchers/providers/docker/docker-cron-watch.test.ts
  • app/watchers/providers/docker/docker-cron-watch.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttbnsn

scttbnsn commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Review the final cron deadline fix at 27845d5. Threat model: an operator-configured Docker update manager; valid long cron schedules must not overflow Node timers or falsely expire the single-flight guard. Hostile operators attacking their own machine are out of scope. Check the timer boundary and regression tests. This is the first actual review; the earlier attempt was rate-limited.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit='27845d58eca18489031de30ce9d1d131a3f236b1'

git show --no-ext-diff --format=fuller --stat "$commit"
printf '\n--- changed paths ---\n'
git diff-tree --no-commit-id --name-status -r "$commit"

printf '\n--- TypeScript outlines for changed files ---\n'
git diff-tree --no-commit-id --name-only -r "$commit" \
  | grep -E '\.(ts|tsx|js|jsx)$' \
  | while IFS= read -r file; do
      printf '\n### %s ###\n' "$file"
      ast-grep outline "$file" --items all || true
    done

printf '\n--- patch ---\n'
git show --no-ext-diff --format= "$commit"

Length of output: 7933


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- docker-cron-watch.ts: source ---'
nl -ba app/watchers/providers/docker/docker-cron-watch.ts | sed -n '1,430p'

printf '%s\n' '--- docker-cron-watch.test.ts: source ---'
nl -ba app/watchers/providers/docker/docker-cron-watch.test.ts | sed -n '1,360p'

printf '%s\n' '--- timer and deadline call sites ---'
rg -n -C 4 --glob '*.{ts,tsx,js,jsx}' \
  '(?:setTimeout|clearTimeout|CRON_WATCH_DEADLINE|getCronWatchDeadlineMs|getCronIntervalMs)\s*\(' \
  app/watchers

printf '%s\n' '--- timer-limit constants and comments ---'
rg -n -C 3 --glob '*.{ts,tsx,js,jsx}' \
  '(?:2147483647|2\*\*31|MAX_.*(?:TIMEOUT|TIMER)|timer ceiling|timer limit|overflow)' \
  .

Length of output: 1130


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- docker-cron-watch.ts: source ---'
sed -n '1,430p' app/watchers/providers/docker/docker-cron-watch.ts

printf '%s\n' '--- docker-cron-watch.test.ts: source ---'
sed -n '1,360p' app/watchers/providers/docker/docker-cron-watch.test.ts

printf '%s\n' '--- timer and deadline call sites ---'
rg -n -C 4 --glob '*.{ts,tsx,js,jsx}' \
  '(?:setTimeout|clearTimeout|CRON_WATCH_DEADLINE|getCronWatchDeadlineMs|getCronIntervalMs)\s*\(' \
  app/watchers || true

printf '%s\n' '--- timer-limit constants and comments ---'
rg -n -C 3 --glob '*.{ts,tsx,js,jsx}' \
  '(?:2147483647|2\*\*31|MAX_.*(?:TIMEOUT|TIMER)|timer ceiling|timer limit|overflow)' \
  . || true

Length of output: 131690


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- production cron-date provider ---'
rg -n -C 12 --glob '*.{ts,tsx,js,jsx}' \
  'getNextScheduledRunDate\s*\(' \
  app

printf '%s\n' '--- package manifests and Vitest configuration candidates ---'
fd -HI -t f '^(package\.json|vitest\.config\..*|vite\.config\..*)$' . \
  | while IFS= read -r file; do
      printf '\n### %s ###\n' "$file"
      sed -n '1,260p' "$file"
    done

printf '%s\n' '--- target test remainder: timer cleanup and cron interval tests ---'
sed -n '340,700p' app/watchers/providers/docker/docker-cron-watch.test.ts

printf '%s\n' '--- commit check ---'
git diff --check 27845d58eca18489031de30ce9d1d131a3f236b1^ 27845d58eca18489031de30ce9d1d131a3f236b1
git status --short

Length of output: 54244


@scttbnsn No actionable findings.

The deadline is clamped before the only deadline setTimeout call. The implementation preserves the ten-minute floor and interval behavior below 2147483647 ms. The tests cover the exact boundary, the first overflowing doubled interval, and a real-timer monthly regression.

Static review only. The sandbox does not permit test execution.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@scttbnsn
scttbnsn merged commit 2bebb22 into dev/v1.6 Sep 8, 2026
29 of 32 checks passed
@scttbnsn
scttbnsn deleted the fix/v1.6-cron-deadline branch September 8, 2026 20:04
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.

1 participant