Spaces:
Sleeping
Sleeping
Commit ·
08d3cbf
1
Parent(s): 5bc8ca1
fix: fall back when conformance vectors are absent
Browse filesUse embedded valid and invalid wire examples when the Space repo does not include the full slipcore spec tree.
- app_logic.py +16 -1
app_logic.py
CHANGED
|
@@ -16,6 +16,18 @@ from slipcore import (
|
|
| 16 |
ROOT = Path(__file__).resolve().parents[1]
|
| 17 |
VALID_VECTORS = ROOT / "spec" / "conformance" / "valid.jsonl"
|
| 18 |
INVALID_VECTORS = ROOT / "spec" / "conformance" / "invalid.jsonl"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
@lru_cache(maxsize=1)
|
|
@@ -95,14 +107,17 @@ def analyze_wire(wire: str) -> dict[str, Any]:
|
|
| 95 |
|
| 96 |
def load_example_wires(kind: str) -> list[str]:
|
| 97 |
path = VALID_VECTORS if kind == "Valid" else INVALID_VECTORS
|
|
|
|
| 98 |
examples: list[str] = []
|
|
|
|
|
|
|
| 99 |
with path.open(encoding="utf-8") as handle:
|
| 100 |
for line in handle:
|
| 101 |
record = json.loads(line)
|
| 102 |
examples.append(record["wire"])
|
| 103 |
if len(examples) == 8:
|
| 104 |
break
|
| 105 |
-
return examples
|
| 106 |
|
| 107 |
|
| 108 |
LANGGRAPH_SNIPPETS = {
|
|
|
|
| 16 |
ROOT = Path(__file__).resolve().parents[1]
|
| 17 |
VALID_VECTORS = ROOT / "spec" / "conformance" / "valid.jsonl"
|
| 18 |
INVALID_VECTORS = ROOT / "spec" / "conformance" / "invalid.jsonl"
|
| 19 |
+
FALLBACK_VALID_WIRES = [
|
| 20 |
+
"SLIP v3 planner reviewer Request Review auth",
|
| 21 |
+
"SLIP v3 ops dev Inform Status green",
|
| 22 |
+
"SLIP v3 worker router Meta Ack",
|
| 23 |
+
"SLIP v3 dev sre Fallback Generic ref7f3a1b2c",
|
| 24 |
+
]
|
| 25 |
+
FALLBACK_INVALID_WIRES = [
|
| 26 |
+
"BAD v3 planner reviewer Request Review auth",
|
| 27 |
+
"SLIP v3 planner reviewer Unknown Review auth",
|
| 28 |
+
"SLIP v3 dev sre Fallback Generic",
|
| 29 |
+
"SLIP v3 planner reviewer Request Review auth-module",
|
| 30 |
+
]
|
| 31 |
|
| 32 |
|
| 33 |
@lru_cache(maxsize=1)
|
|
|
|
| 107 |
|
| 108 |
def load_example_wires(kind: str) -> list[str]:
|
| 109 |
path = VALID_VECTORS if kind == "Valid" else INVALID_VECTORS
|
| 110 |
+
fallback = FALLBACK_VALID_WIRES if kind == "Valid" else FALLBACK_INVALID_WIRES
|
| 111 |
examples: list[str] = []
|
| 112 |
+
if not path.exists():
|
| 113 |
+
return fallback
|
| 114 |
with path.open(encoding="utf-8") as handle:
|
| 115 |
for line in handle:
|
| 116 |
record = json.loads(line)
|
| 117 |
examples.append(record["wire"])
|
| 118 |
if len(examples) == 8:
|
| 119 |
break
|
| 120 |
+
return examples or fallback
|
| 121 |
|
| 122 |
|
| 123 |
LANGGRAPH_SNIPPETS = {
|