Repository navigation
fix(webhook): use resolutionDate and originalStatus when closing by body - #9415
Merged
klesh merged 1 commit intoNov 19, 2026
Merged
Conversation
The body-based close endpoints decoded resolutionDate and originalStatus from the request body but only passed issueKey on to closeIssue, which always set the resolution date to now (when missing) and cleared the original status. Incidents closed after a delay got a resolution date and lead time based on when the webhook arrived. Pass both values to closeIssue: a given resolutionDate replaces the stored one, and a given originalStatus is stored. Without them, and for the path-based endpoints, nothing changes. Leave the lead time unset when the resolution date is before the created date instead of letting the negative duration wrap around. Fixes apache#9414 Generated-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
klesh
approved these changes
Nov 19, 2026
klesh
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thanks for your contribution.
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.
Summary
The body-based webhook close endpoints ignored the
resolutionDateandoriginalStatussent in the request body.CloseIssueByBodyandCloseIssueByBodyByName(added in #8939) decode and validateCloseIssueByBodyRequest, which hasissueKey,resolutionDateandoriginalStatus, but only copiedissueKeyinto the path params before calling the sharedcloseIssue.closeIssuealways clearedoriginal_statusand setresolution_dateto the current time when it was missing, for the issue and for its incident. So an incident closed with{"issueKey": "DLK-1234", "resolutionDate": "2026-06-13T10:00:00Z"}got the time the webhook arrived as its resolution date, and its lead time (and DORA's failed deployment recovery time) was computed from that. Details in #9414.Changes:
api/issues.go:closeIssuetakes the optional resolution date and original status. The two body-based handlers pass the request's values; the path-based handlers passniland"", so they behave as before. A givenresolutionDatereplaces the stored one; without it, a missing resolution date is still set to now. A givenoriginalStatusis stored; without it,original_statusis still cleared. The same applies to the incident row.api/issues.go: since the resolution date can now come from the client, the lead time is only computed when the resolution date is not before the created date. Before, a negative duration would wrap around to a hugeuint.api/issues_test.go(new): calls the handlers against a mocked DAL with an open incident created at 09:00.TestCloseIssueByBodyUsesResolutionDateAndOriginalStatuscloses it by body withresolutionDate10:00 andoriginalStatusresolved, and checks the issue and incident get that date, that status and a 60 minute lead time. It fails without the fix (resolution date is now, original status is empty, lead time is about 229,000 minutes).TestCloseIssueWithoutResolutionDateUsesNowchecks the path-basedCloseIssuestill sets the resolution date to now and clears the original status.TestCloseIssueByBodyWithResolutionDateBeforeCreatedDatechecks a resolution date before the created date leaves the lead time unset.The request and response shapes don't change, so the Swagger docs don't need regenerating.
Does this close any open issues?
Fixes #9414
Screenshots
N/A
Other Information
go test ./plugins/webhook/...(aftermake mock): pass.go vet ./plugins/webhook/...andgofmt: clean.pr-type/bug-fix.Generated-by:trailer per the ASF generative tooling guidance.🤖 Generated with Claude Code