feat: wire CSV segments to the cohorts API - #8295
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdded typed cohort APIs and request and response contracts. Added UTF-8 identifier limits, CSV column serialisation, and upload size validation. Updated the CSV modal to create cohorts and synchronise identifier columns. Updated segment deletion and read-only editing for cohort-managed segments. Segment rows now show cohort details and deletion state. Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🟠 High · up to The CSV segment creation workflow can crash when users select a file or open Custom Fields because required UI components are missing imports, so the feature is not ready to merge until this is fixed. Cohort-managed segment metadata can also be edited locally despite being read-only, although those changes are not saved. 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. Comment |
Docker builds report
|
|
@themis-blindfold review |
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19734 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-16 — run #19734 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #19734 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #19734 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19719 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #19719 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #19719 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #19719 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19710 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #19710 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #19710 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #19710 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
|
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8b480a4e-0382-4485-8041-aa747fe926f9
📒 Files selected for processing (10)
frontend/common/services/useCohort.tsfrontend/common/types/requests.tsfrontend/common/types/responses.tsfrontend/common/utils/__tests__/csv.test.tsfrontend/common/utils/csv.tsfrontend/web/components/CsvUpload/CsvUpload.tsxfrontend/web/components/modals/ConfirmRemoveSegment.tsxfrontend/web/components/modals/CreateSegmentFromCsv/CreateSegmentFromCsv.tsxfrontend/web/components/segments/SegmentRow/SegmentRow.tsxfrontend/web/components/segments/SegmentRow/components/SegmentAction.tsx
Visual Regression19 screenshots compared. See report for details. |
f5c68a3 to
5757a9d
Compare
aa61a35 to
4083994
Compare
f1948e1 to
be6e18f
Compare
b2ed327 to
290b0c1
Compare
…nt-side, cover the two-step submit
290b0c1 to
73abef4
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/web/components/modals/CreateSegmentFromCsv/CreateSegmentFromCsv.tsx (1)
1-2: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winImport the JSX components before use.
Selecton Line 244 andFormGroupon Line 378 have no binding in this module. Selecting a CSV or opening Custom Fields throws aReferenceError.Proposed fix
import React, { FC, FormEvent, useMemo, useState } from 'react' import classNames from 'classnames' +import Select from 'react-select' +import { FormGroup } from 'reactstrap'Also applies to: 244-261, 378-390
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4c190586-88c5-49af-9b90-fcbc2e78c96c
📒 Files selected for processing (4)
frontend/common/types/requests.tsfrontend/common/types/responses.tsfrontend/web/components/modals/CreateSegment.tsxfrontend/web/components/modals/CreateSegmentFromCsv/CreateSegmentFromCsv.tsx
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Wires the CSV segment drawer (#8283) to the cohorts API (#8294).
Create flow
useCohortservice:createCohort,syncCohortCsv(multipart) anddeleteCohortmutations, invalidating the segment list.Segment list
CSVchip and a chip with the targeted environment's name, driven by thecohortsummary on the segment payload.Upload hardening
CsvUploadtakes amaxSizeBytesprop; the drawer passes 10MB to mirror the API cap, so oversized files are rejected client-side with a clear message.toParsedCsvno longer spreads every row intoMath.max, which overflowed the call stack on large files.How did you test this code?