Skip to content

feat: add tagging system with color-coded badges - #28

Open
viganogabriele wants to merge 2 commits into
mainfrom
feat/tagging-system
Open

feat: add tagging system with color-coded badges#28
viganogabriele wants to merge 2 commits into
mainfrom
feat/tagging-system

Conversation

@viganogabriele

Copy link
Copy Markdown

Summary

  • URLs can now carry any number of free-text tags, stored in a new url_tags junction table (url_id, tag_name, cascades on URL delete).
  • Colors are never stored — getTagColor() deterministically derives one of 10 palette colors from the tag name's hash, so a given tag always renders the same badge color everywhere.
  • POST/DELETE /urls/:shortCode/tags and GET /tags (distinct tags in use) added to the REST contract; GET /urls gains a tag filter param.
  • Create/edit dialogs get a tag chip input (Enter/comma to add, click to remove); the dashboard gets a tag-filter dropdown (only shown once at least one tag exists) next to the existing sort control.
  • UrlService.updateUrl now does a full reconcile of a URL's tags against the array passed in (add missing, remove extras) — this is why the diff touches getUrlByShortCode/getAllUrls more broadly than just "add a tags field".

Scope decisions

  • Does not port vigab.cc's is_starred "Starred Only" toggle. Upstream bundled it into the same commit as tagging, but it repurposes this repo's existing "Show Custom Only" filter (which currently filters by is_custom, not a user-favorite flag) — that's a separate product decision for PoliNetwork to make independently, not a tagging concern.
  • Query implementation deliberately avoids correlated subqueries/aggregates combined with table aliases for the tags lookups (uses a plain LEFT JOIN for tag filtering and a batched ANY($1::int[]) query for listing) — an equivalent approach using PostgreSQL-idiomatic correlated subqueries hit unsupported edge cases in pg-mem (this repo's test emulator); the join/batch approach is correct on real Postgres too and keeps the test suite reliable.

Dependency

Builds on #27 (vitest + pg-mem test infra) — UrlService.updateUrl now always calls syncTags, so the existing url-service.test.ts suite from #27 needed a url_tags table added to its schema, which is included here. If #27 merges first, this branch should be rebased onto main (only this PR's diff will remain); if this merges first, #27's diff will need the same url_tags addition — happy to coordinate whichever order is preferred.

Test plan

  • pnpm test — 11 tests pass (includes new tag CRUD/filter/reconcile cases)
  • pnpm check (biome) passes
  • pnpm build succeeds
  • Manual: create a URL with tags, edit tags on an existing URL (including removing all of them), filter the dashboard by tag

viganogabriele and others added 2 commits August 19, 2026 00:34
Introduces the test harness (vitest, an in-memory Postgres via pg-mem, and
`test`/`test:watch` scripts) with no real DB or secrets required, so future
features can ship with unit tests. Included a UrlService smoke-test suite
covering existing create/read/update/delete/search/sort/click-count behavior
as the first consumer of the harness.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Lets each URL carry any number of free-text tags (a new url_tags junction
table), with a deterministic color palette so the same tag name always
renders the same badge color. Adds tag chip inputs to the create/edit
dialogs, a tag filter in the dashboard, and getAllTags/addTag/removeTag
endpoints alongside a `tag` filter on GET /urls.

Scoped to tagging only — does not port vigab.cc's bundled "starred" toggle
(a separate favoriting feature layered on the same commit upstream) since
it would repurpose the existing "Show Custom Only" filter's behavior.

Builds on the vitest/pg-mem test infrastructure branch so UrlService's
existing test suite stays green (tag sync now runs on every update).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@viganogabriele, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9be531b6-c2cc-4b3a-a0de-c5df23fa204f

📥 Commits

Reviewing files that changed from the base of the PR and between 8fb680c and 241e8ea.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • package.json
  • src/app/api/[...ts-rest]/route.ts
  • src/components/create-url-dialog.tsx
  • src/components/dashboard.tsx
  • src/components/edit-url-dialog.tsx
  • src/components/url-record-row.tsx
  • src/hooks/urls.ts
  • src/lib/actions.ts
  • src/lib/contract.ts
  • src/lib/db.ts
  • src/lib/schemas.ts
  • src/lib/url-service.test.ts
  • src/lib/url-service.ts
  • src/lib/utils.ts
  • src/lib/validations.ts
  • vitest.config.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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