Conversation
Add queue introspection UI with job browsing, DLQ management, and redrive support. - Bridge: 6 queue handlers (list, stats, jobs, job, redrive, dlq-count) using engine.console.* naming - Frontend: Full queue dashboard with 3-panel layout, job detail view, DLQ redrive - API: Queue fetch functions with React Query integration (5s auto-refresh) - Nav: Added Queues entry to sidebar between Streams and Functions
0b774d2 to
73c820f
Compare
Code Review Report: PR #9 —
|
| # | Finding | File | Dimension |
|---|---|---|---|
| L1 | No state parameter validation in Rust (state can be any string) |
functions.rs:621-624 |
Quality |
| L2 | Fragile implicit mapping between JobState and QueueInfo fields via indexing |
queues.tsx:127-130 |
Quality |
| L3 | No search debouncing — filter recalculates on every keystroke | queues.tsx:176-182 |
Performance |
| L4 | CSRF protection relies solely on CORS (acceptable for local dev tool) | server.rs:160-167 |
Security |
| L5 | Frontend JobState type only enforced at compile-time, no runtime check |
queues.ts:57-64 |
Security |
| L6 | Timeout values could be more granular (2s for list, 3s for pagination) | functions.rs (all handlers) |
Performance |
| L7 | fetchQueueJob and fetchQueueStats exported but unused in queries |
api/index.ts:89 |
Architecture |
Summary
| Severity | Count |
|---|---|
| Critical | 0 |
| High | 6 |
| Medium | 7 |
| Low | 7 |
| Total | 20 |
Suggested remediation order:
- H1 + H6 — Fix type safety and error handling (quick wins, high impact)
- H2 — Add input validation in Rust handlers (security)
- H4 + M5 — Add
refetchIntervalInBackground: falseandstaleTime(one-liners) - M4 — Scope query invalidation (one-liner)
- H3 + H5 — Component decomposition (larger refactor, can be follow-up PR)
Overall: The feature is well-structured and follows existing codebase conventions in most areas. Main concerns are type safety erosion from unknown[], missing backend input validation, and the monolithic component. The polling and re-render issues are straightforward to fix. Recommend addressing H1-H2 and the medium items before merge; component decomposition (H3) could be a follow-up.
H1: Replace unknown[] with QueueJob | DlqEntry typed unions H2: Add validate_queue_name/validate_job_id in bridge handlers H4: Add refetchIntervalInBackground: false to queuesQuery H6: Throw on fetchQueueJob error instead of returning null M1: Add audit logging for redrive operations M4: Scope query invalidation to selected queue on redrive M5: Add staleTime: 3000 to queue jobs query M6: Fix exhaustive deps - add selectedQueue to useEffect M7: Extract extract_queue_name helper to DRY topic extraction
Return null for 404 responses (job not found) instead of throwing, matching the QueueJob | null return type signature.
📝 WalkthroughWalkthroughAdds a full queue management feature: typed frontend API and React Query helpers, a Queues UI route with list/detail/DLQ/redrive flows, sidebar navigation and route registration, and new Rust bridge handlers and HTTP trigger mappings for queue operations. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI as QueuesPage
participant Query as ReactQuery
participant API as Queues API
participant Backend as Rust Bridge
User->>UI: Open /queues
UI->>Query: prefetch queuesQuery
Query->>API: fetchQueues()
API->>Backend: engine.console.queues_list
Backend-->>API: { queues: QueueInfo[] }
API-->>Query: queues data
Query-->>UI: render queues
User->>UI: Select queue / change tab / page
UI->>Query: queueJobsQuery(queue, state, offset, limit)
Query->>API: fetchQueueJobs(...)
API->>Backend: engine.console.queue_jobs
Backend-->>API: { jobs, count, offset, limit }
API-->>Query: jobs data
Query-->>UI: display jobs
User->>UI: Open job detail
UI->>API: fetchQueueJob(queue, jobId)
API->>Backend: engine.console.queue_job
Backend-->>API: QueueJob | null
API-->>UI: job detail
User->>UI: Trigger redrive
UI->>API: redriveQueue(queue)
API->>Backend: engine.console.queue_redrive
Backend-->>API: success
API-->>Query: invalidate queues/jobs queries
Query-->>UI: refreshed data / confirmation
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
Engine registers queue functions under #[service(name = "queue")], so full paths are queue.list_queues, queue.stats, etc. Without the prefix, call_with_timeout would fail to resolve the functions at runtime.
Summary
/queuesroute with 3-panel layout, search, pagination, and job detail viewerChanges
Bridge (Rust)
functions.rs: 6 new handlers (handle_queues_list,handle_queue_stats,handle_queue_jobs,handle_queue_job,handle_queue_redrive,handle_queue_dlq_count) + fixpath_parameterskey inhandle_state_item_deletetriggers.rs: 6 new HTTP trigger registrations under/_console/queues/*Frontend
routes/queues.tsx: Full queue dashboard page with DLQ/queue visual separationapi/queues/queues.ts: API layer with types (QueueInfo,QueueJob,DlqEntry)api/queries.ts: React Query hooks for queuescomponents/layout/Sidebar.tsx: Added Queues nav entryroutes/index.tsx: Queue health summary card on dashboardBug fixes
handle_state_item_deleteusing wrong key (path_params->path_parameters)println!fromhandle_state_item_deletequeryClientimport instates.tsxTest plan
/queuesand verify queue list, job countscargo checkpasses for console-rusttsc -b && vite buildpasses for console-frontendDepends on
rohit/queue-dashboard-introspectionbranch (engine-side queue introspection functions)Summary by CodeRabbit