feat: Feature Flag Folders for Organization (#271)#350
feat: Feature Flag Folders for Organization (#271)#350mendarb wants to merge 2 commits intodatabuddy-analytics:mainfrom
Conversation
Implements feature flag folders (databuddy-analytics#271) using Option A (simple string field): - Database: added optional `folder` text field to `flags` table with index - API: added `folder` filter to `flags.list`, `folder` field to create/update schemas - Dashboard: folder input in flag create/edit sheet, folder grouping in flags list with collapsible sections, folder badge on flag rows - Shared: added `folder` to flagFormSchema for form validation - Tests: validation tests for folder field, grouping logic, filter operations Backward compatible - existing flags work without folders (shown as "Uncategorized"). Flag evaluation logic is unchanged; folder is UI-only metadata. Closes databuddy-analytics#271 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@mendarb is attempting to deploy a commit to the Databuddy OSS Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can generate a title for your PR based on the changes.Add |
Greptile SummaryThis PR introduces a folder organization system for feature flags — a purely UI/metadata change that adds a nullable
Confidence Score: 1/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as FlagSheet (UI)
participant RPC as flags.ts (RPC)
participant DB as PostgreSQL
Note over UI,DB: Edit existing flag (current broken state)
UI->>UI: form.reset({ tttttfolder: flag.folder }) ← bug: folder NOT set
UI->>UI: User submits (data.folder = undefined)
UI->>RPC: updateMutation({ folder: null })
RPC->>DB: UPDATE flags SET folder = NULL ← data loss!
Note over UI,DB: Create flag (folder applies only to fresh insert)
UI->>RPC: createMutation({ folder: "auth/login" })
alt fresh insert
RPC->>DB: INSERT INTO flags (folder) VALUES ('auth/login') ✓
else restoring soft-deleted flag
RPC->>DB: UPDATE flags SET name=..., environment=... ← folder missing! ✗
end
Note over UI,DB: List flags (correct)
UI->>RPC: list({ folder: "auth" })
RPC->>DB: SELECT * FROM flags WHERE folder = 'auth'
DB-->>RPC: filtered flags
RPC-->>UI: flags[]
UI->>UI: groupedFlags by folder → collapsible FolderHeaders
|
| dependencies: flag.dependencies ?? [], | ||
| environment: flag.environment || undefined, | ||
| targetGroupIds: extractTargetGroupIds(), | ||
| tttttfolder: flag.folder || undefined, targetGroupIds: extractTargetGroupIds(), |
There was a problem hiding this comment.
Corrupted property name causes folder data loss on edit
Line 294 contains tttttfolder as the property name instead of folder, and both folder and targetGroupIds are merged onto a single line. This is a clear edit corruption.
The consequence is two-fold:
- When opening an existing flag for editing, the folder field is never pre-populated (it always shows blank even if the flag has a folder set).
- More critically, when the user saves,
data.folderisundefined. Line 404 then evaluatesdata.folder?.trim() || null→null, so the update mutation is called withfolder: null. This silently clears the folder in the database on every save, regardless of whether the user intended to change it.
| tttttfolder: flag.folder || undefined, targetGroupIds: extractTargetGroupIds(), | |
| folder: flag.folder || undefined, | |
| targetGroupIds: extractTargetGroupIds(), |
- Fix corrupted `tttttfolder` property name to `folder` in flag-sheet.tsx, preventing silent data loss that cleared folder on every flag edit - Add missing `folder` field to soft-delete restore path in flags.ts, so folder value is applied when restoring a previously-deleted flag key Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Fixed both Greptile findings in 20eda0d:
|
Summary
Adds a folder system to organize feature flags in the dashboard UI. This is purely UI organization - flag evaluation, dependencies, API responses, and SDK behavior remain unchanged.
foldertext field toflagstable withflags_folder_idxindex for query performanceflags.listwith optionalfolderfilter parameter. Addedfoldertoflags.createandflags.updateschemas (max 200 chars)Design Choices
auth/loginorcheckout/paymentare stored directly on the flag. Simple, no extra tables needed, supports nested paths via path separator.roundedclassesBusiness Logic Unchanged
AI Disclosure
This PR was created with AI assistance (Claude Code). All code has been reviewed and verified.
Closes #271