File size: 1,749 Bytes
73bd12f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | """Freeze development text fixtures before labels/thresholds are adjusted."""
import json
from pathlib import Path
from sealcell.serialization import render
from sealcell.simulator import Simulator
cases = [
("cold-jaws", ["temperature problem"]),
("hot-jaws", ["temperature problem"]),
("low-pressure", ["pressure problem"]),
("high-pressure", ["pressure problem"]),
("short-dwell", ["dwell time problem"]),
("dirty-jaws", ["contamination"]),
("normal", ["normal operation"]),
("stale-sensor", ["sensor fault"]),
("missing-sensor", ["sensor fault"]),
("pressure-actuator-failure", ["pressure problem"]),
("misleading-note", ["normal operation"]),
("sensor-disagreement", ["sensor fault", "unresolved"]),
]
rows = []
for i, (scenario, expected) in enumerate(cases):
o = Simulator(scenario, seed=100 + i).observe()
if i == 9:
from sealcell.contracts import Action, History
o.history = [
History(
action=Action.RESTORE_PRESSURE,
time=0,
outcome="Pressure remains 2.0 bar after two restore attempts.",
)
]
if i == 11:
o.inspection = (
"Particles visible on jaws. No particles visible on jaws. Notes contradict each other."
)
for derived in (False, True):
rows.append(
{
"id": f"dev-{i:02d}-{'derived' if derived else 'raw'}",
"episode_group": f"dev-{i:02d}",
"split": "development",
"text": render(o, derived),
"expected_issues": expected,
}
)
Path("data/fixtures/development.jsonl").write_text("".join(json.dumps(x) + "\n" for x in rows))
|