Merge commits can take the PR head as parent, dropping carryforward flags on the base branch
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- git, github
- Área
- backend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 52
- Forks
- 26
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codecov/feedback
-
Bundle analysis: `normalizePath` replaces everything after the first `-` in a file name, so different assets collidePosiblemente ocupada @ChiptenIsCool la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Docs Waiting for: Product Owner
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
-
Feature RequestAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 5/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 54/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Todos los issues de codecov/feedback
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Huber-group-EMBL/Rarr#294 ·
Los mantenedores suelen responder en 1 día
-
needs attention untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#3666 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
punitarani/fli#270 ·
-
🐛 Bug 🔔 Pending processing
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
jumpserver/jumpserver#17980 ·
Los mantenedores suelen responder en 1 día
-
agent-butler-finding bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
jordansmall/spindrift#6414 ·
Los mantenedores suelen responder en 1 día