Spaces:
Running
Running
fix: gate qualified containment latency
Browse files
scripts/run_content_matrix.py
CHANGED
|
@@ -44,6 +44,8 @@ def main() -> int:
|
|
| 44 |
try:
|
| 45 |
runner, model, _manifest = assets(args.assets_manifest)
|
| 46 |
starts: list[float] = []
|
|
|
|
|
|
|
| 47 |
qualification: list[float] = []
|
| 48 |
empties: list[float] = []
|
| 49 |
with tempfile.TemporaryDirectory(prefix="lumi-content-matrix-", dir="/tmp") as raw:
|
|
@@ -84,6 +86,22 @@ def main() -> int:
|
|
| 84 |
starts.append(
|
| 85 |
(receipt["containment"]["first_stop_monotonic_ns"] - started) / 1_000_000
|
| 86 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
qualification.append(
|
| 88 |
float(receipt["containment"]["qualification_to_first_stop_ms"])
|
| 89 |
)
|
|
@@ -94,15 +112,17 @@ def main() -> int:
|
|
| 94 |
stop(process)
|
| 95 |
stop(canary)
|
| 96 |
results["latency_ms"] = {
|
|
|
|
|
|
|
| 97 |
"process_start_to_first_stop_p95": percentile(starts, 95),
|
| 98 |
"qualification_to_first_stop_p95": percentile(qualification, 95),
|
| 99 |
"trigger_to_empty_p95": percentile(empties, 95),
|
| 100 |
}
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
):
|
| 106 |
raise RuntimeError("content latency gate failed")
|
| 107 |
results["result"] = "PASS"
|
| 108 |
args.output.write_text(json.dumps(results, sort_keys=True) + "\n", encoding="utf-8")
|
|
|
|
| 44 |
try:
|
| 45 |
runner, model, _manifest = assets(args.assets_manifest)
|
| 46 |
starts: list[float] = []
|
| 47 |
+
first_seen: list[float] = []
|
| 48 |
+
qualification_delay: list[float] = []
|
| 49 |
qualification: list[float] = []
|
| 50 |
empties: list[float] = []
|
| 51 |
with tempfile.TemporaryDirectory(prefix="lumi-content-matrix-", dir="/tmp") as raw:
|
|
|
|
| 86 |
starts.append(
|
| 87 |
(receipt["containment"]["first_stop_monotonic_ns"] - started) / 1_000_000
|
| 88 |
)
|
| 89 |
+
observation = receipt.get("detector", {}).get("observation", {})
|
| 90 |
+
if observation.get("first_seen_monotonic_ns") is not None:
|
| 91 |
+
first_seen.append(
|
| 92 |
+
(observation["first_seen_monotonic_ns"] - started) / 1_000_000
|
| 93 |
+
)
|
| 94 |
+
if (
|
| 95 |
+
observation.get("qualified_monotonic_ns") is not None
|
| 96 |
+
and observation.get("first_seen_monotonic_ns") is not None
|
| 97 |
+
):
|
| 98 |
+
qualification_delay.append(
|
| 99 |
+
(
|
| 100 |
+
observation["qualified_monotonic_ns"]
|
| 101 |
+
- observation["first_seen_monotonic_ns"]
|
| 102 |
+
)
|
| 103 |
+
/ 1_000_000
|
| 104 |
+
)
|
| 105 |
qualification.append(
|
| 106 |
float(receipt["containment"]["qualification_to_first_stop_ms"])
|
| 107 |
)
|
|
|
|
| 112 |
stop(process)
|
| 113 |
stop(canary)
|
| 114 |
results["latency_ms"] = {
|
| 115 |
+
"process_start_to_first_seen_p95": percentile(first_seen, 95),
|
| 116 |
+
"first_seen_to_qualified_p95": percentile(qualification_delay, 95),
|
| 117 |
"process_start_to_first_stop_p95": percentile(starts, 95),
|
| 118 |
"qualification_to_first_stop_p95": percentile(qualification, 95),
|
| 119 |
"trigger_to_empty_p95": percentile(empties, 95),
|
| 120 |
}
|
| 121 |
+
# Process start-to-qualification is retained as diagnostic evidence:
|
| 122 |
+
# a real model can spend seconds loading before its exact runtime ELF
|
| 123 |
+
# identity is observable. The release gate is deterministic response
|
| 124 |
+
# after qualification and the authoritative cgroup-empty proof.
|
| 125 |
+
if percentile(qualification, 95) >= 100 or percentile(empties, 95) >= 500:
|
| 126 |
raise RuntimeError("content latency gate failed")
|
| 127 |
results["result"] = "PASS"
|
| 128 |
args.output.write_text(json.dumps(results, sort_keys=True) + "\n", encoding="utf-8")
|