Repository navigation
perf(mobile): precompute Linear issue sort keys - #20249
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe change replaces pairwise mobile task and Linear issue comparators with array-level sorting helpers. Sorting consumers now call the shared helpers. New tests verify ordering, stability, immutability, setup costs, and parity. Two benchmark scripts compare output and runtime against baseline revisions. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Sorting behavior appears correct, but add identity assertions for empty and singleton repository sorting so a future regression that returns the input array is caught. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the implementation, rationale, performance results, and validation. However, it omits several required template sections, including the linked issue, visual proof or an explicit N/A explanation, AI disclosure, review, agent skill boundary, notes, and checklist confirmations. Resolution Add all required template sections. Include a valid issue reference under Linked Issue, provide visual proof or write N/A with a reason, complete Testing and Checklist items, address AI Disclosure, Review, Agent skill upstream boundary, and Notes. ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
ℹ️ No critical issues — one consistency nit inline.
Reviewed changes
- Batch Linear sorter —
mobile-tasks-reviewer-linear.tsreplaces thecompareLinearIssuescomparator withsortLinearIssues, computingtaskTime/priority rank once per issue and reusing a single numericIntl.Collatorfor identifier order. - Call sites —
groupLinearIssuesplus the view-projection and task-list-loading hooks now delegate tosortLinearIssues. - Tests — new
mobile-linear-sort.test.tspins ordering, stable/identity ties, per-passDate.parse/Intl.Collatorcounts, and empty/singleton no-ops against an independent oracle. - Benchmark — new
config/scripts/mobile-linear-sort-benchmark.mjsasserts old/new output parity and reports counterbalanced medians. - Parity fingerprints — three computation hashes refreshed; semantics/render/style hashes unchanged, confirming the change surface is limited to sorting.
Verified locally: 273 mobile task tests pass, tsc --noEmit is clean, the benchmark runs and its parity assertion holds, and the changed-code quality gate reports 0 findings. I also confirmed Intl.Collator with numeric: true is supported on Hermes for RN 0.83/Expo 55 and shares the same internal path as localeCompare(..., undefined, { numeric: true }), so the identifier ordering is not a runtime regression.
openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 1c8ef62d-1b22-4d79-9459-1dbe86a43fa4
📒 Files selected for processing (10)
config/scripts/mobile-linear-sort-benchmark.mjsconfig/scripts/mobile-task-sort-benchmark.mjsmobile/src/tasks/mobile-linear-sort.test.tsmobile/src/tasks/mobile-task-sort.test.tsmobile/src/tasks/mobile-tasks-refactor-parity.test.tsmobile/src/tasks/mobile-tasks-repository-presentation.tsmobile/src/tasks/mobile-tasks-reviewer-linear.tsmobile/src/tasks/use-mobile-tasks-picker-projection.tsxmobile/src/tasks/use-mobile-tasks-provider-view-projection.tsxmobile/src/tasks/use-mobile-tasks-task-list-loading.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
mobile/src/tasks/mobile-task-sort.test.ts (1)
85-88: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAssert fresh arrays for every short-input path.
Lines 85 and 87 only assert structural equality. An early return of the original array would pass for empty input and singleton
repositoryinput. Keep references to these inputs and assertnot.toBefor both modes.Proposed test update
- expect(sortMobileTaskItems([], 'repository', repos)).toEqual([]) + const empty: TaskItem[] = [] + expect(sortMobileTaskItems(empty, 'repository', repos)).toEqual([]) + expect(sortMobileTaskItems(empty, 'repository', repos)).not.toBe(empty) const one = [items[0]] expect(sortMobileTaskItems(one, 'repository', repos)).toEqual(one) + expect(sortMobileTaskItems(one, 'repository', repos)).not.toBe(one) expect(sortMobileTaskItems(one, 'updated', repos)).not.toBe(one)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 1c8ef62d-1b22-4d79-9459-1dbe86a43fa4
📒 Files selected for processing (10)
config/scripts/mobile-linear-sort-benchmark.mjsconfig/scripts/mobile-task-sort-benchmark.mjsmobile/src/tasks/mobile-linear-sort.test.tsmobile/src/tasks/mobile-task-sort.test.tsmobile/src/tasks/mobile-tasks-refactor-parity.test.tsmobile/src/tasks/mobile-tasks-repository-presentation.tsmobile/src/tasks/mobile-tasks-reviewer-linear.tsmobile/src/tasks/use-mobile-tasks-picker-projection.tsxmobile/src/tasks/use-mobile-tasks-provider-view-projection.tsxmobile/src/tasks/use-mobile-tasks-task-list-loading.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Merged the stacked base branch (#20233 unified task sorting) at its tip (
71468dd8) and reconciled the mobile-tasks parity fingerprints (EXPECTED_SCREEN_HOOKS/EXPECTED_STATEMENTS/EXPECTED_DECLARATIONS) for the combined source; the semantics/render/style hashes stayed unchanged. - Annotated the retained baseline
localeCompareoracle inmobile-linear-sort.test.tswith the repo-conventionalsort-comparator-performance/no-repeated-collatorsuppression, resolving the prior review's nit.
Verified on the new head: the focused refactor-parity/linear-sort/task-sort mobile suites pass (18 tests, including the reconciled fingerprints), the changed-code quality gate reports 0 findings across the 6 files, the disable directive is not flagged unused, and the merge preserves the base branch tree exactly (empty diff against nwparker/perf-mobile-task-sort-keys for the base-branch files).
openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
584dc8d to
0c195c9
Compare
Rebasing onto main surfaced two breakages that the earlier ratchet-only fix could not have caught, because it was computed against a base main had already superseded: - The parity oracle called compareLinearIssues, which #20249 deleted in favour of sortLinearIssues. Rewrote the oracle to use sortLinearIssues, matching what the production memo now calls, and dropped the stale mock override. - Regenerated EXPECTED_SCREEN_HOOKS and EXPECTED_STATEMENTS from an observed run on the rebased tree. Arity assertions (350 hooks, 417 statements) unchanged. mobile/src/tasks: 37 files, 295 tests pass.
* perf(mobile): reuse Linear grouping between list and board * test(mobile): realign parity oracle and ratchet with current main Rebasing onto main surfaced two breakages that the earlier ratchet-only fix could not have caught, because it was computed against a base main had already superseded: - The parity oracle called compareLinearIssues, which #20249 deleted in favour of sortLinearIssues. Rewrote the oracle to use sortLinearIssues, matching what the production memo now calls, and dropped the stale mock override. - Regenerated EXPECTED_SCREEN_HOOKS and EXPECTED_STATEMENTS from an observed run on the rebased tree. Arity assertions (350 hooks, 417 statements) unchanged. mobile/src/tasks: 37 files, 295 tests pass.

ELI5
Calculate each Linear issue’s sort values once, then reuse them while ordering the list.
Mobile Linear issue sorting repeats date parsing or numeric collation setup inside every comparison. Replace the comparator with a batch sorter used by loading, view projection, and grouping. Dates and priority ranks are computed once per issue; identifier sorting reuses one default-locale numeric collator. Empty/singleton lists skip setup.
Preserves descending updated time, priority-0 ranking, invalid-date fallback, numeric identifier order, stable ties, input immutability, and original issue objects. No RPC, provider, host, workspace, rendering, or persistence behavior changes.
Counterbalanced Node 24/macOS timings against
20ab9950654with exact output parity (synthetic inputs; not Hermes/device timings):Reproduce:
ORCA_BACKGROUND_LAUNCH=1 node config/scripts/mobile-linear-sort-benchmark.mjs 20ab9950654.Validation: 273 task tests pass, plus final focused tests after strengthening tie coverage; mobile typecheck and formatting pass, lint has no errors (the deliberately retained baseline comparator in the parity test triggers the performance advisory). Swedish/Turkish locale runs pass. Three operation-count regressions fail against the baseline comparator through an adapter and pass with the batch implementation. The original source-fingerprint suite passed on baseline; three computation fingerprints were refreshed for the intentional change. All fingerprint counts, runtime-string/semantic, render, and style guards remain unchanged.
Merge order
Stacked on #20233. Merge #20233 first, then retarget this PR to
main. Source fingerprints reflect both optimizations; 18 combined sorting/parity tests pass. The intentional baseline comparator is annotated for lint.