Skip to content

app: Register the CLI before setup opens the dashboard - #1882

Merged
nortonandreev merged 2 commits into
norton/ai-4263-done-step-restart-linefrom
norton/ai-4262-register-before-dashboard
Oct 23, 2026
Merged

nortonandreev merged 2 commits into
norton/ai-4263-done-step-restart-linefrom
norton/ai-4262-register-before-dashboard

Conversation

@nortonandreev

Copy link
Copy Markdown
Contributor

Closes #1853 — AI-4262

Stacked on #1881 (same done-step row); retargets to main once that merges.

What & why

Open your workspace opened the dashboard before the server had the cli-setup report, which the app sent only after setup closed, so the website offered a CLI download the app already includes. The Done step now brings the daemon up and sends the report first, showing "Getting your workspace ready…" until it lands. If either fails, a warning card says why and offers Try again. The report is bounded at 30 s, so a silent server never leaves a spinner.

Where to look

Ready is never revoked once reached. A failed daemon run is repeated only on Try again, so a declined service takeover is not asked again. No website change is needed: kcap-server clears its install-cli step on POST /api/users/me/cli-setup.

Verification

Full Capacitor.App.Tests.Unit after the rebase: 4,245 passed, 10 skipped, 0 failed. Headless renders of the real Done view:

Workspace Local
Before
Preparing
Ready
Report failed
Daemon not running

@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown

AI-4262

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 586c77fa-8a39-42a0-b01a-e01d905ff972

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Register the CLI before opening the dashboard from setup

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Wait for the daemon and CLI registration before offering the dashboard link.
• Show preparation progress and a retry option when setup cannot reach readiness.
• Test link gating, retry behavior, and daemon-before-registration ordering.
Diagram

graph TD
  Entry["Done step"] --> Daemon["Ensure daemon"] --> Running{"Daemon running?"}
  Running -->|Yes| Report["Report CLI setup"] --> Accepted{"Report accepted?"}
  Accepted -->|Yes| Ready["Offer dashboard link"]
  Running -->|No| Warning["Retry warning"]
  Accepted -->|No or timeout| Warning
  Warning -->|Try again| Daemon
Loading
High-Level Assessment

Gating the link in the Done step directly addresses the race: reporting only after the wizard closes leaves a window in which the dashboard offers an unnecessary install. Reusing the existing report sender and daemon enabler avoids a second registration mechanism.

Files changed (7) +284 / -27

Enhancement (1) +5 / -0
WorkspaceReadiness.csDefine Done-step readiness outcomes +5/-0

Define Done-step readiness outcomes

• Adds the states used to distinguish preparation, success, a stopped daemon, and an unreported installation.

src/Capacitor.App/ViewModels/Onboarding/WorkspaceReadiness.cs

Bug fix (4) +167 / -27
App.axaml.csProvide a bounded, fresh-profile CLI registration callback +44/-15

Provide a bounded, fresh-profile CLI registration callback

• Passes the wizard a CLI-setup reporting callback that resolves the current server profile, creates a fresh HTTP connection, and bounds the attempt to 30 seconds. Extracts the fresh-server connection setup for reuse by daemon-name lookup.

src/Capacitor.App/App.axaml.cs

WizardComposition.csPrepare the daemon before reporting CLI setup +17/-2

Prepare the daemon before reporting CLI setup

• Wires a preparation callback into the Done step. It waits for an in-flight daemon run, retries a failed daemon run only on request, and reports the installation only after the daemon is running.

src/Capacitor.App/Services/Onboarding/WizardComposition.cs

DoneStepViewModel.csGate dashboard links on workspace readiness +80/-10

Gate dashboard links on workspace readiness

• Tracks preparation, ready, daemon-failure, and reporting-failure states; hides and disables links until ready. Adds retry behavior, refreshes daemon details after preparation, and retains readiness once achieved.

src/Capacitor.App/ViewModels/Onboarding/DoneStepViewModel.cs

DonePaneView.axamlShow preparation progress and retryable failures +26/-0

Show preparation progress and retryable failures

• Adds a preparing indicator and a warning card with failure details and a Try again button. The existing links follow the view model's readiness-dependent visibility.

src/Capacitor.App/Views/Onboarding/DonePaneView.axaml

