You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Report when the deployed policyengine.py version went live #4083
Nothing reports how long the API has served its current policyengine.py (.py) version. GET /v2/tax-benefit-models/by-country/{country} reports the version, but not since when. A deploy timestamp would not help: the API deploys a new Cloud Run revision several times a day while .py stays the same, so "last deployed" is nearly always today.
The app-v2 developer-tools Deployments page (PolicyEngine/policyengine-app-v2#1450) shows, for each core service, which .py, country model and data build it serves. It already shows "live since" for the household API (from its /versionsdeployed_at); the API has no equivalent.
Proposal
At candidate deploy, read the .py version from uv.lock, and read DEPLOYED_POLICYENGINE_VERSION and POLICYENGINE_VERSION_LIVE_SINCE from the revision that serves 100% of traffic (steps.previous.outputs.revision). Keep its date when the .py version is unchanged; use the deploy time for a new version; leave it unknown when the serving revision has no recorded date. Pass both as Cloud Run environment variables.
Add GET /deployment next to /health, returning the installed .py version, its live-since date and the Cloud Run revision (K_REVISION).
Done when
A deploy that keeps the .py version keeps the date; a deploy that changes it (or a first deploy) sets a new date; a serving revision without a recorded date, or a failed lookup, leaves the date unknown rather than wrong, and never fails the deploy.
GET /deployment returns the three fields; the date is null on a revision deployed before this change.
Activity