Skip to content

fix(issues): Reject mismatched status/substatus on group update#115181

Open
mrduncan wants to merge 2 commits into
masterfrom
mrduncan/fix/issue-update-substatus-integrity-error
Open

fix(issues): Reject mismatched status/substatus on group update#115181
mrduncan wants to merge 2 commits into
masterfrom
mrduncan/fix/issue-update-substatus-integrity-error

Conversation

@mrduncan
Copy link
Copy Markdown
Member

@mrduncan mrduncan commented May 8, 2026

A PUT /api/0/issues/{id}/ body with valid-but-mismatched status and substatus (e.g. {status: ignored, substatus: ongoing}) used to issue an UPDATE that violated the substatus_is_valid_for_status DB check constraint and surfaced as a 500.

GroupValidator.validate() now rejects mismatched pairs with a 400. infer_substatus drops a caller-supplied substatus that doesn't match new_status as a backstop, falling through to inference instead.

Fixes SENTRY-5MW7

A PUT /api/0/issues/{id}/ body with valid-but-mismatched status and
substatus (e.g. {status: ignored, substatus: ongoing}) used to issue an
UPDATE that violated the substatus_is_valid_for_status DB check
constraint and surfaced as a 500.

GroupValidator.validate() now rejects mismatched pairs with a 400.
infer_substatus drops a caller-supplied substatus that doesn't match
new_status as a backstop, falling through to inference instead.

Fixes SENTRY-5MW7
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 8, 2026
Combine the two near-duplicate tests into a single test using the
canonical bug case (ignored + ongoing) with consistent post-call
assertions that the group's status is unchanged.
@mrduncan mrduncan marked this pull request as ready for review May 8, 2026 17:20
@mrduncan mrduncan requested review from a team as code owners May 8, 2026 17:20
Copy link
Copy Markdown
Member

@nora-shap nora-shap left a comment

Choose a reason for hiding this comment

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

the 2 functions have 2 different strategies - validate rejects a status/substatus mismatch but infer_substatus will fix the mismatch for you.

your pr description acknowledges this, and I agree with your strategy to reject at the validation step and give the caller correct feedback, then use this graceful backstop to avoid a 500, but I think it would be a good idea to leave a comment (probably in infer_substatus) disclosing the choice+reasoning to handle mismatches differently.

@getsantry
Copy link
Copy Markdown
Contributor

getsantry Bot commented May 30, 2026

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry Bot added the Stale label May 30, 2026
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 Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants