You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds two new inspector HTTP endpoints for the actor queue: DELETE /inspector/queue (clear/reset the queue) and POST /inspector/queue (enqueue a message). The implementation is cleanly wired across the Rust core, NAPI bindings, and both TypeScript runtime adapters (native and WASM). All four issues flagged in my previous review have been addressed in the current revision.
Fixes confirmed in current diff:
queue_notify.notify_waiters() is now called after the reset, waking parked consumers.
queue_metadata lock is held across the entire reset operation, eliminating the concurrent-enqueue race.
next_id is preserved across reset rather than zeroed, preventing stale CompletionHandle instances from corrupting the new ID-1 message.
message.id().toString() is used in native.ts instead of Number(message.id()), avoiding bigint truncation.
Three smaller issues remain:
Partial-failure leaves KV metadata stale on restart
If batch_delete succeeds but the subsequent kv.put(&QUEUE_METADATA_KEY, ...) fails, the in-memory metadata.size is already set to 0 (line runs before the put) and the lock is released on Err. KV messages are gone, but the persisted metadata still shows the pre-reset size. On the next actor cold-start the engine will reload the stale metadata, temporarily reporting a wrong queue depth. This self-corrects on the next full list scan, but the window exists.
Empty name is accepted without validation
InspectorEnqueueBody uses #[serde(default)] on name: String, and the TS handler does body.name ?? "". If the caller omits name, the message is silently enqueued with an empty string. Whether that is intentional or a bug depends on whether other queue paths enforce a non-empty name. If they do, both the Rust and TS paths should return a 400 instead.
No test coverage
The new reset() method has no tests. In particular, the interaction with a consumer parked in next_batch() (that it wakes and returns empty) and the concurrent-enqueue-during-reset path (that the lock serializes it correctly) are exactly the cases that matter but are hard to verify by inspection alone. Even a single integration test that resets a queue mid-consumer would meaningfully increase confidence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.