Skip to content

ref(notebooks): Rename the Investigation endpoint, serializer and validator code to Notebook - #130698

Merged
wedamija merged 2 commits into
masterfrom
danf/notebooks-renames
Nov 11, 2026
Merged

wedamija merged 2 commits into
masterfrom
danf/notebooks-renames

Conversation

@wedamija

Copy link
Copy Markdown
Member

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.

Renames the Investigation* classes, modules and tests in sentry.notebooks to Notebook*. URL paths, URL names, API fields and table names don't change; the investigation_id URL kwarg changes in a later PR.

@wedamija
wedamija requested review from arslnb and billyvg November 10, 2026 22:14
@wedamija
wedamija requested review from a team as code owners November 10, 2026 22:14
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 10, 2026
Comment thread src/sentry/api/urls.py
Comment on lines +465 to 494
from sentry.notebooks.endpoints.organization_notebook_block_execution_index import (
OrganizationNotebookBlockExecutionsEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_block_index import (
OrganizationInvestigationBlocksEndpoint,
from sentry.notebooks.endpoints.organization_notebook_block_index import (
OrganizationNotebookBlocksEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_block_order import (
OrganizationInvestigationBlockOrderEndpoint,
from sentry.notebooks.endpoints.organization_notebook_block_order import (
OrganizationNotebookBlockOrderEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_comment_counts import (
OrganizationInvestigationCommentCountsEndpoint,
from sentry.notebooks.endpoints.organization_notebook_comment_counts import (
OrganizationNotebookCommentCountsEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_comment_details import (
OrganizationInvestigationCommentDetailsEndpoint,
from sentry.notebooks.endpoints.organization_notebook_comment_details import (
OrganizationNotebookCommentDetailsEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_comments_index import (
OrganizationInvestigationCommentsEndpoint,
from sentry.notebooks.endpoints.organization_notebook_comment_index import (
OrganizationNotebookCommentsEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_details import (
OrganizationInvestigationsDetailsEndpoint,
from sentry.notebooks.endpoints.organization_notebook_details import (
OrganizationNotebooksDetailsEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_duplicate import (
OrganizationInvestigationsDuplicateEndpoint,
from sentry.notebooks.endpoints.organization_notebook_duplicate import (
OrganizationNotebooksDuplicateEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_favorite import (
OrganizationInvestigationsFavoriteEndpoint,
from sentry.notebooks.endpoints.organization_notebook_favorite import (
OrganizationNotebooksFavoriteEndpoint,
)
from sentry.notebooks.endpoints.organization_investigation_index import (
OrganizationInvestigationsIndexEndpoint,
from sentry.notebooks.endpoints.organization_notebook_index import (
OrganizationNotebooksIndexEndpoint,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Endpoint class names don't match the renamed modules

The modules were normalized (..._block_executions → ..._block_execution_index, ..._comments_index → ..._comment_index), but the classes still follow the old names:

  • organization_notebook_block_execution_index → OrganizationNotebookBlockExecutionsEndpoint
  • organization_notebook_block_index → OrganizationNotebookBlocksEndpoint
  • organization_notebook_comment_index → OrganizationNotebookCommentsEndpoint
  • OrganizationNotebooksDetailsEndpoint / ...DuplicateEndpoint / ...FavoriteEndpoint / ...IndexEndpoint use plural Notebooks, while Presence, TitleGeneration, Block* and Comment* use singular Notebook.

Sentry usually pairs *_index.py with ...IndexEndpoint and *_details.py with ...DetailsEndpoint, with a singular resource name. This PR already touches every one of these names, so this is the cheapest time to make them consistent (for example OrganizationNotebookBlockExecutionIndexEndpoint, OrganizationNotebookDetailsEndpoint). Otherwise it takes another rename PR later.

Written by an AI agent and included in this review by its author.



def update_investigation(
def update_notebook(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Raw update_notebook/archive_notebook now share names with producer ones

Before this PR, the low-level functions here were update_investigation/archive_investigation. The producer-dispatching wrappers in services/producer.py were already update_notebook/archive_notebook. After the rename, both pairs have the same names and take the same keywords. For update_notebook the signatures are identical: (*, notebook, expected_version, fields, project_ids).

They don't do the same thing. The ones in producer.py route agentic notebooks through OrchestrationProducer, which calls update_investigation_with_orchestration/archive_investigation_with_orchestration. That locks the orchestration run, handles manualTitleOverride, and cancels the workflow on archive. The ones here skip all of that. services/__init__.py does from .notebooks import * with no __all__, so from sentry.notebooks.services import update_notebook returns the raw one. A future caller can pick the wrong one, and neither mypy nor the import will catch it. producer.py already needed the notebook_service alias to tell them apart.

The details endpoint imports the right ones today, so nothing is broken yet. Since every name here is changing anyway, give the raw pair names that say they bypass the producer, such as update_notebook_row/archive_notebook_row. Then the notebook_service alias in producer.py can go.

Written by an AI agent and included in this review by its author.

@wedamija
wedamija force-pushed the danf/notebooks-index-move branch from 12dbd08 to 8d6f25c Compare November 11, 2026 00:57
@wedamija
wedamija force-pushed the danf/notebooks-renames branch from a76c76b to 2d76c07 Compare November 11, 2026 00:57
@sentry

sentry Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 808 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

Base automatically changed from danf/notebooks-index-move to master November 11, 2026 02:34
@wedamija
wedamija force-pushed the danf/notebooks-renames branch from 2d76c07 to 8e2ffae Compare November 11, 2026 02:37
@wedamija
wedamija merged commit 3df7403 into master Nov 11, 2026
77 checks passed
@wedamija
wedamija deleted the danf/notebooks-renames branch November 11, 2026 02:58
joshuarli pushed a commit that referenced this pull request Nov 11, 2026
…130382)

Refreshes `.github/workflows/scripts/backend-test-durations.json` from
recent master runs, following #129569.

**Source data:** the per-file median of the `backend-test-durations-*`
artifacts from three green full-suite master `backend.yml` runs:
[42956939397](https://github.com/getsentry/sentry/actions/runs/42956939397),
[42949582386](https://github.com/getsentry/sentry/actions/runs/42949582386)
and
[42946963462](https://github.com/getsentry/sentry/actions/runs/42946963462)
(master through `80574457ad`). All three ran 30 shards with 4 workers on
`ubuntu-26.04`, with no `.github/` changes between them. The file was
built with the `merge` then `median` commands in the
`backend-test-durations.py` docstring.

This replaces the earlier candidate on this branch (built from runs
42725166893, 42723710111 and 42720716567).

**What changed vs master**
- **66 test files added, 12 removed.** Added: mostly
`tests/sentry/notebooks` (28) after the investigations → notebooks move,
plus `cadence` (5), `telemetry_classifiers` (5), `apidocs` (4),
`integrations` (4), `issues` (3), `preprod` (3) and others. Until now
the planner estimated these from their AST test count. Removed: files
deleted from the repo (`test_organization_sampling_project_rates.py`,
`test_organization_sampling_project_span_counts.py`, and ten
`tests/sentry/investigations/` files).
- **`seconds_per_test`:** 0.407 → 0.406 (−0.2%).
- **Files in both versions:** total time +2.8% (19,376s → 19,915s). One
file moved by more than 25% and 30s:
`tests/sentry/discover/test_dataset_split.py` 33.9s → 3.1s, after
#129853 removed the saved-query dataset splitter. No file regressed by
more than 50% and 30s.

**Reviewer note:** the oldest source run (`8cfabdbe5e`) predates
#130698, which renamed nine
`tests/sentry/notebooks/endpoints/*investigation*` test files to
`*notebook*`. Their old names carry one run's timing and no longer exist
on master; the planner never looks them up, and the next resync drops
them. I kept the output exactly as `median` produced it rather than
hand-editing it.

**Not changed:** `WORKER_SECONDS_PER_SHARD`. The shared files shifted
well under 15%, so the budget doesn't need retuning.

**Checks:** `test_backend_test_durations.py`,
`test_calculate_backend_test_shards.py` and `test_pytest_selected.py`
pass (58 tests) on this branch and on current master with the new file,
and prek passes on the changed file.

Updated by the nightly backend CI audit.

<!-- junior-request-attribution:start -->
via [automation
`sched_de6a73f860e60ba77d1f3cfb024722f2`](https://junior-prod.sentry.dev/automations/sched_de6a73f860e60ba77d1f3cfb024722f2)
· Run ID `sched_de6a73f860e60ba77d1f3cfb024722f2:1794124800000`,
[automation
`sched_de6a73f860e60ba77d1f3cfb024722f2`](https://junior-prod.sentry.dev/automations/sched_de6a73f860e60ba77d1f3cfb024722f2)
· Run ID `sched_de6a73f860e60ba77d1f3cfb024722f2:1794211200000`,
[automation
`sched_de6a73f860e60ba77d1f3cfb024722f2`](https://junior-prod.sentry.dev/automations/sched_de6a73f860e60ba77d1f3cfb024722f2)
· Run ID `sched_de6a73f860e60ba77d1f3cfb024722f2:1794297600000`,
[automation
`sched_de6a73f860e60ba77d1f3cfb024722f2`](https://junior-prod.sentry.dev/automations/sched_de6a73f860e60ba77d1f3cfb024722f2)
· Run ID `sched_de6a73f860e60ba77d1f3cfb024722f2:1794384000000`.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!--
junior-conversation-id:agent-dispatch%3Adispatch_71235f9c34e965e4d4a45d6c7df91edd
-->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_71235f9c34e965e4d4a45d6c7df91edd)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_71235f9c34e965e4d4a45d6c7df91edd/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants