You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(backups): make idle-expiry admission checks deterministic - #431
The root backup-download idle-expiry regression used a 150 ms real timer and a wall-clock sleep, also applying that small idle allowance to the subsequent snapshot preparation. The final-main smoke retry returned HTTP 503 for that second request. Pass an optional scheduler through the existing timeout factory and drive the actual idle callback after a real snapshot is prepared, so filesystem scheduling cannot decide this admission assertion.
The test still verifies stream cancellation, admission release before the error is observed, immediate second-request HTTP 200, final cancellation and complete timer cleanup. Existing production callers retain the same real timers, limits and cleanup ordering.
Related issue
Refs #426: follow-up required by final-main validation after #427/#428/#429. The parent remains open until its full main verification passes.
Type of change
CI / tooling
Refactoring
Testing
Isolated Linux/root download and timeout tests: 12 passed, 67 assertions; no network or database.
Full application and script typechecks: 2,423 and 820 files passed.
Scoped standard/type-aware Oxlint and diff whitespace checks passed.
Independent focused review found no actionable issue.
The exact reason for the earlier 503 is not established by the redacted CI output; this change removes the test's short wall-clock coupling. The separate first-attempt ACME fixture Docker-start failure remains unclassified. The complete runtime smoke must execute successfully for this PR and on the resulting main; no assertion or production timeout was relaxed.
Checklist
Relevant behavior tested with actual owned snapshot files and stream cleanup.
Test updated without sleeps, polling retries or disabled assertions.
No secrets, production data, dependencies, documentation files or screenshots added.
Related issue linked.
Breaking changes
None; the new optional scheduler defaults to the existing implementation.
Summary by CodeRabbit
Bug Fixes
Backup downloads that expire after inactivity now release their admission slot, allowing a subsequent download to proceed without waiting for the expired download to finish.
When an idle download expires, its timer is canceled and removed. This prevents stale timers from affecting later downloads and helps ensure download capacity is available for the next request.
No actionable comments were generated in the recent review.
Walkthrough
createBackupDownload accepts an optional scheduler and passes it to the timeout factory. The idle-expiration test uses a controlled scheduler to verify cancellation, timer removal, admission-slot release, and subsequent download admission.
Changes: Backup download timeout scheduling
Layer / File(s)
Summary
Forward scheduler and test idle expiration docker/production/backups/download.ts, web/src/tests/tooling/docker/production/backup-download.test.ts
createBackupDownload forwards the optional scheduler to the timeout factory. The test fixture passes the scheduler through, and the idle-expiration test checks cancellation, timer removal, admission-slot release, and a subsequent download.
RentnerProxy/platform#413: It changes cleanup and admission-release behavior in the same backup-download path, which this PR's idle-expiration test also checks.
Merge Risk: Minimal · up to 8f4cd
This change makes a backup-download timeout test deterministic. Production callers keep the same real timers and behavior. No actionable merge risk remains.
Security architecture risk: Minimal · up to 8f4cd
The new scheduler parameter is optional and is not supplied by the production caller or controlled by HTTP requests. Existing timeout defaults and cleanup ordering remain intact. The revised test exercises idle cancellation and immediate admission reuse without relying on a wall-clock sleep.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The inspected production download route gains no new scheduler authority or backup-selection scope. It still passes the request and path identifier to a factory configured with default timers and shared admission; each handler instance retains its single-active-snapshot guard.
Trust Boundaries and Controls
observed — Scheduler selection occurs during trusted factory construction, not request parsing. The production route derives only a backup identifier from the URL and rejects download requests containing a query string; it does not forward request data into scheduler configuration.
Resilience and Maintainability Implications
observed — The lifecycle retains containment against repeated cleanup and timer callbacks: release callers share a promise, cleared timeouts ignore subsequent expiry or progress, and normal completion, read failure, abort, and cancellation converge on cleanup. The controlled scheduler removes timer registrations through its cancellation callbacks.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the backup-download idle-expiry admission test is made deterministic. It is a test-only change, and the title says so with the test(backups) prefix. The title is speci…
Description check
The description follows the template. It has Summary, Related issue, Type of change, Testing, Checklist, Breaking changes, and Screenshots content. The Summary explains the change and the reason for i…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the backup-download idle-expiry admission test is made deterministic. It is a test-only change, and the title says so with the test(backups) prefix. The title is specific and short, and it matches the PR objectives and the test file changes.
Full details: Description check
Explanation
The description follows the template. It has Summary, Related issue, Type of change, Testing, Checklist, Breaking changes, and Screenshots content. The Summary explains the change and the reason for it. The related issue is linked as Refs #426 with a reason why it is not a full closing link. The type is marked as CI / tooling and Refactoring. Testing lists commands and results. The checklist is filled in. Breaking changes is answered as None. The Screenshots section is omitted, which is acceptable because the template says to write None only when UI changed and no UI is involved. The description also records open items, including the unclassified ACME Docker-start failure and the pending full runtime smoke.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The root backup-download idle-expiry regression used a 150 ms real timer and a wall-clock sleep, also applying that small idle allowance to the subsequent snapshot preparation. The final-main smoke retry returned HTTP 503 for that second request. Pass an optional scheduler through the existing timeout factory and drive the actual idle callback after a real snapshot is prepared, so filesystem scheduling cannot decide this admission assertion.
The test still verifies stream cancellation, admission release before the error is observed, immediate second-request HTTP 200, final cancellation and complete timer cleanup. Existing production callers retain the same real timers, limits and cleanup ordering.
Related issue
Refs #426: follow-up required by final-main validation after #427/#428/#429. The parent remains open until its full main verification passes.
Type of change
Testing
The exact reason for the earlier 503 is not established by the redacted CI output; this change removes the test's short wall-clock coupling. The separate first-attempt ACME fixture Docker-start failure remains unclassified. The complete runtime smoke must execute successfully for this PR and on the resulting main; no assertion or production timeout was relaxed.
Checklist
Breaking changes
None; the new optional scheduler defaults to the existing implementation.
Summary by CodeRabbit