Add stale + archived filters to the /repos dashboard page - #196
Merged
Conversation
Two filters on /[tenant]/repos, requested as the dashboard equivalent of scripts/list_active_repos.py's --stale/--include-archived (which only ever touched that standalone CLI script, not the real product). - Stale (no push in 90d+): pure client-side filter on RepoList using the last_run_at the page already loads via getOrgReposSummary — no new data, no new query. Same "never pushed also counts as stale" semantics as the CLI script, and the same documented caveat: this is last iris push time, not literal last-commit time (no per-commit date survives into the stored payload). - Archived (GitHub status): the platform has no stored column for this and no durable GitHub credential to background-sync it — only a session-scoped OAuth token with no `repo` scope (public repos only). Per explicit direction, this ships with no database changes: a new "Check archived"/"Hide archived" toggle triggers an on-demand, ephemeral POST to /api/repos/check-archived, which calls GitHub's REST API in parallel per repo (mirroring the existing listUserOrgs/listOrgMembers pattern in lib/github.ts) using the logged-in user's own token, and returns results that live only in component state — nothing persisted, nothing runs automatically on page load. Private repos (403/404) come back "unknown", not archived. The button is disabled with an explanatory tooltip when the session has no GitHub-linked token. Reuses normalizeRepoSlug (already exported from lib/integrations/datadog/sync.ts, already tested) to match a repo's remote_url back to the API response. Co-Authored-By: claude-code_2-1-238_agent <claude-code_2-1-238_agent@iris.invalid>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Build failed: repo-list.tsx ("use client") imported normalizeRepoSlug
from lib/integrations/datadog/sync.ts, which transitively imports
lib/supabase.ts (server-only, uses next/headers) via decryptCredentials.
Importing anything from that file — even one dependency-free function —
drags its whole module graph into the client bundle, and Turbopack
correctly refuses to ship next/headers to the browser.
Moved normalizeRepoSlug to a new lib/repo-slug.ts with zero
dependencies. sync.ts now imports it from there and re-exports it
(so the existing datadog-sync.test.ts import path keeps working
unchanged); repo-list.tsx and github.ts import the new module
directly instead of going through sync.ts.
Verified with a local `npm run build` using the same placeholder env
vars CI uses — reproduced the original failure, confirmed this fixes it.
Co-Authored-By: claude-code_2-1-238_agent <claude-code_2-1-238_agent@iris.invalid>
This was referenced Aug 26, 2026
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
Follow-up to a bulk-analysis CLI script (
scripts/list_active_repos.py,--stale/--include-archived) that never touched the real product — this adds the equivalent to the actual/[tenant]/reposdashboard page.Stale filter (no push in 90d+) — pure client-side, zero new data or queries.
RepoListalready receiveslast_run_atper repo via the existinggetOrgReposSummaryload. A repo with nolast_run_atat all counts as stale too. Note the same caveat the CLI script already documents: this is lastirispush time, not literal last-commit time — no per-commit date survives into the stored payload (only week-level commit counts).Archived filter (GitHub status) — the platform has no stored column for this and no durable GitHub credential to background-sync it (only a session-scoped OAuth token, no
reposcope → public repos only). Per explicit direction, no database changes in this PR. Instead:checkArchivedStatus()inlib/github.ts, mirroring the existinglistUserOrgs/listOrgMembers"one call per item, parallelized" pattern already used in that file.POST /api/repos/check-archivedroute, mirroring/api/auth/github-orgsexactly (same auth/error shape).RepoList's toolbar triggers the check on first use (not automatically on page load — that would reintroduce the exact "dashboard does expensive work on every load" problem [BUG] Dashboard principal demora muito para carregar as informações #180/Eliminate N+1 query in getOrgChangeDetections #195 just fixed). Results live only in component state: nothing persisted, re-fetched fresh every time. Matched repos,remote_url→normalizeRepoSlug(already exported + tested inlib/integrations/datadog/sync.ts) → GitHub API path.Test plan
npx tsc --noEmit— cleannpx eslinton all touched/new files — 0 errors. One pre-existing-pattern warning (react-hooks/purityon aDate.now()call in the server componentrepos/page.tsx) — already present elsewhere in this codebase for the identical pattern (team/page.tsx:103), not a new regression.npx vitest run— 269 passed. No new tests added:lib/github.tshas zero existing test coverage (external API wrapper, consistent with this codebase's convention of not unit-testing that layer), andnormalizeRepoSlugreuse is already covered byplatform/tests/datadog-sync.test.ts.OrgTimeline/N+1 PRs: needs a live Supabase + GitHub-OAuth session to exercise for real. Recommend a preview-deploy check before merge, especially for the archived-check flow (real GitHub API round-trip).🤖 Generated with Claude Code