Skip to content

Say a repository is untracked instead of blaming branch naming - #269

Merged
imshashank merged 3 commits into
mainfrom
shashank/nov-197-say-a-repository-is-untracked-instead-of-blaming
Aug 9, 2026
Merged

imshashank merged 3 commits into
mainfrom
shashank/nov-197-say-a-repository-is-untracked-instead-of-blaming

Conversation

@imshashank

@imshashank imshashank commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

The pull requests page told an admin, with confidence, that no branch names an issue. It could not know that. The workspace it was rendering for had Noveum/orbit connected to GitHub but never tracked in Orbit, so every pull_request delivery for it was answered like this:

{"ok":true,"actions":0,"ignored":"repository_not_connected"}

GitHub recorded a 200 for all of them. Nothing looked wrong from either side, and the page pointed at branch naming, which was the wrong thing to go and fix.

The mistake in githubReach

It asks an org-wide question:

return tracked.some((row) => active.has(row.integrationId)) ? 'connected' : 'no_repositories';

Any one enabled repository sync row sharing an active installation returns connected. Three unrelated repositories were associated, so the workspace looked healthy while the repository actually being worked in was invisible to the check. The signal that mattered, "GitHub can see repositories nobody switched on", was never computed.

What changes

A new reach state sits between connected and no_repositories:

Reach Meaning
no_repositories nothing is switched on at all
repositories_untracked something is switched on, but GitHub can also see repositories that are not
connected everything GitHub can see is tracked, so naming really is the remaining variable

Its copy says the part that was missing: a delivery from an untracked repository is dropped on arrival and GitHub reports it as accepted.

Two exclusions, so the state means something. An archived repository and one only a suspended installation can see are both left out, because neither will ever open a pull request and nagging about them would train people to ignore the state.

The empty state also always offers the route to /settings/integrations. The previous final branch omitted the action entirely, so an admin who reached the page had nowhere to go.

PullsEmptyState became a lookup rather than a chain of conditionals. Adding a fifth branch to the chain crossed the cognitive complexity limit, and the copy for five states reads better as a table than as nested returns.

Cost

One extra indexed query, and only on the path that was about to return connected. Every other reach state returns before it.

Tests

9 new. 5 against a real database on githubReach, of which 3 are false positive guards: an archived repository, a repository only a suspended installation can see, and the case where nothing is tracked at all must all stay off the new state. 4 on the empty state, covering the new copy, the admin action, and the member who cannot act on it.

Checked that they fail without the change: reverting the two source files takes 24 passing to 20 passing and 4 failing, and the 4 are exactly the ones asserting new behaviour.

bun run verify green.

Not in this PR

Associating a repository does not backfill the pull requests that already exist, because applyGithubEvent is the only writer of git_link and the webhook route is its only caller. A workspace that fixes its association sees the page fill up from the next event, not immediately. That is worth its own issue rather than a change here.

Greptile Summary

This PR distinguishes repositories visible to active GitHub installations but not tracked by Orbit, replacing misleading branch-naming guidance with an actionable repository-tracking state.

  • Adds repositories_untracked reach detection while excluding archived repositories and suspended installations.
  • Refactors empty-state copy into a typed lookup and consistently offers eligible administrators an integrations action.
  • Adds database-backed reach tests and rendering tests for the new guidance and permissions behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/web/src/features/pulls/data.ts Adds organization-scoped catalogue comparison and the new repository-reach classification without leaving the previously raised catalogue-consistency concern outstanding.
apps/web/src/features/pulls/pulls-view.tsx Centralizes typed empty-state content and renders state-appropriate descriptions and administrator actions.
apps/web/tests/features/pulls/github-reach.test.ts Covers untracked, fully tracked, archived, suspended-installation, and no-tracked-repository reach scenarios.
apps/web/tests/features/pulls/pulls-view.test.tsx Verifies the revised guidance, integrations link, and member-versus-administrator behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Evaluate GitHub installations] --> B{Any installations?}
  B -- No --> C[not_installed]
  B -- Yes --> D{Any active installation?}
  D -- No --> E[suspended]
  D -- Yes --> F{Any tracked repository on an active installation?}
  F -- No --> G[no_repositories]
  F -- Yes --> H{Active non-archived visible repository is untracked?}
  H -- Yes --> I[repositories_untracked]
  H -- No --> J[connected]
