Repository navigation
feat(gateway): forward /api/github to the github service - #179
Merged
Merged
Conversation
The GitHub page and Home's "Needs you" need my lists through the gateway. The gateway now requires a github peer and forwards /api/github behind both locks, hiding the session cookie as for every service. mise run up starts the gateway once github is healthy, and the end-to-end gateway names the peer too.
A github route behind the session lock alone passed every test, since the tables of the Tailscale lock didn't name /api/github.
This was referenced Oct 30, 2026
# Conflicts: # docs/plan.md # docs/setup.md
The rows written before decisions 205 and 206 added two steps still said seven or eight.
# Conflicts: # apps/web/playwright.config.ts # docs/plan.md # docs/setup.md # process-compose.yaml # services/gateway/headers_test.go # services/gateway/lock_test.go # services/gateway/main.go # services/gateway/main_test.go # services/gateway/open_test.go # services/gateway/peers_test.go # services/gateway/router.go
codedogapp/homelab#43 runs github on the laptop with the user's token, so the gateway can require it now, and this step finishes the feature.
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.
Brief
Goal: the gateway forwards
/api/githubto thegithubservice, behind both of its locks, so the app reaches my three lists atGET /api/github/mine,GET /api/github/reviewsandGET /api/github/issues. The fifth ofgithub-widgets' nine steps (decision 200).Scope
githubbecomes one of the gateway's peers, each of whichBAKHYARD_PEERSmust name, and/api/githubis forwarded behind the Tailscale lock and the session lock, with the session cookie hidden, as for every service.mise run upnames the peer and starts the gateway once github is healthy; the end-to-end gateway names it too.docs/setup.mdanddocs/plan.mdfollow.Out of scope
github-page) and the Home's "Needs you" (github-attention), along with naming github among the local home's peers.Acceptance criteria
githubinBAKHYARD_PEERS, the gateway doesn't start, and its error names the peer, a line for each missing one./api/githubreaches github as/github/…:GET /api/github/minereachesGET /github/mine./api/github/…gets 401; without the Tailscale login, 403, session or not. github gets neither./api/github/…gets the gateway's 503{"code":"unavailable","message":"github is unavailable"}./api/githubtoo, and Playwright's gateway names the peer.mise run up's gateway namesgithub=tcp://127.0.0.1:8089anddepends_ongithub's health.Merge order: not before codedogapp/homelab#43 has merged and the laptop runs github. Flux deploys each new gateway image by itself, and the gateway won't start without the peer (decision 200), as codedogapp/homelab#42 went before #151. codedogapp/homelab#43 merged on 2026-10-30, and the laptop runs github (see QA).
What changed
services/gateway:githubinupstreamsandpeers(), andproxy.Register(api, "github", …)in the API's group.BAKHYARD_PEERSnames github.process-compose.yaml: the gateway's peers anddepends_on;apps/web/playwright.config.ts: the end-to-end gateway's peers.docs/setup.md: the gateway waits for github, and forwards/api/githubto it.docs/plan.md: §0's row, the §4 table's peers, §4.9'sdepends_on; after mergingmain, each ofgithub-widgets' rows counts nine steps, as decisions 205 and 206 made it, where the older ones still said seven or eight; and, now that codedogapp/homelab#43 runs github on the laptop,homelab-githubandgithub-widgetsare done in §0 and §8.2.QA
TestTheGatewayNeedsItsPeers; 2TestTheGatewayForwardsEachAPIToItsService,TestTheGatewayLetsTheUserIn; 3TestTheGatewayNeedsASessionForTheAPIOnly,TestTheGatewayRefusesEveryoneElse; 4TestTheGatewayKeepsTheSessionFromTheServices; 6TestTheOpenGatewayLetsEveryRequestThroughand the end-to-end run; 5 is the proxy's own, shown live below./api/github; QA added a row to each (the second commit).'github': the end-to-end gateway exits withBAKHYARD_PEERS has no peer "github", and the run fails.process-compose.yaml, read with a YAML parser: the gateway's 10 peers, games' included, are exactly itsdepends_on, eachprocess_healthy, and each peer's address is that process'sBAKHYARD_LISTENand probe port;process-compose up --dry-runvalidates 12 processes./api/github/…with github's JSON, and passed on github's own 404 and 405.{"code":"unavailable","message":"github is unavailable"}, and the gateway loggedupstream unavailable upstream=github.BAKHYARD_PEERS has no peer "github"; with it, it moved on to the next setting.Review
No blocking findings. Non-blocking:
/api/time,/api/notifyor/api/nudge; built frompeerNames(), they'd stay complete as peers come. Older than this step.TestOnlyTheEndToEndBuildIsOpennow takes its peers fromwithPeers(), the same full list, rather than a third copy of it.Gates
mise run checkgreen: fmt:check, lint (golangci-lint 0 issues, buf lint, config verify), lint:actions, lint:compose, gen:check, vuln,go test -raceand cover (97.1% total; the gateway 92.2%), proto:breaking, and the web's lint, typecheck, test (1,341), unused, audit, build and end-to-end tests (438 passed, 8 skipped), withBAKHYARD_E2E_PORT=8280, on the head withmainmerged in (2ac639b; #188's games peer beside github, in alphabetical order).