Skip to content

fix(rivetkit): decode bridge errors with actor: null#5056

Merged
abcxff merged 1 commit into
mainfrom
05-13-fix_rivetkit_decode_bridge_errors_with_actor_null
May 13, 2026
Merged

fix(rivetkit): decode bridge errors with actor: null#5056
abcxff merged 1 commit into
mainfrom
05-13-fix_rivetkit_decode_bridge_errors_with_actor_null

Conversation

@abcxff
Copy link
Copy Markdown
Contributor

@abcxff abcxff commented May 13, 2026

Fixes RVT-6296

@railway-app
Copy link
Copy Markdown

railway-app Bot commented May 13, 2026

🚅 Deployed to the rivet-pr-5056 environment in rivet-frontend

Service Status Web Updated (UTC)
kitchen-sink ❌ Build Failed (View Logs) Web May 13, 2026 at 8:14 pm
frontend-cloud 🕒 Building (View Logs) Web May 13, 2026 at 8:13 pm
frontend-inspector 🕒 Building (View Logs) Web May 13, 2026 at 8:13 pm
website ❌ Build Failed (View Logs) Web May 13, 2026 at 5:14 pm
mcp-hub ✅ Success (View Logs) Web May 13, 2026 at 5:13 pm
ladle ❌ Build Failed (View Logs) Web May 13, 2026 at 5:13 pm

Copy link
Copy Markdown
Contributor Author

abcxff commented May 13, 2026

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 13, 2026

PR Review: fix(rivetkit): decode bridge errors with actor: null

Overview

This PR fixes a bug (RVT-6296) where bridge error payloads containing actor: null silently failed to decode, returning undefined instead of a structured RivetError. Root cause: JSON serialization from the NAPI/Rust side can produce null for an absent actor field, but isActorSpecifier(null) returns false, causing the entire payload to be rejected.


Changes

1. Validation guard in decodeBridgeRivetErrorPayload

// Before
if (payload.actor !== undefined && !isActorSpecifier(payload.actor)) {
// After
if (payload.actor !== undefined && payload.actor !== null && !isActorSpecifier(payload.actor)) {

Correct. Allows null to pass validation as "no actor specified," consistent with how isActorSpecifier itself treats null.

2. Null coercion in decodeBridgeRivetError

// Before
actor: payload.actor,
// After
actor: payload.actor ?? undefined,

Correct. RivetErrorOptions.actor is typed as ActorSpecifier | undefined, not ActorSpecifier | null. The ?? normalizes the runtime null into the expected TS type.


Issues

Missing regression test. The existing rivet-error.test.ts round-trip only covers a fully-populated actor specifier. There is no test for a bridge payload where actor is explicitly null, so a future regression here would go undetected. Suggested addition:

test("decodes bridge payload with actor: null", () => {
    const raw = `${BRIDGE_RIVET_ERROR_PREFIX}${JSON.stringify({
        group: "actor",
        code: "internal_error",
        message: "fail",
        actor: null,
    })}`;
    const decoded = decodeBridgeRivetError(raw);
    expect(decoded).toBeInstanceOf(RivetError);
    expect(decoded?.actor).toBeUndefined();
});

Minor observations

  • BridgeRivetErrorPayload types actor as ActorSpecifier | undefined, not including null. The JSON.parse(...) as BridgeRivetErrorPayload cast is therefore a lie at runtime. Pre-existing issue, out of scope here, but worth tightening the type if the payload schema is revisited.
  • encodeBridgeRivetError omits actor when it is undefined (standard JSON.stringify behavior), so null payloads can only originate from the NAPI/Rust bridge. The fix is correctly placed at the decode boundary.

Summary

The fix is minimal, correct, and well-targeted. Both changes are necessary and consistent with the project's null-vs-undefined conventions. The only missing piece is a regression test for the actor: null path.

@linear
Copy link
Copy Markdown

linear Bot commented May 13, 2026

RVT-6296

@abcxff abcxff changed the base branch from 05-09-fix_workflow-engine_only_commit_step_state_after_success to graphite-base/5056 May 13, 2026 17:41
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from fbaeef3 to 67b4f92 Compare May 13, 2026 17:41
@abcxff abcxff force-pushed the graphite-base/5056 branch from 0eb8f51 to 5f7bac7 Compare May 13, 2026 17:41
@abcxff abcxff changed the base branch from graphite-base/5056 to 05-12-temp_fix_wasm-pack May 13, 2026 17:41
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 17:41 Destroyed
@abcxff abcxff marked this pull request as ready for review May 13, 2026 17:45
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from 67b4f92 to e402a50 Compare May 13, 2026 17:50
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 17:50 Destroyed
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from e402a50 to 7b5d681 Compare May 13, 2026 18:04
@abcxff abcxff force-pushed the 05-12-temp_fix_wasm-pack branch from 5f7bac7 to 24f24d7 Compare May 13, 2026 18:04
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 18:05 Destroyed
@abcxff abcxff force-pushed the 05-12-temp_fix_wasm-pack branch from 24f24d7 to cc6719f Compare May 13, 2026 18:31
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from 7b5d681 to 8625f84 Compare May 13, 2026 18:31
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 18:32 Destroyed
@abcxff abcxff force-pushed the 05-12-temp_fix_wasm-pack branch from cc6719f to 211349e Compare May 13, 2026 18:48
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from 8625f84 to 46973f2 Compare May 13, 2026 18:49
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 18:49 Destroyed
@abcxff abcxff changed the base branch from 05-12-temp_fix_wasm-pack to graphite-base/5056 May 13, 2026 19:11
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from 46973f2 to c5ef70f Compare May 13, 2026 19:11
@abcxff abcxff force-pushed the graphite-base/5056 branch from 211349e to 3d9e480 Compare May 13, 2026 19:11
@abcxff abcxff changed the base branch from graphite-base/5056 to 05-06-fix_rivetkit_bind_methods_through_createwritethroughproxy May 13, 2026 19:11
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 19:11 Destroyed
@abcxff abcxff changed the base branch from 05-06-fix_rivetkit_bind_methods_through_createwritethroughproxy to graphite-base/5056 May 13, 2026 20:07
@abcxff abcxff force-pushed the graphite-base/5056 branch from 3d9e480 to 8f133bf Compare May 13, 2026 20:07
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from c5ef70f to 8708f6b Compare May 13, 2026 20:07
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 20:07 Destroyed
@abcxff abcxff changed the base branch from graphite-base/5056 to 05-12-temp_fix_wasm-pack May 13, 2026 20:07
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from 8708f6b to e2a084d Compare May 13, 2026 20:09
@abcxff abcxff force-pushed the 05-12-temp_fix_wasm-pack branch from 8f133bf to 80c7cb9 Compare May 13, 2026 20:09
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 20:09 Destroyed
Copy link
Copy Markdown
Contributor Author

abcxff commented May 13, 2026

Merge activity

  • May 13, 8:11 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 13, 8:14 PM UTC: Graphite rebased this pull request as part of a merge.
  • May 13, 8:14 PM UTC: @abcxff merged this pull request with Graphite.

@abcxff abcxff changed the base branch from 05-12-temp_fix_wasm-pack to graphite-base/5056 May 13, 2026 20:12
@abcxff abcxff changed the base branch from graphite-base/5056 to main May 13, 2026 20:12
@abcxff abcxff force-pushed the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch from e2a084d to cebc486 Compare May 13, 2026 20:13
@railway-app railway-app Bot temporarily deployed to rivet-frontend / rivet-pr-5056 May 13, 2026 20:13 Destroyed
@abcxff abcxff merged commit 52e743c into main May 13, 2026
11 of 14 checks passed
@abcxff abcxff deleted the 05-13-fix_rivetkit_decode_bridge_errors_with_actor_null branch May 13, 2026 20:14
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