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
6 changes: 6 additions & 0 deletions catalogue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ The rules live in [`catalogue_lifecycle.py`](../scripts/misc/tooling/catalogue_l
regime-only routes, the instrument-scoped dense NUFFT rule). `planned_cells` are the designated
optimal and secondary setups (a held group's provisional ones); mixed precision is
`experimental`.
- **Day zero** ([day_zero.json](day_zero.json), autolens_profiling#499; report §3.6): a current
record carries `day_zero: "2026.10.25.1"` when its class is optimal or secondary, its regime is
`standard`, it is on a reference host, its `release_pin` is the tag, and its cell has a current
parity match and a fit figure; a passing cell is stamped whole (480 records over 116 cells,
the held datacube/delaunay A100 group included). `validate_lifecycle` refuses a stamp off the
rule. PyAutoPulse freezes the stamped records as `snapshots/day_zero/lens.json`.
- **Parity**: a cell's `parity.json` witness becomes a `measurement: parity` record; see
[results/README.md](../results/README.md#parity-witness).
- **Coverage**: `coverage_matrix.py` renders [`dashboard/coverage.md`](../dashboard/coverage.md)
Expand Down
21 changes: 21 additions & 0 deletions catalogue/day_zero.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"schema": "day-zero",
"version": 1,
"tag": "2026.10.25.1",
"rule": "Lifecycle report section 3.6: a current record carries day_zero <tag> when its class is optimal or secondary, its regime is standard, its host_class is a reference host (hpc_ral_cpu, hpc_a100), its release_pin is <tag>, and its cell (likelihood, instrument, setup_id, host_class, model_variant, regime) has a current parity record with status match and a fit figure. A passing cell is stamped whole (runtime, breakdown, compile, memory_host, parity).",
"hosts": [
"hpc_a100",
"hpc_ral_cpu"
],
"regime": "standard",
"classes": [
"optimal",
"secondary"
],
"frozen_against": {
"autolens_profiling": "8c40e7def731307dcedbab6df565b1839eb45cf6",
"autolens_profiling_note": "main after #498 (classes from the Pulse designations); the stamp PR branches from it and re-measures nothing",
"PyAutoPulse_designations": "bcaf6b86 (PyAutoLabs/PyAutoPulse#84, the 39 day-zero designations; mirrored in catalogue/pulse_designations.json)"
},
"decision": "Human 2026-11-01 (AskUserQuestion, autolens_profiling#499): stamp the tag only; include the held datacube/delaunay hpc_a100 group; size variants and experimental rows stay unstamped. Pulse freezes the stamped records as snapshots/day_zero/lens.json."
}
2 changes: 1 addition & 1 deletion dashboard/catalogue.json

Large diffs are not rendered by default.

39 changes: 37 additions & 2 deletions scripts/misc/tooling/build_catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,13 @@ def __init__(self, paths):

V3_LIMITATIONS = [
"Phase-0 labels (autolens_profiling#442): nothing was re-measured. A current record is the "
"canonical cell row on a reference host class for a planned baseline cell; it is not an "
"accepted baseline and carries no day_zero stamp.",
"canonical cell row on a reference host class for a planned baseline cell.",
"Day zero (catalogue/day_zero.json, autolens_profiling#499; lifecycle report section 3.6): "
"a current record carries day_zero 2026.10.25.1 when its class is optimal or secondary, its "
"regime is standard, it is on a reference host (hpc_ral_cpu, hpc_a100), its release_pin is "
"the tag, and its cell has a current parity match and a fit figure; a passing cell is "
"stamped whole. Experimental rows, size variants and rows off the tag are not stamped. "
"PyAutoPulse freezes the stamped records as its day_zero snapshot.",
"Classes come from the PyAutoPulse designation records (decisions.yaml kind: designation, "
"mirrored in catalogue/pulse_designations.json; autolens_profiling#497): the designated "
"optimal setup on its likelihood x standard regime x hardware class (hpc_ral_cpu = "
Expand Down Expand Up @@ -1350,6 +1355,16 @@ def build_lifecycle(root, generated, revision, dates=None):
if undated:
raise UndatedRows(undated)
records, excluded = label_lifecycle(candidates, planned, refs)
stamped = lc.day_zero_cells(records)
for record in records:
if record["status"] == "current" and lc.day_zero_cell(record) in stamped:
record["day_zero"] = lc.DAY_ZERO["tag"]
record["validation"] = {
**record["validation"],
"reason": f"Day-zero baseline {lc.DAY_ZERO['tag']} (catalogue/day_zero.json): "
"measured on the released tag on a reference host, cell parity match and fit "
"figure; no scientific re-review beyond that rule.",
}
planned_cells = []
for dataset_type, variant, instrument in sorted(planned):
for host_class in ("hpc_a100", "hpc_ral_cpu"):
Expand Down Expand Up @@ -1415,6 +1430,26 @@ def validate_lifecycle(root, doc):
current[lc_key(record)] = record["id"]
elif record["status"] != "superseded" or record["superseded_by"] not in ids:
raise ValueError(f"Superseded record without a target: {record['id']}")
if record["day_zero"] is not None:
tag = lc.DAY_ZERO["tag"]
if (
record["day_zero"] != tag
or record["status"] != "current"
or record["release_pin"] != tag
or record["host_class"] not in lc.DAY_ZERO["hosts"]
or record["regime"] != lc.DAY_ZERO["regime"]
or record["class"] not in lc.DAY_ZERO["classes"]
):
raise ValueError(f"{record['id']}: day_zero stamp off the section 3.6 rule")
cell = lc.day_zero_cell(record)
if not any(
lc.day_zero_cell(r) == cell
and r["status"] == "current"
and r["measurement"] == "parity"
and r["parity"]["status"] == "match"
for r in doc["records"]
):
raise ValueError(f"{record['id']}: day_zero stamp without a parity match")
if record["class"] == "optimal" and not text(record["decision_id"]):
raise ValueError("class optimal needs a designation decision_id")
if record["decision_id"] is not None:
Expand Down
57 changes: 57 additions & 0 deletions scripts/misc/tooling/catalogue_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,63 @@ def size_note(variant: str, pixels: int | None) -> str:
)


# ---- day zero (lifecycle report §3.6): catalogue/day_zero.json ----

#: The frozen baseline: the released tag and the rule a current record meets to carry
#: ``day_zero: <tag>`` (autolens_profiling#499). Pulse freezes the stamped records as its
#: ``day_zero`` snapshot.
DAY_ZERO_PATH = Path(__file__).resolve().parents[3] / "catalogue" / "day_zero.json"


def load_day_zero(doc: dict) -> dict:
if doc.get("schema") != "day-zero" or doc.get("version") != 1:
raise ValueError(f"{DAY_ZERO_PATH.name}: unsupported schema/version")
for key in ("tag", "hosts", "regime", "classes"):
if not doc.get(key):
raise ValueError(f"{DAY_ZERO_PATH.name}: {key} is required")
return doc


DAY_ZERO = load_day_zero(json.loads(DAY_ZERO_PATH.read_text()))


def day_zero_cell(record: dict) -> tuple:
"""The cell a record belongs to: its lifecycle key without the measurement."""
return (
record["likelihood"]["dataset_type"],
record["likelihood"]["variant"],
record["instrument"],
record["setup_id"],
record["host_class"],
record["model_variant"],
record["regime"],
)


def day_zero_cells(records: list[dict], day_zero: dict = DAY_ZERO) -> set[tuple]:
"""Cells whose current records meet the §3.6 rule: class optimal/secondary, the standard
regime, a reference host, every current record on the day-zero tag, a current parity
record with status match, and a fit figure on a current record."""
by_cell = {}
for record in records:
if record["status"] == "current":
by_cell.setdefault(day_zero_cell(record), []).append(record)
cells = set()
for cell, items in by_cell.items():
if (
cell[4] in day_zero["hosts"]
and cell[6] == day_zero["regime"]
and all(r["class"] in day_zero["classes"] for r in items)
and all(r["release_pin"] == day_zero["tag"] for r in items)
and any(
r["measurement"] == "parity" and r["parity"]["status"] == "match" for r in items
)
and any(r["figures"] for r in items)
):
cells.add(cell)
return cells


# ---- designations: the Pulse records (catalogue/pulse_designations.json) and the holds ----

#: The machine mirror of PyAutoPulse ``decisions.yaml`` ``kind: designation`` rows, written by
Expand Down
83 changes: 83 additions & 0 deletions scripts/misc/tooling/test/test_build_catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,3 +1085,86 @@ def test_size_variant_folders_are_declared_per_likelihood():
# Not declared for Delaunay: the folder stays an ordinary model variant there.
other = lc.mirrored(f"{A100}/source_pixels_784/runtime.json")
assert (other["model_variant"], other["size_variant"]) == ("source_pixels_784", None)


def _day_zero_cell(tree, version="2026.10.25.1", status="match", figure=True):
write(
tree,
f"{A100}/runtime.json",
row(autolens_version=version, configuration={"delaunay_vertices": 1250}),
)
write(
tree,
f"{A100}/parity.json",
parity(
autolens_version=version,
source_pixels=1250,
status=status,
log_likelihood=-100.0 if status == "match" else -90.0,
),
)
if figure:
(tree / A100 / "fit.png").write_bytes(b"\x89PNG fixture")
return {(r["evidence"]["path"], r["measurement"]): r for r in lifecycle(tree)["records"]}


def test_a_cell_meeting_the_day_zero_rule_is_stamped_whole(tree):
"""autolens_profiling#499 (report section 3.6): a current optimal/secondary cell on the
day-zero tag, at the standard size on a reference host, with a parity match and a fit
figure: every current record of the cell carries the tag."""
tag = cat.lc.DAY_ZERO["tag"]
records = _day_zero_cell(tree)
runtime = records[(f"{A100}/runtime.json", "runtime")]
witness = records[(f"{A100}/parity.json", "parity")]
for record in (runtime, witness):
assert (record["status"], record["release_pin"], record["day_zero"]) == (
"current",
tag,
tag,
)
assert record["validation"]["reason"].startswith(f"Day-zero baseline {tag}")
assert runtime["class"] == "optimal" and runtime["decision_id"]


@pytest.mark.parametrize(
"change",
[
{"version": "2026.10.23.2"}, # off the tag
{"status": "diverged"}, # no parity match
{"figure": False}, # no fit figure
],
)
def test_a_cell_off_the_day_zero_rule_is_not_stamped(tree, change):
records = _day_zero_cell(tree, **change)
assert all(r["day_zero"] is None for r in records.values())


def test_a_stamp_off_the_rule_is_refused(tree):
records = _day_zero_cell(tree)
doc = {"records": list(records.values())}
runtime = records[(f"{A100}/runtime.json", "runtime")]
runtime["class"] = "experimental"
with pytest.raises(ValueError, match="day_zero stamp off"):
cat.validate_lifecycle(tree, doc)


def test_the_catalogue_stamps_the_day_zero_baseline():
"""Witness: 480 current records over 116 cells, every one of the 39 designations with a
stamped current optimal, the held datacube A100 group included (human 2026-11-01)."""
doc = json.loads((TOOLING.parents[2] / "dashboard" / "catalogue.json").read_text())
tag = cat.lc.DAY_ZERO["tag"]
stamped = [r for r in doc["records"] if r["day_zero"] is not None]
assert {r["day_zero"] for r in stamped} == {tag}
assert len(stamped) == 480
assert len({cat.lc.day_zero_cell(r) for r in stamped}) == 116
assert all(r["status"] == "current" and r["class"] != "experimental" for r in stamped)
designations = json.loads(cat.lc.DESIGNATIONS_PATH.read_text())["designations"]
assert {r["decision_id"] for r in stamped if r["class"] == "optimal"} == {
d["id"] for d in designations
}
held = [
r
for r in stamped
if r["likelihood"]["dataset_type"] == "datacube" and r["host_class"] == "hpc_a100"
]
assert len(held) == 20 and all(r["decision_id"] is None for r in held)
1 change: 1 addition & 0 deletions scripts/misc/tooling/test/test_coverage_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def test_editing_the_mirror_changes_catalogue_lifecycle(tmp_path):
(tmp_path / "catalogue").mkdir()
(tmp_path / cm.DESIGNATIONS).write_text(json.dumps(doc))
(tmp_path / cm.HOLDS).write_text(json.dumps(HOLDS))
(tmp_path / "catalogue" / "day_zero.json").write_text(lc.DAY_ZERO_PATH.read_text())
copy = tmp_path / "scripts" / "misc" / "tooling" / "catalogue_lifecycle.py"
copy.parent.mkdir(parents=True)
copy.write_text((TOOLING / "catalogue_lifecycle.py").read_text())
Expand Down
Loading