Link team repos to problem statements on team approval; TTL-cache the GitHub issues proxy - #260
Open
gregv wants to merge 1 commit into
Open
Link team repos to problem statements on team approval; TTL-cache the GitHub issues proxy#260gregv wants to merge 1 commit into
gregv wants to merge 1 commit into
Conversation
…roxy
Fix-forward for the project-page discoverability gap: approve_team created
the GitHub repo and wrote github_links on the team doc only, so problem
statements' github field stayed empty and /project/<id> showed no code.
- approve_team now also appends {name, link} to the github array of the
team's linked problem statement(s) via _link_repo_to_problem_statements:
team.problem_statements refs preferred (string ids and DocumentReferences
both handled); falls back to the nonprofit's problem statement only when
it has exactly one (ambiguous cases skip + log). Dedupes by normalized
link, converts legacy string-shaped github values, clears the cached
get_single_problem_statement_old read, and never blocks the approval flow.
- GET /api/github/issues responses are now cached 10 min per
(org, repo, state) — the public project pages fetch this per repo, so the
cache protects the shared GITHUB_TOKEN rate budget. Errors are not cached
so transient GitHub failures retry.
Note: GITHUB_TOKEN currently returns 401 Bad credentials in prod — the
issues proxy (and admin issue summaries) won't work until it's rotated.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Why
Companion to frontend PR opportunity-hack/frontend-ohack.dev#336. Project pages couldn't show any code for hackathon-built projects because
approve_teamwrote the created repo only to the team doc — the problem statement'sgithubfield stayed empty forever.What changed
approve_teamfix-forward (_link_repo_to_problem_statementsinapi/teams/teams_service.py): after writing the team'sgithub_links, the new repo is also appended to thegithubarray of the linked problem statement(s). Teamproblem_statementsrefs are preferred (handles both string ids and DocumentReferences); the nonprofit fallback applies only when it has exactly one problem statement (ambiguous → skip + log). Dedupes by normalized link, upgrades legacy string-shapedgithubvalues to[{name, link}], clearsget_single_problem_statement_old's cache, and is fully best-effort — it can never fail the approval flow.GET /api/github/issues(api/github/github_service.py), keyed per (org, repo, state). The public project pages now fetch this per repo for live issue counts, so the cache protects the sharedGITHUB_TOKENbudget. Error responses are not cached.Ops note
GITHUB_TOKENcurrently returns 401 Bad credentials in prod (verified viacurl https://api.ohack.dev/api/github/issues?...) — the issues proxy and the admin team-management issue summaries are silently broken until the token is rotated.🤖 Generated with Claude Code