Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Show roach-motel and webdriver-probe detections in the popup#129

Merged
twschiller merged 2 commits into
mainfrom
feat/popup-detections-section
Jun 4, 2026
Merged

Show roach-motel and webdriver-probe detections in the popup#129
twschiller merged 2 commits into
mainfrom
feat/popup-detections-section

Conversation

@twschiller

Copy link
Copy Markdown
Contributor

Summary

  • New "Detected on this page" section in the browser-action popup that lists what roach-motel-annotate and webdriver-probe-annotate flagged on the active tab.
  • Toolbar badge tints amber on tabs with detections; shows ! when there's no placeholder count to anchor on, otherwise keeps the existing count text.
  • Detections clear on navigation, tab close, and when the user toggles the producing rule off mid-session.

Why

Today both rules surface their findings only as sr-only landmarks in the accessibility tree — readable to agents but invisible to sighted users. The popup had no per-tab activity view and the badge only counted placeholders, so a roach-motel hit or a navigator.webdriver read on the current page produced zero human-visible signal.

Approach

  • Each rule emits a typed rule-detection message right after stamping its landmark. The existing landmark-presence short-circuits double as per-document dedupe latches, so no separate flag is needed.
  • background.ts keeps a Map<tabId, Map<DetectionKind, DetectionPayload>> alongside the existing tabCounts map. A unified refreshBadge(tabId) reads both signals and picks color + text. Detections are cleared on tabs.onUpdated status: "loading", tabs.onRemoved, enforcement-off, and rule-disable transitions via ruleStatesStorage.subscribe.
  • The popup queries the background once on mount via a get-tab-detections message; the hook stays null until the runtime fetch resolves so the empty state doesn't flash on tabs that actually have detections.
  • No new permissions required. Page DOM is untouched, which keeps hidden-text-strip and CSP-strict sites out of the picture.

Out of scope

  • Promoting tabDetections to chrome.storage.session so SW restarts don't lose state (in-memory matches tabCounts posture today).
  • Surfacing detections via the on-page floating shield button.

Test plan

  • bun run typecheck, bun run check, bun run knip, bun run build, bun run test (1005 tests pass).
  • Load unpacked from extension/dist, visit https://www.nytimes.com/subscription/all-access, open popup → roach-motel entry appears with host, difficulty, cancellation link, source; badge is amber.
  • Toggle roach-motel-annotate off → entry disappears; badge reverts to blue (or empty) when there's no placeholder count.
  • Toggle webdriver-probe-annotate on, reload a probing page → webdriver-probe entry appears.
  • Navigate the same tab elsewhere → detections clear.
  • Close the tab → background drops the entry (verify via SW console).

🤖 Generated with Claude Code

Both rules currently land their findings only as sr-only landmarks —
visible to agents but invisible to sighted users. Add a "Detected on this
page" section to the browser-action popup and tint the toolbar badge
amber on tabs with detections so the human user sees what was flagged.

Rules emit a typed `rule-detection` message after stamping the landmark;
the existing landmark-already-present short-circuits act as per-document
dedupe latches. The background keeps a per-tab record alongside
`tabCounts`, cleared on navigation, tab close, and when the producing
rule is toggled off mid-session.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser-shield-demo-site Ready Ready Preview, Comment Jun 4, 2026 8:10pm

Request Review

Only render the popup section when there is at least one detection,
and use "Heads up" as the heading. The prior "Detected on this page"
copy implied a full audit of rule activity when really it only covers
the informational annotations from roach-motel and webdriver-probe.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@twschiller twschiller merged commit 8af8a3b into main Jun 4, 2026
7 checks passed
@twschiller twschiller deleted the feat/popup-detections-section branch June 4, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant