Feature/decouple poll scheduler#26
Conversation
Map all 42 server entities (services, routes, modules) with 120 depends_on edges. Add layer_assignment and decouple ASP programs for architectural analysis. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
officePollSchedule imported startPoll from poll.ts, pulling in SSE, auth, and email transitively — placing it at layer 6 despite being a pure scheduling service. Extract creation logic, validation, timers, and formatPoll into pollCreation.ts (layer 2). The scheduler now imports createPollRecord directly; poll.ts registers endPoll as the expiry callback. Drops officePollSchedule from layer 6 to layer 4. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
provenance.pl was renamed to sources.pl in FAIM 0.4.0 but the old file lingered, causing phantom staleness. Also re-derives dependency edges after the pollCreation extraction: officePollSchedule, poll, and sse now depend on pollCreation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Blocking a user now bumps sessionVersion, invalidating the pre-block cookie, so /api/auth/config reports authenticated:false while still surfacing blocked:true. Update the assertion accordingly and warm up the user's access row before blocking so the block takes the version-incrementing update path (deterministic on a clean DB). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TKlerx
left a comment
There was a problem hiding this comment.
Blocking regression: scheduled polls no longer emit poll_started or send the poll-start email. In src/server/services/officePollSchedule.ts the scheduler now calls createPollRecord directly, which only validates/creates/schedules the poll. The broadcast/email side effects still live in startPoll (src/server/services/poll.ts), so browsers already connected over SSE will stay in the old phase until reconnect/refresh, despite specs/poll-lifecycle requiring poll_started for new active polls. Keep the low-layer creation helper, but have the scheduler trigger the same notification/broadcast path via a small exported wrapper/hook, or otherwise emit poll_started after createPollRecord.
TKlerx
left a comment
There was a problem hiding this comment.
Fix verified: scheduled poll creation now calls the shared poll-start announcement hook, preserving SSE poll_started and email notification behavior while keeping pollCreation decoupled from SSE/email imports. Focused scheduler test and precommit validation passed locally.
extract pollCreation service to decouple scheduler from poll
officePollSchedule imported startPoll from poll.ts, pulling in SSE,
auth, and email transitively — placing it at layer 6 despite being a
pure scheduling service. Extract creation logic, validation, timers,
and formatPoll into pollCreation.ts (layer 2). The scheduler now
imports createPollRecord directly; poll.ts registers endPoll as the
expiry callback. Drops officePollSchedule from layer 6 to layer 4.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com