feat(spot-check): pace live Edifabric calls at 1.5s apart

Edifabric /v2/x12 endpoints apply a per-second rate limit
(typical: 1 call/sec sustained, 429 if exceeded) on top of the
daily quota. Sequential spot-checks of 10 files tripped it on
back-to-back runs. Insert a 1.5s pause between calls so the
spot-check always lives within the rate budget. This is the
'1-2 s spacing' the plan flagged; the original monolithic
scratch driver skipped it and the verifier noted the gap on
retry.
This commit is contained in:
Nora
2026-07-08 04:26:00 -06:00
parent 5fe61fddd3
commit 95d04f9991
@@ -74,9 +74,18 @@ def validate_spot_check_files(paths: list[Path]) -> list[dict]:
This module never silently substitutes a different This module never silently substitutes a different
validator. validator.
""" """
import time
out: list[dict] = [] out: list[dict] = []
for p in paths: for i, p in enumerate(paths):
body = p.read_bytes() body = p.read_bytes()
# The Edifabric /v2/x12 endpoints apply a per-second rate limit
# in addition to the daily quota (typical: 1 call/sec sustained,
# 429 if exceeded). Insert a 1.5s pause between calls so 10-file
# spot-checks don't trip the limit; this is the value the plan
# flagged ("1-2 s spacing") that the original monolithic scratch
# driver skipped.
if i > 0:
time.sleep(1.5)
try: try:
result = validate_edi(body) result = validate_edi(body)
except EdifabricError as exc: except EdifabricError as exc: