Skip to content

ci: plugin-tests 不再重复跑 tests/unit(#2492 后已冗余) - #2513

Merged
wehos merged 1 commit into
mainfrom
ci/dedupe-unit-tests
Jul 28, 2026
Merged

ci: plugin-tests 不再重复跑 tests/unit(#2492 后已冗余)#2513
wehos merged 1 commit into
mainfrom
ci/dedupe-unit-tests

Conversation

@wehos

@wehos wehos commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

#1542 收尾第 2 批。纯 CI 去重,不改任何产品代码。

起因

#2492 加的 unit-tests.yml每个 PR 上无 paths 过滤地pytest tests/unit -q 全量。而 plugin-tests.yml 仍在两处 paths 过滤器 + 一个 Run repository contract tests step 里点名同一批 11 个 tests/unit/* 文件 —— 全部是重复执行。

其中 9 个(card_cache_puller、card_forge_story_generator、card_drop_session_facts、card_drop_steam_pkce、community_oauth、facts_sync_worker、forge_credit_ledger、neko_warthunder_review_regressions、system_status_router)是 #1542 加进去的;另外 2 个(avatar_return_button_idle_tiers_static、plugin_sdk_packaging)是 #2492 之前就在的遗留。

改动

  1. 删掉 Run repository contract tests step —— 11 个文件全在 tests/unit/ 下,已被 unit-tests.yml 覆盖。

  2. paths 收回 plugin 自身范围,只留 plugin/**、workflow 自身、pyproject.tomluv.lock。移除的是那 11 条 tests/unit/*、为它们服务的主程序路径(card_drop_router.py / community_oauth.py / system_router/** / card_forge_facts.py / card_cache/** / facts_sync/** / forge_credit_ledger.py / forge_story_generator.py),以及 static/avatar/avatar-ui-buttons/**specs/launcher.spec。后两者已确认 plugin/tests 自身不引用(grep 零命中),它们纯粹是为触发被点名的那两个 tests/unit 文件而加的。

  3. 更新顶部注释 —— 原文自称 "First pytest gate in CI",fix(tests): 分诊并修完 tests/unit 的 18 条存量失败,并把该目录挂进 CI #2492 之后不再准确;改为说明 tests/unitunit-tests.yml 全量覆盖,本 workflow 只管 plugin/tests

  4. 删掉一条自锁测试 —— test_neko_warthunder_review_regressions.py::test_warthunder_review_regressions_are_in_plugin_ci 只做一件事:

    assert workflow.count("tests/unit/test_neko_warthunder_review_regressions.py") == 3

    它把「我必须留在 plugin-tests.yml 里」自锁住了,摘掉 workflow 那几行它就红。tests/unit 全量进 CI 后这个前提不存在了。同文件其余 warthunder 回归测试全部保留,改由 unit-tests.yml 跑。

回归报告 / Regression Report

  • 改动了什么plugin-tests.yml 去掉与 unit-tests.yml 重复的 tests/unit 执行与触发路径;删除一条自锁的元测试。无产品代码改动。
  • 理由 / 必要性:同一批测试在两个 workflow 里各跑一遍,白白占 Windows runner 时间;plugin-tests.yml 的 paths 被撑到覆盖大片主程序路径,与它自述的 "Scoped to the plugin subsystem on purpose" 相悖。
  • 改动前后的表现对比:测试覆盖不变 —— 11 个文件全部仍由 unit-tests.yml 每 PR 全量执行(两个 workflow 同为 windows-latest,平台覆盖也无变化)。差别只是不再跑第二遍,以及改动主程序文件时不再触发 plugin-tests(它只跑 plugin/tests,与那些文件无关)。
  • 潜在回归点:(a) 若将来 unit-tests.yml 被缩回 paths 过滤或点名模式,这批测试会失去覆盖 —— 届时需同步恢复;(b) 改 specs/launcher.spec 不再触发 plugin-tests,但 test_plugin_sdk_packaging.py 仍由 unit-tests.yml 每 PR 跑到,覆盖未丢。
  • 验证yaml.safe_load 解析通过(jobs / steps 结构完好);ruff 通过;原本被点名的 11 个文件单独跑 → 188 passeduv run pytest tests/unit -q6789 passed, 26 skipped, 0 failed(比改动前少 1 项,正是删掉的那条自锁断言)。

不拆分理由 / Why Not Split

workflow 的清理和那条自锁测试的删除必须同一个 PR:只删 workflow 行会让该测试立刻变红,只删测试则清理没做。两者加起来 2 个文件、-69/+7。

#2492 加的 unit-tests.yml 在每个 PR 上无 paths 过滤地跑 `pytest tests/unit -q`
全量,而 plugin-tests.yml 仍在 paths 过滤器 ×2 + 一个 "Run repository contract
tests" step 里点名同一批 11 个 tests/unit 文件——全部重复。

- 删掉 "Run repository contract tests" step(11 个文件,全在 tests/unit/ 下,
  已被 unit-tests.yml 覆盖)
- paths 收回 plugin 自身范围:plugin/**、workflow 自身、pyproject.toml、uv.lock。
  移除的 tests/unit/*(11 条)、card_drop_router / community_oauth /
  system_router / card_forge_facts / card_cache / facts_sync /
  forge_credit_ledger / forge_story_generator 这批主程序路径,以及
  static/avatar/avatar-ui-buttons/** 与 specs/launcher.spec,都只为触发那批
  被点名的 tests/unit 而存在(已确认 plugin/tests 本身不引用后两者)
- 更新顶部注释:它自称 "First pytest gate in CI",#2492 之后不再准确

同时删掉 tests/unit/test_neko_warthunder_review_regressions.py 里的
test_warthunder_review_regressions_are_in_plugin_ci——它只断言
`workflow.count("tests/unit/test_neko_warthunder_review_regressions.py") == 3`,
唯一作用是把「我必须留在 plugin-tests.yml 里」这件事自锁住。tests/unit 全量进
CI 后这个前提已不存在,同文件其余 warthunder 回归测试保留、改由 unit-tests.yml 跑。

验证:yaml.safe_load 通过;ruff 通过;原本被点名的 11 个文件单独跑
188 passed;uv run pytest tests/unit -q → 6789 passed, 26 skipped, 0 failed
(比改动前少 1 项 = 删掉的那条自锁断言)。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7172396b-0d2e-4e0b-890d-0fed3b857577

📥 Commits

Reviewing files that changed from the base of the PR and between 92ed281 and e0c53d6.

📒 Files selected for processing (2)
  • .github/workflows/plugin-tests.yml
  • tests/unit/test_neko_warthunder_review_regressions.py

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

本 PR 删除 plugin-tests.yml 中与全量单元测试工作流重复的执行与触发配置,测试覆盖保持不变喵。

  • plugin-tests.yml 现在仅负责 plugin/tests,并保留插件、依赖及工作流自身的触发路径喵。
  • 11 个仓库契约测试继续由无路径过滤的 unit-tests.yml 在每个 PR 和 main push 上全量执行喵。
  • 删除了仅用于锁定旧工作流文本配置的 Warthunder 元测试,其余回归测试保持不变喵。

Confidence Score: 5/5

本 PR 看起来可以安全合并,未发现测试覆盖缺口或其他可执行问题喵。

无路径过滤的单元测试工作流仍在相同 Windows 与 Python 环境中运行完整的 tests/unit 测试集,而 plugin/tests 不依赖被移除的触发路径喵。

Important Files Changed

Filename Overview
.github/workflows/plugin-tests.yml 删除重复的单元测试步骤及无关触发路径后,插件测试工作流仍完整覆盖其自身测试范围喵。
tests/unit/test_neko_warthunder_review_regressions.py 删除已失效的工作流自锁断言,不影响该文件保留的产品回归测试喵。

Reviews (1): Last reviewed commit: "ci: plugin-tests 不再重复跑 tests/unit(#2492 ..." | Re-trigger Greptile

@wehos
wehos merged commit c0229df into main Jul 28, 2026
12 checks passed
@wehos
wehos deleted the ci/dedupe-unit-tests branch July 28, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant