Skip to content

Remove the unused economy comparison module - #3936

Merged
anth-volk merged 1 commit into
masterfrom
remove-economy-comparison
Oct 22, 2026
Merged

anth-volk merged 1 commit into
masterfrom
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
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 2 times, most recently from 89149d0 to f7e306d Compare October 15, 2026 15:45
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from f7e306d to 8e75b50 Compare October 15, 2026 17:21
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 2 times, most recently from 9bf8980 to ba5d037 Compare October 16, 2026 06:00
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 2 times, most recently from dbf072d to 554a3d8 Compare October 16, 2026 06:45
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 4 times, most recently from 315d39f to b0509e1 Compare October 19, 2026 13:39
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 3 times, most recently from 0312903 to bdd6308 Compare October 19, 2026 18:48
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from bdd6308 to 62bc929 Compare October 19, 2026 19:14
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from cf3f89a to 7e4a8f5 Compare October 19, 2026 21:42
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from 7e4a8f5 to 50f2364 Compare October 20, 2026 12:36
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from 50f2364 to 2882578 Compare October 20, 2026 12:42
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from 2882578 to 07e7bf7 Compare October 20, 2026 14:00
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from 07e7bf7 to e083b9a Compare October 20, 2026 16:31
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch from e083b9a to 00cb62f Compare October 20, 2026 18:01
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 4 times, most recently from 1f375ec to 8fe1310 Compare October 21, 2026 15:49
@anth-volk
anth-volk force-pushed the remove-economy-comparison branch 2 times, most recently from 9767392 to e5f3835 Compare October 21, 2026 21:53
Base automatically changed from ruff-complexity-tests-scripts to master October 21, 2026 22:30
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 e5f3835 to f953ff1 Compare October 21, 2026 22:31
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.72%. Comparing base (a04d681) to head (f953ff1).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3936      +/-   ##
==========================================
- Coverage   87.86%   87.72%   -0.15%     
==========================================
  Files         259      258       -1     
  Lines       16149    15864     -285     
  Branches     2630     2594      -36     
==========================================
- Hits        14190    13917     -273     
+ Misses       1283     1280       -3     
+ Partials      676      667       -9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anth-volk
anth-volk marked this pull request as ready for review October 22, 2026 17:42
@anth-volk
anth-volk requested a review from a team as a code owner October 22, 2026 17:42
@anth-volk
anth-volk merged commit 615ec9e into master Oct 22, 2026
14 of 15 checks passed
@anth-volk
anth-volk deleted the remove-economy-comparison branch October 22, 2026 17:43

This branch was successfully deployed

1 active deployment
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