Skip to content

SEP-1787: Validate the PostgreSQL Backups incremental cycle at the form boundary - #1380

Open
olucasandrade wants to merge 3 commits into
mainfrom
SEP-1787
Open

SEP-1787: Validate the PostgreSQL Backups incremental cycle at the form boundary#1380
olucasandrade wants to merge 3 commits into
mainfrom
SEP-1787

Conversation

@olucasandrade

@olucasandrade olucasandrade commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • PostgreSQL Backups now rejects incremental-cycle values outside daily, weekly, and ISO weekdays 17 at create and update (422), instead of accepting free text and failing later on the database host.
  • The Incremental Cycle field is a dropdown with those values labelled Daily, Weekly (Monday), and Monday–Sunday. The payload vocabulary check is unchanged as defence in depth.
  • Legacy tasks whose stored cycle is out of vocabulary are counted skipped_invalid by form backfill rather than raising. See SEP-1787.

Tested

  • From the SEP-1787 worktree (/Users/lucas.andrade/SEP/.worktrees/SEP-1787), start make dev-backend and make dev-frontend (stop any other process on :8000 / :5174 first — those ports currently belong to other checkouts).
  • Sign in at http://localhost:5174, open PostgreSQL Backups (/backups/postgresql), click Create.
  • Confirm Incremental Cycle is a dropdown offering Daily, Weekly (Monday), Monday through Sunday — not a free-text box. monday is not an option.
  • Leave Incremental Cycle unset, fill required fields (Database Service, stanza, Backup Directory), save. Task creates; cycle stays unset (payload default still applies at run time).
  • Edit the task, choose Wednesday, save. The saved value is 3.
  • Regression: payload still raises on PGBACKREST_INCREMENTAL_CYCLE=bogus (covered by TestIncrementalCycleValidation; no need to wait for a scheduled backup).

Checklist

  • New/modified functions have type hints and rST docstrings
  • New tests added for new features or bug fixes
  • All tests pass locally (make test)
  • Pre-commit hooks pass (make run-pre-commit)
  • Database migrations generated if models changed (make makemigrations) (N/A — no persisted SQLModel change)
  • User-facing changes documented (README, inline help, UI text)
  • Configuration changes documented with examples (N/A)
  • Changelog fragment added under changelog.d/ if the change is user-facing (make changelog-add), or confirmed N/A (internal-only change, or a same-release-cycle fix for an unreleased sibling ticket)

make regen-specs updated tests/app/sep/snapshots/schema/backup_pg.json, the OpenAPI snapshot, and the generated TS client. Covering suite: 144 passed, 13 skipped. Lint clean. Payload runtime logic was not changed.

…rm boundary

Reject out-of-vocabulary pgBackRest cycle values when a task is saved, and
offer daily, weekly, and ISO weekdays as a dropdown so invalid values never
reach the database host.
@olucasandrade olucasandrade self-assigned this Aug 20, 2026
@github-actions github-actions Bot added python frontend app:backup_pg PR touches the backup_pg app slice labels Aug 20, 2026
@olucasandrade olucasandrade added the qa passed Tests for this PR are completed and successful. label Aug 20, 2026
@olucasandrade
olucasandrade marked this pull request as ready for review August 20, 2026 15:57
Copilot AI balanced review requested due to automatic review settings August 20, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds strict incremental-cycle validation and dropdown choices for PostgreSQL Backups, with comprehensive contract and backfill coverage.

Changes:

  • Restricts cycles to daily, weekly, or ISO weekdays.
  • Exposes labelled dropdown choices and regenerates API artifacts.
  • Tests create/update rejection and legacy backfill behavior.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
app/sep/apps/backup_pg/models.py Adds cycle validation and choices.
changelog.d/SEP-1787.changed.md Documents user-visible behavior.
frontend/packages/api/specs/sep.json Updates the generated OpenAPI specification.
frontend/packages/api/src/generated/sep.ts Narrows the generated TypeScript type.
tests/app/sep/apps/backup_pg/conftest.py Adds shared cycle test data.
tests/app/sep/apps/backup_pg/test_contract.py Tests create/update rejection.
tests/app/sep/apps/backup_pg/test_form_backfill.py Tests invalid legacy-cycle handling.
tests/app/sep/apps/backup_pg/test_models.py Tests validation and dropdown vocabulary.
tests/app/sep/snapshots/openapi/backup_pg.json Updates the app OpenAPI snapshot.
tests/app/sep/snapshots/schema/backup_pg.json Updates the form-schema snapshot.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread app/sep/apps/backup_pg/models.py Outdated
Comment thread tests/app/sep/apps/backup_pg/conftest.py Outdated
Comment thread tests/app/sep/apps/backup_pg/test_form_backfill.py Outdated
Comment thread changelog.d/SEP-1787.changed.md Outdated
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  app/sep
  inventory.py
  app/sep/apps/backup_pg
  models.py
  app/sep/sync/syncers
  pmm.py
Project Total  

This report was generated by python-coverage-comment-action

Share literal_members across plugin tests, reuse the backfill context helper, and distinguish skipped-invalid legacy tasks from stamped forms that can pick a valid cycle.
@github-actions github-actions Bot added the app:mysql_backups PR touches the mysql_backups app slice label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:backup_pg PR touches the backup_pg app slice app:mysql_backups PR touches the mysql_backups app slice frontend python qa passed Tests for this PR are completed and successful.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants