Skip to content

Conversation

@ahal
Copy link
Collaborator

@ahal ahal commented Oct 9, 2025

No description provided.

@ahal ahal self-assigned this Oct 9, 2025
@ahal ahal requested a review from a team as a code owner October 9, 2025 20:43
@ahal ahal requested a review from bhearsum October 9, 2025 20:43
@ahal ahal marked this pull request as draft October 9, 2025 20:43
@ahal ahal force-pushed the ahal/push-kmlzomtxmptr branch 2 times, most recently from 0a5acfb to 6cb4197 Compare October 10, 2025 03:57
@ahal
Copy link
Collaborator Author

ahal commented Oct 14, 2025

Ok, I was able to test this in mozilla-releng/firefox-ci-playground#11

I made a commit on main that touched README.md, then create a PR based on the parent of that commit. The files-changed in the Decision task still showed only the files modified by the PR.

@ahal ahal marked this pull request as ready for review October 14, 2025 14:43
@ahal ahal added the BREAKING CHANGE Backwards incompatible request that will require major version bump label Oct 14, 2025
@ahal
Copy link
Collaborator Author

ahal commented Oct 14, 2025

I'm going to hold off landing this to see if we can sneak in a quick 16.2.1 release to fix a couple regressions before I cause another major version bump.

ahal added 2 commits October 14, 2025 14:25
This function works with anything committish, update the argument name
to reflect that (while we're breaking backwards compat anyway).
BREAKING CHANGE: the base_ref and base_rev parameters will now match
what was passed into the Decision task exactly. This means `base_ref`
will not get reset to the repo's default branch, and `base_rev` will no
longer be reset to the merge base.

### Why we were previously post-processing these parameters

Github push and pull_request events almost never contain the base ref,
and often don't contain the base rev. For base ref, it only ever seems
to be present when pushing a new branch. For base rev it is missing in
the following cases:

1. All pull_request events. The value we pass in is actually the
   revision that the base ref happens to be pointing at when the event
   is fired.
2. Force pushes. The value we pass in is actually the old unreachable
   head rev that used to be on the branch

Really, we only ever get a proper base rev when doing normal
fast-forward pushes.

The reason we need a base rev in the first place, is to compute the
files changed. So let's say there's a PR with the following graph:

    A -> B -> C -> D (main)
         \
          E -> F (PR)


Based on the Github event, `D` is being passed in as `base_rev` and `F`
is being passed in as `head_rev`. The post-processing was essentially
running `git merge-base` to find `B`, so that we could then use `git
log` to find all files touched between `B..F`.

### Why the post-processing isn't actually necessary

It turns out that `git log D..F` already does the right thing! It means,
show me all commits reachable from `F`, but not reachable from `D`,
which is exactly what we want. Only files changed in `E` and `F` will be
included. So there's no benefit of using `merge-base` for the purposes
of finding changed files.

As far as the `base_ref` post-processing goes, all we were doing was
setting it to `repo.default_branch` if it doesn't exist (which is almost
always for pushes). While this likely works in most cases, we don't
actually have any idea what the real `base_ref` is, so it's not correct
to be doing this.

Since we don't even need `base_ref` to determine files changed, I think
it's fine to leave it as `None` in the event it wasn't passed in.

### Risks with this patch

While removing this should be fine for the purposes of determining
changed files, there might be other use cases that projects are using
the `merge-base` for. Such projects may need to determine the merge-base
on their own, therefore this patch is backwards incompatible.

### Future improvements

I think we should consider removing or renaming the `base_ref` and
`base_rev` parameters. As outlined, they are misleading (at least with
Github based repos) and don't actually represent the "base revision".

But for now, I'll save that particular change for another day.
@ahal ahal force-pushed the ahal/push-kmlzomtxmptr branch from 6cb4197 to 90a856b Compare October 14, 2025 18:25
@ahal ahal enabled auto-merge (rebase) October 14, 2025 18:25
@ahal ahal merged commit 65b6496 into taskcluster:main Oct 14, 2025
15 checks passed
@ahal ahal deleted the ahal/push-kmlzomtxmptr branch October 15, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE Backwards incompatible request that will require major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants