Repository navigation
refactor: remove dead code and simplify duplicates - #224
Merged
Merged
Conversation
- Drop the unused ADK streaming turn and its StreamChunk type - Drop unused Telegram API methods and escape_markdown - Drop unused storage, workout, health, and search helpers - Delete the tests that only exercised the removed code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Merge duplicated helpers in telegram, dashboard, and miniapp - Share transaction, decode, and error helpers in health storage - Share HTTP client and validation helpers in Gmail and OAuth - Replace the describe_tool if-chain with lookup tables - Deduplicate miniapp route and compiler test setup - Keep log text, tool schemas, routes, and SQL unchanged Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
I found two dashboard regressions in this refactor.
Ruff, mypy, and 619 focused tests passed. The full coverage run had the same Mini App server failures on both commits because the local environment denied loopback socket binding. |
- Treat oversized session version suffixes as unversioned again - Stream trace spans so trace detail keeps only matching spans - Cover the oversized version suffix in the dashboard tests Co-Authored-By: Claude Opus 5.5 <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.
What
Removes production-dead code and simplifies duplicated code across the
codebase, with no feature removed and no intended behavior change. Net
change: 50 files, +1,591 / −3,355 lines (about −1,760).
The PR has two commits so each kind of change can be reviewed on its own:
refactor: remove production-dead code(−1,004 lines, mostly tests)refactor: simplify code without behavior change(−760 lines)Why
A scan found no unreachable modules: every file under
src/is importedfrom
blacki.serverorblacki.agent. The dead weight was in functionsonly tests called, and in copy-pasted blocks that had drifted into many
files. Removing both makes the code smaller and easier to change.
How
AdkRuntime.run_user_turn_streamingandStreamChunkTelegramApiClient.get_me,send_message_draft,get_my_commandsescape_markdown,create_telegram_botSqlStorage._execute_many,_fetch_val,close_connectionSqliteWorkoutStorage.update_exercise,delete_exerciseGoogleHealthService.summary_for_tool,inference_profile_from_mapping*_api_key_availablehelpers,ModelCapabilitiesResolvercalled by name (ADK callbacks, FastAPI routes, dashboard
getattrdispatch, test reset helpers, miniapp store wrappers).
describe_toolif-chain replaced by lookup tables (checked identicalover 12,516 name/argument combinations)
summaries, the compiler's 55
err+raisepairs replaced bybail()Health API error handling, meal-export identity checks
shared lazy HTTP client, a shared WHERE builder, confirmation parsing
tool names, parameters, and docstrings (ADK builds tool schemas from
them), prompts, skills, SQL schemas and queries, env var names, HTTP
routes and response shapes, and Telegram user-facing text.
noqa,type: ignore, orpragma: no cover. Existing ones thatmoved with merged code went from 11 to 6.
Tests
uv run ruff format(no changes)uv run ruff checkuv run mypy .uv run pytest --cov=src: 2,822 passed, 1 skipped, 100.00% coverageroute and compiler test setup. No surviving assertion changed.
response shapes are meant to be unchanged, but a quick manual look
at the dashboard and mini app after deploy is worth doing.
🤖 Generated with Claude Code