fix: 参拝時の exp 二重加算を修正#115
Merged
cursor[bot] merged 2 commits intoJun 30, 2026
Merged
Conversation
Merged
actionlint が "the runner of ... action is too old to run" を検出し actions-test ジョブが失敗していた(alpha-0.2 既存の不具合)。 ランタイム廃止された古いアクションを互換性のある最新メジャーへ更新する。 - actions/checkout@v3 -> v4 - actions/setup-node@v2,v3 -> v4 - actions/cache@v3 -> v4 - google-github-actions/auth@v1 -> v2 - google-github-actions/setup-gcloud@v1 -> v2 入力仕様は各アクションで互換のため挙動は変えない。 ローカルで actionlint v1.7.12 がエラーなし(exit 0)を確認済み。 Co-authored-by: kojira <kojira@users.noreply.github.com>
sanpai で userRef.update を2回呼んでおり、双方に FieldValue.increment(add_exp) が含まれていたため、DB上の exp が獲得ポイントの2倍だけ加算されていた (表示用 status.exp は userData.exp + add_exp で1倍のため、DBと表示が乖離)。 1回目の update は参拝可能時間ロックのための last_sanpai 確定が目的なので、 exp の加算を除去し、計算後の2回目の update でのみ1回加算する。 注意: 既存ユーザーの exp は過去の二重加算分を含む可能性があるが、 本修正は今後の加算のみを正す(過去データの遡及補正は行わない)。 Co-authored-by: kojira <kojira@users.noreply.github.com>
7a9c87c to
e18cb70
Compare
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.
概要
PR #113 のレビューで指摘した既存バグ(参拝時に経験値
expが2倍加算される)を修正します。参拝高速化/ログイン修正(#113)とは独立した別件のため、本PRで分離して対応します。原因
exports.sanpai(app/functions/index.js)でuserRef.updateを2回呼んでおり、双方にexp: FieldValue.increment(add_exp)が含まれていたため、DB上のexpフィールドが獲得ポイントの 2倍 加算されていた。一方、レスポンス/表示用の
status.exp(=userData.exp + add_exp)は1倍で計算されており、DBの値と表示値が乖離していた。変更内容
1回目の
updateは「参拝可能時間のロックのためlast_sanpaiを先に確定させる」のが目的なので、expの加算のみを除去。計算後の2回目のupdateでのみ1回だけ加算するようにした(last_sanpaiの早期確定は維持)。影響・注意
expが正しく1倍で加算される(status.expとDBが一致)。expは過去の二重加算分を含む可能性があるが、本修正は今後の加算のみを正すもので、過去データの遡及補正は行わない(データ補正が必要な場合は別途マイグレーションを提案します)。補足
actions-test(actionlint)を通すため、alpha-0.2既存の古いアクション更新コミットを含む(参拝の解析処理の高速化とログイン切れの修正 #113/CI: actionlint が弾く古い GitHub Actions を新バージョンへ更新 #114 と同一の変更)。