Skip to content

fix(onboarding): don't create or change flags in a project already in use - #8217

Open
talissoncosta wants to merge 5 commits into
mainfrom
fix/onboarding-skip-flag-creation-existing-project
Open

fix(onboarding): don't create or change flags in a project already in use#8217
talissoncosta wants to merge 5 commits into
mainfrom
fix/onboarding-skip-flag-creation-existing-project

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Visiting /getting-started wrote into projects it had no business touching.

  • Seeded show_demo_button into whichever project the API returned first. Now only into a project with no flags.
  • Adopted any flag tagged Onboarding, including a customer's own, then offered a toggle and a rename that deletes and recreates it. Now the tag has to match our description, and the tour continues only while our flag is the only one in the project.
  • Polled onboarding-status every 5s on the already-set-up screen, which waits for nothing. Now it doesn't.

Still open: creation happens on page load, the project is still the first one returned, and nothing persists that a user has onboarded.

How did you test this code?

  • 11 unit tests on the seed, tag and resume rules, checked by mutation
  • test:unit (404) and lint clean, no typecheck errors in the touched files
  • New account: seeds the flag, tags it, tour works end to end
  • Project with flags: nothing created, no Onboarding tag, already-set-up state shown
  • Project holding only the onboarding flag: reused, not duplicated
  • Project that ran the tour and later gained other flags: no tour
  • A tag the customer labelled Onboarding themselves: not adopted
  • Empty project on an established account: still seeded

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview Aug 12, 2026 6:43pm
flagsmith-frontend-staging Ready Ready Preview Aug 12, 2026 6:43pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 12, 2026 6:43pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

The onboarding bootstrap now detects shared demo flags and onboarding tags. It seeds flags only in empty projects and resumes only eligible existing demo flags. It reports hasDemoFlag through the resource hook. When no demo flag exists, OnboardingFlow skips connection polling and renders links to the projects list and project flags page. Organisation creation now supports AccountStore events, timeout handling, and cleanup. Tests cover flag detection and resume conditions.

Estimated code review effort: 3 (Moderate) | ~20 minutes


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 687db188-e702-4cea-8a87-bdf2abececc2

📥 Commits

Reviewing files that changed from the base of the PR and between fb78687 and 3f8c70c.

📒 Files selected for processing (7)
  • frontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsx
  • frontend/web/components/pages/onboarding/hooks/__tests__/demoFlag.test.ts
  • frontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.ts
  • frontend/web/components/pages/onboarding/hooks/demoFlag.ts
  • frontend/web/components/pages/onboarding/hooks/useEnsureOnboardingResources.ts
  • frontend/web/components/pages/onboarding/onboarding-already-set-up/OnboardingAlreadySetUp.tsx
  • frontend/web/components/pages/onboarding/onboarding-already-set-up/index.ts

Comment thread frontend/web/components/pages/onboarding/bootstrap/__tests__/demoFlag.test.ts Outdated
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f2bc4afd-cc1d-4693-947a-0bd91c472a61

📥 Commits

Reviewing files that changed from the base of the PR and between 3a496c3 and 1b1d836.

📒 Files selected for processing (5)
  • frontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsx
  • frontend/web/components/pages/onboarding/hooks/__tests__/demoFlag.test.ts
  • frontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.ts
  • frontend/web/components/pages/onboarding/hooks/demoFlag.ts
  • frontend/web/components/pages/onboarding/hooks/useEnsureOnboardingResources.ts

@github-actions github-actions Bot added fix and removed fix labels Aug 12, 2026
@talissoncosta
talissoncosta force-pushed the fix/onboarding-skip-flag-creation-existing-project branch from 886d205 to 1026eee Compare August 12, 2026 18:18
@github-actions github-actions Bot added fix and removed fix labels Aug 12, 2026
@talissoncosta
talissoncosta force-pushed the fix/onboarding-skip-flag-creation-existing-project branch from 1026eee to cfc431a Compare August 12, 2026 18:21
@github-actions github-actions Bot added fix and removed fix labels Aug 12, 2026
@talissoncosta
talissoncosta force-pushed the fix/onboarding-skip-flag-creation-existing-project branch from cfc431a to f734d12 Compare August 12, 2026 18:28
@github-actions github-actions Bot added fix and removed fix labels Aug 12, 2026
@talissoncosta talissoncosta changed the title fix(onboarding): don't seed a demo flag into a project that has flags fix(onboarding): don't create or change flags in a project already in use Aug 12, 2026
talissoncosta and others added 2 commits August 12, 2026 15:37
The flow adopted any flag it recognised, wherever it lived. The tag
lookup matched on label alone, so a customer's own tag labelled
Onboarding picked up one of their flags, and a recognised flag was toured
even in a project full of their own work.

The tour then offers a toggle that writes a feature state, and a rename
that is a create plus a delete. The new flag carries only name,
description, project, tags and type, so the environment values, segment
overrides, identity overrides and variations stay behind on the deleted
one, and an SDK reading by name starts getting defaults.

Match the tag on its description too, and carry on only while our flag is
the only one in the project. One flag is what a mid-tour refresh finds,
so a run in progress still resumes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The connection hook runs before the already-set-up early return, so that
screen polled onboarding-status every 5s for a first evaluation it never
waits on. Pass an empty key, which the hook already skips.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8cf1523c-72e9-4795-9f8e-fede8acff1c4

📥 Commits

Reviewing files that changed from the base of the PR and between 48c2d0d and f734d12.

📒 Files selected for processing (6)
  • frontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsx
  • frontend/web/components/pages/onboarding/bootstrap/__tests__/demoFlag.test.ts
  • frontend/web/components/pages/onboarding/bootstrap/bootstrapOnboarding.ts
  • frontend/web/components/pages/onboarding/bootstrap/createOrganisationViaAccountStore.ts
  • frontend/web/components/pages/onboarding/bootstrap/demoFlag.ts
  • frontend/web/components/pages/onboarding/hooks/useEnsureOnboardingResources.ts

Comment thread frontend/web/components/pages/onboarding/bootstrap/demoFlag.ts
The lookup ends in .unwrap(), and unlike ensureOnboardingTag it wasn't
guarded, so a transient tags request rejected ensureFlag and dropped the
user on the "we couldn't set up your workspace" screen. Treat it as
optional: without the tag we still match our flag by name.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant