Repository navigation
refactor(cleanup): remove dead workflow package and deps aggregator - #3644
Daniel Meppiel (danielmeppiel) merged 3 commits into
Conversation
apm_cli.workflow (discovery, parser, runner) and apm_cli.deps.aggregator had no production callers on main; apm run goes through core/script_runner.py. Remove them, the deps re-export, the PyInstaller hiddenimports and the architecture-linter consumer entry, plus tests that only exercised the removed code. Add a regression guard that the modules stay gone. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Deleting the workflow test module removes regression coverage for the still-active compute_file_hash() symlink rejection branch; the test must be moved to tests/unit/test_content_hash.py to preserve that coverage.
No open issues 🎉
What changed in this PR
Removes APM's unused workflow package and dependency aggregator, addressing #3524 through deletion rather than optimizing unreachable code. The live apm run implementation remains unchanged.
Changes:
- Deletes legacy workflow modules, dependency aggregation, and associated exports.
- Removes obsolete packaging and architecture-linter references.
- Removes related tests, adds removal regression guards, and records the cleanup in the changelog.
| File | Description |
|---|---|
tests/unit/workflow/test_workflow.py |
Deletes the workflow test module. |
tests/unit/workflow/__init__.py |
Removes the test package initializer. |
tests/unit/test_workflow_runner_phase3w4.py |
Deletes legacy runner coverage tests. |
tests/unit/test_workflow_runner_branch_coverage.py |
Deletes legacy runner branch tests. |
tests/unit/test_deps.py |
Removes aggregator tests; retains verifier tests. |
tests/unit/test_dead_workflow_code_removed.py |
Adds guards against restoring removed modules and exports. |
tests/unit/deps/test_aggregator.py |
Deletes aggregator-specific tests. |
tests/noninteractive_workflow_test.py |
Removes the noninteractive workflow script. |
tests/manual_workflow_script.py |
Removes the manual workflow script. |
tests/integration/test_runtime_smoke.py |
Removes legacy workflow preview coverage. |
tests/integration/test_multi_runtime_integration.py |
Removes workflow tests; retains runtime factory coverage. |
tests/integration/test_llm_runtime_integration.py |
Deletes workflow/runtime integration tests. |
tests/integration/test_coverage_gaps_phase4w2.py |
Removes aggregator and workflow discovery cases. |
tests/basic_workflow_test.py |
Deletes basic workflow tests. |
src/apm_cli/workflow/runner.py |
Deletes legacy execution and preview helpers. |
src/apm_cli/workflow/parser.py |
Deletes workflow parsing and definitions. |
src/apm_cli/workflow/discovery.py |
Deletes discovery and template generation. |
src/apm_cli/workflow/__init__.py |
Removes the workflow package initializer. |
src/apm_cli/deps/aggregator.py |
Deletes workflow dependency aggregation. |
src/apm_cli/deps/__init__.py |
Removes aggregator imports and exports. |
scripts/architecture_linter/checks/registry_owner_guards.py |
Removes the deleted runner from runtime consumers. |
CHANGELOG.md |
Records the internal code removal. |
build/apm.spec |
Removes hidden imports for deleted modules. |
Review effort: Balanced
The deleted tests/unit/workflow/test_workflow.py also held a test for the live compute_file_hash() symlink branch. Move it next to the other compute_file_hash tests so that coverage survives the dead-code removal. PackageManagerFactory cases from the same file are already covered in tests/integration/test_wave2_adapters_coverage.py. Addresses Copilot review on PR #3644. Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 0 | Clean dead-code removal with thorough regression guard; no architectural concerns. |
| Test Coverage Expert | 0 | 0 | 0 | Delta recovers both live-code test gaps flagged by review: symlink regression trap added with mutation-break proof, PackageManagerFactory already duplicated in wave2. No coverage regressions. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
The delta pass confirms the prior ship_now stance. Both live-code test gaps surfaced by Copilot review are recovered with mutation-break proof, CI is green, and no panelist raised a finding across either pass. No follow-ups to track.
- Folded in this run: keep
compute_file_hashsymlink coverage intests/unit/test_content_hash.py(ef6dec8). - Copilot signals reviewed: 1 -- LEGIT (symlink test lost with the deleted module; folded). The
PackageManagerFactoryhalf was already covered. - Deferred: none.
- Lint: ruff check/format (0.15.12), pylint R0801, lint-auth-signals, lint-architecture-boundaries all clean.
- CI: 22 pass, 2 skipping at ef6dec8; license/cla success.
| PR | Head | Stance | Iter | Folds | Deferrals | Copilot rounds | CI | Mergeable | State | Notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3644 | ef6dec8 | ship_now | 1 | 1 | 0 | 1 | green | MERGEABLE | BLOCKED | pending required review |
Full per-persona findings
Python Architect
No findings.
Test Coverage Expert
No findings.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.
Clean merge of #3644 and #2030; no lockfile or autopilot package changes. Co-authored-by: sergio-sisternes-epam <[email protected]> Co-authored-by: Copilot App <[email protected]>
refactor(cleanup): remove dead
workflow/package anddeps/aggregator.pyTL;DR
apm_cli.workflow(discovery, parser, runner) andapm_cli.deps.aggregatorhave no production callers onmain—apm rungoes throughcore/script_runner.py. This PR deletes them (closing the duplicated*.prompt.mdglob walks reported in #3524 by removal rather than consolidation), plus their re-export, PyInstaller hidden imports, linter entry and the tests that only exercised them. No CLI command, flag or output changes.Fixes #3524
Important
The approved scope record (#3524 comment) chose removal over the issue body's "one shared walk" proposal: "Close out this performance finding by removing code verified on origin/main to have no production callers, instead of consolidating globs". This PR implements the record. Local preflight skipped by maintainer instruction (2026-11-12); CI is the gate.
Description
Dead-code removal. 24 files, +64 / −2527.
Issue and approved scope
Issue: Fixes #3524
Human scope-approval comment: #3524 (comment) (approver and review contact Daniel Meppiel (@danielmeppiel);
eligibility.cjs→record-presentat trusted1a370716e1).Does this PR complete the issue? Yes — every Done-when clause is met (see Validation); CI proves the unit-suite clause.
Problem (WHY)
discover_workflows()andscan_workflows_for_dependencies()each ran two recursiveglob.globwalks where one pattern already covered the other, and the aggregator usedlist(set(...))(nondeterministic order) — perf: single prompt.md walk in workflow discovery and dependency aggregator #3524.apm_cli.workflow/deps.aggregator, is reachable from a CLI command:git greponmainfinds only self-references, thedeps/__init__.pyre-export,build/apm.spechidden imports, one architecture-linter path, and tests.Why it matters: optimizing an unreachable walk improves nothing for users; the record's Out-of-scope forbids "Changing glob patterns of any live code path", so deletion is the only in-scope fix.
Approach (WHAT)
src/apm_cli/workflow/(4 modules) andsrc/apm_cli/deps/aggregator.py.scan_workflows_for_dependencies/sync_workflow_dependenciesre-export fromapm_cli.deps.hiddenimportsfrombuild/apm.specandsrc/apm_cli/workflow/runner.pyfrom_RUNTIME_NAME_CONSUMERS.tests/unit/test_dead_workflow_code_removed.pyregression guard.Implementation (HOW)
src/apm_cli/workflow/*,src/apm_cli/deps/aggregator.py— deleted.core/script_runner.py(incl. the livePromptCompiler._substitute_parameters) is untouched.src/apm_cli/deps/__init__.py— import and two__all__entries removed.build/apm.spec— fivehiddenimportsentries removed.scripts/architecture_linter/checks/registry_owner_guards.py— removed path from_RUNTIME_NAME_CONSUMERS; docstring no longer says "four" modules.tests/unit/workflow/,tests/unit/deps/test_aggregator.py,tests/unit/test_workflow_runner_{branch_coverage,phase3w4}.py,tests/{basic_workflow_test,noninteractive_workflow_test,manual_workflow_script}.py,tests/integration/test_llm_runtime_integration.py.tests/unit/test_deps.py(aggregator class),tests/integration/test_multi_runtime_integration.py(tworun_workflowtests;RuntimeFactorytest kept),tests/integration/test_runtime_smoke.py(test_apm_workflow_compilation),tests/integration/test_coverage_gaps_phase4w2.py(TestDepAggregator,TestWorkflowDiscovery).compute_file_hash()symlink test from the deletedtests/unit/workflow/test_workflow.pymoves totests/unit/test_content_hash.py(mutation-break: droppingor file_path.is_symlink()fails it). That file'sPackageManagerFactorycases are already duplicated intests/integration/test_wave2_adapters_coverage.py.__pycache__namespace dir),apm_cli.depsno longer exports the two names, andPromptCompiler._substitute_parametersstays live.Diagrams
Legend: the only path from
apm runto prompt files isscript_runner; the removed modules (dashed) hung off nothing but a re-export and tests.flowchart LR CLI["apm run"] --> SR["core/script_runner.py"] SR --> PC["PromptCompiler"] DI["deps/__init__.py re-export"] -.-> AG["deps/aggregator.py (removed)"] T["tests only"] -.-> WF["workflow/ package (removed)"] T -.-> AG WF -.-> PR["workflow/parser.py (removed)"]Trade-offs
primitives/discovery.py.apm_cli.deps.scan_workflows_for_dependencies/sync_workflow_dependenciesdisappear. APM is a CLI, not a documented library; no CLI surface changes.Benefits
src/.Validation
Targeted tests, mutation-break, lint mirror
Scenario evidence
Pure removal of unreachable code; no user-promise scenario changes. The live
apm runprompt path stays covered by existingscript_runnertests; the guard assertsPromptCompiler._substitute_parametersis still present.Type of change
Testing
Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedHow to test
git grep -n "apm_cli.workflow\|deps.aggregator" -- src build scriptsreturns nothing.uv run --extra dev pytest -q tests/unit/test_dead_workflow_code_removed.pypasses.apm run <script>with a.prompt.mdbehaves as before (path untouched).Co-authored-by: Copilot [email protected]