Skip to content

Remove the unused economy comparison module - #3936

Draft
anth-volk wants to merge 1 commit into
ruff-complexity-tests-scriptsfrom
remove-economy-comparison
Draft

anth-volk wants to merge 1 commit into
ruff-complexity-tests-scriptsfrom
remove-economy-comparison

Conversation

@anth-volk

@anth-volk anth-volk commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3935

Summary

Stacked on #3934.

policyengine_api/services/economy_comparison.py has had no caller in the package since #2569, which removed the Public API's own society-wide simulations. This PR removes the module with its unit tests, its snapshot tests and its snapshot data: 915 lines of code, about 1,600 lines of tests and an 8,000-line JSON file.

  • No production behaviour changes. Nothing in policyengine_api imports the module. The only other matches for economy_comparison are the economy_comparison report kind in report_spec_service.py, which is a string, and a docstring.
  • The enhanced FRS weight-matrix dependency goes with it. The module's uk_constituency_breakdown and uk_local_authority_breakdown downloaded the enhanced FRS constituency and local-authority weight matrices. UK: certify a Microcosm national dataset as the UK default, with separate national and local-area datasets and a corrected local-authority list policyengine.py#553 lists that as a Public API dependency to resolve before a Microcosm UK default.
  • Rules:
    • api.routes.no-domain-logic-in-http drops test_economy_comparison_logic_is_not_in_the_http_layer, which only checked that the module stayed out of the HTTP layer.
    • The rule keeps its calculation-route check, and its statement now reads "Flask routes delegate domain processing, such as calculation, to services instead of doing it in the HTTP layer."
    • AGENTS.md and docs/generated/rules.md are re-rendered.
  • Docstring: the congressional district metadata model's docstring pointed at the module as an example of Pydantic models. It now refers to the codebase's other Pydantic models.
  • Left for later: microdf_python stays declared, although nothing imports microdf any more. Removing an unused dependency is a separate cleanup; step 2.7's dependency check would flag it.

The weighted-microdata rules (step 1.9) are the next PR in the stack. With this module gone, they start enforced with no findings.

Testing

  • pytest tests/unit: 2,727 passed. The 97 removed tests are exactly the module's unit and snapshot tests, plus the one route-boundary test.
  • uv run --frozen --extra dev mypy: no issues. The module was outside the type-check scope, so the file count is unchanged.
  • python scripts/run_quality_guards.py: migration-contracts, rules-registry and ci-scripts passed.
  • python -m scripts.rules render leaves no diff, and python -m scripts.rules guard passes.
  • ruff check . and ruff format --check . (ruff 0.15.12, from uv.lock) are clean.

🤖 Generated with Claude Code

@anth-volk
anth-volk added this pull request to stack #3917 October 14, 2026 21:56
@anth-volk anth-volk changed the title remove economy comparison Remove the unused economy comparison module Oct 14, 2026
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 4 times, most recently from a6b3066 to 8887f8e Compare October 15, 2026 00:06
policyengine_api/services/economy_comparison.py has had no caller in
the package since #2569 removed the Public API's own society-wide
simulations; only its tests and snapshot data used it. Remove the
module, its unit and snapshot tests, and the route-boundary test that
checked it stayed out of the HTTP layer. api.routes.no-domain-logic-in-http
now covers the calculation route alone, and a docstring that pointed at
the module now points at the codebase's other Pydantic models.

Nothing in the package imports microdf any more, but microdf_python
stays declared; removing an unused dependency is a separate cleanup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from 8887f8e to 89149d0 Compare October 15, 2026 15:21

This branch has not been deployed

No deployments
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.

Remove the unused economy comparison module

1 participant