Tests (2) +112 / -0
DoneStepViewModelTests.csTest link gating and Done-step retry +62/-0

Test link gating and Done-step retry

• Verifies that the workspace cannot open before registration and becomes available afterward. Covers the warning and retry transition from daemon failure to readiness.

test/Capacitor.App.Tests.Unit/DoneStepViewModelTests.cs

WizardCompositionTests.csTest daemon-before-report ordering +50/-0

Test daemon-before-report ordering

• Checks that the composed wizard reports CLI setup only after the daemon runs and skips reporting when the daemon cannot run.

test/Capacitor.App.Tests.Unit/WizardCompositionTests.cs

@qodo-code-review

qodo-code-review Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. A new workspace opens before registration ✓ Resolved
Description
DoneStepViewModel.OnEnterAsync refreshes the workspace URL but retains Ready, so it skips
PrepareWorkspaceAsync and the setup report. If someone goes back from Done, signs in to a
different workspace, and returns, the button can open that workspace even though its server has not
received this machine's report.
Code

src/Capacitor.App/ViewModels/Onboarding/DoneStepViewModel.cs[R178-179]

+        Refresh();
+        if (Readiness != WorkspaceReadiness.Ready) _ = PrepareAsync(retry: false);
Relevance

●●● Strong

Matches the PR's stated intent: readiness must be revalidated after workspace changes before opening
the dashboard.

PR-#1668
PR-#1392

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Done permits Back navigation, and sign-in can commit another workspace before the wizard returns to
Done. Its facts then read the new server, but the retained Ready state bypasses the only path that
sends the report.

src/Capacitor.App/ViewModels/Onboarding/DoneStepViewModel.cs[176-194]
src/Capacitor.App/ViewModels/Onboarding/DoneStepViewModel.cs[207-213]
src/Capacitor.App/ViewModels/Onboarding/SignInStepViewModel.cs[469-474]
src/Capacitor.App/ViewModels/Onboarding/SignInStepViewModel.cs[563-573]
src/Capacitor.App/Services/Onboarding/WizardComposition.cs[253-267]
src/Capacitor.App/Services/Onboarding/WizardComposition.cs[298-306]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Done page keeps `Ready` after sign-in changes the selected server, allowing the new workspace to open without its CLI-setup report.
## Fix Focus Areas
- src/Capacitor.App/ViewModels/Onboarding/DoneStepViewModel.cs[176-209]
- src/Capacitor.App/Services/Onboarding/WizardComposition.cs[253-267]
## Recommended Fix
Associate successful readiness with the resolved server identity. On entry, require preparation again when that identity changes, and prevent an earlier in-flight preparation from publishing readiness for a later identity.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
⚠️ Tickets: not configured — No jira, linear integration is connected for the linked tickets
✅ Compliance rules (platform): 59 rules
✅ Cross-repo context — repo relationships
  Explored: repo: kurrent-io/kcap-server (sha: 6b5e15fe) — View relationship
Review mode: Auto: ⚖️ Balanced: Downgraded extended -> standard: change is below the extended eligibility bar (hunks 17/18, lines 311/200; both must reach the floor). Router rationale: Substantial asynchronous onboarding logic spans multiple independent paths and UI states.

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/Capacitor.App/ViewModels/Onboarding/DoneStepViewModel.cs
@nortonandreev nortonandreev self-assigned this Oct 23, 2026
@nortonandreev
nortonandreev force-pushed the norton/ai-4262-register-before-dashboard branch from 6b3f180 to 6010308 Compare October 23, 2026 13:17
The dashboard asks for an install until the server has the cli-setup report, which the app used to send only after setup closed. The Done step now waits for the daemon and sends the report before it offers the link.
Ready holds only for the server that took the report, so going back to sign in elsewhere prepares the new server, and a report still in flight for the old one is discarded.
@nortonandreev
nortonandreev force-pushed the norton/ai-4262-register-before-dashboard branch from 6010308 to c042848 Compare October 23, 2026 13:20
@nortonandreev

Copy link
Copy Markdown
Contributor Author

@CodeRabbit approve

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@nortonandreev
nortonandreev merged commit d2f4168 into norton/ai-4263-done-step-restart-line Oct 23, 2026
12 checks passed
@nortonandreev
nortonandreev deleted the norton/ai-4262-register-before-dashboard branch October 23, 2026 13:59
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