feat(recovery): bind physical/WAL/PITR profiles with fail-closed UTF-8 - #220
Closed
cursor[bot] wants to merge 1 commit into
Closed
feat(recovery): bind physical/WAL/PITR profiles with fail-closed UTF-8#220cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Record a caller-owned physical or PITR profile without executing pg_basebackup. Parse wraps lone-surrogate UTF-8 failures as PostgresPhysicalRecoveryError. wal_archive_required=False means no continuous archive, not missing backup-internal WAL. pitr+immediate is recovery_target=immediate, not replay-to-end-of-archive. Refs #204. Successor of #217. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Contributor
Author
There was a problem hiding this comment.
Review (1c2ce7d)
This head repairs the same two #217 defects as #219 (b03d913):
- Lone-surrogate profile text now raises
PostgresPhysicalRecoveryErrorinstead ofUnicodeEncodeError. - Doctoring and tests now treat
wal_archive_required=Falseas no continuous WAL archive, not missing backup-internal WAL.pitr+immediateis a consistent-state stop.
Do not merge this PR. Prefer #219 as the earlier landing vehicle. #219 uses the same five profile files and leaves CHANGELOG/README/ARCHITECTURE to the documentation writers, so it does not race #214. This branch's extra CHANGELOG bullet and longer public docstrings are not a second landing reason.
Do not merge #217 at 2aaa6d8. Keep #208 and #212 as the logical executors. This automation will not self-approve #219 or #220.
Sent by Cursor Automation: Fix Issues
This was referenced Aug 16, 2026
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.


Why this exists
PR #217 at
2aaa6d8binds a caller-owned physical/WAL/PITR profile, butparse_postgres_physical_recovery_profile()encodes the document without catchingUnicodeError. Lone-surrogate text such as"\ud800"leaksUnicodeEncodeError. Hosts that catch onlyPostgresPhysicalRecoveryErrormiss that path, and the codec diagnostic is not content-free.The same slice also told operators that a physical+immediate profile may omit WAL. That confuses continuous WAL archive with backup-internal WAL from
pg_basebackup -X stream|fetch. Crash-consistent restore still needs the backup's own WAL.This branch is the landing vehicle for the profile seam. Do not merge #217 at
2aaa6d8.Operator action
backup_method="physical"only for a crash-consistent base backup whose target kind isimmediate.wal_archive_required=Falseas "no continuous WAL archive". Still keep backup-internal WAL frompg_basebackup -X streamor-X fetch.pitrplusimmediateasrecovery_target=immediate, not replay-to-end-of-archive.pg_basebackup/restore_commandoutside this package, then prove schema, tenant/RLS, checkpoint, and lifecycle usability on an isolated target.Evidence
test_parse_rejects_surrogate_textfailed withUnicodeEncodeErroron"\ud800"before the encode wrap.PostgresPhysicalRecoveryErrorwith a content-free JSON diagnostic.test_pitr_immediate_is_consistent_state_not_end_of_archivelockspitr+immediateas a consistent-state stop.coverage run --branch --source=pg_llm_batch.postgres_physical_recoveryis 100% statement and branch (71 stmts / 22 branches / 0 miss / 0 partial). Physical unit plus documentation tests: 43 passed. Related receipt/schema/backup/physical suite: 106 passed.interrogate100%.ruff checkclean.docs/doctoring/postgres-physical-pitr-profile.md,docs/adr/0019-postgres-physical-pitr-profile.md, CHANGELOG.This slice does not execute
pg_basebackup, archive WAL, or restore a cluster. It does not claim CSAP, SOC 2, or a complete recovery program. Refs #204. Successor of #217. Does not race #208 backup or #212 restore executors.