Skip to content

refactor(app): extract session share command owner#678

Merged
Astro-Han merged 1 commit into
devfrom
codex/session-commands-share-owner
May 16, 2026
Merged

refactor(app): extract session share command owner#678
Astro-Han merged 1 commit into
devfrom
codex/session-commands-share-owner

Conversation

@Astro-Han
Copy link
Copy Markdown
Owner

Summary

Extract the session share/unshare command flow out of use-session-commands.tsx into a focused owner module.

Touched files:

  • packages/app/src/pages/session/use-session-commands.tsx
  • packages/app/src/pages/session/session-share-command.ts
  • packages/app/src/pages/session/session-share-command.test.ts

Why

This is a #601 message-flow governance slice for the oversized use-session-commands.tsx file. The share/unshare clipboard, toast, and SDK flow was embedded inside the command registry hook, making that hook harder for another agent to scan. This PR moves that responsibility behind a small command owner with direct tests while preserving the public command behavior.

Related Issue

Refs #601.
Parent: #599.

Dependency Status

Independent flat PR on dev.

This PR does not depend on #667/#669/#670/#671/#672/#674/#675/#676/#677/#673 and does not touch files currently owned by those flat PRs. It should be reviewed as a standalone #601 command-owner extraction.

Review order: can be reviewed after #667 for governance context, but does not need to wait for the message-timeline stack or the SessionTurn short stack.

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

  • Confirm use-session-commands.tsx still wires share/unshare commands to the same session id, existing share url, SDK client, language, and toast behavior.
  • Confirm session-share-command.ts owns only share/unshare command behavior and browser clipboard fallback, not unrelated command groups.
  • Confirm the test coverage locks existing-url copy, new share creation, share failure, copy failure, unshare success, and unshare failure.

Architecture Effect

  • owner extracted
  • verification added
  • behavior preserved
  • LOC reduced: use-session-commands.tsx 618 -> 548 physical LOC in this PR
  • new extracted owner is 122 LOC, test file is 165 LOC

Risk Notes

Behavior is intended unchanged. Main risk is share/unshare toast or clipboard regression; the new tests cover existing-url copy, create-share copy, failure to create a share, clipboard failure, unshare success, and unshare failure. No visible UI, dependency, persistence, platform, updater, packaging, or permission change.

How To Verify

Install in new worktree: pass
bun install --frozen-lockfile

Focused tests: 8 pass, 0 fail
bun test --preload ./happydom.ts src/pages/session/session-share-command.test.ts src/pages/session/use-session-commands.test.ts

Typecheck: 8 successful, 8 total
bun run typecheck

Diff check: pass
git diff --check

Screenshots or Recordings

Not applicable. This is a behavior-preserving command-owner extraction with no visible UI or copy change.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, primary area, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@Astro-Han has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 8 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 900e0fa6-42bf-4b5d-8957-ec2fc93387cf

📥 Commits

Reviewing files that changed from the base of the PR and between 03140f7 and 7d0c343.

📒 Files selected for processing (3)
  • packages/app/src/pages/session/session-share-command.test.ts
  • packages/app/src/pages/session/session-share-command.ts
  • packages/app/src/pages/session/use-session-commands.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/session-commands-share-owner

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 and usage tips.

@github-actions github-actions Bot added app Application behavior and product flows ui Design system and user interface labels May 16, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Suggested priority: P2 (includes user-path files (packages/app/src/pages/session/session-share-command.test.ts, packages/app/src/pages/session/session-share-command.ts, packages/app/src/pages/session/use-session-commands.tsx)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@github-actions
Copy link
Copy Markdown

Perf delta summary

Comparator: pass

Profile / Scenario interaction median interaction worst long task max tbt frame gap p95 frame gap max jank count cls status
default / homepage-cold 32 -> 24 (-8) 48 -> 64 (+16) 78 -> 62 (-16) 28 -> 12 (-16) 33.4 -> 16.8 (-16.6) 150 -> 133.4 (-16.6) 3 -> 3 (0) 0 -> 0 (0) pass
default / long-session-input-lag 48 -> 48 (0) 48 -> 72 (+24) 0 -> 0 (0) 0 -> 0 (0) 16.7 -> 16.7 (0) 16.8 -> 16.8 (0) 0 -> 0 (0) 0 -> 0 (0) pass
default / session-streaming-long 48 -> 48 (0) 64 -> 56 (-8) 0 -> 0 (0) 0 -> 0 (0) 33.3 -> 16.8 (-16.5) 33.4 -> 33.3 (-0.1) 0 -> 0 (0) 0 -> 0 (0) pass
default / tool-call-expand 16 -> 16 (0) 16 -> 24 (+8) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.7 (-0.1) 16.8 -> 16.7 (-0.1) 0 -> 0 (0) 0 -> 0 (0) pass
default / tool-default-open-heavy-bash 24 -> 24 (0) 24 -> 24 (0) 63 -> 64 (+1) 13 -> 15 (+2) 50 -> 50 (0) 116.7 -> 100 (-16.7) 2 -> 2 (0) 0 -> 0 (0) pass
default / terminal-side-panel-open 48 -> 40 (-8) 56 -> 48 (-8) 0 -> 0 (0) 0 -> 0 (0) 33.4 -> 33.3 (-0.1) 33.4 -> 33.3 (-0.1) 0 -> 0 (0) 0 -> 0 (0) pass
default / session-scroll-reading 24 -> 16 (-8) 32 -> 24 (-8) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.8 (0) 16.8 -> 16.8 (0) 0 -> 0 (0) 0.505 -> 0.505 (0) warn: cls
low-end / session-scroll-reading-long 64 -> 64 (0) 72 -> 88 (+16) 69 -> 85 (+16) 48 -> 53 (+5) 16.8 -> 16.8 (0) 66.7 -> 200 (+133.3) 3 -> 4 (+1) 0.016 -> 0.016 (0) warn: frame_gap_max_ms_delta
low-end / session-timeline-recompute 136 -> 120 (-16) 136 -> 136 (0) 109 -> 106 (-3) 189 -> 171 (-18) 83.4 -> 100 (+16.6) 183.3 -> 183.3 (0) 4 -> 3 (-1) 0.081 -> 0.081 (0) pass
low-end / concurrent-shimmer-extreme 0 -> 0 (0) 0 -> 0 (0) 0 -> 0 (0) 0 -> 0 (0) 16.8 -> 16.8 (0) 33.4 -> 16.8 (-16.6) 0 -> 0 (0) 0 -> 0 (0) pass

@Astro-Han
Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Astro-Han Astro-Han merged commit b4234b6 into dev May 16, 2026
27 checks passed
@Astro-Han Astro-Han deleted the codex/session-commands-share-owner branch May 16, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant