feat(server): post on a schedule from the queue and the pool
Merged
BR
12d ago+5600+5600+0123456789012345678901234567890123456789-12-12-01234567890123456789
Summary
- Adds automatic posting. The schedule is a list of slots, each with days of the week, a time and an optional random spread, in one timezone set for the install. With no slots, nothing posts.
- The queue is an ordered list that drains first and ignores the pick rules. The Queue screen reorders it by dragging a handle or with the arrow keys.
- With an empty queue a select is picked from the pool under three pick rules: spacing by capture day, spacing by place, and order. A rule that would leave nothing to pick is relaxed, place before capture day.
- Next up is chosen a day ahead and stored as a select, never as a rendered post: the frame and caption are built when it posts, so privacy rules and templates in force then apply. It can be swapped or skipped.
- Each slot on each local date is one stored row, with its spread drawn once. A slot missed while the app was down posts late only within the grace period (two hours by default), and missed slots never stack. While Selects runs, every due slot posts, including two at the same minute; a slot found within the timer's tolerance counts as on time, so a grace period of 0 still posts on time. A slot always takes the queue head when a queued select is free. A select that cannot be posted as it stands is passed over and flagged, and a skip survives edits to its slot. A select whose post failed for good is held back from scheduled picks for 7 days or until its owner presses Try again, so one refused photo cannot take every slot. Pause, dry run and a slot's due time are read again before each slot is claimed. A row is marked before the publisher is called and checked at start, so a restart neither posts twice nor loses the slot.
- Slot times are wall-clock times in the install's timezone. A time skipped by a clock change posts once, as does a time that happens twice.
- A pause switch stops every slot. Dry run records a dry run and leaves the select where it was. With no account or bucket, a slot takes nothing from the queue and says why.
- Posting goes through the publisher only. Migration 9 adds
queueandslot_runs. Decisions are recorded as ADR 0007. No new dependencies.
Evidence
From the generated fixtures, in fake mode.


Typecheck, lint, 533 tests and the build pass locally; scheduler tests run on a fake clock. In fake mode I set two slots a few minutes ahead: the first posted the queued select, the second posted the pick I had swapped in, both through the real timer, and the next day's picks were planned.
Merge Danger
Medium. This is the code that posts without anyone clicking. It can only reach Instagram in live mode with a connected account and at least one slot; a new install has no slots.
Summary by CodeRabbit
- New Features
- Added scheduling controls for posting days, times, time zones, and grace periods, with upcoming slots and recent run status.
- Added a queue for prioritizing or removing items, plus controls to swap, skip, or restore upcoming selections and add items from the pool.
- Added selection rules for ordering and spacing, along with controls to pause and resume posting.
- Schedules account for time-zone and daylight-saving changes. Missed slots do not stack, and only the latest eligible slot may post after downtime.
- Added attention notices for selections held after certain posting failures, with an option to retry them. Other eligible selections can continue posting.