Skip to content

Added Structured logs for creator list query#405

Merged
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
dubemoyibe-star:feat/structured-logs-creator-list-query
Jun 1, 2026
Merged

Added Structured logs for creator list query#405
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
dubemoyibe-star:feat/structured-logs-creator-list-query

Conversation

@dubemoyibe-star
Copy link
Copy Markdown
Contributor

@dubemoyibe-star dubemoyibe-star commented May 31, 2026

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:

  • A string field receiving a number fires the error log with the correct field/type metadata
  • A Date field receiving a string fires the error log
  • Correctly typed fields produce no error log

The existing null-field warning tests are untouched and still pass.
Closes #404

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@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! 🚀

Learn more about application limits

@Chucks1093 Chucks1093 merged commit a42cbb1 into accesslayerorg:main Jun 1, 2026
1 check passed
@dubemoyibe-star dubemoyibe-star deleted the feat/structured-logs-creator-list-query branch June 1, 2026 11:10
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.

Add structured log for creator list query returning unexpected field types

2 participants