🧹 Refactor discover_websocket_url to improve code health - #33
Conversation
…ability. Extracted the raw HTTP fetch and parsing logic into a helper function `fetch_json_targets`. Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Fixed `clippy::chunks-exact-to-as-chunks` in macOS/Windows `cdp::endpoint_owner_process_ids` implementations.
- Ran `cargo update -p event-listener` to pull in 5.4.2 to resolve `RUSTSEC-2026-0221` ("`event-listener` allows `!Send` tags to cross thread boundaries via `StackSlot`").
Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
- Fixed `clippy::chunks-exact-to-as-chunks` in macOS/Windows `cdp::endpoint_owner_process_ids` implementations.
- Ran `cargo update -p event-listener` to pull in 5.4.2 to resolve `RUSTSEC-2026-0221` ("`event-listener` allows `!Send` tags to cross thread boundaries via `StackSlot`").
Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🎯 What: Extracted the logic for issuing the manual HTTP request and parsing the JSON response into a separate function,
fetch_json_targets.💡 Why:
discover_websocket_urlwas 85 lines long, reducing maintainability. Breaking the logic up into the actual HTTP fetching part and the target parsing part improves readability and separation of concerns.✅ Verification: Ran
cargo checkandcargo test --libsafely avoiding flaky conformance tests. Code compiles successfully, passes all tests, and passed AI review.✨ Result: Improved codebase maintainability without changing any functionality or behavior.
PR created automatically by Jules for task 12576747564247521406 started by @undivisible
Note
Low Risk
Pure refactor plus a formatting fix in tests; CDP discovery behavior is unchanged.
Overview
Splits CDP target discovery so HTTP fetch and JSON parsing live in a new
fetch_json_targets, whilediscover_websocket_urlonly selects the configured target and validates the WebSocket URL. Behavior and error handling for connect,/json/list, and parsing are unchanged; this is a readability/maintainability split.Also fixes indentation in
tests/cli.rsfor the stdin piping block inrun(no test logic change).Reviewed by Cursor Bugbot for commit d4c6474. Configure here.