Add the Stage 12 parallel v2 simulation path

Aperta
#681 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
google-cloud, postgresql, python

Direzione di ricerca

La issue non nomina file di implementazione del repository, test o punti di ingresso; identifica però i file bundle .py di PolicyEngine.py e la ricevuta privata reports/comparison.json. Inizia esaminando la dipendenza di deployment da PolicyEngine/policyengine-api#3842 e la validazione di deployment esistente. Il lavoro è completato quando sono verificati tutti i controlli di accettazione, le risorse v2 elencate, il percorso isolato di dispatch e confronto e l’autorità di produzione invariata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Objective

Add the Stage 12 v2 comparison path alongside the existing simulation services without replacing the current production calculation path or making v2 output authoritative.

Scope

  • Deploy a separately named Modal v2 application.
  • Run one report coordinator that starts baseline and reform as independent simulation functions before waiting for either result.
  • Publish and consume a v2 version manifest that is separate from the existing v1 manifest.
  • Resolve country-package and dataset versions exclusively from reviewed PolicyEngine.py .py bundle files.
  • Provide a temporary authenticated direct Stage 12 runner for qualification.
  • When STAGE12_ENABLED=1, automatically start one Stage 12 comparison run after a supported production annual society-wide report is accepted.
  • Wait no more than five seconds for Modal to acknowledge the coordinator invocation, then return the unchanged production response without waiting for Stage 12 calculation or comparison.
  • After Stage 12 aggregation, retrieve the production Modal result, compare the complete aggregate result objects exactly, and write a private reports/comparison.json receipt containing result digests and every differing scalar leaf.
  • Isolate Stage 12 dispatch, calculation, comparison, artifact, and persistence failures from the production result.
  • Remove the shared runtime-control object, process-local dispatch queue, and periodic PostgreSQL cleanup function.

Deployment dependency

PolicyEngine/policyengine-api#3842 adds the comparison-result columns consumed by this runtime. That PR must merge and its v2 Alembic revision must run before this simulation PR merges. The production restricted PostgreSQL URL secret and environment configuration must also be present and pass the existing deployment validation.

The beta and prod GitHub environments both define STAGE12_ENABLED=0. Merging this PR therefore deploys the separate Modal application, separate v2 manifest, Cloud Run configuration, and temporary authenticated direct endpoint without automatically sending normal report submissions to Stage 12. Setting one environment value to 1 and deploying Cloud Run enables automatic runs in that environment; it does not change the existing production forwarding destination or result authority.

Acceptance criteria

  • Existing v1 routing and user-visible result authority are unchanged.
  • Baseline and reform simulations execute independently and are aggregated by the report coordinator.
  • V1 and v2 manifests use distinct storage objects.
  • Stage 12 resources deploy in both staging and production after prerequisites exist.
  • Automatic runs remain disabled in both environments after the initial deployment.
  • The five-second Modal-acknowledgement wait is the only Stage 12 work on the production request path.
  • Direct Stage 12-only execution remains available independently of STAGE12_ENABLED when resources are configured.
  • No periodic Stage 12 function runs.
  • Private artifacts expire through the existing 30-day storage lifecycle; temporary PostgreSQL rows remain until Stage 14.
  • Local tests, formatting, focused type checks, container-import validation, and deployment-contract checks pass.
Lingua principale
Python
Stelle
1
Fork
1
Merge medio
9h 14m
PR unite (30g)
8

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PolicyEngine/policyengine-sim-api

Tutte le issue di PolicyEngine/policyengine-sim-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.