Skip to content

test(rivetkit): re-enable gateway URL and direct-registry coverage#4659

Draft
NathanFlurry wants to merge 1 commit intobreak-up/restore-hibernating-socketsfrom
break-up/reenable-gateway-url-coverage
Draft

test(rivetkit): re-enable gateway URL and direct-registry coverage#4659
NathanFlurry wants to merge 1 commit intobreak-up/restore-hibernating-socketsfrom
break-up/reenable-gateway-url-coverage

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 14, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown

claude bot commented Apr 14, 2026

Code Review

Overview

This PR re-enables previously commented-out gateway URL and direct-registry test coverage for raw HTTP and WebSocket connections. The old tests used direct registry endpoint access with explicit HEADER_ACTOR_QUERY headers; the new approach uses handle.getGatewayUrl() to get per-actor gateway URLs and routes requests through those. The PR also:

  • Adds a warmupActor fixture to probe readiness before each test
  • Adds retry logic to refreshRunnerMetadata
  • Rewrites driver-engine-ping.test.ts to use the serverless runner pattern
  • Updates setupTest in src/test/mod.ts to spin up a local Hono server
  • Re-enables the dynamic registry variant in driver tests
  • Switches engine driver tests to describe.sequential

Issues

Significant: Code duplication across test files

refreshRunnerMetadata, closeNodeServer, buildGatewayRequestUrl, buildGatewayWebSocketUrl, and waitForOpen are duplicated across multiple files:

  • driver-engine.test.ts
  • driver-engine-ping.test.ts
  • src/test/mod.ts
  • src/driver-test-suite/tests/raw-http-direct-registry.ts
  • src/driver-test-suite/tests/raw-websocket-direct-registry.ts

The implementations have already diverged: buildGatewayWebSocketUrl in raw-websocket-direct-registry.ts handles query strings, but the version in driver-engine-ping.test.ts does not. Extracting these into a shared module would prevent further drift.

Minor: Silently swallowed refreshRunnerMetadata failure

In driver-engine.test.ts, the call is wrapped in a bare catch {}:

try {
    await refreshRunnerMetadata(...);
} catch {
    // The engine can take a while to expose the metadata refresh
    // endpoint in local test harnesses...
}

If the refresh fails for reasons other than timing (misconfiguration, wrong token, network error), tests will silently proceed and produce misleading failures. Consider logging the error, or distinguishing transient network errors from hard failures.

Minor: serverlessHandleStart non-null assertion without guard

In src/test/mod.ts at the /start route:

app.post("/start", async (ctx) => {
    return await actorDriver.serverlessHandleStart!(ctx);
});

If a driver doesn't implement serverlessHandleStart, this throws with no useful message. A guard returning a 501 would make the failure actionable. The same pattern appears in driver-engine-ping.test.ts.

Minor: Missing conn_params HTTP gateway test

The old commented-out tests included a "should handle connection parameters for authentication" case via HEADER_CONN_PARAMS. The new raw-http-direct-registry.ts skips this. The WebSocket variant does test conn params. If HTTP gateway routes support them, a test case would close the gap.


Positive observations

  • waitForClientWarmup in utils.ts is a clean readiness barrier that replaces the previous setTimeout(250) guess.
  • describe.sequential for engine driver tests is the right call for tests sharing an engine process.
  • The new test structure (helper functions, httpOnlyTest conditional skip, clear names) is significantly more readable than the old commented-out block style.
  • Retry logic on refreshRunnerMetadata with AbortSignal.timeout per attempt is a solid improvement over the single-shot request.
  • Re-enabling the dynamic registry variant closes real coverage that was previously missing.

Nit: CLAUDE.md recommends antiox for TypeScript concurrency primitives. The retry loops use await new Promise((resolve) => setTimeout(resolve, 250)) directly. Not blocking for test code, but worth noting.

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.

1 participant