test(rivetkit): cover bypass fetch header forwarding#4947
Conversation
Code Review: test(rivetkit): cover bypass fetch header forwardingOverviewThis PR adds two new test cases to
Strengths
Issues and Suggestions[Minor] Misleading actor name in the second test The call [Minor] No negative path (header absent when option is omitted) Both new tests only cover [Nit] Unnecessary optional chaining After SummaryClean, focused test PR with good coverage of the Generated with Claude Code |
4d9300e to
c0b45b3
Compare
81c9b4d to
cc49ff7
Compare
|
Code Review: test(rivetkit): cover bypass fetch header forwarding Overview: This PR adds two new tests to remote-engine-client-public-token.test.ts that verify the bypassConnectable flag correctly propagates HEADER_RIVET_BYPASS_CONNECTABLE through both the low-level RemoteEngineControlClient.sendRequest path and the high-level ActorHandle.fetch path. What is Good:
Issues and Suggestions:
The second test calls handle.fetch('/bypass', ...) which produces path /bypass, then asserts the outgoing URL is https://api.rivet.dev/request/bypass. Those paths do not match. The first test uses new Request('http://actor/request/bypass') which extracts /request/bypass as the path. The second test would produce https://api.rivet.dev/bypass, not /request/bypass. This assertion will fail as written.
Confirm that ActorHandle.fetch with bypassConnectable + getForId does not emit any resolution preflights. disableMetadataLookup: true suppresses metadata fetches, but a resolution step might still occur and cause the toHaveLength(1) assertion to fail.
Neither test asserts that HEADER_RIVET_TOKEN is absent. Since no token is provided, buildGuardHeaders should not set it. Adding a null assertion would document the intentional absence and guard against regression.
The second test is titled 'handle fetch forwards bypass connectable to browser request'. The word 'browser' is misleading in a Node/Vitest environment. Consider 'ActorHandle.fetch forwards bypassConnectable header'. Summary: The intent and structure are correct and cover a real coverage gap. The primary concern is the URL path mismatch in the second test (point 1), which looks like a copy-paste oversight and will cause a test failure. Please verify the path before merging. |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: