Skip to content

feat(sw): add telemetryBatches store with atomic claim/send primitives - #97

Open
a-d-j-i wants to merge 3 commits into
mainfrom
refactor/telemetry-batches-store
Open

a-d-j-i wants to merge 3 commits into
mainfrom
refactor/telemetry-batches-store

Conversation

@a-d-j-i

@a-d-j-i a-d-j-i commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator
  • SCHEMA adds telemetryBatches + batchId_timestamp compound index on verificationResults
  • claimUnclaimed dedups unclaimed rows by eventKey (SHA-256 prefix of identity tuple), stamps batchId back atomically
  • markSent / bumpAttempt take id arrays for atomic multi-batch state flips
  • sentAt field encodes waiting vs sent; sentAt index naturally scans only sent for purge

@a-d-j-i
a-d-j-i added this pull request to stack #95 October 28, 2026 17:50
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch from d2994bf to d266224 Compare October 29, 2026 15:45
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch 4 times, most recently from 30ea22c to 9a5e841 Compare November 3, 2026 14:46
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch 2 times, most recently from dfc3a9c to 2b12b6f Compare November 5, 2026 18:08
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch from 2b12b6f to d72f469 Compare November 16, 2026 15:10
@netlify

netlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dappfence-templates canceled.

Name Link
🔨 Latest commit 60c9107
🔍 Latest deploy log https://app.netlify.com/projects/dappfence-templates/deploys/6b12ffd2d56a1ad1d59e2e96

Base automatically changed from refactor/verification-results-per-row to main November 16, 2026 16:59
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch 3 times, most recently from 24b8b7b to 6250484 Compare November 16, 2026 22:18
@a-d-j-i
a-d-j-i removed this pull request from stack #95 November 17, 2026 14:27
@a-d-j-i
a-d-j-i added this pull request to stack #112 November 17, 2026 14:27
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch from 6250484 to ccc9d98 Compare November 27, 2026 16:35
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch from ccc9d98 to c7a9882 Compare December 4, 2026 17:23
- SCHEMA adds telemetryBatches + batchId_timestamp compound index on verificationResults
- claimUnclaimed dedups unclaimed rows by eventKey (SHA-256 prefix of identity tuple), stamps batchId back atomically
- markSent / bumpAttempt take id arrays for atomic multi-batch state flips
- sentAt field encodes waiting vs sent; sentAt index naturally scans only sent for purge
crypto.subtle.digest inside the readwrite tx let the browser auto-commit
before the batch writes ran, so no batch was ever claimed. Replace the
async SHA-256 prefix key with a sync JSON-identity string; drop the
stored event.key since dedup only needs it in memory.

Add withTransactionLifetime() so the in-memory mock reproduces real
IDB's auto-commit, pinning the regression in a unit test.
Rename claimUnclaimed → createBatch; take a selectVerdicts callback so
the caller owns sort, dedup, and size policy. Storage keeps atomicity,
the unclaimed-row filter, and batchId stamping.

Drop events[] from the batch row — verificationResults is the single
source of truth; the executor joins by batchId at send time. Add
VerdictRow typedef and getAll() on verification-results-store.
@a-d-j-i
a-d-j-i force-pushed the refactor/telemetry-batches-store branch from c7a9882 to 60c9107 Compare December 4, 2026 18:00

This branch has not been deployed

No deployments
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.

1 participant