test: 検索テストの日付条件が実行時刻に依存して 0 件になるのを修正 - #102
Open
dotani1111 wants to merge 1 commit into
Open
Conversation
- getCreateDate() は同一インスタンスを返すため、review_start の -2日と review_end の +2日の modify が相殺し、review_end が create 当日になっていた - create_date は UTC 保存・検索日付は JST 解釈のため、JST 0:00〜8:59 の実行では 当日日付の review_end が検索範囲外となり 0 件になる - clone してから modify し、±2日のウィンドウを意図どおりにする Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要(Overview・Refs Issue)
JST 0:00〜8:59 に CI が実行されると
testReviewSearch/testDownloadCsvが必ず失敗する、テストの時刻依存バグを修正します。#101 の CI(JST 8:42 実行)で 8 ジョブすべてが同じ 2 テストで失敗し発覚しました(該当 run)。
4.4 ブランチ自体の問題のため、push CI や他 PR でも実行時刻によって再現します。
原因
initForm()が検索条件の日付を作る際、getCreateDate()が返す同一の DateTime インスタンスにmodify('-2 days')→modify('+2 days')を順に適用しているため相殺し、review_endが「投稿の 2 日後」ではなく「投稿当日」の日付になります。これ単体では成立します(リポジトリ側が
review_endに +1 日して終端にするため)が、create_date は UTC で保存され、検索フォームの日付は JST として解釈されるため、終端は「JST 翌日 0 時 = UTC 当日 15 時」になります。UTC 15:00 以降(= JST 0:00〜8:59)に実行すると「UTC now」の create_date が終端を過ぎ、検索が 0 件になります。
裏取りとして、
review_endを投稿当日にすると 0 件・翌日にすると 1 件になることをローカルで確認しています。方針(Policy)
cloneしてからmodifyし、±2 日の検索ウィンドウを意図どおりにする(3 行の修正)テスト(Test)
マイナーバージョン互換性保持のための制限事項チェックリスト
※ 変更はテストコードのみです。
レビュワー確認項目
🤖 Generated with Claude Code