Skip to content

feat(inspector): insert and clear actor queue#5065

Draft
abcxff wants to merge 1 commit into
05-18-fix_rivetkit_wire_cancellationtoken_through_waitfornamesavailable_to_eliminate_kv_busy-pollingfrom
05-19-feat_inspector_insert_and_clear_actor_queue
Draft

feat(inspector): insert and clear actor queue#5065
abcxff wants to merge 1 commit into
05-18-fix_rivetkit_wire_cancellationtoken_through_waitfornamesavailable_to_eliminate_kv_busy-pollingfrom
05-19-feat_inspector_insert_and_clear_actor_queue

Conversation

@abcxff
Copy link
Copy Markdown
Contributor

@abcxff abcxff commented May 19, 2026

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

@railway-app
Copy link
Copy Markdown

railway-app Bot commented May 19, 2026

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

Service Status Web Updated (UTC)
kitchen-sink ❌ Build Failed (View Logs) Web May 21, 2026 at 12:35 am
frontend-cloud 😴 Sleeping (View Logs) Web May 19, 2026 at 9:54 pm
frontend-inspector ❌ Build Failed (View Logs) Web May 19, 2026 at 9:47 pm
website 😴 Sleeping (View Logs) Web May 19, 2026 at 8:33 pm
ladle ✅ Success (View Logs) Web May 19, 2026 at 8:30 pm
mcp-hub ✅ Success (View Logs) Web May 19, 2026 at 8:20 pm

Copy link
Copy Markdown
Contributor Author

abcxff commented May 19, 2026

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 19, 2026

PR Review: feat(inspector): insert and clear actor queue

Summary

This PR adds inspector endpoints for queue management: POST /inspector/queue to enqueue messages and DELETE /inspector/queue to clear the queue. The feature is implemented across Rust core, NAPI bindings, and TypeScript runtime adapters (native and wasm).


Strengths

  1. Consistent error handling — Uses .context() throughout for anyhow error propagation without glob imports.
  2. Async lock usage — Correctly uses tokio::sync::Mutex for queue metadata updates in the async reset() method.
  3. Proper data structure choice — Uses SccHashMap::clear_async() for concurrent completion waiters, following the constraint against Mutex<HashMap>.
  4. Complete runtime parity — Implements the feature across all three runtime paths (core, NAPI, wasm) with matching semantics.
  5. No fallthrough arms — New match arms for the queue endpoints enumerate variants explicitly with no _ => fallthrough.

Issues

1. Missing queue reset notifications
The reset() implementation calls notify_inspector_update(0), but there's no corresponding notification to listeners waiting on queue activity. Resetting the queue while a consumer is waiting for a message could leave them hanging indefinitely. Verify this is intentional or add a notification path.

2. Missing validation on enqueue body
The InspectorEnqueueBody struct uses #[serde(default)], so the name field defaults to an empty string if omitted. Consider whether empty queue names should be explicitly rejected with a clear error rather than silently accepted.

3. TypeScript type assertion (not narrowing)

const body = await jsRequest.json() as { name?: string; body?: unknown };

This is a as assertion without validation. Consider explicitly validating name is non-empty before defaulting to "".


Test Coverage

This PR is marked as DRAFT and has no tests. For inspector endpoints that manipulate actor state, tests should cover:

  • Resetting an empty queue
  • Resetting a queue with multiple messages
  • Enqueueing via the POST /inspector/queue endpoint
  • Verifying message ID sequence is correct after reset
  • Boundary conditions (max message size, max queue depth)

Blocking Concerns Before Merge

  1. No test coverage — Driver tests are required for the queue reset and enqueue flows.
  2. Queue name validation — Empty-string default behavior should be validated or explicitly documented.

Non-blocking Observations

  • The implementation integrates cleanly with existing queue infrastructure.
  • Wasm and NAPI bindings correctly forward to core without duplicating logic.
  • Doc comment on reset() ("Removes all messages from the queue and resets metadata.") is clear and well-formed.
  • No println!/eprintln! — logging correctly omitted for these endpoints.
  • Lock scope on queue_metadata.lock().await is appropriately short (single assignment).

Overall this is a solid, well-structured implementation. The main blockers are test coverage and the queue name validation edge case.

@abcxff abcxff force-pushed the 05-18-fix_rivetkit_wire_cancellationtoken_through_waitfornamesavailable_to_eliminate_kv_busy-polling branch from 73cbe67 to 9dc7e20 Compare May 21, 2026 00:35
@abcxff abcxff force-pushed the 05-19-feat_inspector_insert_and_clear_actor_queue branch from a89784a to 95dd3b3 Compare May 21, 2026 00:35
@abcxff abcxff mentioned this pull request May 21, 2026
11 tasks
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