Repository navigation
Description
#49109 states that removed entries stay in the position the cell used to hold, so the list reads as a diff. A move that is later downgraded to unchanged (a no-op move) breaks this: the removed entry gets displaced below a cell that originally followed it.
Repro against current master (b9d22fa), vitest in apps/studio (added to data/content/notebooks/notebook-operations.test.ts, using the file's existing NOTEBOOK fixture):
const NOTEBOOK: NotebookWire = {
schema_version: 1,
cells: [
{ _tag: 'markdown_cell', _id: 'cell-1', text: '# Intro' },
{ _tag: 'database_cell', _id: 'cell-2', sql: 'select 1', row_limit: 100 },
{ _tag: 'markdown_cell', _id: 'cell-3', text: '# Outro' },
],
}
it('does not let a no-op move after a deletion reorder the removed entry', () => {
const ops: NotebookOperation[] = [
{ _tag: 'delete_cell', cell_id: 'cell-2' },
{ _tag: 'move_cell', cell_id: 'cell-3', after_cell_id: 'cell-1' },
]
const result = deriveNotebookDiff(NOTEBOOK, ops)
expect(result.success).toBe(true)
if (!result.success) return
expect(result.entries).toHaveLength(3)
expect(result.entries).toEqual([
{ _tag: 'unchanged', cell: NOTEBOOK.cells[0] },
{ _tag: 'removed', cell: NOTEBOOK.cells[1], operationIndex: 0 },
{ _tag: 'unchanged', cell: NOTEBOOK.cells[2] },
])
})Moving cell-3 after cell-1 is a no-op once cell-2 is deleted (the surviving order is unchanged), and the move is correctly downgraded — but the removed entry no longer holds its original position:
- Expected + Received
{ "_tag": "removed", { "_tag": "unchanged",
"cell": { "_id": "cell-2", … }, "cell": { "_id": "cell-3", … } },
"operationIndex": 0 }, { "_tag": "removed",
{ "_tag": "unchanged", "cell": { "_id": "cell-2", … },
"cell": { "_id": "cell-3", … } } "operationIndex": 0 },
The final cell contents are unaffected, but the rendered preview shows the deletion happening in the wrong place — the entry order disagrees with what the reader is told to expect.
First found Aug 20 (master 5d3b849); re-verified today, Aug 25, on current master (b9d22fa) — fails identically throughout, across the id → _id refactor (#49272). The 29 existing tests in the file pass in the same run. Failing-test branch: https://github.com/anp0429/supabase/tree/edgeverdict/notebook-regressions-v2 — happy to open a PR with the test if useful.
Activity
anp0429 commentedon Aug 28, 2026
Re-verified on master 86c813e (after #49694): the test above still fails with the same shape, removed entry displaced below cell-3. Two more variants of the same class fail on master too (insert after a downgraded move; leading delete then move-to-start), both on the regression branch. If this was closed as design-intent, understood; if it was closed as fixed, it isn't yet.
test(notebooks): two more supabase#49546 variants, fail on master 86c…