refactor: Split protocol.rs into protocol/ submodule#128
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe protocol layer is being reorganized from a single monolithic file ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/pu-core/src/protocol/tests.rs (1)
482-484: Consider extracting the protocol version constant assertion.The hardcoded value
4here will need updating whenPROTOCOL_VERSIONchanges. This test ensures the version is intentional, which is good, but consider adding a comment explaining why this assertion exists (to catch accidental version bumps).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/pu-core/src/protocol/tests.rs` around lines 482 - 484, The test given_protocol_version_should_be_current currently asserts PROTOCOL_VERSION equals the hardcoded value 4; update the test to keep the explicit assertion but add a clarifying comment above the assertion explaining that this check is intentional to catch accidental protocol bumps and must be manually updated when the protocol is intentionally versioned, and optionally extract the literal into a named test-constant (e.g., EXPECTED_PROTOCOL_VERSION) referenced in the assertion to make intent clearer; locate this in the given_protocol_version_should_be_current function referencing PROTOCOL_VERSION and modify accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@crates/pu-core/src/protocol/tests.rs`:
- Around line 482-484: The test given_protocol_version_should_be_current
currently asserts PROTOCOL_VERSION equals the hardcoded value 4; update the test
to keep the explicit assertion but add a clarifying comment above the assertion
explaining that this check is intentional to catch accidental protocol bumps and
must be manually updated when the protocol is intentionally versioned, and
optionally extract the literal into a named test-constant (e.g.,
EXPECTED_PROTOCOL_VERSION) referenced in the assertion to make intent clearer;
locate this in the given_protocol_version_should_be_current function referencing
PROTOCOL_VERSION and modify accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e71dfce7-f776-4dc2-ac87-27ac4f197ae5
📒 Files selected for processing (7)
crates/pu-core/src/protocol.rscrates/pu-core/src/protocol/encoding.rscrates/pu-core/src/protocol/grid.rscrates/pu-core/src/protocol/mod.rscrates/pu-core/src/protocol/payloads.rscrates/pu-core/src/protocol/targets.rscrates/pu-core/src/protocol/tests.rs
💤 Files with no reviewable changes (1)
- crates/pu-core/src/protocol.rs
|
Addressed the CodeRabbit nitpick: added a clarifying comment to the protocol version assertion in |
Break up the 2,614-line protocol.rs into focused subfiles: - encoding.rs: hex serde helper - grid.rs: GridCommand enum - targets.rs: KillTarget/SuspendTarget enums - payloads.rs: all payload structs and From impls - tests.rs: all tests - mod.rs: Request/Response enums, re-exports Pure refactoring — no behavior changes. All public API paths preserved via re-exports from mod.rs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6eb2db6 to
4d25306
Compare
|
Rebased onto main to incorporate PR #131 (trigger opt-in). Changes applied to the submodule structure:
All 306 pu-core + 93 pu-cli + 130 pu-engine tests pass. |
Summary
crates/pu-core/src/protocol.rsinto aprotocol/directory module with 6 focused files:encoding.rs,grid.rs,targets.rs,payloads.rs,tests.rs, andmod.rsTest plan
cargo test -p pu-core— 304 tests passcargo test -p pu-engine— 130 tests passcargo test -p pu-cli— 93 tests pass🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Tests