Skip to content

Feature/decouple poll scheduler#26

Merged
TKlerx merged 6 commits into
mainfrom
feature/decouple-poll-scheduler
Jul 6, 2026
Merged

Feature/decouple poll scheduler#26
TKlerx merged 6 commits into
mainfrom
feature/decouple-poll-scheduler

Conversation

@0xC0FEBABE

Copy link
Copy Markdown
Collaborator

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

0xC0FEBABE and others added 2 commits July 1, 2026 12:00
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>
@0xC0FEBABE
0xC0FEBABE requested a review from TKlerx July 1, 2026 11:30
@0xC0FEBABE 0xC0FEBABE self-assigned this Jul 1, 2026
0xC0FEBABE and others added 3 commits July 1, 2026 14:07
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 TKlerx left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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 TKlerx left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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.

@TKlerx
TKlerx merged commit d7c24d8 into main Jul 6, 2026
1 check passed
@TKlerx
TKlerx deleted the feature/decouple-poll-scheduler branch July 6, 2026 16:27
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