Spaces:
Running on Zero
Running on Zero
Codex commited on
Commit ·
56e9a84
1
Parent(s): 86db2be
Pin complete glyph evidence runtime sources
Browse files- glyph_hybrid_adapter.py +25 -0
- tests/test_glyph_hybrid_adapter.py +22 -0
glyph_hybrid_adapter.py
CHANGED
|
@@ -19,6 +19,7 @@ from typing import Any, Callable, Mapping, Sequence
|
|
| 19 |
|
| 20 |
import numpy as np
|
| 21 |
|
|
|
|
| 22 |
import glyph_assets as glyph_assets_module
|
| 23 |
import glyph_hybrid_evidence as evidence
|
| 24 |
import glyph_hybrid_plan as glyph_plan_module
|
|
@@ -251,6 +252,14 @@ def _runtime_pins(
|
|
| 251 |
)
|
| 252 |
for pin in tuple(bundle.source_pins)
|
| 253 |
) + (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
_source_file_pin(
|
| 255 |
"glyph-hybrid-plan-source",
|
| 256 |
glyph_plan_module.__file__,
|
|
@@ -267,6 +276,22 @@ def _runtime_pins(
|
|
| 267 |
"role": "join-and-carrier-conditioner",
|
| 268 |
},
|
| 269 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
_source_file_pin(
|
| 271 |
"glyph-generation-runtime-source",
|
| 272 |
runtime.generate_chunk.__code__.co_filename,
|
|
|
|
| 19 |
|
| 20 |
import numpy as np
|
| 21 |
|
| 22 |
+
import glyph_ascii_v1 as glyph_ascii_module
|
| 23 |
import glyph_assets as glyph_assets_module
|
| 24 |
import glyph_hybrid_evidence as evidence
|
| 25 |
import glyph_hybrid_plan as glyph_plan_module
|
|
|
|
| 252 |
)
|
| 253 |
for pin in tuple(bundle.source_pins)
|
| 254 |
) + (
|
| 255 |
+
_source_file_pin(
|
| 256 |
+
"glyph-ascii-runtime-source",
|
| 257 |
+
glyph_ascii_module.__file__,
|
| 258 |
+
config={
|
| 259 |
+
"schema": ADAPTER_SCHEMA,
|
| 260 |
+
"role": "grammar-and-inverse-proof",
|
| 261 |
+
},
|
| 262 |
+
),
|
| 263 |
_source_file_pin(
|
| 264 |
"glyph-hybrid-plan-source",
|
| 265 |
glyph_plan_module.__file__,
|
|
|
|
| 276 |
"role": "join-and-carrier-conditioner",
|
| 277 |
},
|
| 278 |
),
|
| 279 |
+
_source_file_pin(
|
| 280 |
+
"glyph-hybrid-evidence-source",
|
| 281 |
+
evidence.__file__,
|
| 282 |
+
config={
|
| 283 |
+
"schema": ADAPTER_SCHEMA,
|
| 284 |
+
"role": "evidence-rebuild-and-validation",
|
| 285 |
+
},
|
| 286 |
+
),
|
| 287 |
+
_source_file_pin(
|
| 288 |
+
"glyph-hybrid-adapter-source",
|
| 289 |
+
__file__,
|
| 290 |
+
config={
|
| 291 |
+
"schema": ADAPTER_SCHEMA,
|
| 292 |
+
"role": "production-evidence-adapter",
|
| 293 |
+
},
|
| 294 |
+
),
|
| 295 |
_source_file_pin(
|
| 296 |
"glyph-generation-runtime-source",
|
| 297 |
runtime.generate_chunk.__code__.co_filename,
|
tests/test_glyph_hybrid_adapter.py
CHANGED
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
| 3 |
from dataclasses import dataclass, replace
|
| 4 |
import hashlib
|
| 5 |
import json
|
|
|
|
| 6 |
from types import MappingProxyType, SimpleNamespace
|
| 7 |
import threading
|
| 8 |
|
|
@@ -523,6 +524,27 @@ def test_adapter_replays_generation_and_reruns_pinned_evaluators(
|
|
| 523 |
).encode("ascii")
|
| 524 |
)
|
| 525 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
|
| 527 |
|
| 528 |
def test_adapter_replays_every_completed_carrier_attempt():
|
|
|
|
| 3 |
from dataclasses import dataclass, replace
|
| 4 |
import hashlib
|
| 5 |
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
from types import MappingProxyType, SimpleNamespace
|
| 8 |
import threading
|
| 9 |
|
|
|
|
| 524 |
).encode("ascii")
|
| 525 |
)
|
| 526 |
)
|
| 527 |
+
source_pins = {
|
| 528 |
+
pin["name"]: pin
|
| 529 |
+
for pin in payload["renderer_contract"]["source_pins"]
|
| 530 |
+
}
|
| 531 |
+
exact_runtime_sources = {
|
| 532 |
+
"glyph-ascii-runtime-source": (
|
| 533 |
+
adapter_module.glyph_ascii_module.__file__
|
| 534 |
+
),
|
| 535 |
+
"glyph-hybrid-plan-source": adapter_module.glyph_plan_module.__file__,
|
| 536 |
+
"glyph-assets-runtime-source": (
|
| 537 |
+
adapter_module.glyph_assets_module.__file__
|
| 538 |
+
),
|
| 539 |
+
"glyph-hybrid-evidence-source": adapter_module.evidence.__file__,
|
| 540 |
+
"glyph-hybrid-adapter-source": adapter_module.__file__,
|
| 541 |
+
"glyph-generation-runtime-source": (
|
| 542 |
+
case.runtime.generate_chunk.__code__.co_filename
|
| 543 |
+
),
|
| 544 |
+
}
|
| 545 |
+
assert set(exact_runtime_sources).issubset(source_pins)
|
| 546 |
+
for name, path in exact_runtime_sources.items():
|
| 547 |
+
assert source_pins[name]["sha256"] == _sha(Path(path).read_bytes())
|
| 548 |
|
| 549 |
|
| 550 |
def test_adapter_replays_every_completed_carrier_attempt():
|