Skip to content

Conversation

@kjamrog
Copy link
Collaborator

@kjamrog kjamrog commented Dec 18, 2025

Context:
The reason for the change is that we want to avoid logging full message payload in debug logs as it can potentially contain private data. The aim is to log only some metadata that is generally useful for debugging and gathering metrics about the processing + give client an option to provide custom formatter if more logs are needed

Summary of the changes:

  • not logging full message anymore
  • removed redundant logs - each message processing goes through handleMessageProcessed method and we have single log there:
  • in the log we include:
    • parsed message properties (id, type, metadata, timestamps etc.) - this is always logged
    • the output of messageLogFormatter - only if provided explicitly (default one printing whole message was removed)

Summary by CodeRabbit

  • New Features

    • Added configurable message metadata field for richer message tracking.
  • Bug Fixes

    • Consolidated message logging into a unified processed-message path for consistent, structured logs.
    • Removed per-publish inline logging to prevent duplicate or unstructured log entries and reduce noisy logs.
  • Refactor

    • Message log formatters are now optional.
    • Logging APIs now operate on processed message metadata for more consistent logging behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

📝 Walkthrough

Walkthrough

Refactors per-message logging: removes inline logging in publishers/consumers, centralizes logging around ProcessedMessageMetadata, changes resolveMessageLog signatures to accept metadata, makes messageLogFormatter optional, adds messageMetadataField and messageMetadata handling, and removes the default log formatter export.

Changes

Cohort / File(s) Summary
Core Queue & Types
packages/core/lib/queues/AbstractQueueService.ts, packages/core/lib/queues/HandlerContainer.ts, packages/core/lib/types/queueOptionsTypes.ts, packages/core/test/queues/HandlerContainer.spec.ts
Adds messageMetadataField; introduces logMessageProcessed (replacing inline logs); resolveMessageLog now accepts ProcessedMessageMetadata; MessageHandlerConfig.messageLogFormatter becomes optional; ProcessedMessageMetadata gains messageMetadata; removes defaultLogFormatter export; test updated to remove default-formatter assertion.
AMQP
packages/amqp/lib/AbstractAmqpConsumer.ts, packages/amqp/lib/AbstractAmqpPublisher.ts, packages/amqp/test/consumers/AmqpPermissionConsumer.spec.ts, packages/amqp/test/publishers/AmqpPermissionPublisher.spec.ts
Removed inline per-message logging in publish/process paths; consumer resolveMessageLog signature updated to accept ProcessedMessageMetadata; tests updated to reflect new log shapes and counts.
GCP Pub/Sub
packages/gcp-pubsub/lib/pubsub/AbstractPubSubConsumer.ts, packages/gcp-pubsub/lib/pubsub/AbstractPubSubPublisher.ts
Consumer: resolveMessageLog now accepts ProcessedMessageMetadata and guards missing fields/formatter; Publisher: removed inline per-message logging and prior resolveMessageLog implementation.
SQS
packages/sqs/lib/sqs/AbstractSqsConsumer.ts, packages/sqs/lib/sqs/AbstractSqsPublisher.ts, packages/sqs/test/consumers/SqsPermissionConsumer.spec.ts
Removed inline logging during processing/publish; consumer resolveMessageLog signature changed to accept metadata; tests adjusted for collapsed/reshaped log entries and added messageMetadata in metrics.
SNS
packages/sns/lib/sns/AbstractSnsPublisher.ts
Removed conditional inline per-message logging in publish; publish flow otherwise unchanged.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

patch

Suggested reviewers

  • kibertoad
  • CarlosGamero

Poem

🐰
I hop through queues with tidy feet,
Metadata gathered, logs concise and neat,
One structured hop, no stray log crumbs,
My burrow hums with clean outcomes,
Hoppity-hop — organized and sweet! 🥕

🚥 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 The title 'Improved message logging' accurately captures the main objective of the pull request: refactoring the message logging system to improve security and reduce noise by stopping full payload logging and centralizing the logging approach.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% 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

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bcb2775 and e8642b2.

📒 Files selected for processing (1)
  • packages/gcp-pubsub/lib/pubsub/AbstractPubSubConsumer.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/gcp-pubsub/lib/pubsub/AbstractPubSubConsumer.ts (1)
packages/core/lib/types/queueOptionsTypes.ts (1)
  • ProcessedMessageMetadata (19-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: general (24.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/s3-payload-store) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/outbox-core) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/s3-payload-store) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/core) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/core) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/gcs-payload-store) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/metrics) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/redis-message-deduplication-store) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/core) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: kafka (24.x) / build
  • GitHub Check: kafka (22.x) / build
🔇 Additional comments (1)
packages/gcp-pubsub/lib/pubsub/AbstractPubSubConsumer.ts (1)

865-876: LGTM! Clean refactoring to metadata-based logging.

The implementation correctly:

  • Guards against incomplete metadata (missing message or messageType)
  • Makes messageLogFormatter optional by returning null when not provided
  • Only invokes the formatter when all preconditions are met
  • Aligns with the PR's goal to centralize logging and avoid exposing full payloads by default

The defensive null checks ensure this won't throw when called with partial metadata (e.g., during error cases where messageType resolution failed).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@kjamrog kjamrog added the minor label Dec 18, 2025
@kjamrog kjamrog marked this pull request as ready for review December 18, 2025 14:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/lib/queues/AbstractQueueService.ts (1)

345-349: Fix the property name - critical bug!

Line 348 accesses message[this.messageDeduplicationId] but the property is named this.messageDeduplicationIdField (defined at line 112). The "Field" suffix is missing, causing this to always return undefined and breaking deduplication ID tracking.

🔎 Apply this diff to fix the property name:
   const messageDeduplicationId =
     message && this.messageDeduplicationIdField in message
       ? // @ts-ignore
-        message[this.messageDeduplicationId]
+        message[this.messageDeduplicationIdField]
       : undefined
🧹 Nitpick comments (1)
packages/core/lib/events/DomainEventEmitter.spec.ts (1)

207-207: Consider removing the non-null assertion for consistency.

The combination of optional chaining (?.) and non-null assertion (!) is contradictory: optional chaining handles undefined gracefully, while ! asserts the value is definitely not undefined. Line 407 uses the cleaner pattern metadata?.correlationId without the trailing !.

🔎 Apply this diff for consistency:
-          correlationId: createdEventPayload.metadata?.correlationId!,
+          correlationId: createdEventPayload.metadata?.correlationId,
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a78d2a7 and 03b7220.

📒 Files selected for processing (16)
  • packages/amqp/lib/AbstractAmqpConsumer.ts (2 hunks)
  • packages/amqp/lib/AbstractAmqpPublisher.ts (0 hunks)
  • packages/amqp/test/consumers/AmqpPermissionConsumer.spec.ts (3 hunks)
  • packages/amqp/test/publishers/AmqpPermissionPublisher.spec.ts (1 hunks)
  • packages/core/lib/events/DomainEventEmitter.spec.ts (1 hunks)
  • packages/core/lib/queues/AbstractQueueService.ts (7 hunks)
  • packages/core/lib/queues/HandlerContainer.ts (2 hunks)
  • packages/core/lib/types/queueOptionsTypes.ts (2 hunks)
  • packages/core/test/queues/HandlerContainer.spec.ts (0 hunks)
  • packages/gcp-pubsub/lib/pubsub/AbstractPubSubConsumer.ts (2 hunks)
  • packages/gcp-pubsub/lib/pubsub/AbstractPubSubPublisher.ts (0 hunks)
  • packages/sns/lib/sns/AbstractSnsPublisher.ts (0 hunks)
  • packages/sns/lib/utils/snsInitter.ts (1 hunks)
  • packages/sqs/lib/sqs/AbstractSqsConsumer.ts (3 hunks)
  • packages/sqs/lib/sqs/AbstractSqsPublisher.ts (0 hunks)
  • packages/sqs/test/consumers/SqsPermissionConsumer.spec.ts (2 hunks)
💤 Files with no reviewable changes (5)
  • packages/core/test/queues/HandlerContainer.spec.ts
  • packages/gcp-pubsub/lib/pubsub/AbstractPubSubPublisher.ts
  • packages/sns/lib/sns/AbstractSnsPublisher.ts
  • packages/sqs/lib/sqs/AbstractSqsPublisher.ts
  • packages/amqp/lib/AbstractAmqpPublisher.ts
