Skip to content

chore(scripts): harden lastSeen backfill + add coverage diagnostic - #352

Merged
cabcookie merged 1 commit into
mainfrom
chore/harden-last-seen-backfill
Sep 23, 2026
Merged

cabcookie merged 1 commit into
mainfrom
chore/harden-last-seen-backfill

Conversation

@cabcookie

Copy link
Copy Markdown
Owner

Dev-script-only change (no app/backend runtime impact).

Why

The first PROD lastSeen backfill silently under-stamped (875 of 1757 people).
Write failures (DynamoDB throttling) hit a console.error branch that incremented
neither counter, so the run reported success while ~882 people were left without
lastSeen.

Changes

  • backfill-person-last-seen.js: retry transient/throttling errors with
    exponential backoff, count failures explicitly (non-zero exit + re-run hint),
    steadier throttle. Still idempotent (forward-only condition).
  • check-last-seen-coverage.js: read-only diagnostic comparing people seen in
    relationships vs. people with lastSeen, splitting the gap into orphan refs
    (deleted person) vs. real misses.

Verified

After the hardened re-run: all 1757 existing seen people have lastSeen; 0
existing people missing it (8 remaining are orphan refs to deleted people).

The first PROD lastSeen backfill silently under-stamped (875 of 1757): write
failures (DynamoDB throttling) hit a console.error branch that incremented
neither the stamped nor skipped counter, so the run reported success while ~882
people were left without lastSeen.

- backfill-person-last-seen.js: retry transient/throttling errors with
  exponential backoff, count failures explicitly (non-zero exit + re-run hint),
  and use a steadier throttle. Still idempotent (forward-only condition).
- check-last-seen-coverage.js: read-only diagnostic that compares people seen in
  relationships vs. people with lastSeen, splitting the gap into orphan refs
  (deleted person) vs. real misses. Used to verify full coverage.

Verified after re-run: all 1757 existing seen people have lastSeen (8 remaining
are orphan references to deleted people).
@cabcookie
cabcookie merged commit 7346e36 into main Sep 23, 2026
1 check passed
@cabcookie
cabcookie deleted the chore/harden-last-seen-backfill branch September 23, 2026 09:47
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