From 6732091dee2243daf606d6cf54561fdc2b29c70b Mon Sep 17 00:00:00 2001 From: "dilux-bot[bot]" <333187390+dilux-bot[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2026 22:24:06 +0000 Subject: [PATCH] test(repro): failing test for #726 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Written by the reproduction job from the report in #726; it fails on main, which confirms the bug. The fix goes in on top of it. 🤖 AI-generated · claude-sonnet-5-5 (Anthropic) --- tests/repro/test_issue_726.py | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/repro/test_issue_726.py diff --git a/tests/repro/test_issue_726.py b/tests/repro/test_issue_726.py new file mode 100644 index 00000000..8769d981 --- /dev/null +++ b/tests/repro/test_issue_726.py @@ -0,0 +1,40 @@ +"""#726: the release lane's scenarios, all played at once with one test identity's +token, must not poll GitHub faster than that token's 5000 requests an hour.""" +import importlib.util +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +HOURLY_LIMIT = 5000 + + +def load(name): + spec = importlib.util.spec_from_file_location(name.replace("-", "_"), ROOT / "scripts" / f"{name}.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def test_all_scenarios_polling_together_stay_within_the_hourly_rate_limit(): + ws = load("release-scenarios") + scenarios = ws.load_yaml(ROOT / "tests" / "release" / "scenarios.yml")["scenarios"] + calls, marks = [], [] + + def fake(*a, input=None): + calls.append(a) + if a[:2] == ("issue", "create"): + return "https://github.com/o/t/issues/9\n" + if a[:2] == ("issue", "view"): + return json.dumps({"labels": [], "comments": [], "state": "OPEN"}) + return "[]" + + def sleep(seconds): + if seconds == ws.POLL: + marks.append(len(calls)) + + s = {"id": "never", "opens": {"issue": {"title": "t"}}, "expect": {"labels": ["never"]}} + ws.play(s, "o/t", "v7-next", {}, fake, sleep, 2) + assert len(marks) >= 3 + per_poll = max(b - a for a, b in zip(marks, marks[1:])) + per_hour = len(scenarios) * per_poll * 3600 / ws.POLL + assert per_hour <= HOURLY_LIMIT, f"{len(scenarios)} scenarios at {per_poll} calls per poll make {per_hour:.0f} calls an hour"