Conversation
- delete cli/utils/conda.py (never imported) - delete cli/commands/resource.py (never imported, commented-out registration) - remove _extract_runpod_flash_dependencies and cleanup_build_directory from build.py - remove dead deployment helpers (create/remove/rollback/get_environment_info) - remove FlashBuildNotFoundError, _get_id_by_name, download_tarball, deploy_resources, get_build from FlashApp - remove get_resource_from_store from ResourceManager - remove WORKER_PYTHON_VERSION, GPU_BASE_IMAGE_PYTHON_VERSION, local_python_version, FLASH_GPU_IMAGE/CPU/LB module-level constants from constants.py - remove TOKEN_PATTERN and commented-out usage from logger.py - remove state_dot and STATE_STYLE from formatting.py - remove corresponding tests
…rs, and exception class
…etrics, retry_manager, reliability_config)
runpod-Henrik
left a comment
There was a problem hiding this comment.
PR #331 — chore: remove dead and unused code
Henrik's AI-Powered Bug Finder
1. Deleted runtime modules — confirmed dead
The five deleted runtime/ files (circuit_breaker.py, load_balancer.py, reliability_config.py, retry_manager.py, metrics.py) form an isolated dependency cluster. A grep across all live production source confirms none are imported by any file outside their own group. The only callers were each other. Deletion is safe.
cli/commands/resource.py was already commented out in main.py (# app.command("report")). cli/utils/conda.py is unreferenced. Both clean.
2. Dead API methods — confirmed not imported
The methods removed from FlashApp, RunpodGraphQLClient, LoadBalancerSlsResource, and ResourceManager (e.g., deploy_resources, register_endpoint_to_environment, get_cpu_types, is_deployed_async) are not called anywhere in live code. The removed exception classes (FlashBuildNotFoundError, ManifestError, ManifestFunction, ManifestResource) are defined but never raised or imported outside their own files.
3. FLASH_GPU_IMAGE / FLASH_CPU_IMAGE / FLASH_LB_IMAGE constants removed — env var overrides still work
The three module-level constants are removed from constants.py, but the environment variable overrides they represented are still honoured at runtime. get_image_name() reads _IMAGE_ENV_VARS = {"gpu": "FLASH_GPU_IMAGE", "cpu": "FLASH_CPU_IMAGE", "lb": "FLASH_LB_IMAGE", ...} directly via os.environ.get(). Users who set these env vars will not notice any change.
FLASH_CPU_LB_IMAGE is correctly kept because preview.py imports it directly.
4. logger.py — redaction behaviour unchanged
The redact_password_pattern local function was removed from _redact_string. Verified in the resulting file: the pattern that called it is replaced by an inline lambda that produces an identical output (f"{m.group(1)}{m.group(2)}***REDACTED***"). No change in what gets redacted.
5. tomllib import removed from build.py — dep still justified
The try: import tomllib / except: import tomli block in build.py is removed along with its only caller (_extract_runpod_flash_dependencies). credentials.py still uses the same tomllib/tomli pattern, so the tomli>=2.0.0; python_version < '3.11' dep in pyproject.toml remains justified.
6. Test changes — only tests for dead code
Every deleted test file (test_circuit_breaker.py, test_load_balancer.py, test_reliability_config.py, test_retry_manager.py, test_metrics.py, test_resource.py, test_conda.py, etc.) corresponds to a deleted production module. Updated tests (test_live_serverless.py, test_constants.py) replace GPU_BASE_IMAGE_PYTHON_VERSION with DEFAULT_PYTHON_VERSION — both resolve to "3.12", so the assertions are equivalent. No live-path test coverage was removed.
Nits
Nit 1 — documented env vars that are now fully inert. The SDK reference documentation lists FLASH_CIRCUIT_BREAKER_ENABLED, FLASH_LB_STRATEGY, and FLASH_RETRY_ENABLED as configurable env vars. These were read by reliability_config.py, which was never imported from production code — so they never had any effect. This PR doesn't change that, but with the code gone, any user who discovers those env vars in the docs and tries to set them will get no feedback that they're no-ops. Worth a follow-up doc cleanup (or an explicit deprecation note in the changelog).
Nit 2 — _RESOLVED_TAG was a single-use alias. The removed _RESOLVED_TAG = FLASH_IMAGE_TAG intermediate was assigned and used only for FLASH_CPU_LB_IMAGE. The replacement f"...{FLASH_IMAGE_TAG}" is cleaner. The PR already does this correctly; just noting it's the right call.
Verdict: PASS WITH NITS
4,600 lines of unreachable code removed with no live-path regressions. The only follow-up is a documentation pass for the three inert env vars.
🤖 Reviewed by Henrik's AI-Powered Bug Finder
There was a problem hiding this comment.
Pull request overview
This PR removes previously unused runtime modules, CLI utilities/commands, and related tests to reduce maintenance surface area and eliminate dead code paths.
Changes:
- Deleted unreferenced runtime modules (load balancer/circuit breaker/retry/metrics) and pruned associated tests.
- Removed unused helper functions/methods across build/deployment/resource management paths and updated tests accordingly.
- Simplified constants/tests by removing unused image/python-version helpers and dead platform-detection helpers.
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/runpod_flash/core/resources/constants.py |
Removes unused constants/helpers and keeps image resolution via get_image_name() + env var overrides. |
src/runpod_flash/core/resources/load_balancer_sls_resource.py |
Drops unused LB ping/health-check helpers and related constants. |
src/runpod_flash/core/resources/resource_manager.py |
Removes unused get_resource_from_store. |
src/runpod_flash/core/resources/app.py |
Removes dead FlashApp methods and unused imports. |
src/runpod_flash/core/api/runpod.py |
Removes unreferenced GraphQL helper methods (CPU/GPU type queries, environment registration helpers, etc.). |
src/runpod_flash/core/utils/file_lock.py |
Removes unused get_platform_info(). |
src/runpod_flash/cli/commands/build.py |
Removes unused dependency extraction and build cleanup helpers. |
src/runpod_flash/cli/utils/formatting.py |
Removes unused state-dot formatting helper. |
src/runpod_flash/cli/utils/deployment.py |
Removes unused deployment-environment helpers and provisioning helper. |
src/runpod_flash/logger.py |
Removes disabled generic token redaction pattern and inlined unused helper. |
tests/unit/** |
Removes tests that only covered deleted/dead code and updates assertions/comments for remaining behavior. |
src/runpod_flash/runtime/*.py (deleted) |
Removes unreferenced runtime reliability modules and their tests. |
src/runpod_flash/cli/utils/conda.py + tests (deleted) |
Removes unused conda utilities and tests. |
src/runpod_flash/cli/commands/resource.py + tests (deleted) |
Removes unused resource dashboard command and tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d3d7129 to
b5f8ea1
Compare
Removes dead code, unused files, unreferenced functions, and orphaned runtime modules.
Summary
4,637 lines removed across 46 files with minimal additions (import adjustments).
Deleted files
cli/utils/conda.py- never importedcli/commands/resource.py- never importedruntime/load_balancer.py- never imported from production coderuntime/circuit_breaker.py- only consumer was load_balancer.pyruntime/reliability_config.py- only consumer was load_balancer.pyruntime/retry_manager.py- never imported from production coderuntime/metrics.py- never imported from production codeDead functions/methods removed
_extract_runpod_flash_dependencies,cleanup_build_directoryfrom build.pyFlashBuildNotFoundError,_get_id_by_name,download_tarball,deploy_resources,get_build,_get_active_artifact,_register_endpoint_to_environment,_register_network_volume_to_environment,_set_environment_state,_get_environment_by_namefrom FlashAppget_resource_from_storefrom ResourceManagerget_cpu_types,get_gpu_types,get_endpoint,get_flash_artifact_url,register_endpoint_to_environment,register_network_volume_to_environment,set_environment_statefrom GraphQL clientcreate_deployment_environment,remove_deployment_environment,rollback_deployment,get_environment_info,get_deployment_environments,save_deployment_environments,upload_build,provision_resources_for_buildfrom deployment utilsis_deployed_async,_check_ping_endpoint,_wait_for_healthfrom LoadBalancerSlsResourcestate_dot,STATE_STYLEfrom formatting.pyTOKEN_PATTERNand commented-out usage from logger.pyredact_password_pattern(defined but unused, lambda used instead)ManifestResource,ManifestFunction,write_to_filefrom manifest.pyManifestErrorexception classget_platform_infofrom file_lock.pylocal_python_version,WORKER_PYTHON_VERSION,GPU_BASE_IMAGE_PYTHON_VERSION, module-levelFLASH_GPU_IMAGE/FLASH_CPU_IMAGE/FLASH_LB_IMAGEfrom constants.pyTests
All corresponding test code removed. Pre-existing flaky test failures (
test_should_use_execute_for_live_load_balancer,test_undeploy_resource_force_remove_no_tty) are test-ordering issues that pass in isolation.