Skip to content

Fox cloud: Fix stale cache settings - #4196

Merged
springfall2008 merged 1 commit into
mainfrom
fix/fox_v2.3
Jul 6, 2026
Merged

Fox cloud: Fix stale cache settings#4196
springfall2008 merged 1 commit into
mainfrom
fix/fox_v2.3

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 6, 2026 08:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Fox cloud caching issue where persisted device_settings data could remain in an outdated “shape” across restarts, by introducing a cache version and forcing a one-time settings/scheduler refresh when the persisted version is stale.

Changes:

  • Introduces FOX_SETTINGS_CACHE_VERSION and persists device_settings_version to detect and self-heal stale-shaped cached settings.
  • Updates FoxAPI.run() to force a settings/scheduler refresh when the persisted cache version is behind, and persists the version once the scheduler refresh succeeds.
  • Adds regression tests covering stale-cache-version forced refresh behavior and correct version persistence semantics; bumps Predbat version to v8.44.4.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
apps/predbat/fox.py Adds settings cache versioning, persists version in cache, and forces a refresh when the cache version is stale.
apps/predbat/tests/test_fox_api.py Adds tests for stale cache version forcing refresh and ensuring the version is only cleared after scheduler success.
apps/predbat/predbat.py Bumps application version to v8.44.4.

Comment thread apps/predbat/fox.py
Comment on lines +505 to 509
if settings_updated or scheduler_updated:
# update_settings_from_schedule() (called from get_scheduler()) mutates
# device_settings too, so this must save on scheduler_updated as well - not
# just settings_updated - or a schedule-derived upgrade is lost on restart
await self._save_cache("device_settings", self.device_settings)
@springfall2008
springfall2008 merged commit b1d2614 into main Jul 6, 2026
3 checks passed
@springfall2008
springfall2008 deleted the fix/fox_v2.3 branch July 6, 2026 09:57
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