trace-decision: test the check of the merge commit head with a merge queue

Open
#75 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github, javascript, node.js

Research direction

Read tools/trace-decision/collect-lib.mjs, especially mergedHead and readGitHub, and first verify the prerequisite fix for #71 is available. Follow the proposal to compare each queued pull request’s merge_commit_sha and second parent with its head.sha, then run the collector command on a line from each pull request. Done means documenting whether the existing check works for solo and grouped queue merges; if it does not, update the check and add a collector test.

Written by the indexing model from the issue text.

Description

type/feature
Problem to solve

The fix for #71 adds a check to the collector of trace-decision (mergedHead and readGitHub in tools/trace-decision/collect-lib.mjs). The collector confirms a pull request that merged as a merge commit only if the second parent of the merge commit is the head of the pull request (head.sha of GET /repos/{owner}/{repo}/pulls/{number}). The check stops a wrong confirmation when a stack of pull requests merges as one merge commit.

The check is tested only with pull requests that merged directly with the merge commit method. In this repo, the second parent of the merge commit of each of the last 21 merged pull requests (#2 to #74) is the head of the pull request.

A merge queue makes its merge commits in a different way. It groups the changes of a pull request with the latest version of the base branch and with the pull requests before it in the queue, on a temporary branch. After the required checks pass, GitHub merges the temporary branch into the base branch (Managing a merge queue). The docs do not say which parents these merge commits have, or which commit merge_commit_sha gives for each pull request of a group.

If the second parent is not the head of the pull request, the collector reports each pull request that merged through the queue as not confirmed. It does not confirm a wrong pull request. But an agent then gets no confirmed pull request for the lines of these pull requests. This repo does not use a merge queue. A repo that uses this template can turn one on.

Proposal

Test the check with a merge queue:

  1. In a test repo, turn on a merge queue for main with the merge commit method.
  2. Add one pull request to the queue alone. Then add two pull requests that merge in one group, for example with a minimum group size of 2.
  3. For each pull request, compare merge_commit_sha with the commits that main got. Compare the second parent of that commit with head.sha of the pull request.
  4. Run node tools/trace-decision/collect.mjs --max-references 0 <file> <start> <end> on a line of each pull request.

Result:

  • If the second parent is the head of the pull request in each case, remove the "Not tested" part of the comment on mergedHead.
  • If it is not, find which data of a merge through the queue identifies the pull request. Change the check, and add a test of the collector for this case.
Version

No response

More information

The check depends on the fix for #71, which is not in main yet.

Dominant language
Shell
Stars
1
Forks
0
Avg merge
6h 59m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c-w-z/commit-decision-record

All issues in c-w-z/commit-decision-record

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.