Repository navigation
feat(ppr): expose navigation replay hits - #774
Merged
Merged
Conversation
commit: |
8 tasks done
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.
Problem
Consumers could confirm a PPR document shell with
x-rango-shell, but a partial navigation exposed no signal showing whether its captured canonical segment record was reused. A replay hit, an explicitcache()scope, and a correctness fallback all looked identical without inspecting generic timings or private store data.This PR adds the positive replay signal from #772 without changing transition semantics. Bypass reasons and replay-safe
transition({ when })behavior remain separate work.Before vs. after
Before, a consumer could only observe document shell status:
After, a confirmed segment replay is directly assertable:
The wire signal is:
End-to-end example
Semantics
x-rango-ppr-replay: HITcache()scope winsx-rango-shellHITis recorded after successful segment deserialization and handle restoration. Finding a shell entry or installing a seeded store is not enough, so a corrupt record or a higher-priority explicit cache cannot produce a false positive.Code changes
rsc-rendering.tsattaches the header to the partial RSC response only after the implicit replay scope reports a successful hit.cache-scope.tsowns the exact post-decode confirmation boundary through a module-private observer; the publicCacheScopeAPI is unchanged.shell-status.tsexportsassertPprReplayStatus,parsePprReplayStatus,PPR_REPLAY_STATUS_HEADER, andPprReplayStatusfrom both testing entry points.Test plan
x-rango-ppr-replayheader; the new pipeline and store tests failed before implementation and pass after it.cache()precedence and corrupt decode do not.@rangojs/router/testingexports.partial navigation replays the PPR segment shell...in dev and production.CFCacheStore: same case in dev and production.pnpm run typecheckpnpm run test:unit:allpnpm run lintpnpm run formatNotes
transition({ when })routes still bypass PPR segment replay; a follow-up PR will address replay-safe predicate semantics.Part of #772.