Skip to content

fix(ci): restore main CI to green (lint blocker + 2 test systems) - #529

Merged
milechy merged 2 commits into
mainfrom
fix/main-ci-green
Jun 4, 2026
Merged

milechy merged 2 commits into
mainfrom
fix/main-ci-green

Conversation

@milechy

@milechy milechy commented Jun 3, 2026

Copy link
Copy Markdown
Owner

目的

main CI を green に戻す(全 PR の関門)。red はいずれも既存 main 由来で #523 とは無関係。

真因(実機で裏取り済み)

CI の Lint (ruff + mypy) job が ruff check で停止しており、Test job は needs: lint で未実行(run 26872934094 で確認)。よって報告の test 2系統だけ直しても CI は赤のまま。lint も同時に解消する。

Gate1 ruff check(実際の CI ブロッカー)

  • 4× I001(import 未ソート)を auto-fix: auth/router.py, automation/ai_judgment_scheduler.py, tests/test_fee_transfer_service.py, tests/test_line_messaging.py
  • isort が結合 import を2行に分割 → 2行目の # noqa: E402 を復元

Gate2 ruff format --check

  • drift していた5ファイルを整形(空白のみ・意味変更なし)

Gate3 mypy app/

  • reportlab.* を missing-stubs ignore に追加(upstream 型スタブ無し)
  • get_referral_earnings -> dict[str, str | int | None] に型付け

Test系統1 — test_judge_with_rag_vcr(2 ERROR)

aiohttp 3.14.0 で AsyncStreamReaderMixin が削除され vcrpy(<=8.1.1) が壊れる(upstream Issue #995 / PR #996 未リリース)。aiohttp は web3/ccxt 経由の transitive runtime dep のため requirements.txt に aiohttp<3.14 を固定し CI と prod で同一版を保証。3.13.5 で green 確認。

Test系統2 — test_monthly_report_router(8 FAILED)

register 制限(INITIAL_ADMIN_EMAIL)は仕様が正。フルスイートでは他テスト(test_risk_mode.py 等)が fixture 実行時に同 env を上書きするため、module-level の set が本テスト実行前に潰され /auth/register が 403。_register_admin 内で POST 直前に env を再セット(test_risk_mode.py と同パターン)。

ローカル検証

  • ruff check . → All checks passed
  • ruff format --check . → 515 files already formatted
  • mypy app/ → Success: no issues found in 249 source files
  • 系統2: test_risk_mode.py 先行 + 修正なしで 8 failed を再現 → 修正後 33 passed
  • 系統1: vcr 2件 2 passed(aiohttp 3.13.5)
  • 依存解決: web3 aiohttp>=3.7.4 / ccxt >=3.10.11 と <3.14 は両立

Note: フル pytest(Gate4)は postgres+pgvector が必要なため CI 側で最終確認。lint が通ることで初めて Test job が走る点に留意。

🤖 Generated with Claude Code

main CI was red at the Lint job (ruff check), so the Test job never ran
(needs: lint). Fixing only the reported test failures would have left CI
red. Addresses all blocking gates:

Gate1 ruff check (the actual CI blocker):
- 4x I001 import-sort auto-fixed (auth/router, ai_judgment_scheduler,
  test_fee_transfer_service, test_line_messaging)
- isort split a combined import; restored # noqa: E402 on the 2nd line

Gate2 ruff format: reformat 5 drifted files (whitespace-only).

Gate3 mypy:
- ignore reportlab.* missing stubs (no upstream type stubs)
- annotate get_referral_earnings -> dict[str, str | int | None]

Test system 1 - test_judge_with_rag_vcr (2 ERROR):
aiohttp 3.14.0 removed AsyncStreamReaderMixin, breaking vcrpy<=8.1.1
(upstream Issue #995 / PR #996 unreleased). aiohttp is a transitive
runtime dep via web3/ccxt, so pin aiohttp<3.14 in requirements.txt to
keep CI and prod on the same compatible version. Verified green on 3.13.5.

Test system 2 - test_monthly_report_router (8 FAILED):
register restriction (INITIAL_ADMIN_EMAIL) is correct spec. Other test
modules overwrite this env at fixture runtime, so the module-level set is
clobbered before these tests run -> /auth/register returns 403.
Re-set the env in _register_admin right before POST (same pattern as
test_risk_mode.py). Reproduced the 8 failures and confirmed green.

Verified locally: Gate1-3 green; both test systems green under
cross-module ordering.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🛡️ Path Access Control

❌ 違反 (マージブロック)

  • ❌ 凍結ファイル変更: backend/requirements.txt (docs/integration/backend_deps.md への申請が必要)

凍結ファイルを変更する場合は docs/integration/backend_deps.md に申請を記載してください。

⚠️ 警告 (要確認)

  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🤖 Automated Code Review

Files Reviewed: 0
⚠️ Issues: 0
💡 Suggestions: 0

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🤖 Codex Review

Security Check: ✅ PASS
Test Coverage: ✅ OK

No issues found. ✨

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Deploying ultra-autotrade-demo with  Cloudflare Pages  Cloudflare Pages

Latest commit: a9e74bd
Status: ✅  Deploy successful!
Preview URL: https://79c2a4aa.ultra-autotrade-demo.pages.dev
Branch Preview URL: https://fix-main-ci-green.ultra-autotrade-demo.pages.dev

View logs

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

✅ CI Lint Report

Check Status
Ruff (lint) ✅
Ruff (format) ✅
Mypy ✅
Pytest ✅
Coverage 85.2%

backend/requirements.txt is a frozen file; PR #529 added aiohttp<3.14 to
fix the CI vcrpy breakage. Adding the required entry to
docs/integration/backend_deps.md to satisfy the Path Check workflow.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🛡️ Path Access Control

⚠️ 警告 (要確認)

  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ 凍結ファイル変更(backend_deps.md に申請済み): backend/requirements.txt
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨
  • ⚠️ main への直接マージ: fix/main-ci-green → staging 経由が推奨

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🤖 Automated Code Review

Files Reviewed: 0
⚠️ Issues: 0
💡 Suggestions: 0

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🤖 Codex Review

Security Check: ✅ PASS
Test Coverage: ✅ OK

No issues found. ✨

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

✅ CI Lint Report

Check Status
Ruff (lint) ✅
Ruff (format) ✅
Mypy ✅
Pytest ✅
Coverage 85.2%

milechy pushed a commit that referenced this pull request Jun 4, 2026
Cherry-applies the same fixes as PR #529 (fix/main-ci-green) to this branch.
No branch-specific logic changed; all edits are in files this PR does not own.

- 4x I001 import-sort auto-fixed (auth/router, ai_judgment_scheduler,
  test_fee_transfer_service, test_line_messaging)
- ruff format: 5 files reformatted
- mypy: pyproject.toml ignore reportlab.*; referral/service.py type annotation
- test_fee_transfer_service.py L382: restored # noqa: E402 after isort split

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
milechy pushed a commit that referenced this pull request Jun 4, 2026
Cherry-applies the same fixes as PR #529 (fix/main-ci-green) to this branch.
No branch-specific logic changed; all edits are in files this PR does not own.

- 4x I001 import-sort auto-fixed (auth/router, ai_judgment_scheduler,
  test_fee_transfer_service, test_line_messaging)
- ruff format: 5 files reformatted
- mypy: pyproject.toml ignore reportlab.*; referral/service.py type annotation
- test_fee_transfer_service.py L382: restored # noqa: E402 after isort split

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
milechy pushed a commit that referenced this pull request Jun 4, 2026
Cherry-applies the same fixes as PR #529 (fix/main-ci-green) to this branch.
No branch-specific logic changed; all edits are in files this PR does not own.

- 4x I001 import-sort auto-fixed (auth/router, ai_judgment_scheduler,
  test_fee_transfer_service, test_line_messaging)
- ruff format: 5 files reformatted
- mypy: pyproject.toml ignore reportlab.*; referral/service.py type annotation
- test_fee_transfer_service.py L382: restored # noqa: E402 after isort split

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
milechy pushed a commit that referenced this pull request Jun 4, 2026
Same fixes as PR #529 applied to non-overlapping files only.
aave/client.py excluded from ruff format (this branch owns that file).

- 4x I001 import-sort auto-fixed
- ruff format: 4 files reformatted
- pyproject.toml: ignore reportlab.*; referral/service.py type annotation
- test_fee_transfer_service.py L382: restored # noqa: E402

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@milechy
milechy merged commit 69047a7 into main Jun 4, 2026
17 checks passed
@milechy
milechy deleted the fix/main-ci-green branch June 10, 2026 23:42
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