chore(tables): remove tables-fractional-ordering feature flag#5503
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 8777864. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR removes the
Confidence Score: 5/5Safe to merge — this is a dead-code removal of a flag that was already fully enabled in production, with no schema changes and no behavioral change in any live code path. The fractional ordering path was already the sole active path in production; this PR just deletes the branch that was never taken. Lock acquisition in every insert/delete path (acquireRowOrderLock before resolveInsertOrderKey, nextRowPosition, and resolveBatchInsertOrderKeys) is preserved. The type system, API contract, undo hooks, and store types are all updated consistently. The mock extension for .offset() correctly threads through the limitBuilder closure. No files require special attention. All changed files are consistent and the removal is end-to-end. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Client as Client / UI
participant Route as API Route
participant Service as rows/service.ts
participant Ordering as rows/ordering.ts
participant DB as PostgreSQL
Client->>Route: POST /rows (rows, orderKeys?)
Route->>Service: batchInsertRowsWithTx(data, table)
Service->>Ordering: acquireRowOrderLock(trx, tableId)
Ordering->>DB: pg_advisory_xact_lock(hashtextextended(...))
DB-->>Ordering: lock acquired
alt orderKeys provided (undo restore)
Service->>Service: use data.orderKeys directly
else no orderKeys (new insert)
Service->>Ordering: resolveBatchInsertOrderKeys(trx, tableId, count)
Ordering->>DB: SELECT max(order_key) FROM user_table_rows
DB-->>Ordering: maxKey
Ordering->>Ordering: nKeysBetween(maxKey, null, count)
Ordering-->>Service: orderKeys[]
end
Service->>DB: nextRowPosition(trx, tableId) → start
Service->>DB: "INSERT INTO user_table_rows (order_key, position, ...) RETURNING *"
DB-->>Service: inserted rows
Service-->>Route: TableRow[]
Route-->>Client: "{ data: { rows: [...] } }"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Client as Client / UI
participant Route as API Route
participant Service as rows/service.ts
participant Ordering as rows/ordering.ts
participant DB as PostgreSQL
Client->>Route: POST /rows (rows, orderKeys?)
Route->>Service: batchInsertRowsWithTx(data, table)
Service->>Ordering: acquireRowOrderLock(trx, tableId)
Ordering->>DB: pg_advisory_xact_lock(hashtextextended(...))
DB-->>Ordering: lock acquired
alt orderKeys provided (undo restore)
Service->>Service: use data.orderKeys directly
else no orderKeys (new insert)
Service->>Ordering: resolveBatchInsertOrderKeys(trx, tableId, count)
Ordering->>DB: SELECT max(order_key) FROM user_table_rows
DB-->>Ordering: maxKey
Ordering->>Ordering: nKeysBetween(maxKey, null, count)
Ordering-->>Service: orderKeys[]
end
Service->>DB: nextRowPosition(trx, tableId) → start
Service->>DB: "INSERT INTO user_table_rows (order_key, position, ...) RETURNING *"
DB-->>Service: inserted rows
Service-->>Route: TableRow[]
Route-->>Client: "{ data: { rows: [...] } }"
Reviews (3): Last reviewed commit: "improvement(tables): drop dead position ..." | Re-trigger Greptile |
|
@greptile review |
|
@greptile review |
Summary
tables-fractional-orderingfeature flag — fractionalorder_keyordering is now the only path (it was already the production behavior). Dropped the registry entry, theTABLES_FRACTIONAL_ORDERINGenv var, and the staleisTablesFractionalOrderingEnabledtest mock.positionmachinery inlib/table/rows/ordering.ts(shiftRowsUpFrom,shiftRowsDownAfter,reserveInsertPosition,reserveBatchPositions,compactPositions) and simplified insert/delete/order-by to the single fractional path.positionsbatch-insert plumbing end-to-end (contract, route, query hook, undo hook, table-grid paste path, copilotuser-tabletool) — the server already ignored it. Undo restore still places rows exactly viaorderKeys..offset()support to the shareddatabase.mock.ts(the fractional insert path always uses it) and reworked twoupdate-rowtests that asserted the removed flag-off semantics.schema.ts/types.ts/backfill script to drop flag references (no DDL).Type of Change
Testing
lib/table,app/api/table, copilot table tool, feature-flags)tsc --noEmitclean;bun run lintclean;bun run check:api-validation:strictpassedbun run check:migrations origin/staging: no new migrationsChecklist