fix(rivetkit): expose client actor metadata#5016
Conversation
|
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.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Code ReviewOverviewThis PR exposes the actor metadata (specifically
IssuesTest doesn't cover the new code path (medium)The new constructor code: if ("getForId" in actorResolutionState) {
this.#actorId = actorResolutionState.getForId.actorId;
}only runs for const handle = client.counter.getOrCreate(["test-conn-actor-id"]);
const connection = handle.connect();
await connection.ready;
expect(connection.actorId).toBe(await handle.resolve()); // passes via Init message, not the new pathThe test validates the existing Init-message path, not the new constructor pre-population. The primary new behavior — that const actorId = await client.counter.getOrCreate(["test-conn-actor-id"]).resolve();
const handle = client.counter.getForId(actorId);
const connection = handle.connect();
// actorId is already known before the WebSocket handshake
expect(connection.actorId).toBe(actorId);
await connection.ready;
expect(connection.actorId).toBe(actorId);
await connection.dispose();JSDoc is stale (low)The /**
* Get the actor ID (for testing purposes).
* @internal
*/
get actorId(): string | undefined {asyncapi.json —
|

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: