You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per-channel sync state + Sync-now + next-run (live channels, plan steps 6-7)
Closes the gap between what shipped in v0.2.2 and the full new_goals.md plan
(whose post-pseudocode sections were never seen until now): per-channel
last-synced visibility, a per-channel re-run trigger, and a Dashboard "next run".
Backend:
- data/recipe_state.json: cosmetic per-channel sync metadata
{ "<num>": { checked_at, changed_at?, change_summary? } }. Written by the
scheduler (atomic temp-swap) at the end of APPLY cycles only — checked_at for
every live channel in the cycle, changed_at/change_summary only when that
channel was actually patched; full cycles prune entries no longer live. This
is NOT correctness state (the diff still reads live Tunarr) — it lives in its
own file specifically so it never races with channels.json edits/deploys. This
is the principled version of the plan's "write back to channels.json" step,
without making the scheduler a channels.json writer.
- run_cycle/_run_cycle_blocking gain an `only=<number>` filter to scope a cycle
to a single live channel; POST /api/recipes/run?only=N exposes it.
- get_status() adds next_run_seconds (seconds to next auto cycle, null if
disabled/paused) and a channels map (recipe_state). last_auto_run switched
from event-loop time to wall-clock so the sync status handler can compute
next_run without touching the loop.
Frontend:
- Channels page: each live row shows "synced Xago" (from recipe_state); the
edit modal gains a "Save & Sync now" button (live channels only) that saves
then runs only=N&apply=true, applying the recipe in place without leaving the
editor. Save logic refactored into a shared persist().
- Dashboard Auto-Updates card shows "next ~in Xh" from next_run_seconds.
Verified locally in Docker against live Tunarr (all no-ops, no mutations):
- status returns next_run_seconds (~12h) + channels map for all 4 live channels.
- scoped run only=7 processes just #7; full apply writes recipe_state for all 4.
- recipe_state.json written atomically; channels.json untouched.
- frontend builds clean (tsc + vite).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments