Skip to content

Reduce dead code surface and decouple BadgerRoutinePage from BadgerEnvBox UI internals#264

Draft
Copilot wants to merge 7 commits into
mainfrom
copilot/evaluate-unnecessary-functions
Draft

Reduce dead code surface and decouple BadgerRoutinePage from BadgerEnvBox UI internals#264
Copilot wants to merge 7 commits into
mainfrom
copilot/evaluate-unnecessary-functions

Conversation

Copy link
Copy Markdown

Copilot AI commented May 14, 2026

This PR trims several code spurs (unreachable deprecated paths, unused scaffolding, stale disabled tests) and reduces coupling in the GUI layer where BadgerRoutinePage previously depended on BadgerEnvBox internal widgets. It also centralizes duplicated optimization formatting logic and tightens string-to-value parsing behavior.

  • Deprecated CLI and unreachable-path cleanup

    • Removed unreachable legacy bodies behind deprecated command handlers in:
      • src/badger/actions/routine.py
      • src/badger/actions/run.py
      • src/badger/actions/install.py
      • src/badger/actions/uninstall.py
    • Preserved the existing CLI surface by restoring deprecated run argparse wiring in src/badger/__main__.py so badger run ... remains available and backward-compatible.
  • Optimization logic deduplication

    • Added shared helper src/badger/optimization.py::convert_to_solution.
    • Replaced duplicated implementations in:
      • src/badger/core.py
      • src/badger/core_subprocess.py
    • Added clarifying inline docs around “latest row is best” semantics.
  • Routine page / env box disentangling

    • Introduced semantic action signals on BadgerEnvBox (e.g. sig_add_random_requested, sig_refresh_requested, sig_environment_selected, etc.).
    • Rewired BadgerRoutinePage to connect to those signals instead of binding directly to BadgerEnvBox button/widget internals.
    • Result: BadgerRoutinePage now depends on an action interface from BadgerEnvBox, not its internal control graph.
  • Code spur removal

    • Removed unused extension scaffold:
      • src/badger/extension.py
      • inert extension scan state in src/badger/factory.py
    • Removed stale disabled tests:
      • src/badger/tests/x-test_db.py
      • src/badger/tests/x-test_routine_id.py
  • Parsing correctness

    • Fixed convert_str_to_value in src/badger/utils.py so boolean parsing is explicit ("true"/"false"), not bool(str)-based.
    • Added coverage in src/badger/tests/test_utils.py for case variants, direct booleans, numeric strings, and non-convertible strings.
# Before: page-level wiring reached into env_box widget internals
self.env_box.btn_add_rand.clicked.connect(self.show_add_rand_dialog)

# After: page consumes env_box semantic action signals
self.env_box.sig_add_random_requested.connect(self.show_add_rand_dialog)

Copilot AI and others added 6 commits May 14, 2026 20:55
…rmatting

Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/f7f17161-ab60-47d5-8686-54d9f57a6b8d

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/f7f17161-ab60-47d5-8686-54d9f57a6b8d

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/f7f17161-ab60-47d5-8686-54d9f57a6b8d

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/f7f17161-ab60-47d5-8686-54d9f57a6b8d

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/f7f17161-ab60-47d5-8686-54d9f57a6b8d

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/f7f17161-ab60-47d5-8686-54d9f57a6b8d

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
@roussel-ryan
Copy link
Copy Markdown
Collaborator

@copilot we should make sure that these changes do not modify the badger command line interface

Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/8b056ff8-12f6-4f8c-ae5f-4da88ec82c94

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented May 15, 2026

@copilot we should make sure that these changes do not modify the badger command line interface

Addressed in 516de55. I restored the deprecated badger run argparse surface in src/badger/__main__.py so the command-line interface remains unchanged, and validated with python -m badger --help and python -m badger run --help.

Copilot AI requested a review from roussel-ryan May 15, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants