Repository navigation
feat: export error helpers and a browser-safe ./scrub entry - #2
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
QA Check Report — codelittinc/otel-node
|
victor-carv
marked this pull request as ready for review
October 13, 2026 13:26
victor-carv
marked this pull request as draft
October 13, 2026 14:02
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
QA Check Report — codelittinc/otel-node
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
QA Check Report — codelittinc/otel-node
|
victor-carv
marked this pull request as ready for review
October 13, 2026 14:20
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.
Summary
Exports two helpers from the main entry so an app can send a scrubbed error to its own error tracker, and adds a browser-safe
./scrubentry for client-side redaction. Backbone's PostHog reporter needs them when it moves onto this package. Their behaviour does not change, and the version becomes 0.1.1.serializeError(value): the same scrubbed error shapelogexports undererr. It serializes one error value, scrubs the message and stack, keeps only allowlisted fields, and never throws.traceLogFields(): the active span'strace_idandspan_id, or{}when there is no valid active span../scrub, a new browser-safe entry:scrubMessage,scrubErrorTextandstripQuery(the same function objects the server uses), plusTOKEN_PATH_TEMPLATES(frozen) andtemplateUrlPath. Backbone's web app redacts PostHog events with these instead of keeping its own copies, so the browser and server scrubs cannot drift.stripQuerymoved unchanged into a pure module, andredact.tsre-exports it.Testing
pnpm typecheckpasses.pnpm test: 39 files, 956 tests, all passing. The new tests compareserializeErrorwithlog's realerrrecord, assert that the SSN and password value are absent, and checktraceLogFieldswith a valid span, no span and an invalid span context. The import-graph test proves./scrubloads no Node or OTel module, including side-effect imports; a same-object test proves its exports are the server's functions; and a freeze test provesTOKEN_PATH_TEMPLATEScannot be changed.pnpm buildmatches the committeddist/.🤖 Generated with Claude Code