refactor(llm-access): remove dead pub fns with zero workspace callers#3
Merged
Merged
Conversation
Audit of `pub` items across the llm-access* crates (cross-referenced against every first-party crate, incl. inline tests) found 16 `pub fn` with zero callers anywhere in the workspace. On master these are masked from the dead-code lint only because they are public API; nothing actually uses them. Removed (verified zero references workspace-wide): - llm-access-codex/request.rs: ensure_supported_gateway_path, extract_presented_key, extract_query_param - llm-access-kiro/auth_file.rs: resolve_auths_dir, save_auth_record, load_auth_records, delete_auth_record (file-based auth CRUD; the live service is DB-backed) - llm-access-kiro/status.rs: load_persisted_status_cache_from_dir, persist_status_cache_to_dir, merge_newer_account_statuses, ready_status_entry, error_status_entry, disabled_status_entry - llm-access-kiro/anthropic/mod.rs: supported_model_ids - llm-access-kiro/anthropic/converter.rs: classify_tool_name_rewrite_reason - llm-access-kiro/billable_multipliers.rs: canonicalize_kiro_billable_model_multipliers_override_json Also drops the imports orphaned by the above (not_found in request.rs, std::env in auth_file.rs, anyhow::Result in status.rs). clippy reported zero private/pub(crate) dead code, so this is the complete zero-caller set. Verified: clippy -D warnings clean on codex+kiro, the reverse-dep build (llm-access binary + llm-access-store) compiles (proving no macro/trait-dispatch hidden callers), and 79 codex + 160 kiro tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request performs a code cleanup by removing several unused functions, helper methods, and imports across the llm-access-codex and llm-access-kiro crates. Specifically, it removes unused utility functions related to request parsing, authentication file handling, status caching, and model/tool name processing. There are no review comments, so I have no feedback to provide.
acking-you
added a commit
that referenced
this pull request
May 30, 2026
…#4) * refactor(llm-access-codex): split request.rs into request/ submodules Break the 3886-line request.rs into a request/mod.rs facade plus 9 concern-focused submodules (prepare, policy, last_message, headers, native_responses, normalization, tools, chat_completions, path), following the agreed module style: - mod.rs convention (matches the rest of the workspace). - No `use super::*` in submodules: each imports its deps explicitly from their origin. No `pub use X::*` facade globs: the parent re-exports only the 12 items used outside the module, by name. - Minimal visibility: items crossing a module boundary are `pub` with a detailed `///` doc; file-internal helpers stay private. No `pub(crate)`. - Tests inlined: the 2 adapt_openai_chat_completions_request unit tests move into chat_completions.rs (so the fn under test needs no extra exposure); the 8 pipeline integration tests stay in mod.rs against the public API. prepare_gateway_request / read_gateway_request_body are #[cfg(test)] (only reachable from tests), so they're gated accordingly. Also removes 2 dead pub fns PR #3 missed because grep -w could not tell them apart from admin's same-named fns: codex normalize_name / normalize_status (zero workspace callers; admin has its own), plus the 2 now-orphan LLM_GATEWAY_KEY_STATUS_* consts they used. No behavior change: clippy -D warnings clean, 79 codex tests pass, and the reverse-dep build (llm-access binary + llm-access-store) compiles against the narrowed public surface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(llm-access-codex): truncate mcp tool names on a UTF-8 char boundary `String::truncate` panics when the byte index splits a multi-byte UTF-8 character. A tool name with Unicode after the `mcp__` prefix could exceed MAX_OPENAI_TOOL_NAME_LEN bytes and crash the request handler on truncate. Use char-based truncation (`chars().take(..).collect()`), matching the fallback path already in the same fn. ASCII-identical; multi-byte-safe. Addresses a PR review finding from gemini-code-assist. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First refactor step of the incremental
llm-access*cleanup (after PR #2 gotCI green): remove
pub fnthat have zero callers anywhere in the workspace.These crates were extracted from the backend, so their public surface is wider
than what is actually wired up. Library
pubitems are part of the public API,so the dead-code lint never flags them even when nothing uses them. An audit
cross-referenced every
pubitem against every first-party crate (includinginline tests) and found 16
pub fnwith zero references beyond their owndefinition.
What changed
Removed (each verified zero references workspace-wide):
llm-access-codex/request.rsensure_supported_gateway_path,extract_presented_key,extract_query_paramllm-access-kiro/auth_file.rsresolve_auths_dir,save_auth_record,load_auth_records,delete_auth_record(file-based auth CRUD; the live service is DB-backed)llm-access-kiro/status.rsload_persisted_status_cache_from_dir,persist_status_cache_to_dir,merge_newer_account_statuses,ready_status_entry,error_status_entry,disabled_status_entryllm-access-kiro/anthropic/mod.rssupported_model_idsllm-access-kiro/anthropic/converter.rsclassify_tool_name_rewrite_reasonllm-access-kiro/billable_multipliers.rscanonicalize_kiro_billable_model_multipliers_override_jsonPlus the imports orphaned by those deletions (
not_found,std::env,anyhow::Result). Net: +2 / −257 across 6 files.Verification
cargo clippy -p llm-access-codex -p llm-access-kiro -- -D warnings: clean. Also confirmed clippy reports zero private/pub(crate)dead code in these crates, so the 16 zero-callerpub fnare the complete dead set.llm-accessbinary +llm-access-store) compiles — proves none of the removed fns had a hidden macro / trait-dispatch caller that grep would miss.Scoped intentionally to verified-zero-caller free functions.
uses==1items(re-export-only types/consts) are a possible follow-up, kept out to keep this
PR small and obviously-correct.