Skip to content

feat(onboarding): Org-level onboarding experiment events - #8242

Open
khvn26 wants to merge 6 commits into
mainfrom
feat/onboarding-org-experiment-events
Open

feat(onboarding): Org-level onboarding experiment events#8242
khvn26 wants to merge 6 commits into
mainfrom
feat/onboarding-org-experiment-events

Conversation

@khvn26

@khvn26 khvn26 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • 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

Contributes to #8153.

The onboarding experiment splits on organisations, with both exposure and conversion experiment events emitted by the backend.

/api/v1/organisations/ now returns onboarding_variant, and the frontend decides which flow to render based on that.

The Core API now has a FLAGSMITH_ON_FLAGSMITH_SERVER_EVENTS_API_URL setting. If FoF not in offline mode and the new setting is set, the SDK is initialised with event tracking capability.

How did you test this code?

Added unit tests.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 7, 2026 4:25pm
flagsmith-frontend-preview Ignored Ignored Preview Aug 7, 2026 4:25pm
flagsmith-frontend-staging Ignored Ignored Preview Aug 7, 2026 4:25pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fce04713-3f5f-4415-aaee-0a8cc7d80107

📥 Commits

Reviewing files that changed from the base of the PR and between c3944b1 and 9d61fbe.

📒 Files selected for processing (1)
  • api/tests/unit/integrations/flagsmith/test_unit_flagsmith_client.py

📝 Walkthrough

Walkthrough

The API now evaluates and serialises an organisation’s onboarding variant. The frontend selects the onboarding flow from AccountStore. The Flagsmith OpenFeature provider now supports exposure hooks and event processing. First environment evaluations emit tracking events. Production and staging task definitions provide event API URLs. OpenAPI schemas add onboarding variant definitions and webhook URL constraints.

Estimated code review effort: 4 (Complex) | ~45 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.

khvn26 and others added 3 commits August 7, 2026 17:06
The onboarding flow decision is now made in the backend, per
organisation. Serving a multivariate split assignment records the
experiment exposure; the first SDK evaluation of any of the
organisation's environments records the conversion, both against the
organisation targeting key.

- flagsmith 6.2.0 and openfeature-provider-flagsmith from its
  experimentation-tracking PR branch
- events enabled on the Flagsmith-on-Flagsmith client via
  FLAGSMITH_ON_FLAGSMITH_SERVER_EVENTS_API_URL (set in staging and
  production ECS task definitions; never enabled in offline mode)
- get_openfeature_client() attaches the provider's exposure hook, so
  any multivariate split evaluation records an exposure
- onboarding_variant field on the organisation serialiser

beep boop
The gate no longer evaluates the Flagsmith-on-Flagsmith flag client-side;
the backend decides per organisation and the exposure is recorded
server-side.

beep boop
@khvn26
khvn26 force-pushed the feat/onboarding-org-experiment-events branch from 74e6760 to 015d7fd Compare August 7, 2026 16:08
@github-actions github-actions Bot added feature New feature or request and removed infrastructure docs Documentation updates labels Aug 7, 2026
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.73%. Comparing base (eeac6b3) to head (9d61fbe).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #8242    +/-   ##
========================================
  Coverage   98.72%   98.73%            
========================================
  Files        1558     1561     +3     
  Lines       61948    62048   +100     
========================================
+ Hits        61160    61260   +100     
  Misses        788      788            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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: 8


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f621a0df-02a6-4b18-8da0-dc4dd25e31d7

📥 Commits

Reviewing files that changed from the base of the PR and between eeac6b3 and 634faf3.

⛔ Files ignored due to path filters (1)
  • api/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (24)
  • api/app/settings/common.py
  • api/environments/onboarding/services.py
  • api/integrations/flagsmith/client.py
  • api/organisations/serializers.py
  • api/organisations/services.py
  • api/pyproject.toml
  • api/tests/unit/environments/onboarding/test_unit_environments_onboarding_services.py
  • api/tests/unit/integrations/flagsmith/test_unit_flagsmith_client.py
  • api/tests/unit/organisations/test_unit_organisations_serializers.py
  • api/tests/unit/organisations/test_unit_organisations_services.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md
  • docs/docs/integrating-with-flagsmith/CLI.md
  • docs/docs/integrating-with-flagsmith/legacy-cli.md
  • docs/docs/integrating-with-flagsmith/sdks/client-side-sdks/javascript.md
  • docs/docs/integrating-with-flagsmith/sdks/server-side.mdx
  • frontend/common/types/responses.ts
  • frontend/common/utils/getOnboardingVariant.ts
  • frontend/web/components/pages/onboarding/GettingStartedGate.tsx
  • infrastructure/aws/production/ecs-task-definition-admin-api.json
  • infrastructure/aws/production/ecs-task-definition-sdk-api.json
  • infrastructure/aws/production/ecs-task-definition-task-processor.json
  • infrastructure/aws/staging/ecs-task-definition-admin-api.json
  • infrastructure/aws/staging/ecs-task-definition-sdk-api.json
  • infrastructure/aws/staging/ecs-task-definition-task-processor.json
💤 Files with no reviewable changes (1)
  • frontend/common/utils/getOnboardingVariant.ts

Comment thread api/environments/onboarding/services.py
Comment thread api/integrations/flagsmith/client.py
Comment thread api/tests/unit/integrations/flagsmith/test_unit_flagsmith_client.py
Comment thread frontend/web/components/pages/onboarding/GettingStartedGate.tsx

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 8


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f621a0df-02a6-4b18-8da0-dc4dd25e31d7

📥 Commits

Reviewing files that changed from the base of the PR and between eeac6b3 and 634faf3.

⛔ Files ignored due to path filters (1)
  • api/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (24)
  • api/app/settings/common.py
  • api/environments/onboarding/services.py
  • api/integrations/flagsmith/client.py
  • api/organisations/serializers.py
  • api/organisations/services.py
  • api/pyproject.toml
  • api/tests/unit/environments/onboarding/test_unit_environments_onboarding_services.py
  • api/tests/unit/integrations/flagsmith/test_unit_flagsmith_client.py
  • api/tests/unit/organisations/test_unit_organisations_serializers.py
  • api/tests/unit/organisations/test_unit_organisations_services.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md
  • docs/docs/integrating-with-flagsmith/CLI.md
  • docs/docs/integrating-with-flagsmith/legacy-cli.md
  • docs/docs/integrating-with-flagsmith/sdks/client-side-sdks/javascript.md
  • docs/docs/integrating-with-flagsmith/sdks/server-side.mdx
  • frontend/common/types/responses.ts
  • frontend/common/utils/getOnboardingVariant.ts
  • frontend/web/components/pages/onboarding/GettingStartedGate.tsx
  • infrastructure/aws/production/ecs-task-definition-admin-api.json
  • infrastructure/aws/production/ecs-task-definition-sdk-api.json
  • infrastructure/aws/production/ecs-task-definition-task-processor.json
  • infrastructure/aws/staging/ecs-task-definition-admin-api.json
  • infrastructure/aws/staging/ecs-task-definition-sdk-api.json
  • infrastructure/aws/staging/ecs-task-definition-task-processor.json
💤 Files with no reviewable changes (1)
  • frontend/common/utils/getOnboardingVariant.ts
🛑 Comments failed to post (3)
docs/docs/integrating-with-flagsmith/CLI.md (1)

31-40: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

curl -fsSL https://raw.githubusercontent.com/Flagsmith/flagsmith-cli/main/README.md |
  grep -nE 'pin.*install|release archive|install.sh'

Repository: Flagsmith/flagsmith

Length of output: 647


Pin the installer source before making it the default installation path.

These copy-and-paste commands execute a mutable installer from the main branch, which gives that script code execution on the user's machine if the repository or branch is compromised. Document the pinned installer as the recommended path and label the main-branch command as a quick-start or convenience option.

Source: MCP tools

docs/docs/integrating-with-flagsmith/legacy-cli.md (1)

45-51: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

npx --yes `@flagsmith/cli` get --help |
  grep -E -- '--output|--api|--identity|ENVIRONMENT'

Repository: Flagsmith/flagsmith

Length of output: 1180


🌐 Web query:

@flagsmith/cli legacy get command help ENVIRONMENT_API_KEY options --o -o

💡 Result:

