Skip to content
This repository was archived by the owner on May 1, 2026. It is now read-only.

fix: stop app-add success message from flashing during onboarding#566

Closed
WcaleNieWolny wants to merge 3 commits into
mainfrom
fix/app-add-flash-message
Closed

fix: stop app-add success message from flashing during onboarding#566
WcaleNieWolny wants to merge 3 commits into
mainfrom
fix/app-add-flash-message

Conversation

@WcaleNieWolny
Copy link
Copy Markdown
Contributor

@WcaleNieWolny WcaleNieWolny commented Mar 23, 2026

Summary

  • Stop the spinner silently after successful app add — the "App add Done ✅" log was pushed then instantly cleared by the next step's clearInitLogs(), making it flash for ~100ms
  • Move the "accessible to all members of your organization" info to the start of step 2 (addChannelStep) where it persists on screen alongside the channel setup context

Test plan

  • Run node dist/index.js i through app add — no flash after app is added
  • Verify step 2 shows "✅ App added — accessible to all members of your organization" persistently

Summary by CodeRabbit

  • Improvements

    • Streamlined the app ID confirmation flow to use a single selection prompt to keep or change the current ID.
    • Initialized a spinner for onboarding frames to improve feedback during setup.
    • Enhanced duplicate app ID detection to recognize more error patterns.
  • Bug Fixes

    • Alert checks now run only when not in silent mode.
    • Added a clear success log when an app is added and accessible.

- Merge two redundant confirm prompts ("Is this the correct app ID?" +
  "Add in Capgo?") into a single select with emoji labels
- Fix duplicate app ID error not being caught (Supabase returns
  "duplicate key" / code 23505, not "already exist")
- Skip checkAlerts() in addAppInternal when called silently from init
  to avoid flashing clack output during Ink session
The "App add Done ✅" log was pushed then instantly cleared by the next
step's renderCurrentStep → clearInitLogs cycle, making it flash for
~100ms.

- Stop spinner silently after successful app add (progress bar already
  shows completion)
- Move the "accessible to all members" info to the start of step 2
  (addChannelStep) where it persists on screen
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

App onboarding flow and spinner initialization were adjusted: app ID confirmation is replaced by a single selection prompt with re-prompting on change; addAppInternal only runs alerts when not silent; duplicate-app detection expanded; onboarding frame now initializes an init spinner.

Changes

