Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sentry-options/schemas/snuba/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@
},
"optional": true
}
},
"additionalProperties": {
"type": "number"
}
Comment on lines +380 to 382

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 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.

}
}
Expand Down
Loading