Skip to content

feat(unique): use url_matcher capture groups as the unique key - #570

Merged
sebastienfontaine merged 1 commit into
masterfrom
feat/unique-by-capture-groups
Oct 14, 2026
Merged

sebastienfontaine merged 1 commit into
masterfrom
feat/unique-by-capture-groups

Conversation

@sebastienfontaine

Copy link
Copy Markdown
Contributor

Closes #507.

Problem

With the sample GitHub Issues rule (REGEX detection github\.com/.+/issues/\d+, URL matcher github\.com/.+/issues/(\d+)), turning on Unique closes every other issue, not just other tabs of the same issue.

The unique key was the processed url_fragment, which only varies when the fragment holds $n placeholders. But a fragment with $1 never matches during detection (see the analysis in #507). So for any rule that actually matches, every tab got the same key.

Fix

New _getUniqueKey(urlFragment, url, urlMatcher) in helpers.ts, used for both the duplicate comparison and the per-group lock from #558:

Rule Unique key Effect
no url_matcher url_fragment unchanged: one tab per rule
url_fragment with $n processed fragment unchanged
url_matcher with capture groups the captured values new: one tab per issue number, ticket id…
url_matcher without capture groups, or no match url_fragment unchanged

This replaces the unique_pattern proposal with no new field and no UI change; docs/unique-pattern-proposal.md is marked as superseded. The URL matcher help text in the rule form explains it.

Behaviour change

Rules that combine Unique with a url_matcher that has capture groups now close fewer tabs: only those with the same captured values, never more. This is what the sample GitHub Issues rule implies, and what the reporter expected.

Tests

  • _getUniqueKey: capture groups, $n fragment, no matcher, no capture group, no match, invalid regex.
  • End to end with the sample GitHub rule: another tab of the same issue (#issuecomment anchor) is closed; issues 123 / 456 / 789 all stay open. Both fail on master.
  • 234 tests, ESLint, Prettier, vue-tsc and build pass.

With a URL matcher like github\.com/.+/issues/(\d+), every issue was a
duplicate of every other: the unique key was the url_fragment, which only
varies when it holds $n placeholders, and a fragment with $n never matches.
When url_matcher has capture groups (and url_fragment no $n), tabs are now
duplicates only if they capture the same values. Supersedes the
unique_pattern proposal.
@github-actions

Copy link
Copy Markdown

📦 Extension Build Ready!

Version: 1.1.6

📥 Download Extension (tabee.zip)

Installation

  1. Download and extract the zip file
  2. Open Chrome → chrome://extensions/
  3. Enable "Developer mode" (top right)
  4. Click "Load unpacked" → Select the extracted folder

Status

  • ✅ All tests passed
  • ✅ Build successful
  • ✅ Ready for testing

🤖 Auto-generated by GitHub Actions

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 57.38% 602 / 1049
🔵 Statements 57.83% 635 / 1098
🔵 Functions 64.39% 123 / 191
🔵 Branches 53.39% 299 / 560
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/background/TabRulesService.ts 83.9% 91.66% 78.57% 82.5% 31-33, 62-69, 80, 118, 144-145, 157-162, 176, 189, 240
src/common/helpers.ts 53.06% 57.57% 30.76% 53.19% 5, 12-288, 296-300
Generated in workflow #476 for commit d5ec0ce by the Vitest Coverage Report Action

@sebastienfontaine
sebastienfontaine merged commit cb864d9 into master Oct 14, 2026
7 checks passed
@sebastienfontaine
sebastienfontaine deleted the feat/unique-by-capture-groups branch October 14, 2026 21:59
@sebastienfontaine sebastienfontaine mentioned this pull request Oct 14, 2026
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.

Github rule does not prevent duplicate tabs for the same ticket number, even when unique asserted

1 participant