[#1146] Add synchronous get/set execution on POST /command-router/executions#1175
[#1146] Add synchronous get/set execution on POST /command-router/executions#1175marcocapozzoli wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds synchronous execution for ChangesSync command execution
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant CommandRouterHttpAPI
participant execute_router_command
participant RouterProcessor
Client->>CommandRouterHttpAPI: POST /command-router/executions
alt get or set command
CommandRouterHttpAPI->>execute_router_command: dispatch synchronously
execute_router_command->>RouterProcessor: normalize arguments and dispatch
RouterProcessor-->>execute_router_command: stream chunks or error
execute_router_command-->>CommandRouterHttpAPI: chunks or failure
CommandRouterHttpAPI-->>Client: 200 result or 500 error
else other command type
CommandRouterHttpAPI-->>Client: 202 accepted
CommandRouterHttpAPI->>execute_router_command: dispatch from async execution
execute_router_command->>RouterProcessor: poll router stream
end
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@CodeRabbit full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/tests/cpp/command_router_http_api_test.cc (1)
451-509: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSolid sync-path coverage; consider adding a type-mismatch case.
These tests correctly exercise
execute_router_command's sync branch against real get/set behavior, and each is self-contained (set-then-get within the same test), avoiding order-dependent fragility. One gap:set_router_paramhas a distinct error branch for type mismatches (e.g., assigning a non-true/falsestring to a bool parameter) that produces a different error message than "Unknown parameter" — currently untested.🧪 Example additional test
TEST_F(CommandRouterHttpAPITest, set_param_rejects_type_mismatch) { auto res = client().Post("/command-router/executions", make_execution_body("set", "param use_cache not_a_bool").dump(), "application/json"); ASSERT_TRUE(res); EXPECT_EQ(res->status, 500); auto payload = json::parse(res->body); EXPECT_TRUE(payload.contains("error")); EXPECT_NE(payload["error"].get<string>().find("cannot assign value"), string::npos); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tests/cpp/command_router_http_api_test.cc` around lines 451 - 509, Add a test for the missing type-mismatch error path in CommandRouterHttpAPITest by exercising execute_router_command through the sync POST endpoint with set_router_param using a bool parameter like use_cache and a non-bool value. Assert the response is a 500, parse the JSON error payload, and verify it contains the type-mismatch message (not the unknown-parameter branch) so set_router_param’s distinct validation path is covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/tests/cpp/command_router_http_api_test.cc`:
- Around line 451-509: Add a test for the missing type-mismatch error path in
CommandRouterHttpAPITest by exercising execute_router_command through the sync
POST endpoint with set_router_param using a bool parameter like use_cache and a
non-bool value. Assert the response is a 500, parse the JSON error payload, and
verify it contains the type-mismatch message (not the unknown-parameter branch)
so set_router_param’s distinct validation path is covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: faf9bea8-4434-4071-87db-1ec4fbc25431
📒 Files selected for processing (3)
src/agents/command_router/http_api/CommandRouterHttpAPI.ccsrc/agents/command_router/http_api/CommandRouterHttpAPI.hsrc/tests/cpp/command_router_http_api_test.cc
andre-senna
left a comment
There was a problem hiding this comment.
Please wait for @ccgsnet approval before merging
No description provided.