Cohort / File(s) Summary
App addition logic
src/app/add.ts
Guarded checkAlerts() behind if (!silent) so alerts run only in non-silent mode.
Init command / onboarding flow
src/init/command.ts
Replaced two-step confirmations with a single selection prompt that allows changing appId (persists via saver); removed early-exit "don't add" branch; broadened duplicate-app error matching (duplicate key, 23505); adjusted spinner success handling and success/info logs.
Init UI / spinner init
src/init/ui.ts
Imported and invoked setInitSpinner() at start of renderInitOnboardingFrame to initialize onboarding spinner each render.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant InitCommand as Init Command
    participant Prompt as Prompt System
    participant AddModule as Add App Module
    participant DB as Database/API
    participant Logger as Logger

    User->>Prompt: start onboarding / provide appId
    Prompt->>User: present select: keep appId or change
    User->>Prompt: choose (keep/change)
    alt change
        Prompt->>User: request new appId
        User->>Prompt: supply new appId
        Prompt->>InitCommand: return new appId
        InitCommand->>InitCommand: saveAppIdToCapacitorConfig(...)
    end
    Prompt->>InitCommand: return chosen appId
    InitCommand->>AddModule: addAppInternal(appId, silent=false)
    AddModule->>AddModule: if (!silent) checkAlerts()
    AddModule->>DB: attempt to create/add app
    alt success
        DB-->>AddModule: app created
        AddModule->>Logger: log success
        Logger-->>InitCommand: notify success
    else duplicate/error
        DB-->>AddModule: error (exists / duplicate key / 23505)
        AddModule->>InitCommand: surface duplicate error
        InitCommand->>Prompt: suggest retry with different appId
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
I nibble at prompts with nimble paws,
One gentle choice now clears the cause,
Quiet alerts sleep when silence reigns,
Duplicate snares caught in my chains,
Init hops onward—soft spring gains.

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: preventing a success message flash during onboarding by stopping the app-add success message from appearing and disappearing too quickly.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/app-add-flash-message

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1a05cfd90

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/init/command.ts
Comment on lines +1061 to +1064
options: [
{ value: 'yes', label: '✅ Yes, add it' },
{ value: 'change', label: '❌ No, use a different app ID' },
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore skip path for existing Capgo apps

This new selection prompt removed the previous doAdd === false path, so onboarding now always tries to create an app instead of letting users continue with an already-existing one. In addAppStep, users who are onboarding a project whose app already exists in Capgo will hit the duplicate-key branch and be forced to choose a different app ID, whereas the prior flow allowed marking add-app complete and proceeding with the current ID.

Useful? React with 👍 / 👎.

- Remove s.stop() from addAppStep success path — spinner persists
  through the async markStep call instead of leaving an empty frame
- Add setInitSpinner() to renderInitOnboardingFrame so any running
  spinner is cleared atomically with the step transition
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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/init/command.ts`:
- Around line 1078-1079: The success message shown after calling addAppInternal
(the block with await addAppInternal(currentAppId, options, organization, true)
followed by s.stop()) was changed and now omits the original qualifier "based on
their permissions"; restore that exact wording in the moved step-2 success copy
so it matches the canonical message used by src/app/add.ts (ensure the same
phrase appears in both places, including the duplicate spot noted around the
other block at lines 1171-1174), keeping the spinner stop behavior intact
(s.stop) but updating the success string emitted after addAppInternal to include
"based on their permissions".
- Around line 1068-1070: When the user picks the "change" branch, the code
should use the edited currentAppId as the base for any duplicate-ID suggestion
generation and for the value saved; update the logic so that after
askForAppId(...) the subsequent suggestion-builder and recovery logic use
currentAppId (not the original appId) and ensure
saveAppIdToCapacitorConfig(currentAppId) persists that chosen value; apply the
same replacement of appId -> currentAppId in the duplicate-ID recovery code
paths referenced around the other spots (the blocks that build alternatives and
present suggestions).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 03e02a18-1b22-4d45-9aab-40ecaa47a449

📥 Commits

Reviewing files that changed from the base of the PR and between 776895f and a1a05cf.

📒 Files selected for processing (2)
  • src/app/add.ts
  • src/init/command.ts

Comment thread src/init/command.ts
Comment on lines +1068 to 1070
if (addChoice === 'change') {
currentAppId = await askForAppId('Enter the correct app ID (e.g., com.example.app):')
await saveAppIdToCapacitorConfig(currentAppId)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use the edited app ID as the suggestion base.

Once the user takes the new “use a different app ID” branch, currentAppId can diverge from the original appId. The duplicate-ID recovery still builds alternatives from appId, so the suggestions — and the config value saved right after selection — can jump back to the stale base instead of the ID that actually collided.

♻️ Proposed fix
-        const rawSuggestions = [
-          `${appId}-${Math.random().toString(36).substring(2, 6)}`,
-          `${appId}.dev`,
-          `${appId}.app`,
-          `${appId}-${Date.now().toString().slice(-4)}`,
-          `${appId}2`,
-          `${appId}3`,
+        const suggestionBase = currentAppId
+        const rawSuggestions = [
+          `${suggestionBase}-${Math.random().toString(36).substring(2, 6)}`,
+          `${suggestionBase}.dev`,
+          `${suggestionBase}.app`,
+          `${suggestionBase}-${Date.now().toString().slice(-4)}`,
+          `${suggestionBase}2`,
+          `${suggestionBase}3`,
         ]

Also applies to: 1093-1104, 1158-1159

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

In `@src/init/command.ts` around lines 1068 - 1070, When the user picks the
"change" branch, the code should use the edited currentAppId as the base for any
duplicate-ID suggestion generation and for the value saved; update the logic so
that after askForAppId(...) the subsequent suggestion-builder and recovery logic
use currentAppId (not the original appId) and ensure
saveAppIdToCapacitorConfig(currentAppId) persists that chosen value; apply the
same replacement of appId -> currentAppId in the duplicate-ID recovery code
paths referenced around the other spots (the blocks that build alternatives and
present suggestions).

Comment thread src/init/command.ts Outdated
Comment on lines +1078 to +1079
await addAppInternal(currentAppId, options, organization, true)
s.stop(`App add Done ✅`)
s.stop()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Good flash fix, but keep the original access-scope wording.

Silently stopping the spinner is the right way to avoid the transient success flash. The moved step-2 success copy, though, drops the existing “based on their permissions” qualifier that src/app/add.ts still uses, so onboarding now communicates broader access semantics than the regular app add flow.

✏️ Proposed fix
-  pLog.success(`✅ App ${appId} added — accessible to all members of your organization`)
+  pLog.success(`✅ App ${appId} added — accessible to all members of your organization based on their permissions`)

Also applies to: 1171-1174

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

In `@src/init/command.ts` around lines 1078 - 1079, The success message shown
after calling addAppInternal (the block with await addAppInternal(currentAppId,
options, organization, true) followed by s.stop()) was changed and now omits the
original qualifier "based on their permissions"; restore that exact wording in
the moved step-2 success copy so it matches the canonical message used by
src/app/add.ts (ensure the same phrase appears in both places, including the
duplicate spot noted around the other block at lines 1171-1174), keeping the
spinner stop behavior intact (s.stop) but updating the success string emitted
after addAppInternal to include "based on their permissions".

@sonarqubecloud
Copy link
Copy Markdown

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.

♻️ Duplicate comments (2)
src/init/command.ts (2)

1092-1103: ⚠️ Potential issue | 🟡 Minor

Use currentAppId as suggestion base in duplicate recovery.

After Line 1069, currentAppId may differ from the original appId; Lines 1097-1102 still generate alternatives from stale appId, which can propose irrelevant IDs.

♻️ Suggested fix
-        const rawSuggestions = [
-          `${appId}-${Math.random().toString(36).substring(2, 6)}`,
-          `${appId}.dev`,
-          `${appId}.app`,
-          `${appId}-${Date.now().toString().slice(-4)}`,
-          `${appId}2`,
-          `${appId}3`,
+        const suggestionBase = currentAppId
+        const rawSuggestions = [
+          `${suggestionBase}-${Math.random().toString(36).substring(2, 6)}`,
+          `${suggestionBase}.dev`,
+          `${suggestionBase}.app`,
+          `${suggestionBase}-${Date.now().toString().slice(-4)}`,
+          `${suggestionBase}2`,
+          `${suggestionBase}3`,
         ]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/init/command.ts` around lines 1092 - 1103, The duplicate-app handling
block uses stale appId when generating alternatives; change the suggestion base
to currentAppId so suggestions reflect the actual (possibly modified) ID. In the
error branch that logs pLog.error(`❌ App ID "${currentAppId}" is already taken`)
update the rawSuggestions array (and any subsequent validation) to interpolate
currentAppId instead of appId (e.g., `${currentAppId}-${...}`,
`${currentAppId}.dev`, `${currentAppId}2`, etc.) so generated proposals are
relevant to the current attempted ID.

1172-1172: ⚠️ Potential issue | 🟡 Minor

Restore the permission qualifier in the moved success copy.

Line 1172 currently broadens access semantics; align it with the canonical app-add message by keeping “based on their permissions”.

✏️ Suggested fix
-  pLog.success(`✅ App ${appId} added — accessible to all members of your organization`)
+  pLog.success(`✅ App ${appId} added — accessible to all members of your organization based on their permissions`)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/init/command.ts` at line 1172, The success message logged via
pLog.success currently reads "✅ App ${appId} added — accessible to all members
of your organization" which broadens access semantics; restore the canonical
wording by updating the pLog.success call to include the permission qualifier
("based on their permissions") so it reads something like "✅ App ${appId} added
— accessible to all members of your organization based on their permissions"
(update the string inside the pLog.success invocation where it constructs the
success copy).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/init/command.ts`:
- Around line 1092-1103: The duplicate-app handling block uses stale appId when
generating alternatives; change the suggestion base to currentAppId so
suggestions reflect the actual (possibly modified) ID. In the error branch that
logs pLog.error(`❌ App ID "${currentAppId}" is already taken`) update the
rawSuggestions array (and any subsequent validation) to interpolate currentAppId
instead of appId (e.g., `${currentAppId}-${...}`, `${currentAppId}.dev`,
`${currentAppId}2`, etc.) so generated proposals are relevant to the current
attempted ID.
- Line 1172: The success message logged via pLog.success currently reads "✅ App
${appId} added — accessible to all members of your organization" which broadens
access semantics; restore the canonical wording by updating the pLog.success
call to include the permission qualifier ("based on their permissions") so it
reads something like "✅ App ${appId} added — accessible to all members of your
organization based on their permissions" (update the string inside the
pLog.success invocation where it constructs the success copy).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5b6b5af-6040-458c-9815-84f12e0a3067

📥 Commits

Reviewing files that changed from the base of the PR and between a1a05cf and 86093ce.

📒 Files selected for processing (2)
  • src/init/command.ts
  • src/init/ui.ts

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant