Skip to content

ref: Remove unused PUT handler from repository details endpoint#115896

Merged
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/ref-remove-unused-put-handler-from-repository-details-endpoint
May 20, 2026
Merged

ref: Remove unused PUT handler from repository details endpoint#115896
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/ref-remove-unused-put-handler-from-repository-details-endpoint

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

With repositories now auto-synced 1:1 from SCM providers, the frontend no longer exposes a way to hide or restore repositories. Datadog shows zero PUT calls to this endpoint in the last 7 days (vs. thousands in the 30 days before that, while the UI was still calling it).

This removes the now-dead surface area:

  • The PUT method on OrganizationRepositoryDetailsEndpoint and its RepositorySerializer
  • The repository_cascade_delete_on_hide Celery task, whose only caller was that PUT handler, along with its tests and mypy weaklist entries
  • Inlined _get_repository_child_relations into RepositoryDeletionTask — its other caller is gone, and the comment distinguishing "hide" vs "delete" relations no longer applies

GET and DELETE on the endpoint are unchanged. DELETE is still receiving ~15 non-browser calls/day, so leaving it in place for now.

@evanpurkhiser evanpurkhiser requested review from a team as code owners May 20, 2026 16:44
@evanpurkhiser evanpurkhiser requested a review from armenzg May 20, 2026 16:44
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 20, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9915673. Configure here.

Comment thread pyproject.toml
Comment on lines +31 to 41
# CASCADE, so children must be deleted before parents.
return [
ModelRelation(Commit, {"repository_id": instance.id}),
ModelRelation(PullRequest, {"repository_id": instance.id}),
ModelRelation(
RepositoryProjectPathConfig,
{"project_repository__repository_id": instance.id},
),
ModelRelation(
SeerProjectRepositoryBranchOverride,
{"seer_project_repository__project_repository__repository_id": instance.id},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The deleted module sentry.tasks.repository is still referenced in TASKWORKER_IMPORTS, which will prevent the taskworker from starting.
Severity: CRITICAL

Suggested Fix

Remove the string "sentry.tasks.repository" from the TASKWORKER_IMPORTS list in src/sentry/conf/server.py to align with the module's deletion.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sentry/deletions/defaults/repository.py#L15-L41

Potential issue: The `sentry.tasks.repository` module was deleted, but its import path
remains in the `TASKWORKER_IMPORTS` list located in `src/sentry/conf/server.py`. When
the taskworker process starts, it attempts to import all modules specified in this list.
Since `sentry.tasks.repository` no longer exists, this will raise an `ImportError`,
preventing the taskworker from starting. This will cause CI tests like
`test_import_paths` to fail and will lead to a production outage for the taskworker
service.

Also affects:

  • src/sentry/conf/server.py

Did we get this right? 👍 / 👎 to inform future reviews.

With repositories now auto-synced 1:1 from SCM providers, the frontend
no longer exposes a way to hide or restore repositories. Datadog shows
zero PUT calls to this endpoint in the last 7 days (vs. thousands in
the 30 days before that, when the UI still called it).

Remove the now-dead surface area:

- The PUT method on OrganizationRepositoryDetailsEndpoint and its
  RepositorySerializer
- The repository_cascade_delete_on_hide Celery task, whose only caller
  was that PUT handler, along with its tests and mypy weaklist entries
- Inline _get_repository_child_relations into RepositoryDeletionTask --
  its other caller is gone, and the comment distinguishing "hide" vs
  "delete" relations no longer applies

GET and DELETE on the endpoint are unchanged.
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-remove-unused-put-handler-from-repository-details-endpoint branch from 9915673 to 7677d10 Compare May 20, 2026 16:48
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) May 20, 2026 17:01
@evanpurkhiser evanpurkhiser merged commit 1e6df8b into master May 20, 2026
85 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/ref-remove-unused-put-handler-from-repository-details-endpoint branch May 20, 2026 17:13
JonasBa pushed a commit that referenced this pull request May 21, 2026
)

With repositories now auto-synced 1:1 from SCM providers, the frontend
no longer exposes a way to hide or restore repositories. Datadog shows
zero PUT calls to this endpoint in the last 7 days (vs. thousands in the
30 days before that, while the UI was still calling it).

This removes the now-dead surface area:

- The `PUT` method on `OrganizationRepositoryDetailsEndpoint` and its
`RepositorySerializer`
- The `repository_cascade_delete_on_hide` Celery task, whose only caller
was that `PUT` handler, along with its tests and mypy weaklist entries
- Inlined `_get_repository_child_relations` into
`RepositoryDeletionTask` — its other caller is gone, and the comment
distinguishing "hide" vs "delete" relations no longer applies

`GET` and `DELETE` on the endpoint are unchanged. `DELETE` is still
receiving ~15 non-browser calls/day, so leaving it in place for now.
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