Skip to content

perf(issues): read only the selected project tracker binding - #40587

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
Adamulek123:perf/issues-project-binding
Nov 21, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
Adamulek123:perf/issues-project-binding

Conversation

@Adamulek123

Copy link
Copy Markdown
Contributor

Problem

Opening a GitHub issue or loading another comments page reads and decodes every project’s standalone tracker binding. The SQLite and schema work grows with the number of unrelated project bindings, including their additional team scopes.

Change

Why it happens. The issue service already selects one project when resolving a detail or comment request. Its binding repository still runs the workspace-wide query.

What changed. Pass the selected project ID down to SQLite and use the existing primary key. Workspace-wide issue listings and tracker settings still use a single full snapshot. Reads stay fresh on every operation.

Scope

Server-side issue binding lookups for web, desktop, mobile, and MCP. The query uses the existing schema. A malformed row still fails when the selected project owns it or a workspace-wide read includes it. A malformed row for an unrelated project no longer blocks a valid selected read.

Verification

Compared committed server code on an in-memory SQLite database with the production migrations and a controlled GitHub detail reply. Each arm ran 300 measured detail reads per workload. The exact detail results and provider attempt counts matched, including a failed read and retry. The fixture also checked an edited binding, a missing project, and a workspace listing.

Unrelated bindings with the selected project unbound Main p50 Branch p50
0 0.103 ms 0.165 ms
50 0.308 ms 0.120 ms
500 1.604 ms 0.078 ms
2,500 8.532 ms 0.077 ms

At 500 bindings, unbound p95 fell from 2.433 ms to 0.136 ms. One empty-table candidate process had a noisy tail. Both empty-table runs stayed within 0.1 ms of main at the median. The timed endpoint was the issue service result. GitHub network latency and browser paint were outside the measurement.

  • The Issues service, Issues MCP handler, and binding migration suites passed all 16 tests.
  • The SQLite test covers editing a binding and isolation from an unrelated malformed row. It also verifies failure when explicitly reading that row or the full workspace.
  • Server typecheck and targeted lint and formatting passed.

GPT-6.2 Sol via Codex.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The binding repository now accepts an optional project ID and filters its results when provided. Issue services and test fixtures use the updated listing function.

Changes: Issue tracker binding listing

Layer / File(s) Summary
Binding query and validation
apps/server/src/persistence/IssueTrackerBindings.ts, apps/server/src/persistence/Migrations/103_IssueTrackerAdditionalScopes.test.ts
The repository list function accepts an optional project ID and filters rows when one is supplied. The migration test checks project-specific reads and invalid scope data.
Caller and test updates
apps/server/src/issue/IssueService.ts, apps/server/src/issue/IssueService.test.ts, apps/server/src/issue/IssueTrackerConnections.ts, apps/server/src/mcp/toolkits/issues/handlers.test.ts
listProjects passes its optional project ID to the repository. IssueTrackerConnections.list invokes the repository function. Test fixtures use the updated function shape.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: bil0000, juliusmarminge

Merge Risk: Minimal · up to b9c90

This change makes project-scoped issue binding lookups read only the selected project's binding, which reduces unnecessary work. Workspace-wide reads still read all bindings. No remaining merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "perf(issues): read only the selected project tracker binding" matches the main change. The PR passes the selected project ID into the binding repository's list query so SQLite reads only th…
Description check Passed The description follows the template sections: Problem, Change, Scope, and Verification. It explains the cause (the binding repository runs a workspace-wide query even when a project is selected), the…
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.
Full details: Title check

Explanation

The title "perf(issues): read only the selected project tracker binding" matches the main change. The PR passes the selected project ID into the binding repository's list query so SQLite reads only that project's binding, instead of decoding every project's binding. The title follows conventional commit form and names the performance goal and the scope.

Full details: Description check

Explanation

The description follows the template sections: Problem, Change, Scope, and Verification. It explains the cause (the binding repository runs a workspace-wide query even when a project is selected), the change (the selected project ID is passed to SQLite and the primary key is used), and the scope (web, desktop, mobile, and MCP lookups). Verification gives focused tests, a benchmark table, and observed results, and it notes what was not measured (GitHub network latency and browser paint). The description does not link an issue, and the Scope section asks for one for bug fixes. The template also asks for a note on the agent and model used, which the author supplied (GPT-6.2 Sol via Codex). The Scope section should link the issue that shows the bug, or state why none is needed, because the PR is labeled perf rather than fix.

Resolution

Optionally add a link to the issue or explain why no issue is needed, since the Scope section asks for this. Note that the author describes this as a performance change and not a bug fix, so the Scope wording may need a short justification.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 07bf236 and b9c9025.

Files selected for processing: 1

  • apps/server/src/persistence/Migrations/103_IssueTrackerAdditionalScopes.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 21, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Measured real Linux servers through authenticated HTTP/WebSocket RPC with synthetic GitHub HTTP responses. Each workload used fresh state: create the selected GitHub project, bind N unrelated ids, read detail and two older comments, then run 30 warmups and 300 measured detail reads. Three repetitions per commit.

Before After
7b21adbe7c b9c9025ac0
Full measurement output Full measurement output
500 bindings: binding-resolution p50 median 2.066 ms 500 bindings: 0.254 ms
2,500 bindings: binding-resolution p50 median 10.908 ms 2,500 bindings: 0.344 ms
2,500 bindings: RPC p50 median 18.472 ms 2,500 bindings: 5.552 ms

At 500 bindings, the binding-resolution improvement was 1.812 ms versus run-median spreads of 1.090 ms before and 0.177 ms after. At 2,500, improvement was 10.564 ms versus spreads of 5.539 ms and 0.230 ms. The 2,500-binding RPC improvement was 12.919 ms, exceeding the larger run spread of 11.047 ms.

All 7,200 measured details matched after normalizing projectId. Every run returned two older comments and made exactly 331 provider detail requests for 331 reads, with one comments request and no unexpected requests. Traces show the full-table binding SELECT before and WHERE project_id = ? after.

Before and after issue-read timings, including all three run medians

Driver script · Reproduction bundle · Raw measurements

Not shown:

  • The PR's exact absolute microbenchmark figures were not reproduced; this measurement includes the real server, tracing, credential resolution and synthetic GitHub HTTP transport.
  • At 500 bindings, the end-to-end RPC improvement did not exceed between-run spread; the isolated binding-resolution improvement did. At 2,500 bindings, both metrics exceeded their respective spreads.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 21, 2026
@juliusmarminge
juliusmarminge merged commit b5709bb into pingdotgg:main Nov 21, 2026
58 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants