`comment.require_changes: coverage_drop` ignores the project status threshold
还没有人认领这个 Issue。
评估
调研方向
从 apps/worker/services/notification/notifiers/comment/conditions.py 中的 HasEnoughRequiredChanges._check_coverage_drop 开始,大约在第 147-159 行,这里从 coverage.status.project 读取阈值。修复需要查看具名状态条目(例如 default)内部的值,而不是映射本身。运行评论条件的单元测试,并确认覆盖率下降幅度小于已配置阈值时不再发布评论。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
The pull request comment docs say that coverage_drop "respects project status threshold, if configured (i.e. drop needs to be bigger than the configured threshold for the comment to be posted)". It does not: with a valid threshold configured, a comment is posted on any drop of more than 0.01%.
HasEnoughRequiredChanges._check_coverage_drop (conditions.py#L147-L159) reads the threshold one level too high:
project_status_config = read_yaml_field(
comparison.comparison.current_yaml, ("coverage", "status", "project"), {}
)
threshold = 0
if isinstance(project_status_config, dict):
threshold = Decimal(project_status_config.get("threshold", 0))
coverage.status.project is a map of named statuses (user_schema.py#L405-L418), so threshold lives under a status name such as default. project_status_config.get("threshold") therefore always returns the default 0. The shape the unit tests use, {"coverage": {"status": {"project": {"threshold": 10}}}}, is rejected by the validator: Error at ['coverage', 'status', 'project', 'threshold']: must be of ['dict', 'boolean'] type.
To Reproduce
-
Use this
codecov.yml(the validator accepts it and parses the condition to[6]):coverage: status: project: default: threshold: 0.5% comment: require_changes: "coverage_drop OR uncovered_patch" -
On a pull request with no existing Codecov comment and reports for both base and head, upload coverage that lowers project coverage by more than 0.01 but less than 0.5 percentage points, with no uncovered changed lines.
-
Codecov posts the comment. In umputun/remark42#2390, coverage went from 78.58% to 78.56% (-0.03%),
codecov/projectpassed,codecov/patchreported "Coverage not affected", and the comment was posted.
Expected behavior
No initial comment, because the project coverage drop is below the configured 0.5 percentage-point threshold and no changed lines are uncovered.
- 主要语言
- 没有语言数据
- 星标
- 52
- 派生
- 25
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codecov/feedback 的其他 Issue
-
Bundle analysis: `normalizePath` replaces everything after the first `-` in a file name, so different assets collide可能已有人在做 @ChiptenIsCool 于 16 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
Docs Waiting for: Product Owner
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 4/5 3-5 天 新手友好度 52/100
-
难度 4/5 1-2 天 新手友好度 42/100
-
难度 3/5 1-2 天 新手友好度 55/100
相似的 Issue
-
Grok provider voice list shows 5 of xAI's 28 built-in voices可能已有人在做 @hkjarral 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
hkjarral/AVA-AI-Voice-Agent-for-Asterisk#883 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: layer.move to the place a layer already has fails and stops a script; with several layers it leaves an empty undo step可能已有人在做 @jgregoriorincon 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
opengeos/RustGIS#2621 · 1 条评论 ·
维护者通常 1 天内回复
-
area:api bug finding
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Alexa HelpIntent and exception handler format HELP_MSG using audio data instead of the skill name未关闭
难度 2/5 1-3 小时 新手友好度 62/100
-
Hono path parameters with a regex pattern keep the pattern in the OpenAPI path可能已有人在做 @0z5a 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
cloudflare/chanfana#400 ·
维护者通常 1 天内回复