Repository navigation
Bump server/shared: actually wire UtcTimestampSubscriber - #177
Merged
Merged
Conversation
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
There was a problem hiding this comment.
🟡 Changes recommended
New wiring spec mutates NODE_ENV and loads databaseConfig at module scope in way that can become test-order dependent and miss updatedAt bounds assertion.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Wire UtcTimestampSubscriber into real TypeORM DataSourceOptions.subscribers, so @CreateDateColumn/@UpdateDateColumn values get stamped by app code (not MySQL CURRENT_TIMESTAMP()).
Changes:
- Add
UtcTimestampSubscribertodatabaseConfigsubscribers for test + production configs - Add wiring/integration spec that builds real
DataSourcefrom exporteddatabaseConfigand verifies subscriber active onrepository.save()
File summaries
| File | Description |
|---|---|
| server/shared/config/database.config.ts | Register UtcTimestampSubscriber in DataSourceOptions.subscribers |
| server/shared/utils/entity/tests/utc-timestamp.subscriber.wiring.spec.ts | Add regression test validating subscriber wiring via exported databaseConfig |
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.
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.
Picks up buzz-code/nra-server#49. The previous bump (#175) shipped
UtcTimestampSubscriberregistered only as a NestJS provider, which does nothing on its own — TypeORM only picks up a subscriber if it's listed inDataSourceOptions.subscribers. Confirmed live: that fix deployed cleanly but a fresh API write still storedcreatedAtwith local wall-clock digits mislabeled UTC, unchanged.This bump declares the subscriber in
database.config.ts'ssubscribersarray (whatTypeOrmModule.forRootactually reads), and adds an integration test that exercises the real exporteddatabaseConfigthrough a realDataSource+repository.save()— the gap that let the previous version pass all tests while being broken in production.🤖 Generated with Claude Code
https://claude.ai/code/session_01Grpcg4VKLrJw9MkLWUMMBS
Generated by Claude Code