fix(gitlab): add missing commit_updated_at column used by the MR incremental filter - #9046
Open
DoDiODev wants to merge 1 commit into
Open
fix(gitlab): add missing commit_updated_at column used by the MR incremental filter#9046DoDiODev wants to merge 1 commit into
DoDiODev wants to merge 1 commit into
Conversation
…tal filter apache#8959 changed `GetMergeRequestsIterator` to filter merge requests by `GREATEST(gmr.gitlab_updated_at, COALESCE(gmr.commit_updated_at, gmr.gitlab_updated_at))`, but `commit_updated_at` does not exist on `_tool_gitlab_merge_requests`: there is neither a model field nor a migration script, and nothing ever writes the value. As a result every incremental "Collect MR Notes" run (the only caller that passes a stateful collector; the MR commit collector passes nil) aborts with: Error 1054 (42S22): Unknown column 'gmr.commit_updated_at' in 'where clause' This makes the intended behaviour actually work instead of reverting it: * add `CommitUpdatedAt` to `GitlabMergeRequest` plus a migration script * maintain the column in the MR commit extractor, setting it to the latest authored date of the MR's commits, so MRs that received new commits without their own `updated_at` being bumped (e.g. force-pushes) are picked up again * the collector filter is unchanged and now resolves against a real column Verified on MySQL 8 and PostgreSQL 14 (extractor UPDATE and the GREATEST filter produce identical results on both).
DoDiODev
force-pushed
the
pr/gitlab-mr-commit-updated-at
branch
from
August 12, 2026 12:19
5a7923d to
2ffa333
Compare
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.
fix(gitlab): add missing
commit_updated_atcolumn used by the MR incremental filterSummary
#8959 changed
GetMergeRequestsIterator(backend/plugins/gitlab/tasks/shared.go) tofilter merge requests by
but
commit_updated_atdoes not exist on_tool_gitlab_merge_requests. There is no fieldon the
GitlabMergeRequestmodel, no migration script, and no code writing the value —the only occurrences of the identifier in the whole repository are the three lines added
by that PR.
Consequently every incremental run of
Collect MR Notes— the only caller passing astateful collector,
mr_commit_collector.gopassesnil— fails with:Approach
Rather than reverting #8959, this PR makes the intended behaviour actually work:
CommitUpdatedAt *time.TimetoGitlabMergeRequest20260812_add_mr_commit_updated_at.go(registered inregister.go)ExtractApiMergeRequestsCommits: after extraction it is set tothe latest
commit_authored_dateof the MR's commits, scoped to the currentconnection/project
GetMergeRequestsIteratoris left as introduced by fix(gitlab): always re-collect MR commits regardless of MR updated_at… #8959 and now resolvesagainst a real column, so MRs that received new commits without their own
updated_atbeing bumped (e.g. force-pushes) are picked up again
Testing
make migration-script-lintgo test ./plugins/gitlab/e2e/ -run TestGitlabMrCommitDataFlow— green on MySQL 8and PostgreSQL 14; the extractor's
UPDATE ... SET ... = (SELECT MAX(...))and theGREATEST/COALESCEfilter behave identically on both enginesgo test ./plugins/ -run TestTableInfoNotes
The
GREATEST(...)expression returnsNULLon MySQL whengitlab_updated_atisNULL,so such MRs stay excluded — same as before #8959, where
gitlab_updated_at > ?alsoevaluated to
NULL. No behaviour change there.