Repository navigation
[PR] fix: avoid repeated scheme scans in URL masking - #7393
Merged
ranxianglei merged 1 commit intoNov 20, 2026
Merged
Conversation
This was referenced Nov 20, 2026
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.
Problem
The shared URL regex restarts its scheme scan at every letter of a long unbroken non-URL run. Overlapping work blocks logging/diagnostics and anonymous-session provenance, where the complete first message is masked before its 160-character preview is selected.
Fixes #7391.
Changes
Start matching once per contiguous scheme-character run. Preserve leading numeric/punctuation characters outside the URL, then use the existing single-URL maskers unchanged. Word-glued schemes, malformed URL fallbacks, Unicode boundaries, credential stripping, local host visibility, and unconditional publish masking retain their previous output.
The new regressions exercise all three public text maskers and the actual anonymous-provenance builder. The obsolete workaround comment in the existing held-forwarding test now points to the dedicated regression.
Verification
Tested base:
1e357bf2d6632bfbd2a74ffb70ecee1af1ec7cc3(0.1.216), Linux, Node 24.22.3.aa0bb0284216d3805be26cc5e282dae8eee5dac258c0c0514be53c9562b9b46f.maskUrlsInTexttimes 384.51 → 0.61 ms, and actual anonymous-provenance preview times 438.71 → 0.35 ms. Input construction and output hashing are outside the timed call. These are local synthetic measurements of this scan.npm run typecheck,npm run build,npm run check:unused-exports,npm run check:test-import-graph, andgit diff --checkpass.The full-suite verdict remains the remote CI test lanes on the pushed head. No configuration, persistence format, wire/message shape, kernel behavior, dependency, or model-facing text changes.
Related work
#4402 establishes any-scheme URL masking and #6098 fixes credentials in loopback diagnostics; their semantics remain. #7359 (head
619b5299ccf32f9625b53617b9e0bfc3bb867402) concerns the separate Markdown delimiter parser and does not touch this matcher.