Repository navigation
fix: reject overflowing backup and PostgreSQL durations - #215
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The overflow checks are correct, comprehensive, and covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents duration overflow from producing misleadingly short backup and PostgreSQL durations.
Changes:
- Adds overflow checks before duration multiplication.
- Rejects oversized positive-day backup windows.
- Adds boundary and backup-policy regression tests.
| File | Description |
|---|---|
internal/app/runtime.go |
Safely parses PostgreSQL duration units. |
internal/app/backup_schema.go |
Caps whole-day positive durations. |
internal/app/duration_limits_test.go |
Tests valid boundaries and overflow rejection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

What this changes
Reject duration overflow before multiplying whole-day backup windows or PostgreSQL settings into nanoseconds. Previously
213504dbecame a plausible 25-minute window; oversized PostgreSQL values also wrapped in every supported unit. Backup health checks now report invalid or overflowing server timeouts and effective policies, and disabled archive timeouts, instead of silently treating them as within policy.Addresses item 1 of #111. The other timing, documentation, and rollout follow-ups in that umbrella remain open.
Why this is correct
Regression tests failed on the original code and now cover the largest representable count and the first overflowing count for every PostgreSQL unit, positive day windows, and backup-policy validation for data loss, retention, and drill age. Engine-level tests cover invalid/overflowing timeout diagnostics, disabled archiving, invalid retained policies, and valid timeout boundaries. Existing parser syntax and zero-valued PostgreSQL settings remain supported. Independent local agent review found no remaining issues.
Validation: targeted regression tests and
just cipass locally, including all Go tests, vet, lint, vulnerability/workflow checks, generated documentation verification, and the website build. All five GitHub CI checks pass on the updated head, including Docker E2E and native Linux/macOS/Windows smoke tests. Copilot's fresh Lite review reports no findings and confirms the earlier production-caller finding is resolved. Docker/remote-host E2E was not run locally.Effect on the safety envelope
Oversized durations are refused rather than allowed to wrap into misleadingly short values. No new capability or host operation is introduced.
Checklist
just checkpasses locally.just checkverifies this).