Repository navigation
Conversation
Replaces the FastAPI bot and Django dashboard API with Go binaries built
from a single module rooted at the repo top level. The original Python
sources move to legacy/ as porting reference; web_ui/ and docs/ are
untouched.
New binaries (all under cmd/):
- bot webhook receiver + per-PR merge evaluator
- webapi dashboard API (chi + pgx + signed sessions)
- ingest-events Redis→Postgres webhook envelope ingestor
- aggregate-pr-activity per-day PR rollup
- aggregate-user-activity per-user PR rollup
Bot internals (internal/bot/):
- JWT App auth + cached installation tokens
- GitHub REST methods (merge, update branch, comment, labels, check
runs, collaborator permission)
- Full GetEventInfo GraphQL query and response parser
- Per-installation webhook queue and per-repo merge queue on Redis
sorted sets, with restart restoration via the *_queue_names sets
- Full Mergeable() decision tree ported from evaluation.py — config
validation, branch protection, push allowances, paywall, auto-approve,
automerge label, conflict handling, blacklists, draft state, BLOCKED
/BEHIND review counting with travis-ci special case, skippable
contexts with retry budget, optimistic update vs status-check
prioritization, do_not_merge, prioritize_ready_to_merge, queue
position rendering
- MergeBody builder including PR-number suffix and co-author trailers
Web API internals (internal/webapi/):
- chi router with every route from core/urls.py
- HMAC-signed session cookies in place of Django sessions
- pgx store layer over typed row structs in models/
- OAuth login redirect, ping, accounts, current_account, activity
handlers wired end-to-end. Stripe billing handlers and the OAuth
token exchange are explicit HTTP 501 stubs with one-line TODOs
pointing at their legacy implementations.
- SQL rollups for pull_request_activity and user_pull_request_activity
Build / CI:
- Dockerfile.bot and Dockerfile.webapi (multi-stage Go + distroless)
- .github/workflows/go.yml runs build/vet/test + image builds
- .circleci/config.yml rewritten: replaces bot_*/web_api_* Python
jobs with go_build + go_docker_bot + go_docker_webapi; docs/web_ui
pipelines unchanged
Signed-off-by: Tamal Saha <tamal@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bot/and Djangoweb_api/with a single Go module at the repo root. Both binaries plus three job binaries (ingest-events,aggregate-pr-activity,aggregate-user-activity) build cleanly undercmd/.legacy/as porting reference.web_ui/(React) anddocs/(Docusaurus) are unchanged.GetEventInfoGraphQL query, the per-installation webhook queue and per-repo merge queue on Redis sorted sets (with restart restoration), and the completeMergeable()decision tree fromevaluation.py(branch protection, paywall, auto-approve, automerge label, conflict handling, blacklists, BLOCKED/BEHIND review counting with the travis-ci special case, skippable contexts, optimistic vs status-check prioritization,do_not_merge,prioritize_ready_to_merge).core/urls.py, HMAC-signed session cookies in place of Django sessions, pgx store layer, and end-to-end implementations ofoauth_login,ping,logout,accounts,current_account, andactivity. Stripe billing handlers (update_subscription,start_checkout,cancel_subscription, etc.) and the OAuth token exchange portion ofoauth_completeare intentionally HTTP 501 with one-line TODOs pointing at the corresponding legacy view — they needstripe-gowiring.Dockerfile.bot,Dockerfile.webapi). CI: new.github/workflows/go.ymland a rewritten.circleci/config.ymlthat drops the oldbot_*/web_api_*jobs and addsgo_build+go_docker_*.go build ./... && go vet ./... && go test ./...is clean.Test plan
go build ./... && go vet ./...pass on CIdocker build -f Dockerfile.bot .anddocker build -f Dockerfile.webapi .succeedpull_requestwebhook to a localcmd/botand confirm aWebhookEventlands on thewebhook:<installation_id>Redis sorted setGET /v1/ping(200),GET /v1/oauth_login(302 to GitHub),GET /v1/accountswithout a session cookie (401)legacy/bot/andlegacy/web_api/are git-tracked but no longer referenced by any active CI joboauth_completetoken exchange before retiring the legacy services in production