Skip to content

feat: 失敗時もジョブサマリに落ちたフェーズ+理由を出力(#78)#85

Merged
yk-lab merged 2 commits into
mainfrom
feat/failure-job-summary
Jul 13, 2026
Merged

feat: 失敗時もジョブサマリに落ちたフェーズ+理由を出力(#78)#85
yk-lab merged 2 commits into
mainfrom
feat/failure-job-summary

Conversation

@yk-lab

@yk-lab yk-lab commented Jul 13, 2026

Copy link
Copy Markdown
Owner

概要

core.summary のジョブサマリは従来 成功時のみ出力で、run() が途中で throw すると core.setFailed でログに出るだけだった。本 PR で 失敗時も「落ちたフェーズ + エラー理由 + 収集済みの部分情報」を表形式でジョブサマリに出す(NFR-5 可観測性 / #39 成功時サマリの補完)。

変更点

  • RunSummary.phase を導入し、パイプライン各ステップの頭で summary.phase を逐次更新(reading configurationresolving assetresolving versionchecking tool cachedownloading release assetverifying checksumextracting & cachinginstalling onto PATH)。
  • run()catchwriteFailureSummary() を呼び、Phase / Error / Version / Asset / Cache / Checksum を出力してから re-throw。
  • サマリ write 自体の失敗は握りつぶす(best-effort、成功時サマリと同じ扱い)。トークンは既存の setSecret 前提を維持。

レビュー修正(Codex P2)

  • configureProxyFromEnv()core.getInput(...) / parseRetryInput(...)try の外 に置いていたため、不正な retries / retry-base-ms 入力やプロキシ設定で throw すると catch に入らず failure summary が出ないまま死ぬ穴があった。
  • summary を関数先頭で先に宣言(phase: 'reading configuration')し、setup 一式を try 内へ移動。設定読込段階の失敗も failure summary が拾えるようにした。

受け入れ条件

  • run() throw 時も落ちたフェーズ / エラー / 部分情報(version・asset・cache・checksum)を表出力
  • サマリ write の失敗は action を落とさない(best-effort)
  • 成功時サマリ([enhancement] ジョブサマリに導入結果を出力(NFR-5) #39)の挙動は不変
  • 秘密情報がサマリに漏れない(setSecret 維持)

検証

ローカル pnpm run all green(typecheck / biome / vitest 95 passed / ncc build)。実 IO 経路は self-test.yml のマトリクスで E2E 検証される。

Closes #78

🤖 Generated with Claude Code

https://claude.ai/code/session_01AECzAv2vcdATecuvLjBSa6


Summary by cubic

Adds a failure-aware job summary so failed installs show the phase that broke, the error, and partial state. Also splits the action entry point to make run()/writeFailureSummary testable and adds unit tests; success behavior stays the same.

  • New Features

    • Track summary.phase across steps and, on error, write a failure summary via writeFailureSummary() from the run() catch.
    • Failure table includes: Phase, Error, Version, Asset, Cache, Checksum; write is best-effort and won’t fail the action. Success path keeps the existing summary; secrets remain masked via core.setSecret.
  • Refactors

    • Move proxy setup and input parsing into the try block so config/proxy errors also produce a failure summary.
    • Split ncc entry to src/index.ts (moves run().catch out of main), update build script, and document the entry in CLAUDE.md.
    • Add vitest unit tests for the failure summary path (tests/main.test.ts), including placeholders and handling a failed summary write.

Written for commit e6e1b01. Summary will update on new commits.

Review in cubic

run() のパイプラインを try/catch で囲み、throw 時に core.summary へ
失敗フェーズ・エラー・収集済みの部分情報(version/asset/cache/checksum)を
表形式で出力してから re-throw する(既存の outer catch が setFailed)。

- summary に phase を追加し各ステップ境界で更新(resolving version /
  downloading / verifying checksum / extracting & caching / installing)
- 失敗サマリ write 自体は best-effort(失敗しても action を落とさない)
- 成功時サマリ(#39)の挙動は不変

Closes #78

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

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

run() の実行状態を追跡し、処理失敗時にもフェーズ、エラー、収集済み情報をジョブサマリーへ出力するよう変更した。サマリー書き込み失敗は警告として扱い、元のエラーは再スローする。

Changes

失敗時ジョブサマリー

Layer / File(s) Summary
実行状態と失敗捕捉
src/main.ts
RunSummary で実行情報を保持し、主要ステップごとにフェーズを更新しながら、run() の失敗を捕捉してサマリー出力後に再スローする。
失敗サマリー出力
src/main.ts
writeFailureSummary() が失敗フェーズ、エラー、収集済み情報を Install Task — failed テーブルへ出力し、書き込み失敗を警告として処理する。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant run
  participant writeFailureSummary
  participant core.summary
  run->>run: 主要ステップの phase を更新
  run->>writeFailureSummary: summary と err を渡す
  writeFailureSummary->>core.summary: 失敗テーブルを書き込む
  run-->>run: 元のエラーを再スロー
Loading

Possibly related PRs

  • yk-lab/setup-task#50: src/main.tsrun() とジョブサマリー出力を扱う変更として関連する。

Poem

ぴょんと跳ねたら失敗も
サマリーの道しるべ
フェーズと理由を葉に書いて
キャッシュの跡も残します
うさぎは安心、月へ帰る 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed 失敗時のフェーズ・エラー・部分情報出力、best-effort 化、成功時挙動維持、秘密情報保護を満たしています。
Out of Scope Changes check ✅ Passed 要約された変更は #78 の目的に沿う main.ts まわりに限定され、明らかな逸脱は見当たりません。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed 主変更である失敗時のジョブサマリ出力を簡潔かつ具体的に表しており、内容も一致しています。
Description check ✅ Passed 概要・関連issue・検証が揃っており、テンプレート要件を概ね満たしています。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/failure-job-summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 4.22535% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.81%. Comparing base (85e1141) to head (e6e1b01).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/main.ts 4.34% 66 Missing ⚠️
src/index.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
- Coverage   72.18%   70.81%   -1.37%     
==========================================
  Files          13       14       +1     
  Lines         266      281      +15     
  Branches       68       70       +2     
==========================================
+ Hits          192      199       +7     
- Misses         65       74       +9     
+ Partials        9        8       -1     
Files with missing lines Coverage Δ
src/index.ts 0.00% <0.00%> (ø)
src/main.ts 6.94% <4.34%> (+6.94%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

run()/writeFailureSummary を import 副作用なくテストできるよう、ncc エントリを
src/index.ts に分離(run().catch は index.ts へ移動)。build script も index.ts に。
tests/main.test.ts で #78 の失敗サマリ経路(落ちたフェーズ / エラー / 部分情報 /
write 失敗の握りつぶし / '—' プレースホルダ)を検証する。self-test は happy path
のみでこの経路に届かないため単体テストで担保。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AECzAv2vcdATecuvLjBSa6
@yk-lab yk-lab merged commit a8f6861 into main Jul 13, 2026
20 of 21 checks passed
@yk-lab yk-lab deleted the feat/failure-job-summary branch July 13, 2026 14:26
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.

[enhancement] 失敗時もジョブサマリに落ちたフェーズ+理由を出力(NFR-5 観測性)

1 participant