Standardize frontend on country_id instead of tax_benefit_model_name#803
Merged
anth-volk merged 9 commits intomove-to-api-v2from Mar 14, 2026
Merged
Standardize frontend on country_id instead of tax_benefit_model_name#803anth-volk merged 9 commits intomove-to-api-v2from
anth-volk merged 9 commits intomove-to-api-v2from
Conversation
…itecture Replace the old migration code (which only copied association pointers without migrating base entities) with a proper layered system: - Detection: pure localStorage reads to find v1 reports on page load - Strategies: single-purpose functions for each record type (policy, household, geography, and all user-association types) - Orchestrators: compose strategies to migrate full report trees (policy → household → analysis endpoint → user associations) - Cleanup: remove only successfully-migrated records from localStorage - Reports page: detection banner with progress UI and migrate button - Tests: 41 tests across detect, strategies, orchestrators, and cleanup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…_name
All API calls, types, adapters, hooks, and utilities now use country_id
('us' or 'uk') instead of tax_benefit_model_name ('policyengine_us' etc).
Updates Household type field, all v2 API modules (datasets, regions,
parameters, variables, economyAnalysis, simulations, households), adapters,
migration orchestrators, and all test fixtures/unit tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…chestrator Replace single policy_id with baseline_policy_id + reform_policy_id in economy and household analysis TypeScript interfaces, strategy classes, useCreateReport hook, and v1-v2 migration orchestrator. Orchestrator now fetches both v1 simulations and migrates both policies independently. Updates all corresponding tests and fixtures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migration orchestrator now passes run: false to both analysis endpoints, creating reports with EXECUTION_DEFERRED status instead of triggering immediate computation. Adds execution_deferred to frontend ReportStatus types. Fixes 3 pre-existing ESLint errors (duplicate import, missing curly braces, unused import). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Surface unmapped v1 policy parameters as warnings in the migration banner (strategies → orchestrator → UI pipeline) - Show report labels and v1 report IDs in error/warning details - Style the pre-migration banner with design token grayscale background - Use teal for success, yellow for warnings-only, orange for errors - Add enabled guards (!!userId) to simulation, household, and policy hooks to prevent 422 errors from empty user_id - Flip storeBackend to 'api' and update useUserReports for UUID-based v1/v2 classification with v2 full-endpoint fetching - Add brittleness analysis document for migration code - Fix test fixtures and mocks for updated types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address code review findings: fix sentence case in column headers, correct indentation in orchestrator early-return blocks, surface migration errors to the user via Alert, and log errors in cleanup catch blocks. Enable actual localStorage removal of migrated v1 records instead of dry-run counting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update variables test to match new country_id-based API (no upfront unknown country validation). Update useUserHousehold test to expect disabled query with empty userId (enabled guard). Fix duplicate import in apiV2Mocks. Apply prettier formatting across codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
Requires completion of PolicyEngine/policyengine-api-v2-alpha#109 before review/merge |
…wallowing them cleanup.ts now returns errors in CleanupSummary instead of silently returning 0. detectV1Reports now returns DetectionResult with error field so callers can distinguish "no reports" from "corrupt localStorage". Reports page surfaces detection errors to the UI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #802
Fixes #818
Summary
v1-to-v2 report migration script
Standardize frontend on country_id
country_id("us" or "uk") instead oftax_benefit_model_name("policyengine_us" etc)Householdtype field changed fromtax_benefit_model_nametocountry_idcountryIdToModelName/modelNameToCountryIdas identity functionsTest plan
country_idto APIcountry_idquery paramCompanion API PR: PolicyEngine/policyengine-api-v2-alpha#109
🤖 Generated with Claude Code