Repository navigation
fix(meditations): harden frame publish cache writes - #399
Merged
Merged
Conversation
…lpers
Self-review pass on the issue-390 frame hardening:
- Add module JSDoc to src/lib/meditations/frames.ts and a rationale
comment on persistMeditationNodeWeightsCache explaining why it goes
through payload.db.updateOne (break recompute loop + best-effort).
- Replace the untyped `(options as { previousValue?: unknown })` cast
with direct access — Payload v3 exposes previousValue on
BaseValidateOptions.
- Drop the eager JSON.stringify in normalizeMeditationFrames; compute
normalizedPayloadBytes lazily inside getFrameDiagnosticsLogContext
where it's actually read. Replace JSON.stringify equality in
meditationFramesChanged with a length+per-index loop (called from
both invalidate + recompute hooks on every save).
- Refactor the cache-failure test to use vi.spyOn / mockRestore so a
thrown assertion can't leak the patched db.updateOne to siblings.
No behavior change.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced May 25, 2026
Ardnived
added a commit
that referenced
this pull request
Nov 5, 2026
Adds operation, documentId, request body (truncated to 10KB), and an `issue: '390'` tag for meditations errors to the global Sentry afterError context. PR #399 already silenced the cache-write path, but the same 500 keeps reproducing on first-publish of a newly-created meditation — and the existing context (collection, locale, url) isn't enough to tell which of the four suspect paths threw. This lifts visibility so the next occurrence is diagnosable from the Sentry dashboard alone. Diagnostic-only — no speculative fixes to the suspect paths yet. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests
Notes