feat(api): GET /api/v1/public/pulls, Longshot's open PRs with BigBean authors and approved heads #90

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:feat/public-pulls into main 2026-11-18 07:16:43 +00:00
Owner

Longshot Launcher is getting pull request builds and must warn more strongly about a PR that neither a BigBean wrote nor the farm approved, but it has no Forgejo token and Forgejo hides its teams from anonymous readers. This gives it a public, read-only answer from the coordinator, which already knows both.

What changed

  • GET /api/v1/public/pulls (new coordinator/beanstalk/public.py, registered beside the other /api/v1 routes): no token, no session, Cache-Control: public, max-age=60.
    {"generated_at": "2026-11-18T07:00:00Z",
     "pulls": [{"number": 1558, "title": "…", "author": "HumanBean", "head": "<40 hex>", "draft": false,
                "labels": ["platform/linux"], "updated_at": "…", "author_bigbean": true, "approved": false, "approved_by": []}]}
    
  • pulls: the open PRs from dashboard.open_prs (Forgejo's list, already kept a minute; 503 when Forgejo never answered), newest updated_at first, heads that are not 40 lowercase hex left out.
  • author_bigbean: farm.is_maintainer(author), once per distinct author, at most 4 checks at a time, kept 10 minutes per login (false too). A Forgejo error on a login is false for that answer and not kept.
  • approved: commit_tier(live approvals of the head, commits.sensitive) != untrusted, read for every head in two queries (= ANY(%s)). A new push, a revoke or a head the farm never saw is false; approved_by is the distinct live approvers, sorted.
  • The whole answer is kept 60 s (its cache lives on the Farm), so many launchers cost one computation.
  • /api/ paths already skip the viewer middleware (auth.NO_SESSION) and answer errors as plain text; the security headers apply as on every response.
  • Documented in docs/protocol.md, "Public".

Testing

coordinator/tests/test_public_pulls.py (7 tests): the shape and headers, open PRs only and their order, author_bigbean from the fake Forgejo's teams and its caching, a Forgejo error on one login, approved for an approved head and not after a new push or a revoke, a sensitive commit with one then two approvals, a head the farm never saw, and 503 when Forgejo is down. The client runs with sign-in set up and sends no token or cookie.

pytest -q in coordinator/ (Docker Postgres): 564 passed, 1 skipped.

Nothing shows on screen, so no screenshots.

🤖 Generated with Claude Code

Longshot Launcher is getting pull request builds and must warn more strongly about a PR that neither a BigBean wrote nor the farm approved, but it has no Forgejo token and Forgejo hides its teams from anonymous readers. This gives it a public, read-only answer from the coordinator, which already knows both. ## What changed - `GET /api/v1/public/pulls` (new `coordinator/beanstalk/public.py`, registered beside the other `/api/v1` routes): no token, no session, `Cache-Control: public, max-age=60`. ```json {"generated_at": "2026-11-18T07:00:00Z", "pulls": [{"number": 1558, "title": "…", "author": "HumanBean", "head": "<40 hex>", "draft": false, "labels": ["platform/linux"], "updated_at": "…", "author_bigbean": true, "approved": false, "approved_by": []}]} ``` - `pulls`: the open PRs from `dashboard.open_prs` (Forgejo's list, already kept a minute; 503 when Forgejo never answered), newest `updated_at` first, heads that are not 40 lowercase hex left out. - `author_bigbean`: `farm.is_maintainer(author)`, once per distinct author, at most 4 checks at a time, kept 10 minutes per login (false too). A Forgejo error on a login is false for that answer and not kept. - `approved`: `commit_tier(live approvals of the head, commits.sensitive) != untrusted`, read for every head in two queries (`= ANY(%s)`). A new push, a revoke or a head the farm never saw is false; `approved_by` is the distinct live approvers, sorted. - The whole answer is kept 60 s (its cache lives on the `Farm`), so many launchers cost one computation. - `/api/` paths already skip the viewer middleware (`auth.NO_SESSION`) and answer errors as plain text; the security headers apply as on every response. - Documented in `docs/protocol.md`, "Public". ## Testing `coordinator/tests/test_public_pulls.py` (7 tests): the shape and headers, open PRs only and their order, `author_bigbean` from the fake Forgejo's teams and its caching, a Forgejo error on one login, approved for an approved head and not after a new push or a revoke, a sensitive commit with one then two approvals, a head the farm never saw, and 503 when Forgejo is down. The client runs with sign-in set up and sends no token or cookie. `pytest -q` in `coordinator/` (Docker Postgres): `564 passed, 1 skipped`. Nothing shows on screen, so no screenshots. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(api): GET /api/v1/public/pulls, Longshot's open PRs with BigBean authors and approved heads
Some checks failed
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 4s
CI / Coordinator tests (pull_request) Failing after 19s
CI / Agent build and checks (pull_request) Has been cancelled
CI / Coordinator image (pull_request) Has been cancelled
fed55df6b5
Longshot Launcher is getting pull request builds: a tester picks an open
Longshot PR and the launcher builds it, warning once when a BigBean wrote
it or the farm approved its exact head, twice otherwise. The launcher has
no Forgejo token and Forgejo hides its teams anonymously, so the farm
tells it.

The new public endpoint (no token, no session; Cache-Control public,
max-age=60) lists the open PRs from dashboard.open_prs (Forgejo's list,
kept a minute), newest update first, skipping heads that are not 40 hex.
author_bigbean is farm.is_maintainer, checked once per distinct author,
four at a time, and kept 10 minutes per login (a Forgejo error is false
for that answer and not kept). approved is commit_tier of the head's live
approvals != untrusted, read for every head in two queries; approved_by
is the live approvers. The whole answer is kept a minute (public.py, its
cache on the Farm). Documented in docs/protocol.md, "Public".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Beanstalk!90
No description provided.