🧰 Additional context used
🧬 Code graph analysis (7)
packages/gcp-pubsub/lib/pubsub/AbstractPubSubConsumer.ts (1)
packages/core/lib/types/queueOptionsTypes.ts (1)
  • ProcessedMessageMetadata (19-70)
packages/core/lib/queues/AbstractQueueService.ts (1)
packages/core/lib/types/queueOptionsTypes.ts (1)
  • ProcessedMessageMetadata (19-70)
packages/amqp/lib/AbstractAmqpConsumer.ts (1)
packages/core/lib/types/queueOptionsTypes.ts (1)
  • ProcessedMessageMetadata (19-70)
packages/amqp/test/consumers/AmqpPermissionConsumer.spec.ts (1)
examples/sns-sqs/lib/common/Dependencies.ts (1)
  • logger (22-22)
packages/amqp/test/publishers/AmqpPermissionPublisher.spec.ts (1)
examples/sns-sqs/lib/common/Dependencies.ts (1)
  • logger (22-22)
packages/sqs/test/consumers/SqsPermissionConsumer.spec.ts (1)
examples/sns-sqs/lib/common/Dependencies.ts (1)
  • logger (22-22)
packages/sqs/lib/sqs/AbstractSqsConsumer.ts (1)
packages/core/lib/types/queueOptionsTypes.ts (1)
  • ProcessedMessageMetadata (19-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: general (20.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/core) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/s3-payload-store) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/s3-payload-store) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: kafka (24.x) / build
  • GitHub Check: kafka (22.x) / build
🔇 Additional comments (18)
packages/core/lib/types/queueOptionsTypes.ts (1)

65-69: LGTM!

The new optional fields messageMetadata and messageMetadataField are well-documented and properly typed to support the metadata-driven logging refactor described in the PR objectives.

Also applies to: 121-121

packages/sqs/test/consumers/SqsPermissionConsumer.spec.ts (2)

446-458: LGTM!

Test expectations correctly updated to reflect the new consolidated logging structure using processedMessageMetadata. The reduction from 2 log entries to 1 aligns with the PR's goal of centralizing message logging.


515-517: LGTM!

Metrics test correctly validates that messageMetadata is captured and includes the schemaVersions field from the published message's metadata.

packages/amqp/test/publishers/AmqpPermissionPublisher.spec.ts (1)

50-64: LGTM!

Test expectations correctly updated to validate the new metadata-based logging structure for publishers, including the processedMessageMetadata object with processingResult: { status: 'published' }.

packages/sqs/lib/sqs/AbstractSqsConsumer.ts (1)

835-846: LGTM!

The resolveMessageLog method has been correctly refactored to accept ProcessedMessageMetadata and includes appropriate null guards. The implementation properly returns null when the message log formatter is not configured, which aligns with the change to make messageLogFormatter optional in HandlerContainer.

packages/amqp/test/consumers/AmqpPermissionConsumer.spec.ts (3)

98-115: LGTM!

Test expectations correctly updated to reflect the consolidated logging structure with processedMessageMetadata objects. The reduction from 6 to 4 log entries aligns with the centralized logging approach.


166-166: LGTM!

Correctly validates that messageMetadata is undefined when no metadata is provided in the message.


408-408: LGTM!

Good defensive programming with optional chaining to safely access potentially undefined nested properties.

packages/core/lib/queues/HandlerContainer.ts (1)

99-99: LGTM - Important behavioral change!

The messageLogFormatter is now optional and no longer has a default value. This ensures that message payloads are not logged by default, which aligns with the PR's objective to avoid exposing potentially private data. Clients must now explicitly provide a messageLogFormatter if they want message logging.

This is a semantic change that improves privacy by default.

Also applies to: 127-127

packages/gcp-pubsub/lib/pubsub/AbstractPubSubConsumer.ts (1)

865-876: LGTM!

The resolveMessageLog method has been correctly refactored to use the metadata-based approach, consistent with similar changes in other consumer implementations (SQS, AMQP). The implementation includes proper guards and correctly handles the optional messageLogFormatter.

packages/amqp/lib/AbstractAmqpConsumer.ts (2)

9-9: LGTM!

The import is necessary for the updated resolveMessageLog signature and is correctly placed.


266-277: LGTM!

The refactored resolveMessageLog method correctly:

  • Accepts the new ProcessedMessageMetadata parameter
  • Guards against missing message or messageType
  • Returns null when no formatter is configured
  • Invokes the formatter only when appropriate

