Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

Refactor timestamp handling across multiple components to use ISO 860… - #23

Merged
sucalul merged 2 commits into
mainfrom
rm-tz
Feb 19, 2026
Merged

Refactor timestamp handling across multiple components to use ISO 860…#23
sucalul merged 2 commits into
mainfrom
rm-tz

Conversation

@sucalul

@sucalul sucalul commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

…1 format without timezone; update related tests and documentation

Summary by CodeRabbit

  • ドキュメント

    • API 仕様のタイムスタンプ表記を ISO 8601(UTC 指示子なし)に更新しました。
  • テスト

    • GET/POST レスポンスの created_at/updated_at が ISO 8601 形式であることを検証するテストを追加・強化しました。
  • その他の改善

    • 各実装でタイムスタンプ出力を文字列化して一貫化しました。
    • 内部のスキーマ定義を小規模に調整しました。

…1 format without timezone; update related tests and documentation
@sucalul sucalul self-assigned this Feb 19, 2026
@coderabbitai

coderabbitai Bot commented Feb 19, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉


Walkthrough

複数言語のハンドラー、テスト、ドキュメント、OpenAPI でタイムスタンプ表記を除去・調整しています。ISO 8601 の末尾の Z(UTC 指示子)を削除し、Go の構造体はタイムスタンプを文字列化、テストはフォーマット検証を追加しています(約50語)。

Changes

Cohort / File(s) Summary
README サンプル更新
webapp/README.md
API レスポンスサンプルの created_at/updated_at から末尾の Z を削除(表示例のみ変更)
テスト検証強化
webapp/e2e/test.py
re インポートと公開定数 TIMESTAMP_PATTERN を追加。GET/POST レスポンスの created_at/updated_at を正規表現で検証するアサーションを追加
Go ハンドラー
webapp/go/handlers.go
PressReleaseCreatedAt/UpdatedAttime.Timestring に変更。DB からの time 値を受け取り formatTimestamp ヘルパーでタイムゾーン表記なしの文字列に変換する処理を追加
OpenAPI スキーマ
webapp/openapi.yml
PressRelease スキーマの created_at/updated_atformat: date-time から説明(ISO 8601 形式の日時文字列)へ変更し、例示値から Z を削除
PHP コントローラー
webapp/php/src/GetPressReleaseController.php, webapp/php/src/SavePressReleaseController.php
formatTimestamp の UTC 正規化と Z サフィックス付与を削除(DateTimeZone の削除を含む)
Python ハンドラー
webapp/python/main.py
format_timestamp(value: datetime) -> str を追加し、get_press_release/save_press_release のレスポンスで created_at/updated_at を文字列に変換するよう適用
データベーススキーマ
webapp/sql/schema.sql
press_releasesCREATE INDEX IF NOT EXISTS idx_press_releases_id ON press_releases(id); と関連コメントを削除

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRのタイトルは、複数のコンポーネント間でのタイムスタンプ処理をISO 8601形式(タイムゾーン除外)に統一するというコアな変更を正確に反映しており、変更内容の主要な目的と一致しています。
Docstring Coverage ✅ Passed Docstring coverage is 92.86% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rm-tz

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
webapp/e2e/test.py (1)

73-74: 検証: TIMESTAMP_PATTERNが実装出力より寛容

パターンは(?:Z|[+-]\d{2}:\d{2})?でZまたはタイムゾーンオフセットをオプショナルとして許容していますが、実際の実装(Go/PHP/Python)は常にタイムゾーン情報なし(例: 2026-02-13T06:14:04.732533)を出力します。

現在のパターンでもテストは通りますが、より厳密に実装と一致させる場合は以下のようにできます:

# より厳密なパターン(タイムゾーン部分を除外)
TIMESTAMP_PATTERN = r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+$'

ただし、将来的な柔軟性を考慮して現在の寛容なパターンを維持することも合理的です。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@webapp/e2e/test.py` around lines 73 - 74, TIMESTAMP_PATTERN currently allows
an optional timezone (?:Z|[+-]\d{2}:\d{2})? but your implementation always emits
timestamps without timezone (e.g. 2026-02-13T06:14:04.732533); update the
TIMESTAMP_PATTERN constant to match the implementation by removing the optional
timezone part and requiring fractional seconds (i.e., require \.\d+ after the
seconds) so the regex strictly matches timestamps produced by the Go/PHP/Python
output while keeping the symbol name TIMESTAMP_PATTERN unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@webapp/e2e/test.py`:
- Around line 73-74: TIMESTAMP_PATTERN currently allows an optional timezone
(?:Z|[+-]\d{2}:\d{2})? but your implementation always emits timestamps without
timezone (e.g. 2026-02-13T06:14:04.732533); update the TIMESTAMP_PATTERN
constant to match the implementation by removing the optional timezone part and
requiring fractional seconds (i.e., require \.\d+ after the seconds) so the
regex strictly matches timestamps produced by the Go/PHP/Python output while
keeping the symbol name TIMESTAMP_PATTERN unchanged.

@sucalul
sucalul merged commit 97443ea into main Feb 19, 2026
5 checks passed
@sucalul
sucalul deleted the rm-tz branch February 19, 2026 09:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant