Merge commits can take the PR head as parent, dropping carryforward flags on the base branch
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- git, github
- Lĩnh vực
- backend
Hướng nghiên cứu
The report identifies apps/worker/services/repository.py, especially fetch_appropriate_parent_for_commit and _possibly_filter_out_branch, as the parent selection path. Read those functions alongside the merge handling in apps/worker/tasks/sync_pull.py, then trace how git parent order reaches the database query. Done means merge commits select the first git parent for the base branch and tests cover the case where both parents are stored on that branch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When a PR is merged with a merge commit (not squash/rebase), Codecov can pick the PR head as the parent of the merge commit on the base branch instead of the previous base-branch commit (the first git parent). With carryforward flags, the base branch then inherits the PR branch's report, so flags the PR never uploaded disappear from the base branch, or roll back to stale values.
In our repo (39 carryforward flags, CI runs only affected projects per PR) this happens on roughly half of merges. After about a week, 27 of the 39 flags had no coverage on main's head, and PRs showed (?) / "No coverage information found on base report" for them.
Root cause (worker source, codecov/umbrella @ 6d449dd)
apps/worker/tasks/sync_pull.py(L396-L420): when a PR is merged without squash, every commit on the PR includingpull.headis updated tobranch=<base branch>,merged=True.apps/worker/services/repository.pyfetch_appropriate_parent_for_commit(L109-L157): the merge commit's git parents are looked up, and both exist in Codecov's DB (the previousmaincommit from the push upload, the PR head from PR CI)._possibly_filter_out_branch(L160-L170) returns the first row whosebranchequals the commit's branch. After step 1, both parents havebranch=main. The query has noORDER BY, and git parent order is never consulted, so whichever row the DB returns first wins.
Empirically the row with the lexicographically smaller commit SHA wins: that held for every merge commit we checked (19 of 19), and it picks the PR head about half the time.
Expected
For a merge commit, prefer the first git parent (the previous commit on the base branch), e.g. preserve git_commit["parents"] order in _possibly_filter_out_branch instead of relying on the unordered query result.
Things we tried that don't help
- Uploading with an explicit parent (
commit_parentin codecov-action v5 /--parent-shain the CLI): the stored parent is still the one chosen above. - No
codecov.ymlkey controls parent selection. - Changing the merge strategy to squash avoids it, but that isn't an option for us.
Environment
- GitHub, Codecov GitHub App,
codecov/codecov-action@v5 - Carryforward on all flags,
strict_yaml_branch: main, merge-commit merges
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 52
- Fork
- 26
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codecov/feedback
-
Bundle analysis: `normalizePath` replaces everything after the first `-` in a file name, so different assets collideCó thể đã có người làm @ChiptenIsCool đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Docs Waiting for: Product Owner
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
Feature RequestĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 5/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 54/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của codecov/feedback
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
FinanceFlash/unvibecode#577 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
umbraco/Umbraco-CMS-MCP-Editor#274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ProdigyV21/ARVIO#873 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE]: Set fieldPath and reason on the CEL validation rulesCó thể đã có người làm @bjosv đã nhận hôm nay. Đang mởenhancement needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
valkey-io/valkey-operator#618 ·
Maintainer thường phản hồi trong vòng 3 ngày