Skip to content

feat(onboarding): name the SDK that reported the first evaluation - #8147

Open
talissoncosta wants to merge 1 commit into
fix/onboarding-code-snippetsfrom
feat/onboarding-console-sdk-label
Open

feat(onboarding): name the SDK that reported the first evaluation#8147
talissoncosta wants to merge 1 commit into
fix/onboarding-code-snippetsfrom
feat/onboarding-console-sdk-label

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Jul 28, 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

Stacked on #8145, so the snippets a reviewer copies from the preview are the fixed ones. Follows @Zaimwa9's suggestion on #8132: first_evaluated_sdk_label arrives in the onboarding-status response and nothing used it.

The console's receipt line was invented, and asserted a flag value nothing had checked:

SDK initialized · flags loaded · show_demo_flag: true

It now reports what actually happened:

flagsmith-python-sdk · first evaluation received

That's the one thing the console couldn't tell you before: whether the evaluation came from the user's own app rather than something else hitting the environment.

  • Core sends 'unknown' when it can't identify the SDK from the user agent. The hook normalises that to null and the line falls back to first evaluation received.
  • useOnboardingConnection returns { status, sdkLabel } instead of a bare status string. The label is latched alongside the status, since skipping the query drops data.

Not in scope, still open from the same review: the poll ignores isError, so a 404 or 500 renders identically to "still listening".

How did you test this code?

The e2e mock already returned flagsmith-js-sdk, so onboarding-tests.pw.ts now asserts the console names it after the flip.

  • typecheck and lint clean on the changed files
  • Storybook: added a ConnectedWithSdkLabel variant next to Connected
  • Onboarding → run an SDK against the environment: the receipt names that SDK, e.g. flagsmith-python-sdk · first evaluation received
  • Verified end to end on staging: ran the Python snippet, then GET environments/{key}/onboarding-status/ returned first_evaluated_sdk_label: "flagsmith-python-sdk"

Note on the null-label path: features/views.py:1040 only records the evaluation when map_request_to_sdk_label recognises the user agent, so 'unknown' never reaches this endpoint from the SDK flow. The normalisation is defensive, and not reachable by hitting the API with plain curl.

Screenshots

Before (main) After
Console receipt, connected
Console receipt, SDK not identified n/a

@talissoncosta
talissoncosta requested a review from a team as a code owner July 28, 2026 20:27
@talissoncosta
talissoncosta requested review from kyle-ssg and removed request for a team July 28, 2026 20:27
@vercel

vercel Bot commented Jul 28, 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 Building Building Preview, Comment Jul 28, 2026 8:48pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jul 28, 2026 8:48pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jul 28, 2026 8:48pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

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

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2c44cbc0-2165-4e76-907d-003c99988de3

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
📝 Walkthrough

Walkthrough

The onboarding connection hook now returns connection status together with the SDK label from the first evaluation, stopping polling once that evaluation is detected. The onboarding flow passes this data to the terminal, which displays the label in the LIVE receipt. Storybook includes a labelled connected state, and the E2E test verifies the displayed SDK label.

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.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@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: 71fee9fa-8d8a-4c7c-bfdd-e0ae00500253

📥 Commits

Reviewing files that changed from the base of the PR and between b8073b9 and a44bb36.

📒 Files selected for processing (5)
  • frontend/documentation/pages/onboarding/OnboardingTerminal.stories.tsx
  • frontend/e2e/tests/onboarding-tests.pw.ts
  • frontend/web/components/pages/onboarding/OnboardingFlow/OnboardingFlow.tsx
  • frontend/web/components/pages/onboarding/OnboardingTerminal/OnboardingTerminal.tsx
  • frontend/web/components/pages/onboarding/hooks/useOnboardingConnection.ts

Comment on lines +102 to +105
// The console names the SDK that reported the evaluation, from the mocked
// first_evaluated_sdk_label above.
await expect(page.getByText(/flagsmith-js-sdk/)).toBeVisible();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Scope the assertion to the terminal receipt.

page.getByText(/flagsmith-js-sdk/) searches the whole page and only checks a substring, so it does not prove that the new first evaluation received receipt rendered the label. Assert the exact receipt text or scope the locator to the onboarding terminal.

Proposed fix
-    await expect(page.getByText(/flagsmith-js-sdk/)).toBeVisible()
+    await expect(
+      page.getByText('flagsmith-js-sdk · first evaluation received', {
+        exact: true,
+      }),
+    ).toBeVisible()
📝 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.

Suggested change
// The console names the SDK that reported the evaluation, from the mocked
// first_evaluated_sdk_label above.
await expect(page.getByText(/flagsmith-js-sdk/)).toBeVisible();
// The console names the SDK that reported the evaluation, from the mocked
// first_evaluated_sdk_label above.
await expect(
page.getByText('flagsmith-js-sdk · first evaluation received', {
exact: true,
}),
).toBeVisible()

@github-actions

github-actions Bot commented Jul 28, 2026

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

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

passed  4 passed

Details

stats  4 tests across 3 suites
duration  39.6 seconds
commit  977c780
info  🔄 Run: #18816 (attempt 1)

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  35.8 seconds
commit  977c780
info  🔄 Run: #18816 (attempt 1)

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

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

passed  5 passed

Details

stats  5 tests across 4 suites
duration  11.6 seconds
commit  977c780
info  🔄 Run: #18817 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.2 seconds
commit  977c780
info  🔄 Run: #18817 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  43.2 seconds
commit  977c780
info  🔄 Run: #18816 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.9 seconds
commit  977c780
info  🔄 Run: #18816 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.8 seconds
commit  977c780
info  🔄 Run: #18817 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.7 seconds
commit  977c780
info  🔄 Run: #18817 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  35.5 seconds
commit  a44bb36
info  🔄 Run: #18815 (attempt 1)

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  20.4 seconds
commit  a44bb36
info  🔄 Run: #18815 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  46.3 seconds
commit  a44bb36
info  🔄 Run: #18815 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.4 seconds
commit  a44bb36
info  🔄 Run: #18815 (attempt 1)

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

The verify console printed an invented receipt: "SDK initialized · flags loaded ·
<flag>: true", which asserted a flag value nothing had checked. The
onboarding-status endpoint already returns first_evaluated_sdk_label, so the
receipt now names the SDK that actually reported the evaluation:

    flagsmith-python-sdk · first evaluation received

That is the one thing the console could not previously tell you: whether the
evaluation came from the user's own app.

Core sends 'unknown' when it cannot identify the SDK from the user agent, which
is nothing to show a user, so the hook normalises that to null and the line
falls back to "first evaluation received".

useOnboardingConnection now returns { status, sdkLabel }. The label is latched
alongside the status, because skipping the query drops `data`.

The e2e mock already returned a label, so the test asserts the console names it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@talissoncosta
talissoncosta force-pushed the feat/onboarding-console-sdk-label branch from a44bb36 to 977c780 Compare July 28, 2026 20:47
@talissoncosta
talissoncosta changed the base branch from main to fix/onboarding-code-snippets July 28, 2026 20:47
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jul 28, 2026

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

👍

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

Labels

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.

2 participants