feat(launch): friendly GitHub-limit message on Generate; document the score formula

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shay
2026-11-30 06:12:22 -08:00
co-authored by Claude Opus 5.5
parent b737a0171e
commit d907815f19
7 changed files with 78 additions and 1 deletions
+15
View File
@@ -316,6 +316,21 @@ def test_generate_endpoint_renders_and_stores_svg(client):
assert b"<svg>r</svg>" in r2.data
def test_generate_rate_limited_returns_503(client):
"""A spent GitHub quota surfaces as 503 github_rate_limited, not 502."""
import requests
dbmod.enroll("alice", {"theme": "dark"})
with client.session_transaction() as s:
s["gh_login"] = "alice"
resp = requests.Response()
resp.status_code = 503
err = requests.HTTPError("503 Server Error", response=resp)
with patch("src.worker.render_widgets_now", side_effect=err):
r = client.post("/api/alice/generate", headers={"Origin": "https://gh-stats.com"})
assert r.status_code == 503
assert r.get_json() == {"error": "github_rate_limited"}
def test_generate_endpoint_rejects_unenrolled(client):
"""With OAuth, unenrolled means having a session but no profile."""
with client.session_transaction() as s: