😏
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
# Cross-replica payment constraints
|
||||
|
||||
Requests have globally unique idempotency keys; six stateless replicas can receive retries; SQL supports unique constraints and transactions; the external payment cannot join the SQL transaction; the design must recover from crashes between durable state and the side effect. Replica-local memory is neither shared nor durable.
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Label normalization
|
||||
|
||||
`slug_label` trims surrounding whitespace, lowercases ASCII text, collapses every run of spaces or underscores to one hyphen, and removes leading or trailing hyphens.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
max_batch_items = 128
|
||||
retry_limit = 4
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import re
|
||||
|
||||
|
||||
def slug_label(value: str) -> str:
|
||||
return re.sub(r" +", "-", value.strip().lower())
|
||||
@@ -0,0 +1,15 @@
|
||||
import unittest
|
||||
|
||||
from labels import slug_label
|
||||
|
||||
|
||||
class LabelTests(unittest.TestCase):
|
||||
def test_mixed_separators(self):
|
||||
self.assertEqual(slug_label(" Release__ Candidate "), "release-candidate")
|
||||
|
||||
def test_outer_separators(self):
|
||||
self.assertEqual(slug_label("__Ready__"), "ready")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
mode = sys.argv[1]
|
||||
text = Path(".mmo-eval-final.txt").read_text(encoding="utf-8").lower()
|
||||
holdout_path = Path("access-holdout.json")
|
||||
holdout = json.loads(holdout_path.read_text(encoding="utf-8")) if holdout_path.is_file() else {}
|
||||
if mode == "literal" and not (
|
||||
holdout.get("expected_value", "128").lower() in text
|
||||
and holdout.get("expected_path", "LIMITS.toml").lower() in text
|
||||
):
|
||||
raise SystemExit("literal result is not grounded in the hidden expected location")
|
||||
if mode == "routine":
|
||||
from labels import slug_label
|
||||
|
||||
if slug_label(" Release__ Candidate ") != "release-candidate":
|
||||
raise SystemExit("routine slug contract still fails")
|
||||
if mode == "decision":
|
||||
required = holdout.get("required_terms", ["unique", "durable", "crash", "external", "local"])
|
||||
missing = [term for term in required if term not in text]
|
||||
if missing:
|
||||
raise SystemExit("decision lacks constraints: " + ", ".join(missing))
|
||||
Reference in New Issue
Block a user