-
Notifications
You must be signed in to change notification settings - Fork 135
feat(devtools): add devtools #3589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
More templates
@rivetkit/cloudflare-workers
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
Code Review: RivetKit DevToolsOverviewThis PR adds a browser-based devtools integration for RivetKit. The implementation creates a floating button that opens the RivetKit Inspector with pre-configured connection parameters. 🔴 Critical Issues1. Security Risk: Token Exposure in URL Parameters (rivetkit-typescript/packages/devtools/src/mod.ts:56-57)if (config.token) {
url.searchParams.set("t", config.token);
}Issue: Authentication tokens are being passed as URL query parameters. This is a security vulnerability because:
Recommendation:
2. Resource Leak: Event Listeners Never Removed (rivetkit-typescript/packages/devtools/src/mod.ts:36-65)Issue: Event listeners are added at module load time but never cleaned up. In single-page applications, this could lead to memory leaks if the script is reloaded or the devtools are toggled. Recommendation: Export a cleanup function or use AbortController for automatic cleanup 3. Missing Environment Check Before DOM Manipulation (rivetkit-typescript/packages/devtools/src/mod.ts:68)document.body.appendChild(root);Issue: The code assumes Recommendation: Wrap in DOMContentLoaded check or verify document.body exists first 🟡 Important Issues4. Type Safety: Unsafe Global Variable (rivetkit-typescript/packages/devtools/src/mod.ts:45)const config = window._rivetkit_devtools_configs?.[0];
if (\!config || typeof config \!== "object") { ... }Issue: Only checking Recommendation: Add more specific type checking to validate the config structure 5. Multiple Client Support Not Handled (rivetkit-typescript/packages/devtools/src/mod.ts:45)const config = window._rivetkit_devtools_configs?.[0];Issue: The code always uses the first config, but multiple clients can be created. Users have no way to switch between multiple client configurations. Recommendation: Either add UI to select which client config to inspect, or document that only the first client is inspectable 6. Build Configuration Inconsistency (rivetkit-typescript/packages/rivetkit/tsup.config.ts:10-12)Issue: The define replacement sets the value to string "false" (not boolean false) when the env var is not set. This is inconsistent and could cause confusion. Recommendation: Use "undefined" instead of "false" for consistency 🟢 Minor Issues & Suggestions7. DevTools Auto-Enable Logic Could Be More Robust (rivetkit-typescript/packages/rivetkit/src/client/config.ts:46-50)Suggestion: This only enables for 8. Duplicate Script Injection Possible (rivetkit-typescript/packages/rivetkit/src/devtools/mod.ts:20-26)Issue: If Recommendation: Use a flag or promise to track injection state 9. CSS Positioning Could Conflict (rivetkit-typescript/packages/devtools/src/styles.css:3-9)Issues:
Recommendation: Remove duplicate bottom property, consider making z-index configurable 10. Missing Error Handling for Script Load Failures (rivetkit-typescript/packages/rivetkit/src/devtools/mod.ts:21-25)Suggestion: Add onerror handler to log when devtools script fails to load 11. Documentation Typo (rivetkit-typescript/packages/devtools/README.md:17)"This will ensure that the RivetKit will use local devtool assets" 12. Package.json Side Effects Configuration (rivetkit-typescript/packages/devtools/package.json:10-12)Issue: The module has side effects (DOM manipulation at import time), but the side effects array only lists chunk files, not the main entry point. Recommendation: Set ✅ Positive Aspects
📋 Testing RecommendationsThe PR lacks test coverage. Consider adding tests for:
🎯 Priority RecommendationsMust Fix Before Merge:
Should Fix: Nice to Have: SummaryThis is a solid foundation for RivetKit DevTools integration. The implementation is clean and uses modern web APIs appropriately. However, there are critical security concerns around token handling that must be addressed before merging. The code quality is generally good, but would benefit from more defensive programming practices and comprehensive test coverage. |
Graphite Automations"Test" took an action on this PR • (12/04/25)1 assignee was added to this PR based on Kacper Wojciechowski's automation. |
cab4cf2 to
147fff0
Compare
147fff0 to
f0d13f9
Compare

No description provided.