chore: Remove project template endpoints#109632
Conversation
We didn't ever finish off this feature and it has languished for a many months. Remove the endpoints and tests as a first step, next I'll remove the models.
|
|
||
| return project | ||
|
|
||
| @staticmethod | ||
| @assume_test_silo_mode(SiloMode.REGION) | ||
| def create_project_template(project=None, organization=None, **kwargs) -> ProjectTemplate: | ||
| if not kwargs.get("name"): | ||
| kwargs["name"] = petname.generate(2, " ", letters=10).title() | ||
|
|
||
| with transaction.atomic(router.db_for_write(Project)): | ||
| project_template = ProjectTemplate.objects.create(organization=organization, **kwargs) | ||
|
|
||
| return project_template | ||
|
|
||
| @staticmethod | ||
| @assume_test_silo_mode(SiloMode.CONTROL) | ||
| def create_data_access_grant(**kwargs): |
There was a problem hiding this comment.
Bug: The ProjectOptionsTests test class calls the create_project_template() method in its setUp() function, but this method has been removed from the test utility classes, which will cause an AttributeError.
Severity: CRITICAL
Suggested Fix
The ProjectOptionsTests class and its usage of create_project_template() should be removed or updated. Since the functionality related to project templates is being removed, the associated tests are likely no longer necessary and should be deleted.
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/testutils/factories.py#L587-L592
Potential issue: The pull request removes the test helper method
`create_project_template()` from `src/sentry/testutils/factories.py` and
`src/sentry/testutils/fixtures.py`. However, the test class `ProjectOptionsTests` in
`tests/sentry/models/test_project.py` still invokes this method within its `setUp()`
function. Because the test class inherits from `TestCase`, which uses the `Fixtures`
class, the call to the now-nonexistent `self.create_project_template()` will raise an
`AttributeError`. This will cause all tests within the `ProjectOptionsTests` suite to
fail during setup, preventing them from running.
Did we get this right? 👍 / 👎 to inform future reviews.
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Backend Test FailuresFailures on
|
We didn't ever finish off this feature and it has languished for a many months. With the OTLP taking a different route, I don't see us using ProjectTemplates any time soon.
Remove the endpoints and tests as a first step, next I'll remove the models.