Factory intake: client repo provisioning + unfunded gating #4
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Factory front-end (option 1): provision a client Gitea repo, hold client work in a local queue until funded, then create issues with acceptance criteria. No dispatcher changes — the gate lives entirely in this service.
Depends on: issues #1-2 (billing core + API). Files allowed:
gitea_saas/gitea_client.py,gitea_saas/intake_factory.py,tests/test_intake_factory.py. Do NOT modify anything else.Spec
GiteaClient(mockable): thin wrapper over Gitea API v1:create_org_repo(name)if missing (owner per envGITEA_OWNER)create_issue(repo, title, body, labels)repo_exists(name)GITEA_TOKEN,GITEA_BASE_URL). Mock: in-memory dict.IntakeFactory(core, gitea, config):provision_client(client_id, repo_name=None) -> repo_name— creates or reuses repo<repo>; records repo->client mapping inclient_repostable (add to billing schema:client_repos(client_id, repo, created_at)).submit_issue(client_id, repo, title, acceptance_body, labels=None):balance >= SAAS_DEBIT_FLOOR_MINOR, default 500): create Gitea issue immediately, return issue numberpending_issuestable(id, client_id, repo, title, body_json, labels_json, created_at, status)— statusqueued{delivered: bool, issue_number?: int, pending_id?: int}unlock(client_id)— flush ALLqueuedpending issues for the client to Gitea (create +p1label), markshippedlock(client_id)— future submits queue instead of shipping (no label games, no dispatcher coupling)client_unfunded(client_id) -> bool— true when balance < debit floorPOST /api/factory/provision,POST /api/factory/{client_id}/issues,POST /api/factory/{client_id}/unlock,POST /api/factory/{client_id}/lock.Acceptance
client_unfunded()==TrueVerification:
python -m pytest tests/test_intake_factory.py -qpasses.[extend-request from issue #8 / !20] Canonical client needs
list_issue_commentsThe !20 bounce (2026-08-25 22:38) ruled
gitea_saas/gitea_client.pyis ownedhere by issue #4 (per !23 closing #21) and must not be forked on any other
branch — including to add a method that issue. So requesting it here instead
of forking:
intake_eval.py(issue #8,poll_completed) callsself._gitea.list_issue_comments(repo, issue_number)to capture each closedeval-task issue's final comment as the result summary. The current canonical
client (
origin/issue-4) does not expose it — diffing the two blobs showsexactly this 8-line delta:
Not blocking !20 from review (its real-client request test skips until the
method lands here so the gate stays honest), but the eval farm's
poll_completedcannot resolve results at runtime until the canonical client grows this method.
Please add it to this file so it ships once and every consumer (factory + eval
farm) uses the same implementation.