This aligns well with the PR's centralized logging approach.

packages/core/lib/queues/AbstractQueueService.ts (6)

117-120: LGTM!

The new messageMetadataField property is well-documented and its purpose aligns with the PR's goal of structured, privacy-conscious logging.


164-164: LGTM!

The initialization follows the established pattern and provides a sensible default value.


247-251: LGTM!

The signature change to accept ProcessedMessageMetadata aligns with the centralized metadata-driven logging approach described in the PR objectives.


253-277: LGTM!

The new logMessageProcessed method provides comprehensive, structured logging:

  • Safely serializes messageMetadata using stringValueSerializer
  • Includes all relevant processing metadata
  • Allows optional custom message formatting via resolveMessageLog

This implementation aligns well with the PR's privacy and centralized logging objectives.


313-326: LGTM!

The renamed debugMessageLoggingEnabled variable is more descriptive, and the call to logMessageProcessed correctly uses the new logging API.


350-366: LGTM!

The messageMetadata extraction correctly uses this.messageMetadataField and follows the same pattern as other field extractions. The metadata is properly included in the returned ProcessedMessageMetadata object.

@kjamrog kjamrog requested a review from kibertoad January 2, 2026 16:42
this.definition = eventDefinition
this.messageType = options?.messageType
this.handler = handler
this.messageLogFormatter = options?.messageLogFormatter ?? defaultLogFormatter
Copy link
Owner

Choose a reason for hiding this comment

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

why remove default formatter? if not set, we prefer not logging at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are still always logging message metadata, and if custom formatter is provided, we are additionally including formatted message there. If it's not provided, we are skipping this additional property

See: https://github.com/kibertoad/message-queue-toolkit/pull/385/changes#diff-b683f7e6db8850fc5b1312907d63672464ca467c4f217a0b29ddc238d2fa88a5R253

return handler.messageLogFormatter(message)
protected override resolveMessageLog(
processedMessageMetadata: ProcessedMessageMetadata<MessagePayloadType>,
): unknown {
Copy link
Owner

Choose a reason for hiding this comment

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

we can make no assumptions about result here? it may be a record or it can be a string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It returns messageLogFormatter result which is declaring unknown as a returning value. I can change the signature to Record<string, unknown> | string but it would be potentially breaking change

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/core/lib/queues/AbstractQueueService.ts:
- Around line 347-349: The code references a non-existent property
this.messageDeduplicationId in AbstractQueueService; replace that with the
correct property name this.messageDeduplicationIdField (the field declared on
the class) wherever used (e.g., the ternary expression at the message access),
and ensure any related ts-expect-error/comment reflects the corrected property
name so the code compiles against the class property declaration.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f45eaee and 901a5ed.

📒 Files selected for processing (2)
  • packages/core/lib/queues/AbstractQueueService.ts
  • packages/core/lib/types/queueOptionsTypes.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/lib/types/queueOptionsTypes.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/core/lib/queues/AbstractQueueService.ts (1)
packages/core/lib/types/queueOptionsTypes.ts (1)
  • ProcessedMessageMetadata (19-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: general (20.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/outbox-core) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/s3-payload-store) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/outbox-core) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/gcs-payload-store) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/redis-message-deduplication-store) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/gcs-payload-store) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/metrics) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/metrics) / build
  • GitHub Check: kafka (22.x) / build
  • GitHub Check: kafka (24.x) / build
🔇 Additional comments (6)
packages/core/lib/queues/AbstractQueueService.ts (6)

117-120: LGTM!

The property declaration follows the established pattern for field identifiers in this class and includes clear documentation.


164-164: LGTM!

The initialization follows the established pattern with a sensible default value.


247-251: LGTM!

The signature change correctly supports the new logging approach where custom message formatting is optional and receives processed metadata instead of raw message payloads.


253-277: LGTM!

The new logging method properly structures metadata for debug logs while avoiding exposure of full message payloads. The use of stringValueSerializer for metadata and conditional inclusion of custom logs is appropriate.


313-326: LGTM!

The control flow correctly gates debug logging and the variable rename to debugMessageLoggingEnabled improves code clarity.


350-354: LGTM!

The metadata extraction follows the correct pattern established for other dynamic field access in this class, and the extracted metadata is properly included in the returned object.

