Skip to content

fix: stop retrying legacy page-view migration on every page load - #118

Merged
alexs-mparticle merged 1 commit into
mainfrom
fix/page-view-migration-retry
Aug 18, 2026
Merged

fix: stop retrying legacy page-view migration on every page load#118
alexs-mparticle merged 1 commit into
mainfrom
fix/page-view-migration-retry

Conversation

@alexs-mparticle

Copy link
Copy Markdown
Collaborator

Summary

  • migrateLegacyPageViewStorage was retaining the legacy mpPageViews key on write failure and returning early, causing PAGE_VIEW_CAPTURE_FAILED to fire on every subsequent page load for affected users
  • Switched the migration write from writeNamespacedField (bare write, no eviction) to writeNamespacedFieldWithinBudget so oversized legacy payloads are trimmed before the write is attempted
  • Removed the early return on failure so removeKey(LEGACY_PAGE_VIEWS_KEY) always executes — ending the retry loop regardless of outcome

Evidence

Datadog shows Belk (kitv_1.33.0) generating ~330/day PAGE_VIEW_CAPTURE_FAILED errors, with 101 hits carrying the exact message "retaining legacy key for retry" — third most common message across all Belk errors in the past 7 days.

Test plan

  • Updated existing test: now asserts legacy key is null after a failed migration (was not.toBeNull())
  • New: second call after a failed migration fires no PAGE_VIEW_CAPTURE_FAILED (no retry)
  • New: oversized legacy payloads are evicted down to budget before the migration write
  • Lint and build pass; test suite has pre-existing jsdom ERR_REQUIRE_ESM unrelated to this change

🤖 Generated with Claude Code

@alexs-mparticle
alexs-mparticle force-pushed the fix/page-view-migration-retry branch 3 times, most recently from e6bda79 to 13744df Compare August 18, 2026 19:08
When the migration write fails, the legacy key was retained "for retry",
causing PAGE_VIEW_CAPTURE_FAILED to fire on every subsequent page load
for affected users. Fix by using writeNamespacedFieldWithinBudget (which
evicts oldest records before giving up) and always removing the legacy
key so the retry loop can't fire again.
@alexs-mparticle
alexs-mparticle force-pushed the fix/page-view-migration-retry branch from 13744df to ccd95a5 Compare August 18, 2026 19:22
@alexs-mparticle
alexs-mparticle merged commit 0c388d6 into main Aug 18, 2026
5 checks passed
@alexs-mparticle
alexs-mparticle deleted the fix/page-view-migration-retry branch August 18, 2026 20:38
alexs-mparticle added a commit that referenced this pull request Aug 18, 2026
When the migration write fails, the legacy key was retained "for retry",
causing PAGE_VIEW_CAPTURE_FAILED to fire on every subsequent page load
for affected users. Fix by using writeNamespacedFieldWithinBudget (which
evicts oldest records before giving up) and always removing the legacy
key so the retry loop can't fire again.
github-actions Bot pushed a commit that referenced this pull request Aug 18, 2026
## [1.33.4](v1.33.3...v1.33.4) (2026-08-18)

### Bug Fixes

* stop retrying legacy page-view migration on every page load ([#118](#118)) ([c4772f8](c4772f8))
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.

3 participants