Skip to content

fix: exact maintainer status check with negative-cache lockdown (#871) - #876

Open
ionfwsrijan wants to merge 1 commit into
Coder-s-OG-s:mainfrom
ionfwsrijan:fix/issue-871-maintainer-status-exact-check
Open

fix: exact maintainer status check with negative-cache lockdown (#871)#876
ionfwsrijan wants to merge 1 commit into
Coder-s-OG-s:mainfrom
ionfwsrijan:fix/issue-871-maintainer-status-exact-check

Conversation

@ionfwsrijan

Copy link
Copy Markdown
Contributor

Problem

isUserMaintainer fetched only 20 installation users (.limit(20)) then filtered client-side, so a maintainer beyond the first 20 could be misclassified as a non-maintainer. Worse, a transient failure when the service client was missing cached a permanent "denied" answer, locking legitimate maintainers out.

Fix

  • src/lib/maintainer/detect.ts: the DB query now uses an exact EXISTS filter (.eq('github_installations.uninstalled_at', null).limit(1)); the client-side .some() truncation is gone.
  • A missing service client no longer writes a negative cache entry.
  • The negative cache is explicitly busted (cacheDel) during maintainer discovery and when an installation event (re)creates an install.

Files changed

  • src/lib/maintainer/detect.ts
  • src/inngest/functions/maintainer-discover.ts
  • src/inngest/functions/process-installation-event.ts
  • Test: detect.test.ts

Testing

  • Full MergeShip suite passes (tests, tsc, eslint).
  • New tests cover a maintainer at position >20 and the no-cache-on-missing-service case.

Closes #871

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@ionfwsrijan is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Hey @ionfwsrijan

You have 4 open PRs right now. The limit is 3 at a time.

Please get your existing PRs merged or closed before opening new ones:

This PR will remain open but won't be reviewed until you're under the limit. See our Contributing Guidelines for details.

@ionfwsrijan

Copy link
Copy Markdown
Contributor Author

@jakharmonika364 @Soumya-codr Please review this

@jakharmonika364 jakharmonika364 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core .eq(..., null) -> should-be .is(..., null) bug is a one-line fix but is severe: as written, this PR would make isUserMaintainer return false for 100% of users in production, a total maintainer-detection outage. Everything else in the diff (cacheDel cleanups) is correct and can stay as-is once that line is fixed.

@jakharmonika364 jakharmonika364 added the Needs author reply Author need to reply label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs author reply Author need to reply

Projects

None yet

2 participants