Skip to content

chore(routers/http): remove dead code and trim stale comments#1651

Open
slin1237 wants to merge 1 commit into
mainfrom
chore/tidy-gw-routers-http
Open

chore(routers/http): remove dead code and trim stale comments#1651
slin1237 wants to merge 1 commit into
mainfrom
chore/tidy-gw-routers-http

Conversation

@slin1237

Copy link
Copy Markdown
Collaborator

Description

Problem: the HTTP/PD routers carry provably-dead internal code and stale comments flagged by the codebase audit (gw-routers-http) — an unused error enum, an unused URL helper, an unused bootstrap-wrapper struct, a dead function parameter, and comments that are either wrong or merely restate the code.

Solution: removed the dead internal items and trimmed the flagged comments. No behavior change.

From the codebase audit (gw-routers-http): dead_code + comment_bloat findings.

Changes

Dead code (4 internal items, all re-verified unused repo-wide incl. tests/benches/bindings/clients):

  • pd_types.rs: removed unused PDRouterError enum (zero constructors anywhere), api_path helper (no callers), and BatchRequestWithBootstrap struct (no references). The smg crate is consumed only by the in-workspace bindings, which glob-import the crate root (use smg::*); the root does not re-export pd_types, so these pub items are unreachable as external API.
  • pd_router.rs: dropped the unread _start_time: Instant parameter from execute_dual_dispatch_internal (and its now-unnecessary #[expect(clippy::too_many_arguments)], which became unfulfilled at 6 args).

Comments (4 lines, 3 sites):

  • pd_router.rs get_server_info: deleted two stale comments claiming server info comes from the "decode server" — the code proxies to the first prefill worker.
  • pd_router.rs inject_bootstrap_into_value: removed the two repeated "Use static string keys to avoid per-request allocations" comments that restate the code (and are partially inaccurate, since the Map insert still allocates an owned String key).

Kept (re-verified as live test/bench fixtures, not dead): RequestWithBootstrap (used by benches/request_processing.rs) and PDSelectionPolicy (used by tests/routing/test_pd_routing.rs).

Net: 51 deletions across 2 files (deletion-heavy cleanup; well under 400 lines).

Test Plan

Gate run with sccache disabled, scoped to the smg package (CI runs the full --all-features workspace gate):

cargo +nightly fmt --all — clean (pure deletions, no reformatting).

RUSTC_WRAPPER="" cargo clippy -p smg --all-targets -- -D warnings:

    Checking smg v1.4.1 (.../model_gateway)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 12s

(only pre-existing workspace notes: non-root profiles, duplicate main.rs build target — unrelated to this change)

RUSTC_WRAPPER="" cargo test -p smg:

test result: ok. 1003 passed; 0 failed; 4 ignored (lib)
api_tests: 105 passed; 0 failed
routing_tests: 92 passed; 0 failed
reliability_tests: 26 passed; 0 failed
security_tests: 48 passed; 0 failed
... all integration + doc suites: 0 failed
  • cargo +nightly fmt --all
  • cargo clippy --all-targets -- -D warnings

Remove provably-dead internal items from the PD router types and a dead
parameter, and trim stale/restating comments, per the codebase audit
(gw-routers-http) dead_code + comment_bloat findings.

- pd_types: remove unused PDRouterError enum, api_path helper, and
  BatchRequestWithBootstrap struct (zero references repo-wide; bindings
  glob-import the crate root only, which does not re-export pd_types).
- pd_router: drop the unread _start_time arg from
  execute_dual_dispatch_internal (and its now-unnecessary
  too_many_arguments expect).
- pd_router: delete the stale "decode server" comments on
  get_server_info (it proxies to the first prefill worker) and the two
  repeated "static string keys" comments that restate the code.

Signed-off-by: Simo Lin <25425177+slin1237@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@slin1237, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 38307361-322b-41b2-b339-8cfe44d941a6

📥 Commits

Reviewing files that changed from the base of the PR and between 0405bf6 and 6b98cee.

📒 Files selected for processing (2)
  • model_gateway/src/routers/http/pd_router.rs
  • model_gateway/src/routers/http/pd_types.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tidy-gw-routers-http

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request cleans up unused code and parameters in the prefill-decode (PD) router. Specifically, it removes the unused PDRouterError enum, the api_path utility function, and the BatchRequestWithBootstrap struct from pd_types.rs. In pd_router.rs, it removes the unused _start_time parameter from execute_dual_dispatch_internal (allowing the removal of the clippy argument limit suppression) and cleans up several redundant comments. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions github-actions Bot added the model-gateway Model gateway crate changes label Jun 10, 2026
@claude

claude Bot commented Jun 10, 2026

Copy link
Copy Markdown

👋 The PR description doesn't fully follow
PULL_REQUEST_TEMPLATE.md:

  • Missing header: ### Problem (present as inline text "Problem:" but not as a markdown header)
  • Missing header: ### Solution (present as inline text "Solution:" but not as a markdown header)

Please update the PR description so reviewers have the context they need.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean deletion-only PR. Verified all 4 removed items (PDRouterError, api_path, BatchRequestWithBootstrap, _start_time param) are unused repo-wide. Stale comments were correctly identified — get_server_info proxies to prefill, not decode. The clippy expect removal is correct (6 args, under the 7-arg threshold). No issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model-gateway Model gateway crate changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant