Skip to content

Commit 3fa48d5

Browse files
committed
Use canonical Modal manifest schema
1 parent 67b5308 commit 3fa48d5

7 files changed

Lines changed: 340 additions & 151 deletions

File tree

docs/engineering/skills/modal-release-prs.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ package version references, or release validation. Those countries may still be
8484
served by the worker, but their package versions must not control a Modal
8585
release.
8686

87+
The canonical manifest schema version is `1`. Runtime code should validate that
88+
stored manifests already match this schema; do not add legacy normalization to
89+
the gateway, release updater, or active-app discovery paths. The manifest
90+
rewrite command is the only bridge from older stored shapes: it copies the old
91+
`current` and `frontier` app references into canonical schema version `1`,
92+
drops retired history, and removes non-release package keys.
93+
8794
Manual workflow dispatch exposes the same `new_app_target`,
8895
`promote_existing_frontier`, and `cleanup_target` settings as the PR-body YAML
8996
block. The deploy workflow and Modal images use Python 3.13.

policyengine_household_api/modal_release/gateway.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
MANIFEST_DICT_KEY,
1212
MANIFEST_DICT_NAME,
1313
empty_manifest,
14-
normalize_manifest,
14+
validate_manifest,
1515
)
1616

1717

@@ -45,7 +45,7 @@ def liveness_check() -> Response:
4545
@app.get("/readiness_check")
4646
def readiness_check() -> Response:
4747
manifest = load_manifest()
48-
if not normalize_manifest(manifest).get("current"):
48+
if not validate_manifest(manifest).get("current"):
4949
return jsonify(
5050
{
5151
"status": "error",
@@ -56,14 +56,14 @@ def readiness_check() -> Response:
5656

5757
@app.get("/versions")
5858
def versions() -> Response:
59-
return jsonify(normalize_manifest(load_manifest()))
59+
return jsonify(validate_manifest(load_manifest()))
6060

6161
@app.get("/versions/<country_id>")
6262
def country_versions(country_id: str) -> Response:
6363
if country_id not in COUNTRIES:
6464
return _json_error(f"Unsupported country `{country_id}`", 404)
6565

66-
manifest = normalize_manifest(load_manifest())
66+
manifest = validate_manifest(load_manifest())
6767
country_versions = {}
6868
for channel in ("current", "frontier"):
6969
app_reference = manifest.get(channel)
@@ -88,7 +88,7 @@ def route_request(path: str) -> Response:
8888
body = request.get_data()
8989

9090
try:
91-
manifest = normalize_manifest(load_manifest())
91+
manifest = validate_manifest(load_manifest())
9292
if country_id and endpoint in VERSIONED_ENDPOINTS:
9393
body, requested_version = _extract_requested_version(body)
9494
else:
@@ -119,7 +119,7 @@ def load_modal_manifest() -> dict[str, Any]:
119119
)
120120
except NotFoundError:
121121
return empty_manifest()
122-
return normalize_manifest(manifest_dict.get(MANIFEST_DICT_KEY))
122+
return validate_manifest(manifest_dict.get(MANIFEST_DICT_KEY))
123123

124124

125125
def resolve_app_for_request(

0 commit comments

Comments
 (0)