refactor(javascript): MessageProcessor abstraction added#176
Open
Reversean wants to merge 1 commit intorefactor/breadcrumb-storefrom
Open
refactor(javascript): MessageProcessor abstraction added#176Reversean wants to merge 1 commit intorefactor/breadcrumb-storefrom
Reversean wants to merge 1 commit intorefactor/breadcrumb-storefrom
Conversation
3a8de71 to
3e46e20
Compare
neSpecc
reviewed
Apr 1, 2026
| /** | ||
| * Appends `RAW_EVENT_DATA` to the event addons for debug purposes. | ||
| */ | ||
| export class DebugMessageProcessor implements MessageProcessor<'errors/javascript'> { |
Member
There was a problem hiding this comment.
Suggested change
| export class DebugMessageProcessor implements MessageProcessor<'errors/javascript'> { | |
| export class DebugAddonMessageProcessor implements MessageProcessor<'errors/javascript'> { |
Comment on lines
+31
to
+33
| if (!payload.addons) { | ||
| return payload; | ||
| } |
Member
There was a problem hiding this comment.
adding should not depend on each other
Member
Author
There was a problem hiding this comment.
Solved with custom type ProcessingPayload which inherits all addons fields but makes it optional.
3e46e20 to
1704f75
Compare
9890ddb to
afc73fa
Compare
1704f75 to
eba517d
Compare
…ted in catcher event processing pipeline - MessageProcessor interface and MessageHint type - BrowserMessageProcessor, BreadcrumbsMessageProcessor, ConsoleCatcherMessageProcessor, DebugMessageProcessor - replaced inline addon logic with sequential MessageProcessor pipeline
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.
Motivation
Part of the broader effort to extract environment-agnostic logic into
@hawk.so/core(#151). The blocker wasCatcher.formatAndSend()— addon collection (viewport, console output, raw error data) was hardcoded inline against browser APIs with no seam to override it for a different runtime.Why MessageProcessor?
Each
MessageProcessorencapsulates one piece of env-specific addon logic. The pipeline loop belongs in a futureBaseCatcher; processors are registered by the concrete catcher. A futureNodeCatcherregisters Node-appropriate processors without touching browser code.BreadcrumbStorefollows the same pattern — core owns the interface, the browser implementation lives in the browser package.Why ProcessingPayload?
Extracting processors exposed a latent ordering dependency:
ConsoleOutputAddonMessageProcessorandDebugAddonMessageProcessorguarded onpayload.addonsexisting, which onlyBrowserAddonMessageProcessorcreated.ProcessingPayload<T>keepsaddonsalways initialized but structurally partial during the pipeline — each processor writes its fields freely, and the fullJavaScriptAddonscontract is enforced only at the send boundary.Changes
MessageProcessorinterface,ProcessingPayload<T>type,MessageHint,BreadcrumbStoreabstraction,BreadcrumbsMessageProcessorBrowserAddonMessageProcessor,ConsoleOutputAddonMessageProcessor,DebugAddonMessageProcessor— each encapsulates formerly inline addon logicMessageProcessorpipeline