Also applies to: 366-366

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/lib/queues/AbstractQueueService.ts (1)

693-711: Preserve messageMetadata in offloaded payload pointer.

The OffloadedPayloadPointerPayload preserves several fields (messageIdField, messageTimestampField, messageDeduplicationIdField, etc.) but notably omits messageMetadataField. This creates an inconsistency with the PR objective to "always include parsed message properties (id, type, metadata, timestamps, etc.)" in logs.

When an offloaded message pointer is logged before payload retrieval (e.g., during publishing), the metadata will be undefined in the logs, even though other similar fields are preserved and logged.

📝 Proposed fix to preserve messageMetadata
     const result: OffloadedPayloadPointerPayload = {
       // Extended payload reference format
       payloadRef: {
         id: payloadId,
         store: storeName,
         size: serializedPayload.size,
       },
       // Legacy format for backward compatibility
       offloadedPayloadPointer: payloadId,
       offloadedPayloadSize: serializedPayload.size,
       // @ts-expect-error
       [this.messageIdField]: message[this.messageIdField],
       // @ts-expect-error
       [this.messageTimestampField]: message[this.messageTimestampField],
       // @ts-expect-error
       [this.messageDeduplicationIdField]: message[this.messageDeduplicationIdField],
       // @ts-expect-error
       [this.messageDeduplicationOptionsField]: message[this.messageDeduplicationOptionsField],
+      // @ts-expect-error
+      [this.messageMetadataField]: message[this.messageMetadataField],
     }
🤖 Fix all issues with AI agents
In @packages/core/lib/queues/AbstractQueueService.ts:
- Around line 247-251: The override in AbstractPubSubConsumer has a return type
mismatch with the base method; update the method signature of resolveMessageLog
in class AbstractPubSubConsumer (the implementation at the location currently
declared to return unknown) to return unknown | null to match
AbstractQueueService.resolveMessageLog, since the implementation returns null in
multiple branches; ensure the method declaration and any related type
annotations use unknown | null so the override conforms to the base contract.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 901a5ed and bcb2775.

📒 Files selected for processing (1)
  • packages/core/lib/queues/AbstractQueueService.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/core/lib/queues/AbstractQueueService.ts (1)
packages/core/lib/types/queueOptionsTypes.ts (1)
  • ProcessedMessageMetadata (19-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: general (22.x, @message-queue-toolkit/schemas) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/core) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/redis-message-deduplication-store) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/core) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/gcs-payload-store) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/core) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sns) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/redis-message-deduplication-store) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/amqp) / build
  • GitHub Check: general (20.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/metrics) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: general (24.x, @message-queue-toolkit/gcp-pubsub) / build
  • GitHub Check: general (22.x, @message-queue-toolkit/sqs) / build
  • GitHub Check: kafka (22.x) / build
  • GitHub Check: kafka (24.x) / build
🔇 Additional comments (4)
packages/core/lib/queues/AbstractQueueService.ts (4)

117-120: LGTM! Consistent field property pattern.

The new messageMetadataField follows the established pattern for configurable field names and appropriately defaults to 'metadata'. The JSDoc clearly indicates its purpose for debug logging.

Also applies to: 164-164


313-326: Excellent refactoring to centralize logging.

The change from inline logging to the centralized logMessageProcessed method aligns perfectly with the PR objective to remove redundant logs. The debugMessageLoggingEnabled guard is clear and appropriately scoped.


347-354: LGTM! Metadata extraction follows established patterns.

The extraction of messageMetadata using the configurable messageMetadataField follows the same pattern as other field extractions in this method. The ts-expect-error annotation is appropriate for dynamic property access on the generic message type.

Note: The past review comment about a typo in messageDeduplicationId extraction (line 348) has been correctly addressed - the code now properly references this.messageDeduplicationIdField.

Also applies to: 366-366


253-277: Verify stringValueSerializer handles optional metadata gracefully.

The code at line 265 passes processedMessageMetadata.messageMetadata to stringValueSerializer without a guard, but messageMetadata is an optional field (messageMetadata?: Record<string, unknown>). Confirm that stringValueSerializer from @lokalise/node-core handles undefined input gracefully, or add a null check before calling it.

@kjamrog kjamrog requested a review from kibertoad January 7, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants