fix: filter transient toast/alert elements from HTML before markdown analysis#1666
Draft
anuj-adobe wants to merge 5 commits into
Draft
fix: filter transient toast/alert elements from HTML before markdown analysis#1666anuj-adobe wants to merge 5 commits into
anuj-adobe wants to merge 5 commits into
Conversation
…analysis JS-injected notification elements (role="alert", aria-live, #toastContainer) from bot-detection systems (e.g. ThreatMetrix/Signifyd) appear in headless scraped HTML but not in real browsers. This change removes them before markdown analysis so they don't pollute content diffs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and assertive only aria-live="polite" is used broadly for legitimate dynamic content (search result counts, filter updates) and would cause false positives. Restrict to role="alert" and aria-live="assertive" which are W3C live regions reserved for urgent transient notifications by spec. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This PR will trigger a patch release when merged. |
…/alert removal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rser) path too Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…en comments Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Root cause
Per MDN, `role="alert"` is a live region reserved for dynamically rendered, time-sensitive messages triggered by user interaction or application events — by definition not static page content. These elements should never be part of content analysis or citations.
Canadian Tire (and likely others) use Signifyd + ThreatMetrix for fraud detection. When headless Chrome is detected, a session update API call fails and a toast with `role="alert"` is injected via JS with the text "We are currently experiencing system difficulties...". The page still returns HTTP 200, so the scraper has no signal that anything went wrong and the toast ends up in the markdown diff.
Since `filterHtmlNode` runs on both server-side and client-side HTML before markdown analysis, stripping these elements at this layer is the correct fix.
Test plan
🤖 Generated with Claude Code