Skip to content

Auto-open Add Server on fresh installs#2

Open
louzt wants to merge 2 commits into
obbyworld:mainfrom
louzt:feat/onboarding-zero-server-modal
Open

Auto-open Add Server on fresh installs#2
louzt wants to merge 2 commits into
obbyworld:mainfrom
louzt:feat/onboarding-zero-server-modal

Conversation

@louzt
Copy link
Copy Markdown

@louzt louzt commented Apr 22, 2026

This reuses the existing Add Server modal on fresh installs so the app does not open into an empty shell when no servers are configured.

What changed:

  • add a small helper for the initial connect-modal decision
  • open Add Server automatically when there are zero configured servers
  • preserve the existing --setup behavior
  • add focused unit coverage for the decision logic

Why:

  • improves first-run onboarding with a minimal behavior change
  • keeps the existing Add Server flow intact instead of introducing a separate onboarding surface

Validation:

  • bun run test tests/unit/utils/initialSetup.test.ts

Summary by CodeRabbit

  • New Features

    • Enhanced initial app startup to intelligently determine when to display the connection setup modal based on server configuration status or setup mode.
  • Tests

    • Added unit tests validating the initial setup modal behavior across different server configuration scenarios.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@louzt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 4 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 46 minutes and 4 seconds.

⌛ 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ee8ccc4-b30f-4ed7-b3a0-ccd3a8af10a0

📥 Commits

Reviewing files that changed from the base of the PR and between 2681403 and 6cbbc26.

📒 Files selected for processing (2)
  • src/utils/initialSetup.ts
  • tests/unit/utils/initialSetup.test.ts
📝 Walkthrough

Walkthrough

This change introduces conditional initialization logic that automatically opens the "connect" modal on app startup when either setup mode is enabled OR no servers are configured, enabling a guided onboarding experience for fresh installations.

Changes

Cohort / File(s) Summary
Initial Setup Modal Logic
src/App.tsx, src/utils/initialSetup.ts
Introduces shouldOpenInitialConnectModal utility function that returns true when setup mode is active or server count is zero. App.tsx uses this function to conditionally open the connect modal on startup via setTimeout, replacing previous unconditional setup-mode gating.
Unit Tests
tests/unit/utils/initialSetup.test.ts
New test suite with three test cases covering the modal-opening decision logic: setup mode enabled, fresh install (zero servers), and configured installation scenarios.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hop, hop! When servers are few or the mode is set,
A modal pops up—the user's best bet!
Fresh starts need guidance, we rabbits all know,
So we condition the check for a smooth setup flow! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Auto-open Add Server on fresh installs' accurately describes the main change: automatically opening the Add Server modal when there are zero configured servers on first run.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
tests/unit/utils/initialSetup.test.ts (1)

4-22: Consider one more case: setupMode: undefined.

The type allows boolean | undefined, and App.tsx passes globalThis.__SETUP_MODE__ (possibly undefined) through. A case covering { setupMode: undefined, configuredServerCount: 2 } → false would lock in the Boolean(setupMode) coercion contract and prevent regressions if someone later switches to !setupMode or similar.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/utils/initialSetup.test.ts` around lines 4 - 22, Add a test
covering setupMode being undefined to assert the function's coercion behavior:
update the shouldOpenInitialConnectModal tests to include a case like
expect(shouldOpenInitialConnectModal({ setupMode: undefined,
configuredServerCount: 2 })).toBe(false) so the contract of Boolean(setupMode)
is locked in; reference the shouldOpenInitialConnectModal function in the test
file and add the new it block verifying undefined behaves like false.
src/utils/initialSetup.ts (1)

1-11: Small API polish: export the options interface.

InitialSetupOptions is only used internally today, but exporting it makes the helper easier to compose from callers/tests (e.g., building the options object in App.tsx with a typed variable). Purely optional.

♻️ Proposed tweak
-interface InitialSetupOptions {
+export interface InitialSetupOptions {
   setupMode: boolean | undefined
   configuredServerCount: number
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/initialSetup.ts` around lines 1 - 11, Export the
InitialSetupOptions interface so callers/tests can import the type when calling
shouldOpenInitialConnectModal; update the declaration of InitialSetupOptions to
be exported (export interface InitialSetupOptions) and keep the existing
shouldOpenInitialConnectModal signature and behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/utils/initialSetup.ts`:
- Around line 1-11: Export the InitialSetupOptions interface so callers/tests
can import the type when calling shouldOpenInitialConnectModal; update the
declaration of InitialSetupOptions to be exported (export interface
InitialSetupOptions) and keep the existing shouldOpenInitialConnectModal
signature and behavior unchanged.

In `@tests/unit/utils/initialSetup.test.ts`:
- Around line 4-22: Add a test covering setupMode being undefined to assert the
function's coercion behavior: update the shouldOpenInitialConnectModal tests to
include a case like expect(shouldOpenInitialConnectModal({ setupMode: undefined,
configuredServerCount: 2 })).toBe(false) so the contract of Boolean(setupMode)
is locked in; reference the shouldOpenInitialConnectModal function in the test
file and add the new it block verifying undefined behaves like false.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8c9eee5b-8b3d-4bae-971e-e0b42da16a92

📥 Commits

Reviewing files that changed from the base of the PR and between 1bd5860 and 2681403.

📒 Files selected for processing (3)
  • src/App.tsx
  • src/utils/initialSetup.ts
  • tests/unit/utils/initialSetup.test.ts

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