Skip to content

chore: CI で pytest を実行する - #18

Merged
wharfe merged 1 commit into
mainfrom
ci/pytest
Sep 8, 2026
Merged

wharfe merged 1 commit into
mainfrom
ci/pytest

Conversation

@wharfe

@wharfe wharfe commented Sep 8, 2026

Copy link
Copy Markdown
Owner

何を直すか

tests/ に 87 件のテストがあるのに CI が一度も実行していなかった。
scripts/ 側のガード(AI 生成の検証器・compute_stats・附則キーの重複検出)が
全部素通りでマージできる状態だった。

変更

.github/workflows/ci.yml に test ジョブを追加(lint / build と並列)。
astral-sh/setup-uv + uv run pytest -q。

87 tests / 0.39s と軽いのでパスフィルタは付けず、全 PR で無条件に走らせる。
tests/test_shipped_data.py が frontend/public/data/ のコミット済み生成物を
読むため、「スクリプトを直したがデータを再生成し忘れた」ズレもここで落ちる。

検証

  • ローカル: uv run pytest -q → 87 passed / exit 0
  • CI: このPRで赤(テストが守っている production code をわざと壊す)→ 緑 を実視する。
    緑だけでは「pytest が本当にガードになっている」証拠にならないため。
    (結果はこのPRのコメントに追記)

Gate3: 省略(CI 定義だが追加のみ・既存ジョブ / デプロイ経路 / 権限は不変。
実走による赤→緑の検算で閉じる — ユーザー裁定済み)

Closes #17

🤖 Generated with Claude Code

https://claude.ai/code/session_01VXy5NU1LCXmEcZfew4ezSu

Python 側のテストは書かれていたが CI が一度も走らせていなかったため、
scripts/ のガード(検証器・stats・附則キー)が全部素通りでマージできる
状態だった。lint / build と並ぶ独立ジョブとして追加する。

87 tests / 0.39s なのでパスフィルタは付けず全 PR で無条件に実行する。
tests/test_shipped_data.py が frontend/public/data/ の生成物を読むので、
「スクリプトを直したがデータを再生成し忘れた」ズレもここで落ちる。

Closes #17

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VXy5NU1LCXmEcZfew4ezSu
@vercel

vercel Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lex-diff Ready Ready Preview Sep 8, 2026 2:17pm UTC

@wharfe

wharfe commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

赤→緑の検算(実走)

状態 commit run Lint Build Python tests
緑(本体) a793369 34237147356 ✅ 27s ✅ 26s ✅ 13s
赤(意図的に破壊) 1f2a91f 34237279059 ✅ ✅ ❌ failure

破壊内容は compute_stats の main から is_suppl の除外を外したもの
(552a018 で直したばかりの実バグの再現)。ローカルで 18 failed / exit 1、
CI でも Python tests だけが赤・Lint と Build は緑のままで、
新ジョブが原因であることまで切り分けられていることを確認した。

破壊コミットは --force-with-lease で取り消し済み。
巻き戻し後の HEAD は元の a793369 と同一 sha のため、緑の証拠は上表の同一 run を指す
(sha が同じ以上、内容の同一性は保証される)。grep -c DELIBERATE scripts/diff.py = 0。

所要時間: Python tests 13s は Lint 27s / Build 26s より短く、CI のクリティカルパスを伸ばさない。

@wharfe
wharfe merged commit 21d0e2d into main Sep 8, 2026
8 checks passed
@wharfe
wharfe deleted the ci/pytest branch September 8, 2026 14:19

This branch was successfully deployed

1 active (outdated) deployment
Preview — 1f2a91f4 Deployed Sep 8, 2026 by vercel[bot]
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.

CI が pytest を実行していない — Python 側のガードが全部素通りでマージできる

1 participant