This repository was archived by the owner on May 19, 2026. It is now read-only.
fix(collect): gate ADO merge_commit_sha by merge strategy (closes #96)#102
Merged
Conversation
Agent-Id: agent-aaa02b14-3155-4b9c-ac67-3cb7f5dadff2 Linked-Note-Id: 31c3fe18-add5-4954-8f52-1a2f839d12d3
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Narrows the ADO
merge_commit_shaemission gate so non-joinable SHAs from squash / rebase completions aren't silently persisted intopull_requests.commit_shas(issue #96, follow-up to #94).ADO's
lastMergeCommit.commitIdis actually the preview merge ref (refs/pull/N/merge). FornoFastForward(true merge) completions it equals the commit that lands on target. For squash and rebase, ADO creates new commit(s) on target whose SHA is notlastMergeCommit.commitId. The previous code wrote those non-joinable SHAs intocommit_shas, producing rows that never match against thecommitstable.Strategy matrix
statusmergeStrategymerge_commit_shacompletednoFastForwardor absentSome(lastMergeCommit.commitId)(joinable)completedsquash/rebase/rebaseMergeNone(would not join)active/abandoned/ anything elseNone(existing #94 behavior)The
Noneoutcome maps tocommit_shas = "[]"inupsert_pr, which is the same pre-#94 default — no regression for downstream consumers.Changes
Single file:
src/collect/azdo/pr_fetcher.rs(+210 / -16).PrRawnow deserializes both top-levelmergeStrategyand nestedcompletionOptions.mergeStrategy, preferring the top-level field when both are present.From<PrRaw> for AdoPullRequestgatesmerge_commit_shaemission per the matrix above. Comparison is case-insensitive (mirrors the existingstatuscheck style).refs/pull/N/mergesemantics).pr_raw_drops_merge_sha_for_non_completed_statustest fixtures updated to include"mergeStrategy": "noFastForward"so the completed-status sanity branch still emits a SHA after the gate change.Out of scope (deferred)
/pullRequests/{id}/commitsfallback to recover joinable SHAs for squash / rebase — issue Verify ADO lastMergeCommit.commitId against merge/squash/rebase completion strategies #96 lists this as optional;Noneis a safe default and a no-regression default vs pre-fix(collect): persist ADO PR merge commit SHA in commit_shas (closes #92) #94 behavior.Test plan
cargo test --lib azdo::pr_fetcher— 35 / 35 passcargo test— full suite passescargo clippy --all-targets -- -D warnings— cleancargo fmt --check— cleanCloses #96
Pull Request opened by Augment Code with guidance from the PR author