Skip to content

feat: metric event name combobox fed by warehouse events - #8234

Open
Zaimwa9 wants to merge 1 commit into
mainfrom
feat/metrics-combobox-with-distinct-warehouse-events
Open

feat: metric event name combobox fed by warehouse events#8234
Zaimwa9 wants to merge 1 commit into
mainfrom
feat/metrics-combobox-with-distinct-warehouse-events

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Aug 6, 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 #8231.

Turns the Event name field in metric creation into a combo box listing the distinct event names from the environment's connected warehouse, most recently seen first.

  • New EventNameSelect component wrapping react-select's CreatableSelect: type-to-filter, free text kept via a Use "xyz" option, and an inline warning when the chosen event hasn't been received by the warehouse yet.
  • Degrades to a plain creatable input when there is no connection, the warehouse type is unsupported, or the fetch fails.
  • Dropdown overlays the page instead of growing it, adapts its height to the viewport (flips above when space is short), and keeps a visible scrollbar plus a partially cut row as scroll affordances.
  • New getWarehouseConnectionEvents RTK Query endpoint and response types; the edit-metric flow inherits the combo box.
  • Pagination is deferred (see feat: expose distinct warehouse event names per connection #8231): the API caps at the 500 most recent events and filtering is client-side; the is_truncated flag is the hook for server-side narrowing later.

How did you test this code?

  • Parametrised Jest tests on the option-building and unknown-event helpers.
  • Manual create and edit flows against a ClickHouse Cloud BYO connection.
  • Small-viewport dropdown behaviour (flip, adaptive height, scrollbar) and the free-text warning checked manually.

@Zaimwa9
Zaimwa9 requested a review from a team as a code owner August 6, 2026 10:32
@Zaimwa9
Zaimwa9 requested review from talissoncosta and removed request for a team August 6, 2026 10:32
@vercel

vercel Bot commented Aug 6, 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 6, 2026 1:22pm
flagsmith-frontend-staging Ready Ready Preview Aug 6, 2026 1:22pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 6, 2026 1:22pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds request and response contracts for warehouse connection events and exposes a query hook. It adds a creatable event selector that loads events, builds options, and warns when an event is not known by a supported warehouse. The metric creation form now uses this selector instead of a free-text event input. Unit tests cover event option creation and unknown-event detection.

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 added front-end Issue related to the React Front End Dashboard feature New feature or request labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@github-actions

github-actions Bot commented Aug 6, 2026

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  35.6 seconds
commit  2d7400f
info  🔄 Run: #19080 (attempt 1)

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  38.1 seconds
commit  2d7400f
info  🔄 Run: #19080 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  40 seconds
commit  2d7400f
info  🔄 Run: #19080 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.3 seconds
commit  2d7400f
info  🔄 Run: #19080 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  38.3 seconds
commit  cc6c91d
info  🔄 Run: #19078 (attempt 1)

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

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

passed  4 passed

Details

stats  4 tests across 4 suites
duration  33.3 seconds
commit  cc6c91d
info  🔄 Run: #19078 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  41.5 seconds
commit  cc6c91d
info  🔄 Run: #19078 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.5 seconds
commit  cc6c91d
info  🔄 Run: #19078 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  59.2 seconds
commit  ed02717
info  🔄 Run: #19061 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  31.7 seconds
commit  ed02717
info  🔄 Run: #19061 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.5 seconds
commit  ed02717
info  🔄 Run: #19061 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.7 seconds
commit  ed02717
info  🔄 Run: #19061 (attempt 1)

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

@Zaimwa9
Zaimwa9 force-pushed the feat/metrics-combobox-with-distinct-warehouse-events branch from ed02717 to cc6c91d Compare August 6, 2026 12:15
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Aug 6, 2026
Base automatically changed from feat/get-distinct-events-from-warehouse to main August 6, 2026 12:57
@Zaimwa9
Zaimwa9 requested review from a team as code owners August 6, 2026 12:57
@Zaimwa9
Zaimwa9 requested review from emyller and removed request for a team August 6, 2026 12:57

@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: 4c4f1803-d41f-49fd-86be-0edc0352005e

📥 Commits

Reviewing files that changed from the base of the PR and between e9de7ba and 2d7400f.

📒 Files selected for processing (9)
  • frontend/common/services/useWarehouseConnection.ts
  • frontend/common/types/requests.ts
  • frontend/common/types/responses.ts
  • frontend/web/components/experiments/CreateMetricForm/CreateMetricForm.tsx
  • frontend/web/components/experiments/EventNameSelect/EventNameSelect.scss
  • frontend/web/components/experiments/EventNameSelect/EventNameSelect.tsx
  • frontend/web/components/experiments/EventNameSelect/__tests__/utils.test.ts
  • frontend/web/components/experiments/EventNameSelect/index.ts
  • frontend/web/components/experiments/EventNameSelect/utils.ts

Comment on lines +30 to +38
getWarehouseConnectionEvents: builder.query<
Res['warehouseConnectionEvents'],
Req['getWarehouseConnectionEvents']
>({
providesTags: [{ id: 'EVENTS', type: 'WarehouseConnection' }],
query: ({ environmentId, id }) => ({
url: `environments/${environmentId}/warehouse-connections/${id}/events/`,
}),
}),

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

Invalidate the event-list cache after a connection update.

getWarehouseConnectionEvents provides WarehouseConnection:EVENTS, but updateWarehouseConnection invalidates only WarehouseConnection:LIST. If an administrator changes the connection configuration or credentials, an open metric form can continue to show event names from the previous source.

Add the EVENTS tag to updateWarehouseConnection.invalidatesTags.

Proposed fix
-        invalidatesTags: [{ id: 'LIST', type: 'WarehouseConnection' }],
+        invalidatesTags: [
+          { id: 'LIST', type: 'WarehouseConnection' },
+          { id: 'EVENTS', type: 'WarehouseConnection' },
+        ],

Comment on lines +34 to +35
const options = useMemo(() => buildEventOptions(data?.events), [data?.events])
const showWarning = isSuccess && isUnknownEvent(value, data?.events)

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

Do not show an unknown-event warning for a truncated result.

When data.is_truncated is true, an event absent from data.events can still exist in the warehouse. The current condition incorrectly tells users that the warehouse has not received that event.

Only show this warning when the response is complete. Add a component test for a truncated response.

Proposed fix
-  const showWarning = isSuccess && isUnknownEvent(value, data?.events)
+  const showWarning =
+    isSuccess &&
+    !data?.is_truncated &&
+    isUnknownEvent(value, data?.events)
📝 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
const options = useMemo(() => buildEventOptions(data?.events), [data?.events])
const showWarning = isSuccess && isUnknownEvent(value, data?.events)
const options = useMemo(() => buildEventOptions(data?.events), [data?.events])
const showWarning =
isSuccess &&
!data?.is_truncated &&
isUnknownEvent(value, data?.events)

@Zaimwa9
Zaimwa9 removed the request for review from emyller August 6, 2026 13:33
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.

1 participant