-
Notifications
You must be signed in to change notification settings - Fork 131
fix(rivetkit): remove incorrect getEndpoint call in metadata handler #3433
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: 11-09-feat_rivetkit_add_json_protocol_support
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
|
PR ReviewSummaryThis PR fixes an incorrect usage of Code Quality ✅Positive aspects:
Code style: Follows TypeScript conventions and is consistent with the surrounding code. Correctness Analysis ✅Before this PR:
After this PR:
Potential Issues
|
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: |
Code Review - PR #3433SummaryThis PR makes two key improvements to error handling and metadata endpoint logic in RivetKit:
✅ Positive Findings1. Correct semantic fix for metadata handling
This is better because:
The implementation correctly handles both serialization formats:
2. Correct fix for clientEndpoint logic
3. Consistent changes across all affected files
🔍 Observations1. Type safety consideration type ErrorValueJson = {
group: string;
code: string;
message: string;
actionId: number | null;
metadata?: unknown;
};
const val: ErrorValueJson = {
group: value.group,
code: value.code,
message: value.message,
actionId: value.actionId !== undefined ? value.actionId : null,
};2. Conditional field addition pattern if (value.metadata !== undefined) {
val.metadata = value.metadata;
}This ensures the field is completely omitted from JSON when not present, rather than being ✅ Security, Performance, and Quality
📝 Suggestions
Overall AssessmentLGTM ✅ This is a well-executed bug fix that:
The changes are low-risk and improve code correctness. |
0c93402 to
46a76b7
Compare
Code ReviewSummaryThis PR fixes a type mismatch bug where Positive Aspects ✅
Recommendations 📝1. Consider Adding TestsThere are no tests covering the
Example test structure: describe('handleMetadataRequest', () => {
it('returns overrideServerAddress when set', () => {
const runConfig = { overrideServerAddress: 'http://custom:8080', ... };
const response = handleMetadataRequest(mockContext, mockRegistry, runConfig);
expect(response.clientEndpoint).toBe('http://custom:8080');
});
it('returns undefined clientEndpoint when overrideServerAddress is not set', () => {
const runConfig = { overrideServerAddress: undefined, ... };
const response = handleMetadataRequest(mockContext, mockRegistry, runConfig);
expect(response.clientEndpoint).toBeUndefined();
});
});2. TypeScript StrictnessThis bug highlights that TypeScript didn't catch the type mismatch. Consider:
3. DocumentationThe updated comments are good, but could be enhanced: // If server address is explicitly overridden, return it so the client
// can redirect to the new endpoint. Otherwise, return undefined to
// indicate the client should continue using its current endpoint.
clientEndpoint: runConfig.overrideServerAddress,Security & Performance ✅
ConclusionThis is a clean and correct bug fix. The main improvement would be adding test coverage to prevent similar issues in the future. Approval: ✅ Approved with recommendation to add tests Review generated with assistance from Claude Code |

No description provided.