From f9c59223f67ff012051dae512d1e343dc91ee751 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Tue, 10 Nov 2026 16:11:14 -0800 Subject: [PATCH] ref(investigations): Send notebookVersion on notebook writes We're moving the notebook tables (Investigation*) into a new `sentry.notebooks` app, separate from the hypothesis engine that writes them, so other Seer producers like Autofix and triage can write notebooks too. Rename, block delete and archive send notebookVersion. This needs the backend that accepts the new name to be live first. --- static/app/views/investigations/api.ts | 10 +++++----- static/app/views/investigations/detail/block.tsx | 2 +- static/app/views/investigations/detail/index.spec.tsx | 10 +++++----- static/app/views/investigations/index.spec.tsx | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/static/app/views/investigations/api.ts b/static/app/views/investigations/api.ts index c74b8ec91454..5ce934be7f57 100644 --- a/static/app/views/investigations/api.ts +++ b/static/app/views/investigations/api.ts @@ -413,7 +413,7 @@ type FavoriteVariables = { type DeleteBlockVariables = { block: InvestigationBlock; - investigationVersion: number; + notebookVersion: number; }; type StopExecutionVariables = { @@ -530,7 +530,7 @@ export function useRenameInvestigationMutation( }, }), method: 'PUT', - data: {title, investigationVersion: current.version}, + data: {title, notebookVersion: current.version}, }); }, onSuccess: async (updated, savedTitle, onMutateResult, context) => { @@ -573,7 +573,7 @@ export function useDeleteInvestigationBlockMutation( return useMutation({ ...options, - mutationFn: ({block, investigationVersion}) => { + mutationFn: ({block, notebookVersion}) => { return fetchMutation({ url: getApiUrl( '/organizations/$organizationIdOrSlug/notebooks/$notebookId/blocks/$blockId/', @@ -587,7 +587,7 @@ export function useDeleteInvestigationBlockMutation( ), method: 'DELETE', data: { - investigationVersion, + notebookVersion, version: block.version, }, }); @@ -1004,7 +1004,7 @@ export function useDeleteInvestigationMutation( }, }), method: 'DELETE', - data: {investigationVersion: investigation.version}, + data: {notebookVersion: investigation.version}, }), options, {invalidateCandidates: true} diff --git a/static/app/views/investigations/detail/block.tsx b/static/app/views/investigations/detail/block.tsx index 453095c7597f..28227d980e85 100644 --- a/static/app/views/investigations/detail/block.tsx +++ b/static/app/views/investigations/detail/block.tsx @@ -199,7 +199,7 @@ function InvestigationNotebookBlockInner({ onConfirm: () => deleteMutation.mutate({ block, - investigationVersion: investigation.version, + notebookVersion: investigation.version, }), }), }, diff --git a/static/app/views/investigations/detail/index.spec.tsx b/static/app/views/investigations/detail/index.spec.tsx index 77b661293103..98e2eb7a337a 100644 --- a/static/app/views/investigations/detail/index.spec.tsx +++ b/static/app/views/investigations/detail/index.spec.tsx @@ -2855,7 +2855,7 @@ describe('Investigation detail', () => { expect(deleteRequest).toHaveBeenCalledWith( `${detailUrl}blocks/${block.id}/`, expect.objectContaining({ - data: {investigationVersion: 1, version: 1}, + data: {notebookVersion: 1, version: 1}, }) ) ); @@ -2881,7 +2881,7 @@ describe('Investigation detail', () => { expect(deleteRequest).toHaveBeenCalledWith( `${detailUrl}blocks/${block.id}/`, expect.objectContaining({ - data: {investigationVersion: 1, version: 1}, + data: {notebookVersion: 1, version: 1}, }) ) ); @@ -3375,7 +3375,7 @@ describe('Investigation detail', () => { expect.objectContaining({ data: { title: 'Renamed', - investigationVersion: 1, + notebookVersion: 1, }, }) ) @@ -3474,7 +3474,7 @@ describe('Investigation detail', () => { expect(renameRequest).toHaveBeenCalledWith( detailUrl, expect.objectContaining({ - data: {title: 'Saved before leaving', investigationVersion: 1}, + data: {title: 'Saved before leaving', notebookVersion: 1}, }) ) ); @@ -3661,7 +3661,7 @@ describe('Investigation detail', () => { await waitFor(() => expect(deleteRequest).toHaveBeenCalledWith( detailUrl, - expect.objectContaining({data: {investigationVersion: 1}}) + expect.objectContaining({data: {notebookVersion: 1}}) ) ); await act(() => jest.advanceTimersByTimeAsync(600)); diff --git a/static/app/views/investigations/index.spec.tsx b/static/app/views/investigations/index.spec.tsx index f1b5d87c1dcf..c55eec5d4001 100644 --- a/static/app/views/investigations/index.spec.tsx +++ b/static/app/views/investigations/index.spec.tsx @@ -523,7 +523,7 @@ describe('Explore Investigations', () => { await waitFor(() => expect(deleteRequest).toHaveBeenCalledWith( '/organizations/org-slug/notebooks/1/', - expect.objectContaining({data: {investigationVersion: 3}}) + expect.objectContaining({data: {notebookVersion: 3}}) ) ); await waitFor(() =>