Skip to content

fix(postgresql): validate PITR retention TTL - #3390

Draft
weicao wants to merge 2 commits into
easton/pg-pitr-empty-purge-checkpointfrom
easton/pg-pitr-retention-ttl-validation
Draft

fix(postgresql): validate PITR retention TTL#3390
weicao wants to merge 2 commits into
easton/pg-pitr-empty-purge-checkpointfrom
easton/pg-pitr-retention-ttl-validation

Conversation

@weicao

@weicao weicao commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • require a configured PITR retention TTL to contain only decimal digits
  • reject malformed TTL before interval and expiry arithmetic
  • leave repository objects, backup metadata, and the purge checkpoint untouched on invalid configuration

TDD evidence

  • RED test commit: e74e77a4e - 59 examples, 1 failure with 5 failed assertions
  • GREEN fix commit: 500684b7a - focused 59 examples, 0 failures
  • PostgreSQL ShellSpec with Bash 5: 272 examples, 0 failures
  • ShellCheck severity error: clean
  • Bash 5 syntax: clean
  • git diff --check: clean
  • helm lint addons/postgresql: 1 chart, 0 failures
  • Helm render: 41 documents, 1,012,445 bytes

Behavior

Previously DP_TTL_SECONDS=not-a-number was interpreted as shell arithmetic variables, yielding the current epoch as the expiration cutoff. The script then deleted WALs, published metadata, advanced the checkpoint, and returned success. Invalid TTL now fails before any repository access.

@weicao
weicao requested review from a team, ldming and leon-ape as code owners August 16, 2026 14:23
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (a758cda) to head (500684b).

Files with missing lines Patch % Lines
...ons/postgresql/scripts-ut-spec/pitr_backup_spec.sh 0.00% 11 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##           easton/pg-pitr-empty-purge-checkpoint   #3390   +/-   ##
=====================================================================
  Coverage                                   0.00%   0.00%           
=====================================================================
  Files                                        195     195           
  Lines                                      28256   28267   +11     
=====================================================================
- Misses                                     28256   28267   +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants