Skip to content

test: cover the startup log rotation failure paths - #120

Merged
nonz250 merged 1 commit into
mainfrom
sabori-flow/111-20260731231855
Aug 9, 2026
Merged

nonz250 merged 1 commit into
mainfrom
sabori-flow/111-20260731231855

Conversation

@nonz250

@nonz250 nonz250 commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

close #111

worker.log の起動時ローテーション自体は、本 PR とは別の経路で先に main へマージされました(577425c, 20872a2)。そのため origin/main に rebase した結果、この PR に残るのは main 側の実装がカバーしていないテストだけになっています。Issue #111 は未クローズのため、このテスト補強をもってクローズします。

Changes

ローテーション処理は「ワーカーの起動を絶対に止めない」という方針で例外をすべて握り潰しますが、その catch を通る経路にテストがありませんでした。

  • worker.log が存在しない初回起動時に、例外を投げずにローテーションをスキップすることを検証するテストを追加しました
  • リネーム自体が失敗した場合(パーミッションエラー等)にも例外が外に出ないことを検証するテストを追加しました
  • 削除側のシンボリックリンクテストが、すべてのパスをシンボリックリンクとして扱っていたため worker.log のリネームガードまで巻き込んでいました。worker.log だけ通常ファイルとして扱うようモックを分離し、削除のスキップだけを検証するようにしています

Checklist

  • npm run build が通ることを確認
  • 全テストがパスすることを確認(814 tests / 29 files)

その他

サイズ閾値によるローテーションや launchd_stderr.log への重複出力の解消は本 Issue のスコープ外です(Issue コメントの通り別途追跡されています)。

🤖 Generated with Claude Code

…link test

The startup rotation guard swallows every error so a run never dies on a
missing or unwritable worker.log, but nothing exercised that catch. Add the
two failure paths, and stop the delete-side symlink test from also tripping
the rename guard.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@nonz250
nonz250 force-pushed the sabori-flow/111-20260731231855 branch from 3038a09 to f9268d5 Compare August 9, 2026 06:41
@nonz250 nonz250 changed the title fix: rotate worker.log on startup instead of growing forever test: cover the startup log rotation failure paths Aug 9, 2026
@nonz250
nonz250 marked this pull request as ready for review August 9, 2026 06:44
@nonz250
nonz250 merged commit 87cecfa into main Aug 9, 2026
2 checks passed
@nonz250
nonz250 deleted the sabori-flow/111-20260731231855 branch August 9, 2026 06:44
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.

fix: worker.log is never rotated and grows without bound

1 participant