Skip to content

Bump server/shared: explicit createdAt/updatedAt stamping fix - #175

Merged
buzz-code merged 1 commit into
mainfrom
claude/timestamp-utc-offset-prod-8tc72k
Sep 4, 2026
Merged

buzz-code merged 1 commit into
mainfrom
claude/timestamp-utc-offset-prod-8tc72k

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Picks up buzz-code/nra-server#48: UtcTimestampSubscriber stamps createdAt/updatedAt with an explicit Date right before persistence, bypassing MySQL's own CURRENT_TIMESTAMP() default — which evaluates using the MySQL server's session time_zone, independent of mysql2's timezone: 'Z' connection option (#44/#166).

Root cause of the timestamp bug persisting after the earlier fix: confirmed live (via a real API call cross-checked against date -u, and a direct SELECT NOW(), UTC_TIMESTAMP(); on the shared MySQL instance) that its SYSTEM time_zone isn't UTC — so CURRENT_TIMESTAMP() was silently writing local wall-clock digits mislabeled UTC into createdAt/updatedAt, regardless of the app-side fix.

Applies automatically to every @CreateDateColumn/@UpdateDateColumn in this repo (att_reports and 20+ other entities) — no per-entity wiring needed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Grpcg4VKLrJw9MkLWUMMBS


Generated by Claude Code

Picks up buzz-code/nra-server#48: UtcTimestampSubscriber stamps
createdAt/updatedAt with an explicit Date right before persistence,
bypassing MySQL's own CURRENT_TIMESTAMP() default - which evaluates
using the MySQL server's SESSION time_zone, independent of mysql2's
timezone: 'Z' connection option (nra-server#44). Root cause of the
timestamp bug persisting after the earlier fix: confirmed live that
this shared MySQL instance's SYSTEM time_zone isn't UTC, and
CURRENT_TIMESTAMP() was silently writing local wall-clock digits
mislabeled UTC.

Applies automatically to every @CreateDateColumn/@UpdateDateColumn in
this repo (att_reports, and 20+ other entities) - no per-entity wiring
needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Grpcg4VKLrJw9MkLWUMMBS
Copilot AI lite review requested due to automatic review settings September 4, 2026 09:06
@buzz-code
buzz-code merged commit cad0369 into main Sep 4, 2026
1 check passed

Copilot AI 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.

🟢 Approval recommended

Change limited to submodule pointer bump; no additional repo code changes and update aligns with stated timestamp fix scope.

Pull request overview

Update server/shared submodule to pick up shared TypeORM UtcTimestampSubscriber change, so createdAt/updatedAt get explicitly stamped in app layer (avoids MySQL CURRENT_TIMESTAMP() session time_zone behavior) across all entities using @CreateDateColumn/@UpdateDateColumn.

Changes:

  • Bump server/shared submodule pointer to newer commit containing UtcTimestampSubscriber registration and tests.
File summaries
File Description
server/shared Submodule commit bump to include explicit UTC timestamp stamping subscriber
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

buzz-code pushed a commit that referenced this pull request Sep 4, 2026
Picks up buzz-code/nra-server#49. The previous bump (#175) shipped
UtcTimestampSubscriber registered only as a NestJS provider, which
does nothing on its own - TypeORM only picks up a subscriber if it's
listed in DataSourceOptions.subscribers. Confirmed live: the previous
fix deployed cleanly but a fresh API write still stored createdAt with
local wall-clock digits mislabeled UTC, unchanged.

This bump declares the subscriber in database.config.ts's subscribers
array (what TypeOrmModule.forRoot actually reads), and adds an
integration test that exercises the real exported databaseConfig
through a real DataSource + repository.save() - the gap that let the
previous version pass all tests while being broken in production.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Grpcg4VKLrJw9MkLWUMMBS
buzz-code added a commit that referenced this pull request Sep 4, 2026
Picks up buzz-code/nra-server#49. The previous bump (#175) shipped
UtcTimestampSubscriber registered only as a NestJS provider, which
does nothing on its own - TypeORM only picks up a subscriber if it's
listed in DataSourceOptions.subscribers. Confirmed live: the previous
fix deployed cleanly but a fresh API write still stored createdAt with
local wall-clock digits mislabeled UTC, unchanged.

This bump declares the subscriber in database.config.ts's subscribers
array (what TypeOrmModule.forRoot actually reads), and adds an
integration test that exercises the real exported databaseConfig
through a real DataSource + repository.save() - the gap that let the
previous version pass all tests while being broken in production.


Claude-Session: https://claude.ai/code/session_01Grpcg4VKLrJw9MkLWUMMBS

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants