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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ versioning: [Semantic Versioning 2.0.0](https://semver.org/) (policy in `docs/33
and download completed reports.
- Isolate seeded Playwright and Lighthouse runs, and report stale scenario versions as validation
errors during campaign creation (T-117).
- Reference-set generation writes the Parquet SHA-256 manifest and returns the same metadata via the CLI (T-103).
- Embed the API comparison payload in offline experiment reports and surface restart-interrupted
report jobs as errors (T-084a).
- Casebook interaction checks, replays, and Atlas manual probes run after campaign completion.
Expand Down
4 changes: 2 additions & 2 deletions backend/src/roboprobe/bootstrap/reference_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import hashlib
import json
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from dataclasses import asdict, dataclass
from pathlib import Path
from typing import Any, cast
from uuid import uuid4
Expand Down Expand Up @@ -167,7 +167,7 @@ def write_manifest(path: Path, manifest: ReferenceManifest) -> None:
"""Persist manifest JSON next to the parquet artefact."""
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(
json.dumps(manifest.__dict__, indent=2, sort_keys=True) + "\n",
json.dumps(asdict(manifest), indent=2, sort_keys=True) + "\n",
encoding="utf-8",
)

Expand Down
3 changes: 2 additions & 1 deletion backend/src/roboprobe/cli/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import annotations

from dataclasses import asdict
from pathlib import Path
from typing import Annotated

Expand Down Expand Up @@ -35,7 +36,7 @@ def reference_generate(
state = get_state(ctx)
settings: RoboProbeSettings = state.bootstrap()
manifest = generate_and_write(settings, output=output, n=n, seed=seed, space_id=space_id)
state.output.data(manifest.__dict__)
state.output.data(asdict(manifest))


@app.command("label")
Expand Down
38 changes: 38 additions & 0 deletions backend/tests/unit/experiments/test_reference_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

from __future__ import annotations

import json
import subprocess
import sys
from pathlib import Path

import pyarrow.parquet as pq
Expand Down Expand Up @@ -58,3 +61,38 @@ def test_generate_label_and_hash(tmp_path: Path) -> None:
assert sha256_file(path) == sha256_file(path)
reread = pq.read_table(path).to_pylist()
assert len(reread) == 8


def test_reference_cli_outputs_matching_parquet_manifest(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""The documented command writes an integrity manifest and returns it as JSON."""
monkeypatch.setenv("ROBOPROBE_STORAGE__WORKDIR_ROOT", str(tmp_path / "runs"))
out = tmp_path / "reference.parquet"
result = subprocess.run( # noqa: S603 - this is the tested CLI in an isolated interpreter.
[
sys.executable,
"-c",
"from roboprobe.cli.main import app; app()",
"--json",
"reference",
"generate",
"--output",
str(out),
"--n",
"1",
"--seed",
"11",
],
check=False,
capture_output=True,
text=True,
timeout=120,
)
assert result.returncode == 0, result.stderr
manifest = json.loads(out.with_suffix(".manifest.json").read_text(encoding="utf-8"))
assert json.loads(result.stdout) == manifest
assert manifest["path"] == str(out)
assert manifest["sha256"] == sha256_file(out)
assert pq.read_table(out).num_rows == manifest["n"] == 1
assert manifest["seed"] == 11
Loading