Skip to content

Bloat: remove dead code across app.py, api.py, round.py, display.py, reasoning.py #30

Description

@laceyp99

Dead or unreachable code found

arena/app.py

  • clear_histories() (line ~1208) — never wired to any Gradio event; the only reference in the whole repo is its own test (tests/integration/test_callbacks.py::test_clear_histories_clears_user_input_and_resets_outputs). Either wire up a Clear button or delete the function and its test.
  • _remove_vote_record() (line ~323, the locking wrapper) — never called; only _remove_vote_record_unlocked() is used inside _persist_vote_submission.
  • if __name__ == "__main__": block (line ~1558) — duplicates arena/__main__.py::main() verbatim. One launch path is enough.

arena/core/api.py

  • async def main() demo + if __name__ == "__main__": (lines ~447–488) — ~45 lines of demo scaffolding inside a library module, with hardcoded model IDs and a stale site_url="http://localhost:6767" that contradicts arena/ui/config.py. If a manual smoke script is wanted, move it to scripts/ or an example; otherwise delete. This also makes load_dotenv/os imports in api.py removable.

arena/state/round.py

  • _model_ids_from_state() (line ~160) — no callers anywhere (arena or tests).

arena/ui/display.py

  • _empty_display_state() (line ~432) — no callers; it's just an alias for _empty_round_state().
  • _streaming_outputs() default chatbot_updates branch calls _targeted_chatbot_value_updates([], _default_display_order()), which is an obfuscated way of producing three gr.skip()s. Replace with an explicit (gr.skip(), gr.skip(), gr.skip())/helper for readability.

arena/core/reasoning.py

  • The entire max-tokens capability computation is dead: supports_max_tokens, default_max_tokens, max_reasoning_tokens, has_token_ceiling, and REASONING_TOKEN_BUDGET_OUTPUT_RATIO are computed and returned by reasoning_capabilities_for_model(), but nothing consumes them — control_type can only be "effort"/"none", normalize_reasoning_payload() only handles effort, and the UI only renders an effort dropdown. ~30 lines of logic + fields that only exist to be carried around. Delete until a token-budget control actually ships (git history preserves it).

Why it matters

This is a small app (~2 KLOC of source); the dead paths meaningfully add review surface, misleading capability metadata in logged payloads, and tests that pin unused behavior.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:lowUseful cleanup or guardrail work

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions