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 Modal base hand-off blocks (step 7 of the Modal stage runbook, and the 18 October rerun record) copy `base-out` with `-R`. Since microcosm#1635 a base writes its gate-shadow files in `base-out/gate_battery_shadow/`, and the receipt lists them: a copy of the files alone exits 1 on that directory and ends the block before `verify-receipt`.
4 changes: 3 additions & 1 deletion docs/us-modal-stage-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,9 @@ LINEAGE=./modal-runs/$R/compare-lineage.json
--reference docs/us-modal-stage-route-a-base-local-reference.json \
--run-context "$CONTEXT" > "$LINEAGE"
mkdir -p "$RUN/base-out"
cp -p ./modal-runs/$R/state/base-out/* "$RUN/base-out/"
# -R: the base writes its gate-shadow files in base-out/gate_battery_shadow/,
# and the receipt lists them with the rest of base-out.
cp -pR ./modal-runs/$R/state/base-out/* "$RUN/base-out/"
# The copies, in place, against the receipt (COMPLETED only, nothing extra).
python3 tools/modal_us_stage_plan.py verify-receipt "$RECEIPT" \
--state-root "$RUN" --prefix base-out --strict
Expand Down
5 changes: 3 additions & 2 deletions docs/us-route-a-rerun-20261018.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,9 @@ RUN=$RUN_ROOT/run-${C:0:12}
mkdir -p "$RUN/base-out"
# APFS clone: the run copy shares the fetched blocks, so it costs no extra
# disk. That holds only when both paths are on the same APFS volume, as here;
# across volumes cp -c silently makes a full copy.
cp -pc "$FETCH/state/base-out/"* "$RUN/base-out/"
# across volumes cp -c silently makes a full copy. -R brings the base's
# gate_battery_shadow/ directory, whose files the receipt lists.
cp -pRc "$FETCH/state/base-out/"* "$RUN/base-out/"
python3 tools/modal_us_stage_plan.py verify-receipt "$RECEIPT" \
--state-root "$RUN" --prefix base-out --strict
H5=$RUN/base-out/base_populace_us_2024_puf_support.h5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,14 @@ def broken(*_args, **_kwargs):

RUNBOOK = ROOT / "docs" / "us-modal-stage-runbook.md"
RUN_ID = "route-a-base-4b57d15a287c"
#: Where the base tool writes its gate-shadow files, under its ``--out``
#: (``GATE_BATTERY_SHADOW_DIRECTORY`` and the two file suffixes in
#: ``microcosm.build.us_runtime.gate_shadow``, for the ``us_base`` scope).
GATE_SHADOW_DIRECTORY = "gate_battery_shadow"
GATE_SHADOW_FILES = (
"us_base.gate_battery_shadow_comparison.json",
"us_base.gate_battery_shadow_report.json",
)


def _hand_off_block() -> str:
Expand All @@ -2383,9 +2391,19 @@ def _hand_off_block() -> str:
return block.replace("RUN=<Route A run directory>\n", 'RUN="$HANDOFF_RUN"\n')


def _hand_off(tmp_path: Path, *, config: dict | None = None, run: Path | None = None):
def _hand_off(
tmp_path: Path,
*,
config: dict | None = None,
run: Path | None = None,
gate_shadow: bool = False,
):
"""Run step 7 against a Modal run of the committed plan and a Route A
run directory holding the failed local run's checkpoints."""
run directory holding the failed local run's checkpoints.

``gate_shadow`` gives the Modal run the directory a base writes its
gate-shadow files in (microcosm#1635), which its receipt then lists.
"""

checkout = tmp_path / "checkout"
checkout.mkdir()
Expand All @@ -2396,6 +2414,11 @@ def _hand_off(tmp_path: Path, *, config: dict | None = None, run: Path | None =
base_out.mkdir(parents=True)
(base_out / plan_lib.PUF_SUPPORT_BASE_ARTIFACT).write_bytes(b"\x89HDF base")
(base_out / "base_populace_us_2024_puf_support.summary.json").write_text("{}")
if gate_shadow:
shadow = base_out / GATE_SHADOW_DIRECTORY
shadow.mkdir()
for name in GATE_SHADOW_FILES:
(shadow / name).write_text("{}")
reference = _reference()
context = {
"pipeline_sha256": reference["pipeline_sha256"],
Expand Down Expand Up @@ -2486,6 +2509,19 @@ def test_the_hand_off_runs_compare_lineage_and_keeps_its_report(
assert len(list(run.glob("base-checkpoints.local-*"))) == 1


def test_the_hand_off_copies_the_base_s_gate_shadow_directory(
tmp_path: Path,
) -> None:
# The receipt lists every file under base-out, the gate-shadow files in
# their directory included, so the copy has to bring the directory: a
# copy of the files alone exits 1 on it and ends the block.
proc, run, _ = _hand_off(tmp_path, gate_shadow=True)
assert proc.returncode == 0, proc.stderr
shadow = run / "base-out" / GATE_SHADOW_DIRECTORY
assert sorted(path.name for path in shadow.iterdir()) == list(GATE_SHADOW_FILES)
assert (run / "base-sup" / "ACCEPTED").is_file()


@pytest.mark.parametrize("seed", ["12345", None])
def test_the_hand_off_stops_before_writing_when_compare_lineage_fails(
tmp_path: Path, seed: str | None
Expand Down
Loading