feat: add tagging system with color-coded badges - #28
Conversation
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>
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
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. Comment |
Summary
url_tagsjunction table (url_id,tag_name, cascades on URL delete).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/tagsandGET /tags(distinct tags in use) added to the REST contract;GET /urlsgains atagfilter param.UrlService.updateUrlnow does a full reconcile of a URL's tags against the array passed in (add missing, remove extras) — this is why the diff touchesgetUrlByShortCode/getAllUrlsmore broadly than just "add a tags field".Scope decisions
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 byis_custom, not a user-favorite flag) — that's a separate product decision for PoliNetwork to make independently, not a tagging concern.LEFT JOINfor tag filtering and a batchedANY($1::int[])query for listing) — an equivalent approach using PostgreSQL-idiomatic correlated subqueries hit unsupported edge cases inpg-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.updateUrlnow always callssyncTags, so the existingurl-service.test.tssuite from #27 needed aurl_tagstable added to its schema, which is included here. If #27 merges first, this branch should be rebased ontomain(only this PR's diff will remain); if this merges first, #27's diff will need the sameurl_tagsaddition — happy to coordinate whichever order is preferred.Test plan
pnpm test— 11 tests pass (includes new tag CRUD/filter/reconcile cases)pnpm check(biome) passespnpm buildsucceeds