docs: backfill env template and migration notes for M2

This commit is contained in:
2026-07-21 01:28:33 -04:00
parent 9aa97a61ae
commit 724dc3c328
10 changed files with 59 additions and 30 deletions
+3 -1
View File
@@ -145,7 +145,9 @@ def _scoreboard(args: argparse.Namespace, env: dict[str, str]) -> None:
results.append(json.loads(path.read_text(encoding="utf-8")))
rows = sb.load_rows(*(r["telemetry"] for r in results))
calls = sum(r["stats"]["calls"] for r in results)
max_attempts = int(env.get(f"{args.scope}__RETRY__MAX_ATTEMPTS", env.get("LLM_MAX_RETRIES", "3")))
max_attempts = int(
env.get(f"{args.scope}__RETRY__MAX_ATTEMPTS", env.get("LLM_MAX_RETRIES", "3"))
)
verdicts: list[tuple[str, str]] = []
def _check(name: str, fn, *fargs, **fkwargs) -> None:
+3 -1
View File
@@ -72,7 +72,9 @@ def weighted_mix(weights: dict[str, float], rng) -> str:
return next(reversed(weights))
async def p1_trace_chains(corpus: SoakCorpus, run_id: str, rng=random.random) -> AsyncIterator[Item]:
async def p1_trace_chains(
corpus: SoakCorpus, run_id: str, rng=random.random
) -> AsyncIterator[Item]:
"""P1 文本长上下文回放: 单链串行,session/parent 链路照原样语义。"""
for chain_idx, chain in enumerate(corpus.chains):
session_id = f"{run_id}-p1-{chain_idx}"
+2 -3
View File
@@ -48,6 +48,7 @@ def inv_call_ids_unique(rows: list[Row]) -> None:
def _minute_bucket(created_at: str) -> int:
return int(datetime.fromisoformat(str(created_at)).timestamp()) // 60
def inv_rpm_never_exceeded(rows: list[Row], per_source_rpm: dict[str, int]) -> None:
"""不变量 3: 按遥测时间戳重算,任一分钟桶内单源请求数 ≤ RPM 配置。
@@ -59,9 +60,7 @@ def inv_rpm_never_exceeded(rows: list[Row], per_source_rpm: dict[str, int]) -> N
for r in rows
if per_source_rpm.get(r["source_name"], 0) > 0
)
breaches = {
key: n for key, n in buckets.items() if n > per_source_rpm[key[0]]
}
breaches = {key: n for key, n in buckets.items() if n > per_source_rpm[key[0]]}
assert not breaches, f"RPM 击穿: {dict(list(breaches.items())[:5])}"