Repository navigation
購読URLがサブパス配下で404になる不具合を修正し、カレンダー名を分かりやすくする - #74
Merged
Merged
Conversation
## 購読URLの404 本番は https://tukumana.si.aoyama.ac.jp/shift2/ のようにサブパス配下で 配信されているが、購読URLを window.location.origin を基準に組み立てていたため /shift2 が欠落し、Googleカレンダーに追加しても404で購読できなかった。 誤: https://tukumana.si.aoyama.ac.jp/api/ical/user/... → 404 正: https://tukumana.si.aoyama.ac.jp/shift2/api/ical/user/... → 200 config.API_BASE_URL(サブパスを含む)を基準に組み立てる toAbsoluteApiUrl() を 追加し、自分用・管理者用の両方の購読URLで使うようにした。 ## カレンダー名 購読したカレンダーが全員「シフト管理」という名前で追加され、 カレンダーアプリ上で誰のシフトか区別できなかった。 個人用: 「〇〇さんのシフト」(シフト0件時は「マイシフト」) 全体用: 「全員のシフト」 ## テスト js/modules/shifts.js にエクスポートガードを追加し、テストから実コードを 直接 import して検証している(docs/refactoring/phase-1-test-foundation.md の方針)。 本リポジトリで最初のガード追加。ブラウザでは module が未定義のため no-op。 旧挙動に一時的に戻して該当テストが落ちることも確認済み。 テスト: 422 passed (31 suites) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
不具合の報告
「購読URLをGoogleカレンダーに追加しても表示されない」という報告を受けて調査しました。PR #73 で私が作り込んだバグです。
原因: 購読URLから
/shift2が欠落していた本番は
https://tukumana.si.aoyama.ac.jp/shift2/のようにサブパス配下で配信されていますが、購読URLをwindow.location.originを基準に組み立てていたため、サブパスが落ちていました。window.location.originはhttps://ホスト名までしか含まないため、/shift2が失われます。Googleカレンダー側は404を受け取るだけなので、エラーも出さず「何も表示されない」状態になっていました。config.API_BASE_URL(既にサブパスを考慮済み)を基準にするtoAbsoluteApiUrl()を追加し、自分用・管理者用の両方で使うようにしました。管理者用の購読URLも同じバグの影響を受けていました。本番での確認
カレンダー名を分かりやすくした
購読したカレンダーが全員「シフト管理」という名前で追加され、カレンダーアプリ上で誰のシフトか区別できませんでした。
テスト
js/modules/shifts.jsにエクスポートガードを追加し、テストから実コードを直接 import して検証しています。本リポジトリで最初のガード追加です(docs/refactoring/phase-1-test-foundation.mdの方針に沿ったもの)。ブラウザではmoduleが未定義のため no-op です。今回、コピー方式のテストを書いたところ「自分で書いたスタブを検証するだけ」で実装のバグを検出できない状態になり、2度書き直しました。実コードを import する方式に切り替えて初めて、旧挙動で6件中5件が落ちることを確認できています。
マージ後に必要な作業
/shift2/js/modules/shifts.jsは旧コードのままです)セキュリティ上のお願い
デバッグの過程で購読URLがチャットに共有されました。購読トークンは実質パスワードなので、
.envのICAL_TOKENを再生成することをおすすめします。再生成すると全員の購読URLが一括で失効し、各自が新しいURLで登録し直す形になります。🤖 Generated with Claude Code