Avoid decoding unchanged live snapshots on every poll #519

Closed
opened 2026-08-10 22:49:56 +00:00 by timmy · 0 comments
Owner

Problem

Every /api/v1/live request calls LiveSnapshotStore.load(), whose SELECT * retrieves and JSON-decodes the complete shared snapshot before revision-aware responses omit unchanged sections. The current snapshot can be tens of kilobytes, so visible clients repeatedly spend SQLite I/O and CPU on payloads they do not need.

Vertical slice

Add a metadata-only shared-state read and let warm workers reuse their process-local snapshot while shared generation/revisions are unchanged. A cross-worker publication, notification acknowledgement, lease change, or freshness change must remain immediately observable and trigger a full load when required.

Acceptance criteria

  • Metadata reads never select or decode value_json.
  • Warm unchanged polls perform metadata reads without additional full snapshot loads.
  • Cross-worker publications and notification removals trigger a full reload and cannot resurrect acknowledged notifications.
  • Freshness, retry, generation, and refresh-lease behavior remain correct.
  • Focused and full test suites pass.

Non-duplication

Historical issue/PR review found adjacent completed work for revision-aware response omission (#285), cross-worker revisions (#383), and shared SQLite snapshots (#433), but no issue avoids server-side value_json retrieval and decoding for unchanged polls.

## Problem Every `/api/v1/live` request calls `LiveSnapshotStore.load()`, whose `SELECT *` retrieves and JSON-decodes the complete shared snapshot before revision-aware responses omit unchanged sections. The current snapshot can be tens of kilobytes, so visible clients repeatedly spend SQLite I/O and CPU on payloads they do not need. ## Vertical slice Add a metadata-only shared-state read and let warm workers reuse their process-local snapshot while shared generation/revisions are unchanged. A cross-worker publication, notification acknowledgement, lease change, or freshness change must remain immediately observable and trigger a full load when required. ## Acceptance criteria - Metadata reads never select or decode `value_json`. - Warm unchanged polls perform metadata reads without additional full snapshot loads. - Cross-worker publications and notification removals trigger a full reload and cannot resurrect acknowledged notifications. - Freshness, retry, generation, and refresh-lease behavior remain correct. - Focused and full test suites pass. ## Non-duplication Historical issue/PR review found adjacent completed work for revision-aware response omission (#285), cross-worker revisions (#383), and shared SQLite snapshots (#433), but no issue avoids server-side `value_json` retrieval and decoding for unchanged polls.
timmy self-assigned this 2026-08-10 22:49:56 +00:00
timmy closed this issue 2026-08-10 22:56:36 +00:00
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#519
No description provided.