Added Structured logs for creator list query#405
Merged
Chucks1093 merged 2 commits intoJun 1, 2026
Merged
Conversation
|
@dubemoyibe-star Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Creator List Mapper – Runtime Type Validation
What's changed
The creator list mapper had no way to detect when a database field came back as the wrong type — for example, a column that used to be a Date silently becoming a string after a migration. By the time that reaches the client, it's either been coerced quietly or caused a runtime error with no useful context in the logs.
This PR adds runtime type checking inside mapCreatorListItem so that any type mismatch on a projected field is caught early and surfaced as a structured error-level log entry — before the bad value reaches the response.
What was added
logIfFieldTypeMismatch — a new function in creator-list-item.mapper.ts that checks each field from CREATOR_LIST_DEFAULT_SELECT against its expected runtime type (string, boolean, or Date). It skips null/undefined values (those are already handled by the existing null-field warning) and only fires when a non-null value is the wrong type.
The log entry includes fieldName, expectedType, receivedType, creatorId, and requestId for easy correlation in any log aggregator.
Client response behavior is unchanged — the mismatched value still passes through as-is. This is intentional; the log is an early warning signal, not a blocker.
Tests
Extended creator-list-item.mapper.test.ts with three new cases:
The existing null-field warning tests are untouched and still pass.
Closes #404