Skip to content

Scope the inbox issue lookups to one workspace - #254

Merged
imshashank merged 1 commit into
mainfrom
fix/scope-inbox-lookups
Aug 8, 2026
Merged

Scope the inbox issue lookups to one workspace#254
imshashank merged 1 commit into
mainfrom
fix/scope-inbox-lookups

Conversation

@imshashank

@imshashank imshashank commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #244. These two changes were reviewed and written as part of that work but were left out of the merge: the commit existed locally and was never pushed, so #244 merged the state before it. This lands them.

Scope the batch resolvers

list_notifications resolves each row's issue in two batched lookups, and neither was scoped to the caller's workspace. They relied on the invariant that a notification and its entity are written together with the same organization, which does hold, so this was never a cross-workspace leak.

It is still wrong. The comparable resolver in issues.ts runs downstream of getIssue, which has already applied the org and policy checks; these run on raw notification rows with no check at all, and they return the issue's current title. So an account removed from a team still resolves fresh titles for its old notifications, which get_issue would refuse. Both tables carry organization_id, so the predicate is two lines.

Make the type-filter test real

The existing test asserted over an array that was always empty: nothing in the fixture ever produced a second notification type, so [].every(...) passed trivially and the filter was never exercised. It now creates an assigned issue so a differently-typed notification exists, and asserts both that the filtered type comes back and that the other one does not.

Greptile Summary

The PR scopes notification issue and comment resolution to the caller’s workspace and strengthens the notification type-filter test.

  • Adds organization predicates to batched comment and issue lookups.
  • Passes the authenticated principal’s organization into both resolvers.
  • Creates a second notification type and verifies filtered and unfiltered results explicitly.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or test-reliability issues identified.

The new predicates align with existing non-null organization relationships and notification scoping, while the revised test synchronously creates and meaningfully distinguishes both notification types.

Important Files Changed

Filename Overview
packages/mcp-server/src/tools/inbox.ts Correctly adds workspace scoping to both batched entity lookups without changing valid notification resolution.
packages/mcp-server/tests/tools/inbox.test.ts Makes type-filter coverage non-vacuous by creating an assignment notification and checking both inclusion and exclusion.

Reviews (1): Last reviewed commit: "fix(mcp): scope the inbox issue lookups ..." | Re-trigger Greptile

The two batch resolvers behind list_notifications read raw comment and
issue rows by primary key. Nothing upstream checks them: getIssue's
policy check guards the issues.ts path, not this one. So an account
removed from a team keeps its old notifications, and those rows went on
resolving fresh issue titles that getIssue would refuse. Both tables
carry organization_id, so both lookups now carry the predicate.

The "filters by type" test asserted nothing. No assignment ever happened
in that fixture, so the array came back empty and every() was trivially
true. It now creates an issue_assigned notification, asserts the filtered
page is not empty, asserts that notification comes back, and asserts the
mention does not while still being there unfiltered.
@vercel

vercel Bot commented Aug 8, 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 8, 2026 7:31pm

Request Review

@imshashank
imshashank requested a review from pulkitxm as a code owner August 8, 2026 19:30
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@imshashank, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ec88e3c5-e0a1-4839-bbb1-e411ec47df7b

📥 Commits

Reviewing files that changed from the base of the PR and between 373ca37 and 1c1ac35.

📒 Files selected for processing (2)
  • packages/mcp-server/src/tools/inbox.ts
  • packages/mcp-server/tests/tools/inbox.test.ts

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.

@github-actions github-actions Bot added tests Test coverage and test infrastructure area: mcp The MCP server, its tools and its OAuth labels Aug 8, 2026
@imshashank
imshashank merged commit b276ebe into main Aug 8, 2026
14 checks passed
@imshashank
imshashank deleted the fix/scope-inbox-lookups branch August 8, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp The MCP server, its tools and its OAuth tests Test coverage and test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant