Skip to content

Fix renewal of persistent files read with the default key - #1814

Merged
caronc merged 2 commits into
caronc:masterfrom
Dcastroro:fix/default-file-read-renewal
Oct 18, 2026
Merged

caronc merged 2 commits into
caronc:masterfrom
Dcastroro:fix/default-file-read-renewal

Conversation

@Dcastroro

Copy link
Copy Markdown
Contributor

Description

Fixes #1800.

Resolve an omitted PersistentStore.read() key to self.base_key before opening the file and queuing its renewal. Previously, open(None) read default.psdata, but the renewal queue contained None.psdata. A successful read therefore failed to refresh the actual file, and a later retention prune could remove it.

The production change is three lines, following the existing default-key handling in write() and open(). Explicit keys, compression, key validation and expires=True retain their behavior. This does not change pending-cache dirty flags; #1813 addresses that separate set() problem.

Checklist

  • Documentation ticket: not applicable; this restores the documented default-key renewal behavior.
  • The change is tested and works locally.
  • No commented-out code added.
  • tox -e lint passes with the repository-pinned Ruff 0.15.8 (all 485 files).
  • Added 12 parameterized cases covering omitted/default/named keys, plain/gzip files, renewal and explicit expiry.

Testing

Base: bf4c7234968ea6275aad8cfe0b490f5d1cc01dcc.

  • New regression/control cases before the production change: 2 failed, 10 passed. Both failures reproduce deletion of a recently read default file, with and without compression.
  • After: pytest --disable-socket -q tests/test_persistent_store.py: 32 passed, 1 existing skip. Tests use temporary storage, force the file past the retention cutoff, read it, flush and run a real local prune. Explicit expiry still removes the stale file; explicit default/named reads remain controls.
  • Full suite with all-plugin dependencies on Linux/Python 3.12.3: 3,787 passed, 31 skipped, with 17 warnings.
  • Full suite on Windows/Python 3.12.13: 3,746 passed, 38 skipped, 1 failed, with 17 warnings; overall coverage 99.2%. The sole failure is the unchanged Web Push test test_plugin_vapid_write_follows_symlink, where this host raises WinError 1314 at os.symlink() because it lacks symlink-creation privileges. I reproduced that same failure in an untouched checkout of the base and on this head. No permission change, test removal or new skip was made.
  • Both full-suite runs use pytest tests -n 4 with the same all-plugin dependencies as the qa environment and a pytest-socket policy restricting TCP connections to loopback. Observed warnings include dependency deprecations and blocked external connection attempts. Real service credentials and notifications are not used.

No dependency, workflow, permissions, lint rule or security verification changes. No credentials or real notification services are used. The full interpreter/platform matrix and optional compiled AMQP 1.0 dependency were not tested locally.

AI assistance: OpenAI Codex prepared the investigation, patch, tests and this draft description on Dcastroro's behalf. Human review is pending.

Dcastroro and others added 2 commits October 18, 2026 17:31
Resolve the default key before recording the file's renewal path so a
subsequent prune preserves successfully read files. Cover default and
explicit keys with compression and expiry controls.

Fixes caronc#1800

Assisted-by: OpenAI GPT-6 <noreply@openai.com>
@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bf4c723) to head (b1f44f9).
⚠ïļ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##            master     #1814    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          251       252     +1     
  Lines        40685     40887   +202     
  Branches      7007      7040    +33     
==========================================
+ Hits         40685     40887   +202     
Files with missing lines Coverage Δ
apprise/persistent_store.py 100.00% <100.00%> (Ãļ)

... and 2 files with indirect coverage changes

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

@caronc
caronc marked this pull request as ready for review October 18, 2026 20:33
@caronc
caronc merged commit a9dd5a9 into caronc:master Oct 18, 2026
20 checks passed
@caronc

caronc commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thank you for this pr! 🚀

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.

Persistent store file read via the default key is still pruned away - read() renews a path named 'None.psdata'

2 participants