| name | review-api |
| description | Review new or modified API features for completeness and consistency |
| user-invocable | true |
API Feature Review
Review new or modified API features for completeness and consistency.
Checklist
Server-Side (src/server/)
-
Authorization: All API endpoints use authorize_workflow! or authorize_resource! macros
- Check
src/server/http_server.rs for the endpoint handler
- Verify the macro is called before any business logic
-
Error Responses: Proper HTTP status codes are returned
- 403 for unauthorized access
- 404 for not found resources
- 422 for validation errors
- 500 for server errors
-
SQLite indexes: Ensure changes to SQLite tables are paired with appropriate indexes. If the
branch changes any SQLite tables, check what indexes exist for those tables. Report to the
developer whether you would recommend any changes. Be careful recommending indexes that would
consume lots of memory with minimal user value.
OpenAPI Spec (api/openapi.yaml)
-
Endpoint Documentation: All new/modified endpoints are documented
- Path, method, parameters, request body
- Response schemas for 200, 403, 404, 422, 500
- Validate with:
npx @redocly/cli lint api/openapi.yaml
-
Schema Syntax (OpenAPI 3.1):
- Use
type: [integer, "null"] not nullable: true
- Use direct
$ref: without schema: wrapper
- Examples use actual objects:
error: {} not error: "{}"
Client CLI (src/client/commands/)
-
Workflow ID Prompting: Commands use Option<i64> for workflow_id
- Call
select_workflow_interactively() when None
- Follow pattern in
jobs.rs or ro_crate.rs
-
Pagination: List commands that fetch from server use pagination
- Check for
paginate_* functions or pagination iterators
- Single API calls with no limit will truncate at 10,000 items
-
JSON Output: Commands support -f json output format
- Use
print_if_json() or print_wrapped_if_json()
- Ensure structured data is serializable
-
Logging: Check that log messages that include database record IDs use a format like
info!("Created workflow workflow_id={}", workflow_id); so that parsing scripts pick them up.
Performance
- Review all changes for performance.
- Look for excessive invocations of CLI commands as subprocesses.
- Look for problematic API calls from client to the server. Batching is preferred where possible.
- Check SQL queries on the server for unnecessary joins.
Code Quality
- Check the changes for duplication and flag instances.
- Check functions for being too long and complicated.
How to Review
- Identify all files changed in the feature
- For each server endpoint: check authorization and error responses
- For each CLI command: check prompting, pagination, JSON support
- Verify OpenAPI spec matches implementation
- Run linters:
cargo clippy, npx @redocly/cli lint api/openapi.yaml
Example Usage
/review-api
# Or with context:
Review the RO-Crate feature for API completeness