Repository navigation
fix(git): keep a change request's state on edited and synchronized events - #659
Merged
Merged
Conversation
…ents crState returned "open" for every action other than closed/merged, so an edited or synchronized event on a merged or closed request reset the cached row to open. Only opened/created/reopened now set open; other actions keep the cached state (and merged_at), a request never seen defaults to open. Refs Paca-AI#656 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This PR stops a non-lifecycle change-request webhook (edited, synchronized, ready, …) from rewinding a merged or closed row back to open.
crStatestops defaulting to"open"—services/api/internal/service/git/service.go:426now returnsopenonly foropened/created/reopened, keepsclosed/merged, and returns""for actions that don't touch the lifecycle.trackChangeRequestpreserves the cached state —service.go:367reads the stored row when the event sets no state and keepscur.State/cur.MergedAt; a request never seen still defaults to open. This mirrors the existingEventReviewbranch, and themerged_atclearing on reopen is production-correct (the upsert writesstate = EXCLUDED.state, merged_at = EXCLUDED.merged_at).- Tests — a new table test covers edited/synchronized/reopened against merged, closed, open and unseen rows, and the review test's reopen case now uses
reopenedinstead of the previously (incorrectly) load-bearingsynchronized.
Behavior matches the proposal in #656 item 4, and the added read properly propagates non-ErrNotFound errors so a failed cache update still triggers a platform retry.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
pikann
approved these changes
Oct 29, 2026
pikann
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thank you for the 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
crStatenow returns the state an event sets (opened/created/reopened-> open,closed,merged) or an empty string when the event leaves the lifecycle unchanged. For those events (edited,synchronized,ready, ...)trackChangeRequestkeeps the cached state andmerged_at, as review events already do. A request never seen before still defaults to open.Why
crStatereturned "open" for every action other than closed/merged, so aneditedorsynchronizedevent on a merged or closed MR/PR reset the stored row to open.Tests
synchronizedreopening a merged request (nowreopened).go vet ./...,go test ./...and golangci-lint on the package pass.Refs #656
🤖 Generated with Claude Code