Skip to content

fix(rivetkit): keep internal error exposure behavior consistent#4661

Open
NathanFlurry wants to merge 1 commit intobreak-up/stabilize-actor-db-testsfrom
break-up/keep-error-exposure-consistent
Open

fix(rivetkit): keep internal error exposure behavior consistent#4661
NathanFlurry wants to merge 1 commit intobreak-up/stabilize-actor-db-testsfrom
break-up/keep-error-exposure-consistent

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: PR #4661 — fix(rivetkit): keep internal error exposure behavior consistent

Summary

This is a focused 1-line change that removes the NODE_ENV=development shortcut from the TypeScript-side getRequestExposeInternalError() function in rivetkit-typescript/packages/rivetkit/src/common/router-request.ts. After the change, only RIVET_EXPOSE_ERRORS=1 enables internal error exposure via the TS router.

Alignment with Project Architecture

This change is correct and necessary given the architecture constraint documented in CLAUDE.md:

"The dev-mode toggle that exposes raw messages lives in core (reads env at build_internal), not in the TS bridge."

The Rust-side counterpart already gates internal error exposure solely on RIVET_EXPOSE_ERRORS=1 via a process-wide OnceLock. Before this PR, the TS-side getRequestExposeInternalError() checked both RIVET_EXPOSE_ERRORS=1 and NODE_ENV=development, while the Rust/core side checked only RIVET_EXPOSE_ERRORS=1. This inconsistency meant errors handled by the Hono router (TS path) would expose more than errors handled by rivetkit-core (Rust path) when running in a development environment. The fix makes these two paths consistent.

Documentation Drift

Two documentation files have stale content that references the removed behavior:

  1. website/src/content/docs/actors/errors.mdx — Still states:

    • NODE_ENV=development — Automatically enabled in development mode
    • // With NODE_ENV=development or RIVET_EXPOSE_ERRORS=1
  2. website/src/content/docs/general/production-checklist.mdx — Still states:

    • "It is automatically enabled when NODE_ENV=development."

These doc updates should accompany the behavior change (per the docs-sync convention).

Behavior Impact

This is a breaking developer experience change — users who relied on NODE_ENV=development automatically surfacing internal errors must now explicitly set RIVET_EXPOSE_ERRORS=1. The intent (not leaking internals by default even in dev) is sound, but the docs need to reflect this.

Action Items

  • Update website/src/content/docs/actors/errors.mdx to remove the NODE_ENV=development trigger from the error exposure documentation.
  • Update website/src/content/docs/general/production-checklist.mdx to remove the claim that NODE_ENV=development automatically enables error exposure.
  • Consider adding a note that users must explicitly set RIVET_EXPOSE_ERRORS=1 to surface internal errors in any environment.

@NathanFlurry NathanFlurry changed the base branch from break-up/stabilize-driver-lifecycle-tests to graphite-base/4661 April 15, 2026 02:40
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from 309ad25 to b090c6c Compare April 15, 2026 02:40
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4661 to break-up/stabilize-actor-db-tests April 15, 2026 02:41
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from b090c6c to ae2a18f Compare April 15, 2026 02:50
@NathanFlurry NathanFlurry force-pushed the break-up/stabilize-actor-db-tests branch from 9c1861c to 8a0be32 Compare April 15, 2026 02:50
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from ae2a18f to feb2f40 Compare April 15, 2026 06:55
@NathanFlurry NathanFlurry force-pushed the break-up/stabilize-actor-db-tests branch from 8a0be32 to f676d13 Compare April 15, 2026 06:55
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from feb2f40 to 93de088 Compare April 27, 2026 05:57
@NathanFlurry NathanFlurry force-pushed the break-up/keep-error-exposure-consistent branch from 93de088 to de861be Compare April 27, 2026 07:30
@NathanFlurry NathanFlurry marked this pull request as ready for review April 27, 2026 07:40
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