Skip to content

perf(renderer): share retained TabBar projections - #10094

Merged
nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/perf-scan-7-22
Jul 23, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/perf-scan-7-22

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Description

  • Share TabBar's native-chat agent/layout projections through one renderer-local selector instead of rebuilding them in every retained TabBar.
  • Keep the existing pure projection functions as behavior oracles, stabilize equal derived records, and invalidate from the immutable status/layout map identities already used by the store.
  • Return one frozen empty result without scanning either map while native chat is disabled (the default), and release enabled-cache references when the feature is turned off.
  • Add deterministic operation-count, cache-transition, selector-equivalence, and exact production-wiring coverage.

ELI5

Previously, every retained tab strip reread the same two address books whenever Orca published state. Now the first strip makes one small answer sheet and the others reuse it. If native chat is off, Orca does not open either address book at all.

Proof of zero regression

  • Three independent final reviews—performance, correctness, and platform/SSH/maintainability—report no issues.
  • pnpm test: 3,258 files and 34,732 tests passed; 7 files and 57 tests retain the suite's existing skips.
  • Related tab-bar/native-chat behavior: 36 files, 248/248 tests passed.
  • pnpm run typecheck: node, CLI, and web projects passed.
  • Touched-file oxlint/oxfmt, max-lines ratchet, localization coverage, and git diff --check passed.
  • Tests cover pure-selector parity, active/split/hydrating leaf routing, partial state, status-only updates, enable → disable → re-enable transitions, cache release, Zustand identity behavior, and the exact selector passed by production TabBar.
  • Cross-platform/SSH: this is renderer-local projection reuse. It adds no timers, I/O, paths, IPC, Git commands, or provider-specific behavior; native, WSL, SSH, and web-session mirrors continue to feed the same immutable store snapshots.

Known unrelated baseline gates:

  • Full pnpm run lint reaches the pre-existing verify:skill-bundle-manifest failure for released orca-cli revision 9 history.
  • Direct verify:localization-catalog reports pre-existing missing keys in NewWorkspaceComposerCard.tsx, SshHostAdvancedFields.tsx, and sleep-worktree-flow.ts.
  • This diff changes no skill snapshot or UI/localization string.

Proof of performance improvement

Deterministic local benchmark: 100 retained consumers, 500 statuses, 250 layouts, 5 trials.

Metric per shared publication Before After Change
Enabled median elapsed time 38.81 ms 0.45 ms 98.8% lower
Status-map enumerations 100 1 99% fewer
Layout-map enumerations 200 2 99% fewer
Default-disabled map enumerations N/A 0 No projection work

The tracked deterministic tests enforce the operation-count result. The cache retains only the latest input/output tuple and drops raw and derived references when native chat is disabled.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ee9b9e86-a1e9-4fcb-be59-8ee6d8b1dbdf

📥 Commits

Reviewing files that changed from the base of the PR and between 8cb0b8d and 7b2e33b.

📒 Files selected for processing (4)
  • src/renderer/src/components/tab-bar/TabBar.context-menu.test.ts
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts
  • src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.ts

📝 Walkthrough

Walkthrough

Tab bar projection logic now uses reusable projection helpers and a cached selector gated by experimental native chat. The selector normalizes inputs, preserves referential equality for unchanged projections, tracks projection scans through optional callbacks, and exposes a default instance. TabBar consumes the consolidated selector for native-chat state and projection maps. Tests cover scan sharing, targeted invalidation, input normalization, enablement lifecycle, disabled-state scan avoidance, and selector wiring.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change and validation, but it omits several required template sections like Summary, Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections and include screenshots or 'No visual change', detailed testing, AI review, security audit, and notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main renderer performance change and matches the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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 c445f26 into stablyai:main Jul 23, 2026
2 checks passed
@nwparker
nwparker deleted the nwparker/perf-scan-7-22 branch July 23, 2026 05:17
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.

1 participant