Skip to content

perf: index selected team IDs and choose primary team in one pass - #19504

Merged
nwparker merged 1 commit into
mainfrom
OrcaWin/perf-split-63-linear-team
Sep 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
OrcaWin/perf-split-63-linear-team

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​14 $\color{#cf222e}{\Huge{\mathbf{−}}}$​12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2

ELI5

When you filter the Linear issue list by team, Orca has to pick one "main" team to show details for. It picks the alphabetically-first team you selected — or, if you selected none, the alphabetically-first team that exists.

The old way was like sorting an entire deck of cards just to find the lowest card, and checking each card against your whole wishlist one by one. The new way walks the deck once and simply remembers the lowest card seen so far.

Nothing about which team gets picked changes — same team, same alphabetical order, same tie-breaks. It just gets there with less work.

What Changed / Why

  • Replaced two full Array.sort calls plus an Array.includes scan per team with a single linear pass and a Set lookup.
  • 1,000 teams: 500,500 selected-ID reads reduced to 1,000; selected and fallback ordering preserved.
  • Tie-break parity: Array.prototype.sort is stable, and the new min-scan uses a strict < 0 comparison, so ties still resolve to the earliest team in the original list.

This PR contains only this focused change and its regression coverage. It targets main independently of the other desktop audit PRs. Measurements describe operation/allocation reductions, not end-to-end latency gains.

Linked Issue

User-requested desktop performance audit; no issue supplied.

Visual Proof

N/A — no visual design change. Behavior and performance invariants are checked by automated regression tests.

Testing

  • 4 tests across 1 suite(s) passed on this isolated branch on macOS.
  • Differential test of old vs new implementation over 200,000 randomized inputs (0–5 teams, duplicate names, duplicate IDs, empty names, accented and numeric names, 0–3 selected IDs including unmatched ones): 200,000 cases, 0 divergences.
  • Full pnpm tc passed on this branch.
  • Commit hooks passed: oxlint, React Doctor lint and formatting; git diff --cached --check passed.
  • All tests ran with ORCA_BACKGROUND_LAUNCH=1. No visible test window was launched.
  • Full build and Windows/Linux/live SSH validation remain for CI; host/provider contracts are preserved.

Test files:

  • src/renderer/src/components/linear-issue-attribute-filter-primary-team.test.ts

Agent skill upstream boundary

  • No upstream skill-installer material copied or translated.

Checklist

  • Focused change with regression evidence.
  • Typecheck and pre-commit checks passed independently.
  • Cross-platform, folder-workspace and SSH ownership considered.
  • Full CI build and repository checks pass.

@nwparker
nwparker marked this pull request as ready for review September 8, 2026 04:53
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7dae5bd5-68ac-47dc-bf27-b3e0b83cd936

📥 Commits

Reviewing files that changed from the base of the PR and between 6642053 and a56b460.

📒 Files selected for processing (2)
  • src/renderer/src/components/linear-issue-attribute-filter-primary-team.test.ts
  • src/renderer/src/components/linear-issue-attribute-filter-primary-team.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.

@nwparker
nwparker merged commit d3baad2 into main Sep 8, 2026
29 of 33 checks passed
@nwparker
nwparker deleted the OrcaWin/perf-split-63-linear-team branch September 8, 2026 04:59

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Algorithm rewrite — resolveLinearIssueAttributeFilterPrimaryTeam now builds a Set of selected IDs and finds both the name/id-minimum available team and the name/id-minimum selected team in a single linear pass, replacing two full Array.prototype.sort calls and an O(n²) .includes scan. Return value (firstSelected ?? firstAvailable) is identical across all four original branches: empty teams, no selection, matched selection, and unmatched selection.
  • Tie-break parity — the strict < 0 comparison keeps the earliest team on equal (name, id), matching stable sort semantics.
  • Complexity regression test — a new test uses a Proxy to count selected-ID reads (<= 1000) and a name getter to count comparator reads (< 5000). Both assertions fail under the previous O(n²)+sort implementation and pass under the new one, so the test pins real behavior rather than absorbing it.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants