fix(chart): lock synastry chart calls and stop overwriting the A/B note

The bounced contract still looked for the old chart calls. The research script now writes to a temp directory unless --out is set. Quota splits stay unimplemented.

Co-Authored-By: Grok (agent loop)
This commit is contained in:
jesse-ux
2026-10-15 10:19:41 +08:00
co-authored by Grok (agent loop)
parent 18fdce6006
commit e21e167a73
5 changed files with 47 additions and 9 deletions
+21 -2
View File
@@ -10,12 +10,14 @@ generated_at, created_at, timestamp, elapsed_seconds, elapsed_ms, duration_ms, r
from __future__ import annotations
import argparse
import json
import os
import random
import statistics
import subprocess
import sys
import tempfile
import threading
import time
from concurrent.futures import ThreadPoolExecutor
@@ -246,7 +248,22 @@ def _simulate() -> list[dict]:
return [run(mode) for mode in ("O1", "O2", "O3", "O4")]
def main() -> None:
def resolve_record_path(explicit: str | None) -> Path:
"""Write the A/B JSON only where asked. The committed note stays untouched."""
if explicit:
return Path(explicit)
directory = Path(tempfile.mkdtemp(prefix="api-chart-subprocess-ab-"))
return directory / "api-chart-subprocess-gate-ab-20261013.json"
def main(argv: list[str] | None = None) -> None:
parser = argparse.ArgumentParser(description="A/B for issue #64 chart subprocess gate")
parser.add_argument(
"--out",
default=None,
help="Write the JSON record to this path. Omit to use a fresh temp directory, not the committed docs/testing file.",
)
args = parser.parse_args(argv)
counter = _Counter()
counter.install()
charts = _measure_charts(counter)
@@ -263,8 +280,10 @@ def main() -> None:
"jhora_installed": False,
}
text = json.dumps(out, ensure_ascii=False, indent=2)
dest = ROOT / "docs" / "testing" / "api-chart-subprocess-gate-ab-20261013.json"
dest = resolve_record_path(args.out)
dest.parent.mkdir(parents=True, exist_ok=True)
dest.write_text(text + "\n", encoding="utf-8")
print(dest, file=sys.stderr)
print(text)