ctengel / ctengel/simpler-objects
async_replicate: replace integrity asserts with explicit raises (don't rely on Python without -O)
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The replicator (`simpler_objects/async_replicate.py`) uses `assert` for what are really integrity checks: that the source has a content-length and a `Repr-Digest`, that the destination is missing before we PUT, that the stream's length and digest match what we expected, and that the destination holds the right bytes after the PUT.
Under `python -O` (or `PYTHONOPTIMIZE=1`) every one of those becomes a no-op. When the replicator was a manual CLI invocation that was a footgun; now that it runs on every systemd-timer / cron firing under whatever Python the operator installed, it's worth fixing.
Suggested approach: replace the asserts in `replicate_object`, `auto_replica`, and `replicate_bucket` with explicit `if not …: raise `. The places that currently assert on httpx response shape can stay defensive — they just shouldn't disappear under `-O`.
Surfaced by the PR #67 review.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.