fix: レスキューの発生時刻をJSTで返し、採番をRETURNINGで受け取る - #537
Merged
taminororo merged 2 commits intoSep 17, 2026
Merged
Conversation
GET /rescues が DB の timestamptz をロケーション変換せずに整形していたため、 スプレッドシート(Asia/Tokyo で整形)とアプリで同じレコードが9時間ずれていた。 表示直前の一箇所で JST に変換する。
作成後に ORDER BY id DESC LIMIT 1 で最新行を読み直していたため、 同時に送信されると他のリクエストの id を拾い、スプレッドシートの対応番号と 中身がずれる。逆方向同期を有効にしたので、返答が別のレスキューに書き込まれうる。 使わなくなった FindNewRecord は3つのリポジトリから削除する。
|
Warning Review limit reachedNext included review available in 19 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
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 |
taminororo
deleted the
fix/kanba/535/rescue-time-jst-and-returning-id
branch
September 17, 2026 15:33
This was referenced Sep 17, 2026
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.
Close #535
Close #536
技大祭当日にレスキューを運用するための2点。どちらもレスキュー周りだけに閉じた修正で、DBスキーマの変更はない。
1. 発生時刻をJSTで返す(#535)
同じレコードがスプレッドシートとアプリで9時間ずれていた。2026-09-17 の疎通テストで実測した値。
スプレッドシートへ送る時刻はコントローラが
Asia/Tokyoで整形しているのに、アプリへ返す時刻はロケーション変換なしだったため。表示直前の一箇所(entity)に変換を寄せた。2. 採番をINSERTのRETURNINGで受け取る(#536)
作成後に最新行を読み直していたので、同時送信で他のリクエストの id を拾いうる。
この id はスプレッドシートの対応番号になり、逆方向同期(スプシ→DB)の PUT 先にもなる。2026-09-17 に逆方向同期を有効にしたので、ずれると「Aさんへの返答がBさんのレスキューに書き込まれる」形で実害が出る。
INSERT ... RETURNING idに変え、使わなくなったFindNewRecordは3つのリポジトリから削除した。テスト
追加したテストは2種類。
formatRescueTimeが UTC の値を JST で返すこと、ロケーションが違っても同じ瞬間なら同じ表示になることCreateが INSERT の RETURNING から id を受け取ること(go-sqlmock。作成後に読み直す実装に戻ると落ちる)確認済みの動作
本番で往復の疎通を確認済み(送信→スプシ→返答記入→DB)。テスト行は削除済み。