The Flagsmith CLI get command is used to retrieve feature flags from the Flagsmith API and output them to a file [1][2]. The ENVIRONMENT argument represents the client-side environment key, which can be provided directly as an argument or via the FLAGSMITH_ENVIRONMENT environment variable [1][3]. The -o (or --output) option allows you to specify the destination file path for the output [1][2]. Usage syntax: flagsmith get [ENVIRONMENT] [-o <value>] [additional options] [1][2] Available options for the get command include: - -o, --output=<value>: The file path to save the output (default: ./flagsmith.json) [1][2]. - -a, --api=<value>: The API URL to fetch feature flags from (default: https://edge.api.flagsmith.com/api/v1/) [1][2]. - -i, --identity=<value>: The identity for which to fetch feature flags [1][2]. - -e, --entity=<option>: Specify the entity to fetch, either flags or environment (for local evaluation mode) [2]. - -p, --pretty: Prettify the resulting JSON output [2]. Example usage: flagsmith get <ENVIRONMENT_API_KEY> -o ./my-flags.json [1][2] If you omit the environment key, the CLI will attempt to use the value set in the FLAGSMITH_ENVIRONMENT environment variable [1][3].

Citations:


Make the examples match the legacy get interface.

Use <ENVIRONMENT_API_KEY> instead of <ENVIRONMENT_ID>, and use the declared short options -o, -a, and -i rather than --o, --a, and --i.

Suggested example changes
-  $ flagsmith get <ENVIRONMENT_ID>
+  $ flagsmith get <ENVIRONMENT_API_KEY>
 
-  $ flagsmith get --o ./my-file.json
+  $ flagsmith get -o ./my-file.json
 
-  $ flagsmith get --a https://flagsmith.example.com/api/v1/
+  $ flagsmith get -a https://flagsmith.example.com/api/v1/
 
-  $ flagsmith get --i flagsmith_identity
+  $ flagsmith get -i flagsmith_identity
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  $ flagsmith get <ENVIRONMENT_API_KEY>

  $ flagsmith get -o ./my-file.json

  $ flagsmith get -a https://flagsmith.example.com/api/v1/

  $ flagsmith get -i flagsmith_identity

Source: MCP tools

docs/docs/integrating-with-flagsmith/sdks/server-side.mdx (1)

867-867: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

curl -fsSL https://raw.githubusercontent.com/Flagsmith/flagsmith-cli/main/README.md |
  grep -nE 'environment document|evaluate.*--js'

curl -fsSL https://raw.githubusercontent.com/Flagsmith/flagsmith-nodejs-client/main/sdk/offline_handlers.ts |
  grep -nE 'buildEnvironmentModel|EnvironmentModel'

Repository: Flagsmith/flagsmith

Length of output: 902


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Inspect the surrounding context and the referenced command in the documentation.
sed -n '840,885p' docs/docs/integrating-with-flagsmith/sdks/server-side.mdx

# Search for LocalFileHandler and flagsmith command references in the SDK docs/source files.
rg -n "LocalFileHandler|flagsmith eval|--js|flagsmith environment document|environment document" docs docs/docs package.json -S || true

Repository: Flagsmith/flagsmith

Length of output: 16333


Use the environment-document command for LocalFileHandler.

LocalFileHandler reads a file and builds EnvironmentModel. flagsmith eval --js writes SDK resolution state for frontend SDKs, not the server-side local-evaluation environment document. The Node.js offline setup document so LocalFileHandler uses an invalid payload.

Source: MCP tools

Also refreshes a stale line reference in the generated events catalogue.

beep boop
@khvn26
khvn26 marked this pull request as ready for review August 7, 2026 16:25
@khvn26
khvn26 requested review from a team as code owners August 7, 2026 16:25
@khvn26
khvn26 removed the request for review from a team August 7, 2026 16:25
@khvn26
khvn26 requested review from emyller and kyle-ssg and removed request for a team August 7, 2026 16:25
@github-actions github-actions Bot removed the feature New feature or request label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-8242 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-8242 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-8242 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-8242 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8242 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8242 Finished ✅ Results

@github-actions github-actions Bot added feature New feature or request and removed infrastructure docs Documentation updates feature New feature or request labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19121 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 8 seconds
commit  9d61fbe
info  🔄 Run: #19121 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #19121 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  32.9 seconds
commit  9d61fbe
info  🔄 Run: #19121 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19121 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.6 seconds
commit  9d61fbe
info  🔄 Run: #19121 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19121 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.4 seconds
commit  9d61fbe
info  🔄 Run: #19121 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19118 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 4 seconds
commit  c3944b1
info  🔄 Run: #19118 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19117 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  5 passed

Details

stats  5 tests across 4 suites
duration  49.1 seconds
commit  1935afa
info  🔄 Run: #19117 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19118 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  33.4 seconds
commit  c3944b1
info  🔄 Run: #19118 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19118 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  32.4 seconds
commit  c3944b1
info  🔄 Run: #19118 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19118 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.6 seconds
commit  c3944b1
info  🔄 Run: #19118 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19117 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  42 seconds
commit  1935afa
info  🔄 Run: #19117 (attempt 1)

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@github-actions github-actions Bot added docs Documentation updates infrastructure feature New feature or request and removed feature New feature or request infrastructure docs Documentation updates labels Aug 7, 2026
}, [organisation?.id, variant])

return isSinglePageOnboarding() ? <OnboardingFlow /> : <GettingStartedPage />
return variant === 'single_page' ? <OnboardingFlow /> : <GettingStartedPage />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This decides on the org now, but App.js still decides on the flag in two places, so the two can disagree.

Whether a new user reaches /getting-started at all:

if (
AccountStore.getUser()?.isGettingStarted &&
Utils.getFlagsmithHasFeature('onboarding_quickstart_flow')
) {
this.props.history.replace('/getting-started')

And the flag that feeds the chromeless layout:

const isOnboardingFlow =
pathname === '/getting-started' &&
Utils.getFlagsmithHasFeature('onboarding_quickstart_flow')

// Chromeless onboarding: render only the flow - no nav, sidebar or
// header links - so the user can't navigate away mid-flow. The flow
// provides its own Skip escape.
if (isOnboardingFlow) {
return <div>{this.props.children}</div>
}

These need to read onboarding_variant as well, otherwise the result might vary.

@talissoncosta talissoncosta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks so much for handling that @khvn26. 🙏 😃

Just a few comments regarding FE part


The E2E tests seems to still skip on the frontend flag, but the API decides the flow now. Could you double check they still do the right thing or can be adjusted?

test.skip(
!flagsmith.hasFeature('onboarding_quickstart_flow'),
'Onboarding flow is behind onboarding_quickstart_flow',
);

test.skip(
flagsmith.hasFeature('onboarding_quickstart_flow'),
'Legacy signup flow superseded by onboarding_quickstart_flow',
);

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

Labels

api Issue related to the REST API feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants