Merge commits can take the PR head as parent, dropping carryforward flags on the base branch
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- git, github
- 領域
- backend
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- 言語のデータがありません
- スター
- 52
- フォーク
- 26
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codecov/feedback のほかの issue
-
Bundle analysis: `normalizePath` replaces everything after the first `-` in a file name, so different assets collide対応中かも @ChiptenIsCool が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
Docs Waiting for: Product Owner
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
-
Feature Requestオープン
難易度 5/5 1週間以上 初心者へのやさしさ 5/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 54/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
codecov/feedback の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NethermindEth/nethermind#15684 ·
メンテナーはふだん 1 日以内に返信
-
bug(bufdelete): all()/other() abort with "Invalid buffer id" when a buffer is wiped during the loopオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
folke/snacks.nvim#2986 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OCA/l10n-brazil#5602 ·
メンテナーはふだん 1 日以内に返信
-
documentation review-2.0.0
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
dkuenzel/meshcore-home-gateway#98 ·
メンテナーはふだん 1 日以内に返信
-
mp4box.js — 20-byte `sgpd` box with large `entry_count` causes unbounded loop and heap OOM abortオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信