-
Notifications
You must be signed in to change notification settings - Fork 131
fix(inspector): allow executing rpcs in inspector #3289
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
fix(inspector): allow executing rpcs in inspector #3289
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. |
PR ReviewSummaryThis PR refactors actor worker context to support inspector mode and standardizes HTTP header usage by replacing hardcoded strings with constants. Overall, the changes are solid and improve maintainability. ✅ Strengths
🔍 Issues & Suggestions1. Code Style: Missing semicolon (Minor)Location: The const useConnectionDetails = () => {
return match(__APP_TYPE__)
.with("inspector", () => {
return {namespace: "", engineToken: ""};
})
.otherwise(() => {
const provider = useEngineCompatDataProvider();
return {namespace: provider.engineNamespace, engineToken: provider.engineToken};
});
} // Missing semicolon hereRecommendation: Add semicolon for consistency with the rest of the codebase. 2. Code Style: Inconsistent spacing (Minor)Location: There's a trailing whitespace after the destructuring assignment: const {engineToken, namespace} = useConnectionDetails();
// Extra blank line here
const {Recommendation: Remove the trailing whitespace for consistency. 3. Code Style: Object property spacing (Minor)Location: Missing spaces after colons in object literals: return {namespace: "", engineToken: ""}; // Should be { namespace: "", engineToken: "" }
return {namespace: provider.engineNamespace, engineToken: provider.engineToken};Recommendation: Add spaces after colons to match TypeScript/JavaScript conventions. 4. Potential Runtime Issue: Hook call order (Medium)Location: The In inspector mode, Recommendation: Consider restructuring to call hooks unconditionally: const useConnectionDetails = () => {
const provider = match(__APP_TYPE__)
.with("inspector", () => null)
.otherwise(() => useEngineCompatDataProvider());
return match(__APP_TYPE__)
.with("inspector", () => ({ namespace: "", engineToken: "" }))
.otherwise(() => ({
namespace: provider?.engineNamespace ?? "",
engineToken: provider?.engineToken ?? ""
}));
}However, this still has issues. A better approach might be: const useConnectionDetails = () => {
if (__APP_TYPE__ === "inspector") {
return { namespace: "", engineToken: "" };
}
const provider = useEngineCompatDataProvider();
return {
namespace: provider.engineNamespace,
engineToken: provider.engineToken
};
}Since 5. Missing Test Coverage (Medium)No test files were found for these components. Given that this PR changes critical connection logic for both normal and inspector modes, tests would be valuable. Recommendation: Consider adding tests to verify:
📊 Performance ConsiderationsNo performance concerns. The refactoring maintains the same runtime behavior with minimal overhead. 🔒 Security Considerations✅ No security issues identified. The changes improve security by:
📝 Best PracticesThe PR follows repository conventions well:
Final VerdictApprove with minor suggestions. The core logic is sound and achieves the stated goals. The main concern is the conditional hook call, but if 🤖 Generated with Claude Code |
More templates
@rivetkit/actor
@rivetkit/cloudflare-workers
@rivetkit/core
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
Graphite Automations"Test" took an action on this PR • (10/30/25)1 assignee was added to this PR based on Kacper Wojciechowski's automation. |
Code ReviewThanks for this refactor @jog1t! This PR improves the inspector mode support and standardizes header usage. Overall the changes look good, but I have some observations and suggestions: ✅ Strengths
🔍 Observations & Suggestions1. Missing semicolon (frontend/src/components/actors/worker/actor-worker-context.tsx:55)There's a missing semicolon after the const useConnectionDetails = () => {
return match(__APP_TYPE__)
.with("inspector", () => {
return {namespace: "", engineToken: ""};
})
.otherwise(() => {
const provider = useEngineCompatDataProvider();
return {namespace: provider.engineNamespace, engineToken: provider.engineToken};
});
} // ← Missing semicolon hereShould be: };2. Trailing whitespace (frontend/src/components/actors/worker/actor-worker-context.tsx:67)Line 67 has trailing whitespace after const {engineToken, namespace} = useConnectionDetails();
// ← Trailing whitespace here3. Consider edge case handlingThe inspector mode returns empty strings for 4. Unused variable (frontend/src/components/actors/worker/actor-worker-context.tsx:65)After the refactor, const dataProvider = useDataProvider(); // ← Not used anywhere
const {engineToken, namespace} = useConnectionDetails();This appears to be leftover from the refactoring. Should this line be removed, or is 5. Test coverageNo test files exist for this component. Consider adding tests to verify:
6. Consistency check across codebaseGood news: I checked and there are no other places in the TypeScript codebase using hardcoded
🎯 Required Changes
💡 Recommended Changes
📝 Additional NotesThe change is well-aligned with the PR description and solves the stated problem. The code follows the existing patterns in the codebase (using Once the required changes are addressed, this will be ready to merge! |
Merge activity
|
775bd91 to
d6de769
Compare
Code Review for PR #3289SummaryThis PR refactors the actor worker context to support inspector mode by introducing a new Positive Observations ✅
Issues and Concerns 🔴1. Hook Call Order Violation (Critical)Location: const useConnectionDetails = () => {
return match(__APP_TYPE__)
.with("inspector", () => {
return {namespace: "", engineToken: ""};
})
.otherwise(() => {
const provider = useEngineCompatDataProvider(); // ❌ Conditional hook call
return {namespace: provider.engineNamespace, engineToken: provider.engineToken};
});
}Problem: This violates React's Rules of Hooks. The Solution: Call the hook unconditionally at the top level: const useConnectionDetails = () => {
const isInspector = __APP_TYPE__ === "inspector";
const provider = isInspector ? null : useEngineCompatDataProvider();
return match(__APP_TYPE__)
.with("inspector", () => {
return {namespace: "", engineToken: ""};
})
.otherwise(() => {
return {namespace: provider!.engineNamespace, engineToken: provider!.engineToken};
});
}Or more simply: const useConnectionDetails = () => {
if (__APP_TYPE__ === "inspector") {
return {namespace: "", engineToken: ""};
}
const provider = useEngineCompatDataProvider();
return {namespace: provider.engineNamespace, engineToken: provider.engineToken};
}2. Missing Formatting (Minor)Location: const {engineToken, namespace} = useConnectionDetails();
// Missing blank line here
const {Issue: There's a trailing blank line on line 67 that should be removed according to standard formatting practices. 3. Unused Import (Minor)Location: The change updates line 65 to use Question: Is Recommendations 📋
Additional Notes
Approval Status🤖 Generated with Claude Code |

TL;DR
Refactored actor worker context to support inspector mode and standardized HTTP header usage.
What changed?
useConnectionDetails()hook inactor-worker-context.tsxthat returns different connection details based on the application typeActorWorkerContextProviderto use the new hook instead of directly accessing the data providerrivetkitwith imported constants fromdriver-helpers/modHEADER_ACTOR_QUERYto the list of allowed CORS headersHow to test?
Why make this change?
This change improves the codebase by: