mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-12-04 02:06:22 +08:00
## Why Several redesigns moved a job to a new owner but left the old code behind. Nothing in production calls it any more, and some tests only exercised those paths, so they gave confidence about behavior that never runs. Each piece was traced to the PR that removed its last caller, and production was checked to still do the job: - Chat and Responses stream failures (#2362): the API layer now writes each wire's terminal error frame, so `finish_failure`, `terminal_failure` and their per-protocol implementations were unused. - Responses output usage (#1575): both Responses writers track usage themselves, so the ledger's usage tracking was unused. - Rate-limit conditional admission (#1923): admission owns its own capacity window. - Synthetic Chat tool-turn boundaries (#1717): reasoning is attached during conversion, before the boundary is inserted, so its marker type had no reader. - Messaging snapshots (#1919), server-tool helpers (#1800), the ledger's thinking builder (#2013), plus smaller helpers left by refactors. The Anthropic stream assertion helpers also shipped inside the package although only tests and smoke use them. ## How - Delete the unused functions, methods and module, and everything only they kept alive: - The `completed=False` replay path through reasoning-replay `finish` and `capture_reasoning_record`. - The ledger's `close_unclosed_blocks` and its write-only open-block stack. - The Gemini and Responses failure frame builders. - `consumes_terminal_failure`. - The limiter's `allowed` branch. - `ThinkTagParser.in_think_mode`, `RequestHistory.negotiating` and the never-read `tool_input_tail_max`. - Split `core/anthropic/stream_contracts.py`: - The SSE parser that production uses becomes `core/anthropic/sse.py`. - The assertion helpers move to `tests/stream_contracts.py`, along with a small `thinking_frames` helper that replaces the ledger's test-only thinking builder. - Delete tests that only covered removed paths. Point the rest at the production function that does the job: `forced_server_tool_name`, `get_validated_stream_addrinfos_for_egress`, `_read_response_body_capped`, `failure_payload` and `native_reasoning_delta`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <!-- greptile_summary --> <h2><ruby><rp>Confidence Score: 5/5 · The PR appears safe to merge; no actionable new issues were found.</rp></ruby><a href="https://app.greptile.com/api/retrigger?id=123702719&sig=28c07f53b3e70d48a9b4a23bbd4b34650976f2d4154431200d76f79905797571"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=alishahryar1&next=%2FAlishahryar1%2Ffree-claude-code%2Fpull%2F2590&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> The PR appears safe to merge; no actionable new issues were found. <details open><summary><h3>Summary</h3></summary> This PR removes unused stream-failure paths and helpers, and separates production SSE parsing from test assertions. - Production SSE parsing and test-only stream checks now live separately. - Stream writers leave terminal error frames to the API layer. - Stream ledgers and reasoning replay keep only state used by live paths. - Smaller helpers and tests now follow the production functions that remain. No actionable new issues were found. No previous review threads were supplied. Checks were based on source inspection; tests were not run. </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (4) · Last reviewed commit: ["patch: Drop dead ledger thinking and too..."](https://github.com/alishahryar1/free-claude-code/commit/74b2f5242346ca1aa7d188f27cf2ee7785dad8a9) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=alishahryar1/free-claude-code)</sub> <!-- /greptile_comment --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>