-
Notifications
You must be signed in to change notification settings - Fork 16
Add batch deletion to Experiments, Feature Flags, and Segments #3323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zackcl
wants to merge
61
commits into
dev
Choose a base branch
from
feature/3313-batch-delete
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
378a036
feat: guard batch segment deletion against concurrent usage changes
zackcl f2ae6b4
feat: add batch deletion eligibility endpoints
zackcl 602b426
feat: add guarded batch deletion endpoints with per-item outcomes
zackcl c48a328
feat: add frontend batch selection and deletion state flows
zackcl 40edc0c
feat: add batch deletion UI using cached selection state
zackcl 78055da
feat: share deletion state guards between single and batch endpoints
zackcl 0668c48
fix: align batch deletion with existing UI patterns and continue past…
zackcl 0fa4e43
fix: use standard batch deletion error handling and keep selection us…
zackcl 9a64209
refactor: remove obsolete batch deletion code and simplify regression…
zackcl ac76bfd
fix: preserve root table query behavior during batch deletion
zackcl 9b74e33
fix: clear root table loading state when cancelling list requests
zackcl c929131
fix: allow selecting loaded rows while additional pages load
zackcl e0c4f9c
fix: avoid duplicate notifications after reconciliation HTTP failures
zackcl aa38ca1
refactor: remove deletion eligibility endpoints and frontend reconcil…
zackcl 66ddd7e
fix: hide header selection checkboxes on empty tables
zackcl b3cfc95
test: remove redundant batch deletion checks and update rejection fix…
zackcl 9c711e9
refactor: move batch segment lookup into its repository and clarify d…
zackcl 11df68c
refactor: move deletion locking queries into the repository layer and…
zackcl 1e28434
refactor: move experiment and flag deletion eligibility queries into …
zackcl f10d903
refactor: remove unused batch selection exports and redundant confirm…
zackcl 4e0dd3f
fix: show existing table loading indicators during batch deletion
zackcl 8f718fd
fix: retain server-reported deletion restrictions for selected items
zackcl 027b4bd
refactor: simplify batch deletion feedback
zackcl 82bc9d8
refactor: remove unused batch deletion type exports
zackcl b4b4e3c
fix: restore row selection after failed root table queries
zackcl cecafaa
fix: await experiment deletion audit logs in the deletion transaction
zackcl 8ebe3f4
fix: preserve selection and detail views during batch deletion
zackcl c677a0c
fix: keep feature flag deletion audits in the deletion transaction
zackcl f3a1616
refactor: remove redundant batch deletion refreshes and unused outcomes
zackcl 0c6926f
refactor: remove backend deletion eligibility guards
zackcl 7fb56a0
fix: align experiment deletion rules and batch selection permissions
zackcl ea9f93e
docs: restore existing single-delete API descriptions
zackcl 6dd78bf
fix: remove reactive batch selection invalidation
zackcl 2ef23d2
refactor: align batch deletion service and test locations with existi…
zackcl 3ae2020
fix: classify batch deletion notifications by confirmed results
zackcl 7e2213d
test: trim redundant batch deletion cases and correct response fixtures
zackcl 8afb8df
fix: refresh segments when filtering by tag
zackcl 6e1bc92
fix: await segment recomputation between batch deletions
zackcl 6e2802f
fix: stop batch deletion when releasing a skipped item fails
zackcl e335cd8
fix: avoid error logging for expected batch deletion skips
zackcl 001d02d
fix: propagate batch budget reason to remaining items
zackcl d0dbcc9
fix: capture affected segment owners after acquiring deletion lock
zackcl 55c5f8a
test: remove redundant batch HTTP error interceptor coverage
zackcl 52bed39
fix: restore root table name spacing without batch checkboxes
zackcl 1633c74
fix: align batch table headers with existing UI conventions
zackcl 4604b0b
refactor: remove unused batch pagination actions and redundant pruning
zackcl a2ece1e
refactor: simplify segment batch recomputation options
zackcl c5d639e
fix: keep root table selection checkboxes visible
zackcl eea5736
fix: finish post-commit deletion work before reporting release failures
zackcl 1f2bc88
fix: preserve errors from experiment list requests
zackcl 131b90b
fix: reuse transaction connections throughout batch deletion
zackcl 71a529f
fix: handle detail views during batch deletion
zackcl 62bc061
fix: run segment cleanup after ambiguous batch commits
zackcl 6e2ad68
fix: make batch ID validation linear and remove unused pagination sel…
zackcl e80eb99
fix: avoid argument limits when building batch deletion results
zackcl b76320c
perf: use set lookups for batch response validation and selection
zackcl 6f92b8b
refactor: align batch deletion policies with existing single-delete APIs
zackcl 4768e3f
perf: use set membership for batch row checkbox bindings
zackcl b4f2b7e
fix: align flag selection IDs with first-page reloads
zackcl 22b278f
fix: treat a zero list offset as a replacement
zackcl 42c935a
refactor: remove unused phase from batch deletion responses
zackcl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/backend/src/api/controllers/validators/BatchEntityIdsValidator.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { ArrayNotEmpty, IsArray, IsUUID, registerDecorator } from 'class-validator'; | ||
| import { BatchEntityIdsRequest } from 'upgrade_types'; | ||
|
|
||
| const HasUniqueIds = () => (object: object, propertyName: string) => { | ||
| registerDecorator({ | ||
| name: 'arrayUnique', | ||
| target: object.constructor, | ||
| propertyName, | ||
| options: { message: "All $property's elements must be unique" }, | ||
| validator: { | ||
| validate(value: unknown) { | ||
| if (!Array.isArray(value)) return false; | ||
| const normalizedIds = value.map((id: unknown) => (typeof id === 'string' ? id.toLowerCase() : id)); | ||
| return new Set(normalizedIds).size === value.length; | ||
| }, | ||
| }, | ||
| }); | ||
| }; | ||
|
|
||
| export class BatchEntityIdsValidator implements BatchEntityIdsRequest { | ||
| @IsArray() | ||
| @ArrayNotEmpty() | ||
| @HasUniqueIds() | ||
| @IsUUID('all', { each: true }) | ||
| public ids: string[]; | ||
| } | ||
25 changes: 25 additions & 0 deletions
25
packages/backend/src/api/repositories/DeletionRepository.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { EntityManager, Repository } from 'typeorm'; | ||
| import { BatchDeleteEntity } from 'upgrade_types'; | ||
| import { EntityRepository } from '../../typeorm-typedi-extensions'; | ||
| import { Experiment } from '../models/Experiment'; | ||
| import { FeatureFlag } from '../models/FeatureFlag'; | ||
| import { Segment } from '../models/Segment'; | ||
| import repositoryError from './utils/repositoryError'; | ||
|
|
||
| /** All reads and locks use the caller's deletion transaction, never the repository's default manager. */ | ||
| @EntityRepository() | ||
| export class DeletionRepository extends Repository<DeletionRepository> { | ||
| public async findForDeletion( | ||
| entity: BatchDeleteEntity, | ||
| id: string, | ||
| manager: EntityManager | ||
| ): Promise<{ id: string } | null> { | ||
| const target = { experiments: Experiment, flags: FeatureFlag, segments: Segment }[entity]; | ||
| return manager | ||
| .getRepository<{ id: string }>(target) | ||
| .findOne({ where: { id }, select: { id: true }, lock: { mode: 'pessimistic_write' } }) | ||
| .catch((errorMsg: any) => { | ||
| throw repositoryError('DeletionRepository', 'findForDeletion', { entity, id }, errorMsg); | ||
| }); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.