feat(investigations): add the investigation template registry [3/13] - #121403
Merged
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
arslnb
marked this pull request as ready for review
August 6, 2026 06:54
arslnb
force-pushed
the
investigations/02-platform
branch
from
August 6, 2026 07:22
0d083db to
e42180f
Compare
arslnb
force-pushed
the
investigations/03-contracts
branch
from
August 6, 2026 07:22
2e1c19d to
b9518b1
Compare
arslnb
force-pushed
the
investigations/02-platform
branch
from
August 6, 2026 07:36
e42180f to
3bdb176
Compare
arslnb
force-pushed
the
investigations/03-contracts
branch
from
August 6, 2026 07:36
b9518b1 to
1dadf6c
Compare
arslnb
force-pushed
the
investigations/02-platform
branch
from
August 6, 2026 08:17
3bdb176 to
91b7a90
Compare
arslnb
force-pushed
the
investigations/03-contracts
branch
from
August 6, 2026 08:17
1dadf6c to
6483bde
Compare
This comment was marked as outdated.
This comment was marked as outdated.
arslnb
force-pushed
the
investigations/02-platform
branch
from
August 6, 2026 19:22
91b7a90 to
d729b2e
Compare
arslnb
force-pushed
the
investigations/03-contracts
branch
from
August 6, 2026 19:22
6483bde to
4a7acf2
Compare
arslnb
force-pushed
the
investigations/02-platform
branch
from
August 6, 2026 21:38
d729b2e to
ec4feee
Compare
arslnb
force-pushed
the
investigations/03-contracts
branch
from
August 6, 2026 21:38
4a7acf2 to
ded6311
Compare
arslnb
marked this pull request as draft
August 6, 2026 22:14
arslnb
force-pushed
the
investigations/03-contracts
branch
from
August 7, 2026 19:45
ded6311 to
d8aeed0
Compare
arslnb
force-pushed
the
investigations/03-contracts
branch
from
August 7, 2026 19:48
d8aeed0 to
49c1ca2
Compare
wedamija
force-pushed
the
investigations/03-contracts
branch
from
August 7, 2026 21:24
49c1ca2 to
af9440a
Compare
wedamija
marked this pull request as ready for review
August 7, 2026 23:12
… serializers. Split into separate files
wedamija
force-pushed
the
investigations/03-contracts
branch
from
August 8, 2026 00:15
66f9e52 to
9c13a6e
Compare
Comment on lines
+20
to
+30
| key: str | ||
| kind: str | ||
| title: str | ||
| content: str = "" | ||
| generation_prompt: str = "" | ||
| generated_content: str = "" | ||
| config: dict[str, Any] = field(default_factory=dict) | ||
| display: dict[str, Any] = field(default_factory=dict) | ||
| dependencies: tuple[str, ...] = () | ||
| parameters: tuple[str, ...] = () | ||
|
|
Contributor
There was a problem hiding this comment.
Bug: The frozen=True dataclasses TemplateBlockSpec and TemplateParameterSpec are unhashable because they contain dict fields, which will cause a TypeError if they are ever used in sets or as dict keys.
Severity: LOW
Suggested Fix
To make the dataclasses hashable as intended by frozen=True, convert the dict fields to an immutable type. For example, change dict[str, Any] to MappingProxyType[str, Any] and ensure the dictionary is wrapped in MappingProxyType during initialization. This preserves the immutable intent while making the objects correctly hashable.
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/investigations/templates/types.py#L18-L30
Potential issue: The dataclasses `TemplateBlockSpec` and `TemplateParameterSpec` are
defined with `frozen=True`, which implicitly generates a `__hash__` method. However,
these classes contain fields of type `dict` (`config`, `display`, `constraints`), which
are unhashable. Any attempt to add instances of these classes to a set or use them as
dictionary keys will result in a `TypeError: unhashable type: 'dict'`. While the current
pull request does not perform any hashing operations on these objects, this design
creates a latent bug that will likely cause runtime crashes in future code that handles
instantiation, caching, or deduplication of these spec objects.
Also affects:
src/sentry/investigations/templates/types.py:7~16
wedamija
added a commit
that referenced
this pull request
Aug 10, 2026
Split this out from #121403 to keep the size down. This implements validators (ie drf serializers) and contracts (drf serializers for validating seer output) for use in later stacked prs. <!-- Describe your PR here. -->
wedamija
added a commit
that referenced
this pull request
Aug 10, 2026
This splits out the response serializers from #121403 to keep the total pr size down, and restructures them into separate folders.
Contributor
Author
|
LGTM! |
wedamija
approved these changes
Aug 10, 2026
wedamija
added a commit
that referenced
this pull request
Aug 10, 2026
This splits out the response serializers from #121403 to keep the total pr size down, and restructures them into separate folders. <!-- Describe your PR here. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the code-owned, versioned template registry used by Investigation creation, plus the first breached-metric template. Templates are declarative specs with no database or service logic; instantiation comes in the next PR.