Fix: disguised-ad-flag re-hid the article a user just revealed#160
Merged
Conversation
The reveal stamp (`data-abs-revealed`) lands on the article ancestor, not the disclosure label. `isCandidateSkipped` only checked `element.hasAttribute(REVEALED_ATTR)` on the label, so on the next mutation burst the watcher re-found the same Sponsored label, walked up to the same revealed article, and re-wrapped it into an unrevealable loop. Switch the check to a rule-scoped `closest(...)` walk that honors the ancestor stamp. Surfaced on the demo's "Recommended for you" section, which contains a sponsored ProductCard inside an article-shaped grid wrapper. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 5, 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.
Summary
disguised-ad-flag'sisCandidateSkipped: the reveal stamp (data-abs-revealed) lands on the article ancestor the rule replaced, but the skip check only looked at the label element (element.hasAttribute(REVEALED_ATTR)). On the next mutation burst the watcher re-found the same Sponsored label,findArticleAncestorwalked up to the same revealed article, andhideCandidatere-wrapped it — an unrevealable loop.closest([data-abs-revealed="disguised-ad-flag"])walk so reveal stamps on any ancestor (including the article itself) are honored, while reveal stamps from other rules don't accidentally suppress this rule.Not a regression from the #150 perf tiers — the same call sequence reproduces against pre-Tier-1 code. The trailing-only throttle (#151) just makes the re-hide land in a single ~250ms window, so it now reads as instantaneous instead of janky.
Test plan
bun run test(1258 passed, 65 suites)bunx tsc --noEmitcleanbunx eslintclean on touched filesdisguised-ad-flagregression tests:🤖 Generated with Claude Code