PolicyEngine / PolicyEngine/policyengine-app-v2
Preserve and use resolved model/data provenance in policyengine-app-v2
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 50m
- Merged PRs (30d)
- 39
Description
Problem
policyengine-app-v2 already carries some version-ish metadata, but it does not preserve or render a full immutable execution bundle for reports and simulations.
Current gaps:
- the old metadata flow uses a single opaque
versionmostly as a load sentinel, not as reproducibility provenance - report and simulation domain models preserve
apiVersion, but not model/data release identity - v2 request builders know about dataset IDs, but adapters drop provenance when hydrating responses into domain models
- the reproducibility tab reconstructs code from current metadata defaults and floating dataset conventions instead of the report’s actual resolved bundle
- there is still app-side reliance on “latest” model-version helpers for flows that should be historical and pinned
Relevant code paths include:
- metadata loading and guard logic:
app/src/api/metadata.ts,app/src/types/metadata.ts,app/src/reducers/metadataReducer.ts,app/src/routing/guards/MetadataGuard.tsx - report/simulation models and adapters:
app/src/types/ingredients/Report.ts,app/src/types/ingredients/Simulation.ts,app/src/adapters/ReportAdapter.ts,app/src/adapters/SimulationAdapter.ts - v2 hydration points:
app/src/api/v2/reportFull.ts,app/src/api/v2/simulations.ts,app/src/api/v2/economyAnalysis.ts - reproducibility UI and code generation:
app/src/pages/report-output/SocietyWideReportOutput.tsx,app/src/pages/report-output/reproduce-in-python/PolicyReproducibility.tsx,app/src/utils/reproducibilityCode.ts - latest-version helper:
app/src/api/v2/taxBenefitModels.ts
Desired contract
Once downstream APIs expose a structured execution bundle, the app should:
- preserve that bundle in report/simulation domain objects
- render it where users expect reproducibility information
- use it when generating reproduce-in-Python code
- stop reconstructing historical provenance from mutable “latest” metadata
At minimum the app should retain and display:
- model package/version
- data package/version
- resolved dataset artifact or manifest revision
- bundle or manifest ID if available
What should change
- Extend app domain models and adapters to preserve structured release provenance from API responses.
- Hydrate provenance at the report/simulation fetch layer instead of dropping it.
- Update the reproduce tab to generate code from the report’s actual resolved bundle, not current Redux defaults.
- Add a small provenance display on relevant report/simulation output pages.
- Remove reliance on app-side “latest” resolution for historical reports and replay flows.
- Keep backward compatibility for older saved objects where possible, but prefer server-supplied pinned provenance whenever available.
Acceptance criteria
ReportandSimulationobjects retain structured model/data provenance from API responses.- Historical report pages render or otherwise surface the resolved execution bundle.
- Reproduce-in-Python uses the resolved bundle from the report/simulation being viewed.
- App-side latest-version helpers are not used for replay or historical provenance.
- Client-side caching and saved-object hydration do not discard release-bundle metadata.
Upstream dependencies
This depends on API/schema work in:
- PolicyEngine/policyengine-api#3393
- PolicyEngine/policyengine-api-v2#434
- PolicyEngine/policyengine-api-v2-alpha#219
And on the data/orchestration contracts in:
- PolicyEngine/policyengine-us-data#724
- PolicyEngine/policyengine-uk-data#322
- PolicyEngine/policyengine.py#270
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the report and simulation models and adapters, then trace hydration through app/src/api/v2/reportFull.ts, simulations.ts, and economyAnalysis.ts. Review the reproducibility components and app/src/utils/reproducibilityCode.ts alongside the upstream API dependencies. Done means resolved provenance survives hydration, appears in historical output, and drives reproduce-in-Python without latest-version reconstruction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100