Repository navigation
DR backup: copy loops refuse a None read instead of ending the copy short (BACKLOG #6687) - #3254
Merged
Merged
Conversation
BACKLOG #6687 (batch 668), added item 1 and the dr_backup half of item 8. One shared fill loop, dr_backup._read_chunks, replaces the bare `if not buf: break` copy loops in _build_archive_blocking (no-key build), _verify_in_staging (plaintext verify) and _extract_config_members. A None read (a non-blocking source with no data ready) is waited out and read again rather than ending the copy short. A blocking source does not answer None, so its reads are unchanged. Left, by the wave's overlap rule (open PR 3202 edits these functions): the copy loops in _extract_member and _restore_blocking (plaintext branch). Tests: tests/test_dr_backup_none_read.py.
BACKLOG #6687, review round 1 (round-70fc7350). _read_chunks waited out a None read with no limit, so a stalled non-blocking source would hold the worker thread. It now raises TimeoutError (an OSError) once None has been the only answer for _NO_DATA_YET_LIMIT_SECONDS (30 s); a byte arriving restarts that limit. Tests pin the sleep per None read, the refusal, and the restart. The test module's docstring no longer reads as if every copy loop moved to the helper: two remain, left by the overlap rule. Corrects the previous commit body: item 8 (one fill loop shared with the codec, sandbox.py and dicom.py) is not met by this branch.
…ck in its tests BACKLOG #6687, review round 2 (round-89eaf180). The _read_chunks docstring now says the limit bounds one unbroken run of None reads, not the whole copy. _HashingReader.read is annotated bytes | None, the None pass-through engine PR 3033 built. The tests drive the wait and the limit through a fake clock patched onto dr_backup's own time name, so nothing sleeps or races a real clock, and drop a check that could not fail. The test module's docstring names at least four reads this branch leaves. Proposed PR title: DR backup: copy loops wait out a None read instead of ending the copy short (BACKLOG #6687) Proposed banner, #6687: PARTIAL. Item 1: the no-key build, plaintext verify and config-restore copy loops share _read_chunks (None waited out, refused after 30 s with no byte), tests/test_dr_backup_none_read.py. Items 2, 3, 4, 5, 6, 7, 9 and 10 met on main (evidence in the PR body). Left: item 1 at _extract_member and the _restore_blocking plaintext branch (open PR 3202 edits both functions); item 8, one fill loop shared with the codec, sandbox.py and dicom.py (design).
BACKLOG #6687. Text only, from review round-84ccc3f4 (the unrepaired round): one docstring line ran to 195 columns. No code changes. Proposed PR title: DR backup: copy loops wait out a None read instead of ending the copy short (BACKLOG #6687) Proposed banner, #6687: PARTIAL. Item 1: the no-key build, plaintext verify and config-restore copy loops share _read_chunks (None waited out, refused after 30 s with no byte), tests/test_dr_backup_none_read.py. Items 2, 3, 4, 5, 6, 7, 9 and 10 met on main (evidence in the PR body). Left: item 1 at _extract_member and the _restore_blocking plaintext branch (open PR 3202 edits both functions); item 8, one fill loop shared with the codec, sandbox.py and dicom.py (design).
BACKLOG #6687, per the Manager's decision under the owner's instruction of 2026-11-23. _read_chunks now reads through backup_codec._read_once, so the no-key build, plaintext verify and config-restore copies refuse a None read (and a non-bytes or over-long read) with the codec's BackupCodecError, the same rule as the keyed branch. The 30 s wait, its restart logic and their tests are gone. _restore_config_members now names a BackupCodecError as a restore refusal, as it does an OSError. The comment on _MAX_RESTORE_PLAINTEXT_BYTES no longer says the plaintext verify copy is bounded by the archive's size: that limb has no byte cap of its own. Proposed PR title: DR backup: copy loops refuse a None read instead of ending the copy short (BACKLOG #6687) Proposed banner, #6687: PARTIAL. Item 1: the no-key build, plaintext verify and config-restore copy loops share _read_chunks, which refuses a None read through the codec's _read_once; tests/test_dr_backup_none_read.py. Items 2, 3, 4, 5, 6, 7, 9 and 10 met on main. Left: item 1 at _extract_member and the _restore_blocking plaintext branch (open PR 3202 edits both functions); item 8, one fill loop shared with the codec, sandbox.py and dicom.py (design).
…elog BACKLOG #6687. Text only, from review round-69bdc37c. The _read_chunks docstring says it shares only the codec's per-read checks: it authenticates nothing and caps no total. The plaintext-verify comment no longer gives a false reason for that limb's missing cap. Adds a changelog fragment, including the codec wording an operator sees on a no-key box. No code changes.
… one BACKLOG #6687, per the Manager's decision under the owner's instruction of 2026-11-23. _read_chunks raises the codec's refusal as an OSError (EIO), with the BackupCodecError chained, so each site reports it the way it already reports a read failure there: kind write at the build (it read encrypt), a verify FAIL worded without "decrypt failed", and a restore refusal through _restore_config_members' existing OSError arm. That function is back to main's text. A refused build leaves its .part exactly as main does for any OSError in that copy. The tests now assert the failure kind, and that the refused config file is on the rollback ledger. The changelog fragment drops the codec-wording sentence. Proposed PR title: DR backup: copy loops refuse a None read instead of ending the copy short (BACKLOG #6687)
BACKLOG #6687. Text only, from review round-c02119ea. The _read_chunks docstring, the test prose and the changelog no longer say the sites record a read failure: each handles the refusal as it handles any OSError from that copy, which its own except arms define. "All this shares with the keyed copies" becomes "at least". No code changes.
Collaborator
Author
|
Lander: enqueuing at pinned head 380b8d8. Its five QA rounds (exit 0) cover the code; the commits after the last round are docstring, comment and changelog only. All required contexts are green. QA findings 1-3 and 6-7 are ORDINARY and 4, 5 and 8 are MAIN; all are queued for filing under R2. |
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.
BACKLOG #6687, item 1 in part. From Manager runbook-batch-manager-fa3030 (account 9).
Merge danger
Reversible: yes, by a revert.
Blast radius:
messagefoundry/pipeline/dr_backup.py: a new shared copy loop,_read_chunks, used at three sites:Also the
:210comment, a changelog fragment, and the newtests/test_dr_backup_none_read.py.Behaviour change: a
Noneread (a stream with no data yet) at those three sites is now refused through the codec's_read_onceand raised asOSError(EIO). Before, it was treated as end of stream and ended the copy short.write..failed, as main does for anyOSErrorthere.Reach: no current caller can return
Noneat these sites. They read files openedrband the tar'sextractfile.Evidence
_read_chunksunit tests.QA
code-reviewskill at xhigh.round-70fc7350,round-89eaf180,round-84ccc3f4,round-69bdc37c, thenround-c02119eaon13a4da5669b..9720c56f132.xhigh effort → 10 inline angles → dedup (no verify) → sweep → ≤15 findings, andreview_tag.pyexited 0 on each.380b8d8f114changes text only.Noneread rather than wait it out, the same rule as the codec's keyed branch;Remaining difference from main (only on the unreachable
Nonepath)Noneon the first read gave an empty.partfile. Verify renamed it to.failed, and the message named it.write, and the message does not name the.part..partfile, as main does for anyOSErrorin that copy.Banner
#6687 PARTIAL.
_read_chunks, which refuses aNoneread. Tests:tests/test_dr_backup_none_read.py._extract_memberand the plaintext branch of_restore_blocking, because open PR 3202 edits both functions;sandbox.pyanddicom.py, which is a design item.Open findings (one R2 row)
writedoes not tell a source-read stall from a destination write error.EIOnames the wrong cause;EAGAINwould be accurate.exceptalso catches codec errors raised insidesrc.read.Noneread asencryptordecrypt failed._extract_member, the plaintext branch of_restore_blocking, andcopyfileobjin_place_restored_storeare still open. So is_sha256_file.dr_backupimports_read_once, which is private tobackup_codec.