Make live snapshot revisions safe across workers and restarts #383

Closed
opened 2026-08-09 08:09:26 +00:00 by rockachopa · 0 comments
Member

Problem

Live snapshot section revisions are process-local integers. Two workers can issue the same revision for different content, causing the browser to omit a changed section and retain stale My Work, activity, or notifications indefinitely. Restarting a worker creates the same collision risk.

Evidence: src/main.py initializes each revision at 0, increments locally, and suppresses a section solely on integer equality; frontend/context-poller.js intentionally retains omitted section bodies. Operations guidance supports multi-process deployment.

Vertical slice

Use bounded opaque, process-generation-scoped revision tokens end to end. A token from another worker or a previous process generation must trigger a full section response, while an unchanged token from the same process keeps the existing bandwidth optimization.

Acceptance tests

  • Equal local counters from two worker generations cannot suppress different content.
  • A pre-restart token cannot suppress the first post-restart response.
  • Same-generation unchanged sections remain omitted.
  • Context, events, and notifications preserve independent partial responses.
  • Browser sends opaque tokens without numeric coercion and merges omitted sections.
  • Oversized or malformed tokens are rejected before upstream work.
  • Focused and full test suites pass.

Non-duplication

Historical live-snapshot issues cover polling, cancellation, stale retention, outage recovery, backoff, and unchanged-section omission. None makes revision identity safe across workers/restarts. No open PR exists and recent history through 5c2c038 does not implement this behavior.

## Problem Live snapshot section revisions are process-local integers. Two workers can issue the same revision for different content, causing the browser to omit a changed section and retain stale My Work, activity, or notifications indefinitely. Restarting a worker creates the same collision risk. Evidence: `src/main.py` initializes each revision at `0`, increments locally, and suppresses a section solely on integer equality; `frontend/context-poller.js` intentionally retains omitted section bodies. Operations guidance supports multi-process deployment. ## Vertical slice Use bounded opaque, process-generation-scoped revision tokens end to end. A token from another worker or a previous process generation must trigger a full section response, while an unchanged token from the same process keeps the existing bandwidth optimization. ## Acceptance tests - Equal local counters from two worker generations cannot suppress different content. - A pre-restart token cannot suppress the first post-restart response. - Same-generation unchanged sections remain omitted. - Context, events, and notifications preserve independent partial responses. - Browser sends opaque tokens without numeric coercion and merges omitted sections. - Oversized or malformed tokens are rejected before upstream work. - Focused and full test suites pass. ## Non-duplication Historical live-snapshot issues cover polling, cancellation, stale retention, outage recovery, backoff, and unchanged-section omission. None makes revision identity safe across workers/restarts. No open PR exists and recent history through `5c2c038` does not implement this behavior.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#383
No description provided.