test(react-grab): cover freeze-updates replay order and recovery arms - #507
Closed
aidenybai wants to merge 1 commit into
Closed
test(react-grab): cover freeze-updates replay order and recovery arms#507aidenybai wants to merge 1 commit into
aidenybai wants to merge 1 commit into
Conversation
freeze-updates.ts (the dispatcher-patch freeze/replay path, the report's top fragile-internals gap) had no unit coverage. Mock bippy's fiber/renderer surface and the recoverable-error logger to drive the real freezeUpdates end-to-end: - hook-queue buffering: reads masked to null while frozen, every buffered update replayed in chain order on resume (exercises all four mergePendingChains arms via single/single and multi/multi merges), plus the pre-existing pending chain captured at freeze time. - context-dependency freezing: value masked while frozen, buffered write applied on resume. - dispatcher replay order: store callbacks -> transitions -> state updates. - recovery: a throwing buffered update is swallowed/logged and replay continues; a scheduleUpdate failure in the post-resume microtask flush is swallowed/logged. - lifecycle guards: re-freeze and double-resume are no-ops.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
4 tasks
Owner
Author
|
Superseded by #510, which consolidates all the test-coverage PRs into one. Commits preserved there. |
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
freeze-updates.ts— the internal-dispatcher freeze/replay path, flagged as the top fragile-internals gap (65% lines, depth-weighted 42%, an unreached depth-7 block) — had zero unit coverage. This mocks bippy's fiber/renderer surface and the recoverable-error logger to drive the real exportedfreezeUpdatesend-to-end:pendingreads are masked tonullwhile frozen; on resume every buffered update replays in chain order. Three writes during the freeze exercise all fourmergePendingChainsarms ((null, single),(single, single),(multi, multi)) and the resulting circular chain is asserted to extract as["a","b","c","d"]— proving the merge produces a complete, walkable loop. Also covers the pre-existingpendingchain captured at freeze time."Callback failed during state replay") and replay continues; ascheduleUpdatethrow in the post-resume microtask flush is swallowed + logged ("scheduleUpdate failed during unfreeze").The bippy mock is scoped to this file (vitest isolates module mocks per file), so other suites are unaffected.
Test plan
vp test run tests— 65 unit tests pass (7 in this file)pnpm typecheckcleanpnpm lintcleanNote
Low Risk
Test-only change with no production code modifications; mocks are isolated to the new test file.
Overview
Adds
freeze-updates.test.ts, the first unit coverage forfreezeUpdates, using file-scoped mocks of bippy (fiber roots, renderers, composite fibers) andlogRecoverableErrorso React internals can be exercised in Node without a real renderer.The suite drives the real export through lifecycle (nested freeze and double-resume are safe), hook-queue buffering (masked
pendingwhile frozen; replay in chain order, including pre-freeze pending and merged writes), context dependency masking until resume, dispatcher replay order (store → transition → state), and recovery (throwing replay continues with logging;scheduleUpdatefailures in the post-resume microtask are logged).Reviewed by Cursor Bugbot for commit dce3de1. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Add end-to-end tests for
freezeUpdatesto cover freeze/replay behavior, dispatcher replay order, and error recovery. The suite mocksbippyand the recoverable-error logger to verify hook-queue buffering (merge paths and pre-existing chains), context value masking, lifecycle guards, and logging when callbacks orscheduleUpdatethrow.Written for commit dce3de1. Summary will update on new commits.