Skip to content

Replace rich SPM provenance with compact typed receipts - #3863

Closed
anth-volk wants to merge 9 commits into
masterfrom
feat/compact-spm-provenance
Closed

anth-volk wants to merge 9 commits into
masterfrom
feat/compact-spm-provenance

Conversation

@anth-volk

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

Copy link
Copy Markdown
Collaborator

Fixes #3862

Summary

  • replaces rich country-package SPM diagnostic payloads with strict compact canonical-spm-provenance-v2 receipts
  • exposes spm_provenance as the sole completed-result SPM metadata field and rejects the removed sibling spm_config
  • derives the internal resolved SPM configuration from the receipt when validating request identity
  • adds typed comparison receipts with one receipt and execution count per baseline/reform side
  • types Stage 12 simulation artifact provenance as the compact receipt itself
  • requires four explicit non-empty runtime package versions
  • bumps household, economy, and report cache identities so old payloads miss and recalculate instead of being translated
  • publishes the exact contracts in OpenAPI and documents the breaking response change

API behavior

Existing Flask/API v1 household, economy, and report routes remain in place. Request-side partial SPM selections are unchanged. Successful canonical household results expose one compact spm_provenance receipt. Completed US society-wide results expose one compact comparison receipt in spm_provenance. Completed US economy report updates require valid compact provenance and reject the removed spm_config field before persistence. Historical dual-field or incompatible cached output is recalculated rather than translated. Numerical calculation results and route locations do not change; non-US report outputs are unaffected.

Validation

  • full configured repository suite: 2,300 passed, 45 skipped
  • real Redis cache integration: 6 passed
  • focused completed-report, SPM, Stage 12, and OpenAPI suites
  • uv run --frozen --extra dev mypy
  • python scripts/export_migration_contracts.py
  • python scripts/run_quality_guards.py
  • Ruff and formatting checks on changed Python files

@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.70866% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.55%. Comparing base (0ebfc08) to head (5f35197).

Files with missing lines Patch % Lines
policyengine_api/spm.py 84.12% 10 Missing and 10 partials ⚠️
policyengine_api/services/report_output_service.py 57.14% 12 Missing and 3 partials ⚠️
...engine_api/runtime_cache/household_calculations.py 78.26% 2 Missing and 3 partials ⚠️
...gine_api/services/household_calculation_service.py 71.42% 2 Missing and 2 partials ⚠️
policyengine_api/services/simulation_service.py 91.66% 2 Missing ⚠️
policyengine_api/worker_spm.py 80.00% 1 Missing and 1 partial ⚠️
policyengine_api/services/v2/reports/types.py 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3863       +/-   ##
===========================================
+ Coverage   45.76%   87.55%   +41.79%     
===========================================
  Files         182      197       +15     
  Lines       10812    12153     +1341     
  Branches     1837     2145      +308     
===========================================
+ Hits         4948    10641     +5693     
+ Misses       5456      920     -4536     
- Partials      408      592      +184     

☔ 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

Copy link
Copy Markdown
Collaborator Author

Closing as superseded: these changes were incorporated into and deployed through #3855.

@anth-volk anth-volk closed this Oct 6, 2026

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.

Replace rich SPM provenance with compact typed receipts

1 participant