Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ACS local-area release's package stage now refuses to give a build an ID that names code other than the code that wrote its calibrated artifact. Calibrate reads its code identity when the stage starts and records it in `consumer_export.json`; it refuses to write the artifact if the checkout's commit or dirty state changed before the write. Package requires the same commit, and counts a writer record that does not say its tree was clean as dirty. The interim WIC limitation now states exactly whom the assumption covers, and its receipt records how many people were allowed to lack a decision.
10 changes: 10 additions & 0 deletions docs/us-modal-stage-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,16 @@ one stage of a run at a time, because two concurrent stages would race on the
same state directory. The attempt ledger enforces this, best effort (see
"Preemption and restarts").

For `us-acs-local-release`, run package at the commit calibrate ran at.
Calibrate records the code that wrote the calibrated H5 in
`consumer_export.json`: it reads the commit when the stage starts, reads it
again just before it writes the H5, and refuses to write if the commit or
the tree's dirty state changed in between. The build's ID names the
packaging code, so package refuses to give a build an ID that names any
other commit (microcosm#1263). A commit landing between the two stages means
re-running calibrate, qa and finalize at the new commit, or packaging at the
old one.

For a gated or private Hub input, set `MICROCOSM_MODAL_HF_SECRET` to the name
of a Modal secret that holds `HF_TOKEN`, for example `huggingface-token` in
the `policyengine` workspace. Otherwise no secret is attached. Only the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

from collections.abc import Collection
from dataclasses import dataclass
from numbers import Real
from typing import Any

import numpy as np
Expand Down Expand Up @@ -179,23 +178,23 @@ def _live_wic(
"stored_decisions_kept": int(present.sum()),
"stored_decisions_true": int(decisions[present].sum()),
"people_assumed_true": int(assumed.sum()),
"people_allowed_without_decision": int(allowed.sum()),
"rule": ACS_WIC_ASSUMPTION,
"status": "interim",
"flip_condition": ACS_WIC_FLIP_CONDITION,
}


def _booleans(values: pd.Series) -> np.ndarray:
"""Stored decisions as Booleans: bools, or real numbers equal to 0 or 1."""
"""Stored decisions as Booleans: bools, or int or float numbers equal to 0 or 1."""

out = np.empty(len(values), dtype=bool)
for position, value in enumerate(values.to_numpy(dtype=object)):
if isinstance(value, (bool, np.bool_)):
out[position] = bool(value)
elif (
isinstance(value, Real)
and not isinstance(value, (bool, np.bool_))
and value in (0, 1)
elif isinstance(value, (int, float, np.integer, np.floating)) and value in (
0,
1,
):
out[position] = bool(value)
else:
Expand Down
Loading
Loading