Skip to content

refactor: move the deep-analysis last-run record out of the cache - #534

Merged
cplieger merged 1 commit into
mainfrom
refactor/adopt-scheduler-stamp
Sep 2, 2026
Merged

refactor: move the deep-analysis last-run record out of the cache#534
cplieger merged 1 commit into
mainfrom
refactor/adopt-scheduler-stamp

Conversation

@cplieger

@cplieger cplieger commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Moves the deep-analysis pass's last-run record out of the persisted JSON cache and into the shared restart-surviving record from scheduler v4.1.0, at /config/.plex-language-sync-last-run. The startup gate keeps its exact semantics (CountFailed: any completed pass holds its slot, the interval ticker owns the retry), and the replay lookback window now reads the same record, 24h floor and 30-day clamp unchanged. The last_scheduler_run cache field is deleted from the schema, the legacy migrations, the contract, and the test fake; old cache files still load (unknown JSON keys are ignored, pinned by a test).

Migration effect, one-time: on the first boot after this upgrade the record does not exist yet, so one initial deep-analysis pass runs even if the previous version ran recently, with the 24h lookback floor. Self-heals after that pass. The alerting example is unchanged; its window already derives from the conditional startup behavior this preserves.

Tested: startup-gate matrix ported to the record file, lookback floor/extend/cap, watermark set, retired-key cache load, record-write failure tolerance; full suite, lint, and markdownlint green; the race detector runs in CI.

The deep-analysis safety net now keeps its last-run record in a
dedicated file, /config/.plex-language-sync-last-run, instead of a
last_scheduler_run field in state.json. The restart behavior is
unchanged: a startup pass runs only when no record exists or the last
completed pass is older than DEEP_SCAN_INTERVAL, and the replay
look-back window still extends from the previous completed pass,
capped at 30 days.

state.json no longer carries the last_scheduler_run key. Files written
by earlier versions still load; the retired key is ignored on read.

On the first start after this upgrade the record file does not exist
yet, so one initial deep-analysis pass runs even if the previous
version completed one recently, and that pass uses the 24-hour
look-back floor. The pass records its completion and the schedule is
back to normal from then on.

One boundary detail changed: a record aged exactly DEEP_SCAN_INTERVAL
now counts as due, where it previously had to be strictly older.
@cplieger
cplieger merged commit 905c9da into main Sep 2, 2026
19 checks passed
@cplieger
cplieger deleted the refactor/adopt-scheduler-stamp branch September 2, 2026 10:12
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.

1 participant