Skip to content

Comments

Phase 1: Simulation/Report V2 Migration Foundation#84

Merged
anth-volk merged 8 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-1
Feb 19, 2026
Merged

Phase 1: Simulation/Report V2 Migration Foundation#84
anth-volk merged 8 commits intoapp-v2-migrationfrom
feat/sim-report-migration/phase-1

Conversation

@anth-volk
Copy link
Contributor

Fixes #83

Summary

  • Fix Alembic migration branch conflict
  • Add filter_field/filter_value columns to simulations table
  • Remove unused parent_report_id from Report model
  • Create user_simulation_associations table + CRUD endpoints (15 tests)
  • Create user_report_associations table + CRUD endpoints (16 tests)
  • Create standalone /simulations/household and /simulations/economy endpoints (19 tests)
  • Create household_impact_uk and household_impact_us Modal functions
  • Create _run_local_economy_comparison_us local fallback

Test plan

  • 219 API tests pass (57 pre-existing failures unrelated to these changes)
  • Alembic migrations apply cleanly (alembic upgrade head)
  • All new endpoints return correct response shapes
  • Deterministic UUID deduplication verified for simulation creation
  • Integration test: deploy Modal functions and run full household impact analysis
  • Integration test: run US economy comparison locally with agent_use_modal=False

🤖 Generated with Claude Code

anth-volk and others added 8 commits February 18, 2026 23:40
Two migrations (0002_user_policies and f419b5f4acba) both descended from
the initial schema, creating two Alembic heads. This empty merge migration
reconciles them into a single linear chain so future migrations can be added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Simulation model already uses these fields for regional economy
simulations (e.g., filtering a dataset to a specific state), but no
Alembic migration created the columns. This aligns the DB schema with
the existing Python model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The self-referential parent_report_id FK on reports was never read or
written by any code. Removing it keeps the schema clean before we build
further on the Report model in later migration tasks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enables users to save simulations to their list across sessions,
following the same pattern as user_policies and user_household_associations.
Includes model, autogenerated Alembic migration, API endpoints with
ownership verification on update/delete, and 15 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enables users to save reports to their list across sessions, following
the same pattern as user_simulations and user_policies. Includes a
last_run_at field for tracking when a report was last calculated.
Model, autogenerated Alembic migration, API endpoints with ownership
verification, and 16 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…imulations/economy)

Non-blocking POST endpoints that create simulation records and return
immediately with pending status. GET endpoints for polling status and
retrieving results. Region validation for economy sims, deterministic
UUID deduplication, and 19 tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These report-based Modal functions are called by _trigger_household_impact()
when agent_use_modal=True. They load the Report and its Simulations from the
database, run household calculations (reusing _calculate_household_uk/us from
household.py), store results in simulation.household_result, and mark the
report as completed. Follows the economy_comparison_uk/us error handling
pattern with raw SQL fallback for failure marking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements the US counterpart to _run_local_economy_comparison_uk so that
US economy comparisons work when agent_use_modal=False (local dev, testing,
CI). Uses us_latest model, PolicyEngineUSDataset, and US-specific programs
(income_tax, employee_payroll_tax, snap, tanf, ssi, social_security).
Updates _trigger_economy_comparison to call it instead of falling back to
Modal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anth-volk anth-volk marked this pull request as ready for review February 19, 2026 21:37
@anth-volk anth-volk merged commit 813feea into app-v2-migration Feb 19, 2026
1 check passed
@anth-volk anth-volk deleted the feat/sim-report-migration/phase-1 branch February 19, 2026 21:37
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.

1 participant