Skip to content

Instrument post-donor build stages #16

Instrument post-donor build stages

Instrument post-donor build stages #16

Workflow file for this run

name: Site Snapshot
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
site-snapshot:
runs-on: ubuntu-latest
defaults:
run:
working-directory: microplex-us
steps:
- name: Check out microplex-us
uses: actions/checkout@v4
with:
path: microplex-us
- name: Check out core microplex
uses: actions/checkout@v4
with:
repository: CosilicoAI/microplex
ref: 71f270edecac3ef748411deb3beb77109c56a721
path: microplex
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Set up uv
uses: astral-sh/setup-uv@v6
- name: Verify snapshot tooling
run: |
uv run --extra dev --with pydantic --with-editable ../microplex pytest -q \
tests/test_package_imports.py \
tests/pipelines/test_check_site_snapshot.py \
tests/pipelines/test_imputation_ablation.py \
tests/pipelines/test_site_snapshot.py \
tests/pipelines/test_version_benchmark.py
- name: Check generated site snapshot
run: |
snapshot_path="$(uv run python - <<'PY'
import json
import tempfile
from pathlib import Path
from microplex_us.pipelines.site_snapshot import write_us_microplex_site_snapshot
root = Path(tempfile.mkdtemp()).resolve()
artifact_dir = root / "run-1"
artifact_dir.mkdir()
for filename in (
"seed_data.parquet",
"synthetic_data.parquet",
"calibrated_data.parquet",
"targets.json",
):
(artifact_dir / filename).write_text("{}" if filename == "targets.json" else "")
(artifact_dir / "manifest.json").write_text(
json.dumps(
{
"created_at": "2026-03-29T00:00:00+00:00",
"config": {"n_synthetic": 2000},
"artifacts": {
"seed_data": "seed_data.parquet",
"synthetic_data": "synthetic_data.parquet",
"calibrated_data": "calibrated_data.parquet",
"targets": "targets.json",
"policyengine_harness": "policyengine_harness.json",
},
"synthesis": {
"scaffold_source": "cps_asec_2023",
"state_program_support_proxies": {
"available": ["ssi"],
"missing": ["snap"],
},
},
"calibration": {
"n_loaded_targets": 100,
"n_supported_targets": 90,
"converged": False,
"weight_collapse_suspected": False,
},
"policyengine_harness": {
"candidate_mean_abs_relative_error": 0.9,
"baseline_mean_abs_relative_error": 1.1,
"mean_abs_relative_error_delta": -0.2,
},
}
)
)
(artifact_dir / "policyengine_harness.json").write_text(
json.dumps(
{
"summary": {
"candidate_mean_abs_relative_error": 0.9,
"baseline_mean_abs_relative_error": 1.1,
"mean_abs_relative_error_delta": -0.2,
"candidate_composite_parity_loss": 0.8,
"baseline_composite_parity_loss": 1.2,
"target_win_rate": 0.2,
"slice_win_rate": 0.5,
"supported_target_rate": 0.9,
"tag_summaries": {},
"parity_scorecard": {},
"attribute_cell_summaries": {},
}
}
)
)
snapshot_path = root / "snapshots" / "site_snapshot_us.json"
write_us_microplex_site_snapshot(artifact_dir, snapshot_path)
print(snapshot_path)
PY
)"
uv run microplex-us-check-site-snapshot "$snapshot_path"