Loading

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

…aming

githubReach was org wide: it returned "connected" when any enabled
repository sync row shared an active installation. With three unrelated
repositories associated and the repository actually being worked in not
associated at all, the empty pull requests page asserted a cause it
cannot know, that no branch names an issue.

The real cause was that the repository was never tracked, so every
pull_request delivery returned repository_not_connected while GitHub
recorded a 200. Nothing looked wrong from either side.

Reach now separates "everything GitHub can see is tracked" from "GitHub
can see repositories nobody switched on", and the new state says plainly
that those deliveries are dropped on arrival. Archived repositories and
those only a suspended installation can see are excluded, because
neither will ever open a pull request.

The empty state also always offers the route to the integrations page,
which the previous final branch omitted, leaving an admin who reached it
with nowhere to go.

NOV-197
@imshashank
imshashank requested a review from pulkitxm as a code owner August 9, 2026 10:08
@vercel

vercel Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orbit Ready Ready Preview Aug 9, 2026 10:46am

Request Review

@github-actions github-actions Bot added tests Test coverage and test infrastructure area: web The Next.js app and its UI labels Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request adds repositories_untracked to GitHub reach detection. It checks active, visible, non-archived repositories against tracked repositories and updates the pull request empty state and tests for each reach condition.

Changes

GitHub reach status

Layer / File(s) Summary
Reach detection and repository coverage
apps/web/src/features/pulls/data.ts, apps/web/tests/features/pulls/github-reach.test.ts
githubReach now distinguishes tracked repositories, untracked repositories, and no repositories. Tests cover archived repositories, suspended installations, and empty tracking states.

Pull request empty state

Layer / File(s) Summary
Reach-specific empty-state rendering
apps/web/src/features/pulls/pulls-view.tsx, apps/web/tests/features/pulls/pulls-view.test.tsx
PullsEmptyState centralizes copy for each reach state and preserves integration actions only for users with integration-management permission. Tests cover untracked repositories and restricted members.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullsView
  participant githubReach
  participant RepositoryDatabase
  PullsView->>githubReach: request GitHub reach state
  githubReach->>RepositoryDatabase: query tracked and visible repositories
  RepositoryDatabase-->>githubReach: return repository sets
  githubReach-->>PullsView: return reach classification
Loading

Possibly related PRs

  • Noveum/orbit#36: Introduced the GitHub pull-request integration extended by this repository-tracking status work.
  • Noveum/orbit#73: Added GitHub repository discovery and picker flows related to repository tracking.
  • Noveum/orbit#249: Added the GithubReach classification extended with repositories_untracked.

Suggested reviewers: pulkitxm

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: identify untracked repositories instead of attributing the issue to branch naming.
Description check ✅ Passed The description directly explains the new reach state, empty-state messaging, permission behavior, tests, and scope limitations.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shashank/nov-197-say-a-repository-is-untracked-instead-of-blaming

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread apps/web/src/features/pulls/data.ts Resolved
…or another

Measured against the workspace this was written for, the new state was
permanently true: 9 of 24 unarchived repositories are tracked, and the
other 15 are deliberately not. reachableButUntracked therefore never
returns false, the untracked copy renders forever, and the copy for a
fully tracked workspace becomes unreachable.

That repeats the original mistake in a new place. The page asserted
naming was the cause and could not know it; asserting the repository is
the cause is wrong in exactly the same way, because an untracked
repository is usually a deliberate choice rather than an oversight.

Both conditions are now stated together, so the page says what has to be
true instead of ruling on which one failed. The part worth keeping is
the part nobody could have guessed: a delivery from an untracked
repository is dropped while GitHub still reports it accepted.

NOV-197
…a-repository-is-untracked-instead-of-blaming
@imshashank
imshashank merged commit 6f8d75f into main Aug 9, 2026
13 checks passed
@imshashank
imshashank deleted the shashank/nov-197-say-a-repository-is-untracked-instead-of-blaming branch August 9, 2026 10:52

This branch was successfully deployed

1 active deployment
Preview — 5316507f Deployed Aug 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: web The Next.js app and its UI tests Test coverage and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant