Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

マイグレーション処理のタイムゾーン補正に起因する不具合を修正する #531

Merged
merged 25 commits into from
Feb 18, 2022

Conversation

keiji
Copy link
Collaborator

@keiji keiji commented Nov 28, 2021

Issue 番号 / Issue ID

目的 / Purpose

破壊的変更をもたらしますか / Does this introduce a breaking change?

[x] Yes
[ ] No

Pull Request の種類 / Pull Request type

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[x] Documentation content changes
[ ] Other... Please describe:

検証方法 / How to test

コードの入手 / Get the code

git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
dotnet restore

コードの検証 / Test the code


確認事項 / What to check

[xUnit.net 00:00:10.96]     Covid19Radar.UnitTests.Services.Migration.MigrationServiceTests.Migrate_100to130Async [FAIL]
  Failed Covid19Radar.UnitTests.Services.Migration.MigrationServiceTests.Migrate_100to130Async [1 s]
  Error Message:
   System.ArgumentOutOfRangeException : The added or subtracted value results in an un-representable DateTime. (Parameter 't')
  Stack Trace:
     at System.DateTime.op_Addition(DateTime d, TimeSpan t)
   at Covid19Radar.Services.Migration.Migrator_1_3_0.MigrateDateTimeToEpoch(String dateTimeKey, String epochKey, TimeSpan differential) in /home/runner/work/cocoa/cocoa/Covid19Radar/Covid19Radar/Services/Migration/Migrator_1_3_0.cs:line 67
   at Covid19Radar.Services.Migration.Migrator_1_3_0.ExecuteAsync() in /home/runner/work/cocoa/cocoa/Covid19Radar/Covid19Radar/Services/Migration/Migrator_1_3_0.cs:line 41
   at Covid19Radar.Services.Migration.MigrationService.MigrateAsync(Version fromVersion) in /home/runner/work/cocoa/cocoa/Covid19Radar/Covid19Radar/Services/Migration/MigrationService.cs:line 221
   at Covid19Radar.Services.Migration.MigrationService.MigrateAsync() in /home/runner/work/cocoa/cocoa/Covid19Radar/Covid19Radar/Services/Migration/MigrationService.cs:line 136
   at Covid19Radar.UnitTests.Services.Migration.MigrationServiceTests.Migrate_100to130Async() in /home/runner/work/cocoa/cocoa/Covid19Radar/Tests/Covid19Radar.UnitTests/Services/Migration/MigrationServiceTests.cs:line 884
--- End of stack trace from previous location where exception was thrown ---

Failed!  - Failed:     1, Passed:   246, Skipped:     0, Total:   247, Duration: 13 s - /home/runner/work/cocoa/cocoa/Covid19Radar/Tests/Covid19Radar.UnitTests/bin/Debug/netcoreapp3.1/Covid19Radar.UnitTests.dll (netcoreapp3.1)
Passed!  - Failed:     0, Passed:   247, Skipped:     0, Total:   247, Duration: 13 s - /home/runner/work/cocoa/cocoa/Covid19Radar/Tests/Covid19Radar.UnitTests/bin/Debug/netcoreapp3.1/Covid19Radar.UnitTests.dll (netcoreapp3.1)

その他 / Other information

@keiji keiji self-assigned this Nov 28, 2021
@keiji keiji added the bug バグ。本来あるべき動作をしていないもの label Nov 28, 2021
@keiji keiji marked this pull request as ready for review November 28, 2021 16:22
@keiji
Copy link
Collaborator Author

keiji commented Dec 2, 2021

このPull Requestの内容は変更の必要がある。

Hotfix #518 では 0001/01/01 00:00:00のまま、タイムゾーン補正時にエラーをcatchする方式を採用した。
この場合、v1.3.0のマイグレーションを終えても 0001/01/01 00:00:00 のままとなる。

一方、ここで提案している変更だとタイムゾーン補正時に 0001/01/01 00:00:00 が来た場合 2020/06/19 09:00:00に置き換える操作が加わり、現在のv1.3.0マイグレーションと結果が変わる。

すでにHotfixがリリースされて端末上でマイグレーション処理が実行されているので、v1.3.0にこのPull Requestの変更を適用すると、規約合意日時が0001/01/01 00:00:00になっている利用者がいるという事実を伝える手段がなくなってしまう。

  • 0001/01/01 00:00:00のままという結果は変えない
  • タイムゾーン補正の方法のみを変更する
  • マイグレーションと2020/06/19 09:00:00への置き換えは、v1.4.x またはCOCOA2で再検討する

@keiji keiji marked this pull request as draft December 2, 2021 04:01
@keiji keiji marked this pull request as ready for review December 28, 2021 02:36
@ghost
Copy link

ghost commented Feb 17, 2022

@keiji
すみませんが、Confrictの解消もお願いします。

Add fallback when Asia/Tokyo timezone not found on the device.
@cocoa-dev005 cocoa-dev005 merged commit a240205 into develop Feb 18, 2022
@cocoa-dev005
Copy link
Contributor

LGTM :)
実機でマイグレーション処理のテストを行うので、もしロジックに問題があってもそこで発見できると思います。

@keiji keiji deleted the feature/fix520 branch June 8, 2022 03:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug バグ。本来あるべき動作をしていないもの
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TimeZoneInfo の取得方法を統一する
2 participants