fix(schema.json): policies can accept any number of arbitrary properties - #8421
Merged
Conversation
onewland
approved these changes
Aug 31, 2026
pbhandari
enabled auto-merge (squash)
August 31, 2026 23:02
tryangul
approved these changes
Aug 31, 2026
Comment on lines
+380
to
382
| "additionalProperties": { | ||
| "type": "number" | ||
| } |
Contributor
There was a problem hiding this comment.
Bug: The schema allows number for additionalProperties, but the code strictly checks for int types, causing an unhandled ValueError if a float (e.g., 5.0) is used.
Severity: HIGH
Suggested Fix
Change the JSON schema for additionalProperties from "type": "number" to "type": "integer". This ensures the values provided in the configuration match the strict type expectations of the Python code, preventing the unhandled ValueError.
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: sentry-options/schemas/snuba/schema.json#L380-L382
Potential issue: The JSON schema for `allocation_policies` allows `additionalProperties`
of type `number`, which includes both integers and floats. However, the `Configuration`
dataclass in the Python code performs a strict type check (`type(value) is
expected_type`). If a user provides a float value (e.g., `5.0`) for a configuration that
expects an `int`, a `ValueError` is raised during policy initialization. This exception
is not caught in `_construct_policies`, which will crash the policy resolution process
and impact resource allocation and query rate limiting.
Did we get this right? 👍 / 👎 to inform future reviews.
phacops
approved these changes
Aug 31, 2026
phacops
left a comment
Contributor
There was a problem hiding this comment.
This is a nice hack but that's OK. Ideally, we'd spec out correctly the additional properties.
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.
Allocation policy items in sentry-options currently fail schema validation when they include constructor overrides beyond the few named fields.
Allow additional numeric properties on each policy object so per-policy default_config_overrides can be set without listing every config key in the schema.
Follow-up to #8393.
Linear: EAP-726.
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.