-
Notifications
You must be signed in to change notification settings - Fork 130
feat(rivetkit): add GET /actors/names
#3411
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-07-feat_api-public_expose_actor_kv_api
Are you sure you want to change the base?
feat(rivetkit): add GET /actors/names
#3411
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
PR Review: Add
|
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: |
44ab040 to
c5ed5d6
Compare
4f3a2a9 to
42bf4e8
Compare
Code ReviewI've reviewed PR #3411 and found several issues that need to be addressed: Critical Issues1. Unused Query Parameter (Bug)Location: The endpoint accepts a router.openapi(route, async (c) => {
const names = buildActorNames(registryConfig);
return c.json<ActorsListNamesResponse>({
names,
});
});Expected behavior: The handler should either:
Current behavior: The parameter is validated but ignored, which could confuse API consumers who expect namespace-based filtering. Recommendation: Either retrieve and use the namespace parameter with 2. Empty Metadata (Design Issue)Location: The export function buildActorNames(
registryConfig: RegistryConfig,
): Record<string, { metadata: Record<string, any> }> {
return Object.fromEntries(
Object.keys(registryConfig.use).map((name) => [name, { metadata: {} }]),
);
}Questions:
Recommendation: If metadata is meant to be populated, extract it from the actor definitions. If it's a placeholder, add a TODO comment explaining future plans. Code Quality3. Schema DefinitionThe export const ActorNameSchema = z.object({
metadata: z.record(z.string(), z.unknown()),
});However, given that metadata is always empty in the current implementation, consider documenting what this metadata will eventually contain. 4. Response Schema StructureThe response schema is well-structured: export const ActorsListNamesResponseSchema = z.object({
names: z.record(z.string(), ActorNameSchema),
});This provides a good foundation for the API shape. TestingMissing test coverage: There are no tests included for this new endpoint. Recommendation: Add tests covering:
SummaryMust fix before merge:
Should address:
The overall structure and approach are sound, but the unused parameter is a blocking issue that needs resolution before this can be merged. |
Code ReviewThank you for the contribution! I've reviewed the PR and have the following feedback: Issues Found1. Unused Query Parameter - WarningThe query: z.object({
namespace: z.string(),
}),However, in the route handler: router.openapi(route, async (c) => {
const names = buildActorNames(registryConfig); // namespace not used
return c.json<ActorsListNamesResponse>({
names,
});
});Recommendation: Either:
2. Empty Metadata - InfoThe return Object.fromEntries(
Object.keys(registryConfig.use).map((name) => [name, { metadata: {} }]),
);Question: Is this intentional? If the metadata will be populated later, consider adding a TODO comment. If not, the schema could be simplified. Positive Aspects
Minor Observations
Test Coverage RecommendationIf you'd like to add tests, consider testing:
SummaryThe implementation is clean and follows project conventions well. The main concern is the unused Priority: Address the unused |
c5ed5d6 to
819085b
Compare
42bf4e8 to
da963b1
Compare
PR Review: Add
|
PR Review: Add
|

No description provided.