fix(launch): back off build retries on GitHub limits, dedupe fetcher misses, no ad hoc render before first build

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shay
2026-11-30 09:11:03 -08:00
co-authored by Claude Opus 5.5
parent d907815f19
commit d4b4a8bc52
8 changed files with 147 additions and 4 deletions
+27
View File
@@ -215,3 +215,30 @@ def test_data_miss_rate_limited_returns_503(client, monkeypatch):
assert r.status_code == 503
assert r.get_json() == {"error": "github_rate_limited"}
assert dbmod.get_user("alice") is None
def test_concurrent_data_misses_fetch_once(client, monkeypatch):
# Concurrent misses for one user used to each run a full GitHub fetch;
# the per-user lock makes later callers read what the first stored.
import threading, time as _time
calls = []
def fake_fetch(username, **_kw):
calls.append(username)
_time.sleep(0.3)
return {"user": {"login": username}, "repos": [], "events": []}
monkeypatch.setattr(apimod.github, "fetch_github_data", fake_fetch)
monkeypatch.setattr(apimod, "_is_github_not_found", lambda _d: False)
app = apimod.app
codes = []
def hit():
with app.test_client() as c:
codes.append(c.get("/data/alice", headers={"X-Internal-Token": "secret"}).status_code)
threads = [threading.Thread(target=hit) for _ in range(3)]
for t in threads:
t.start()
for t in threads:
t.join()
assert codes == [200, 200, 200]
assert calls == ["alice"]