fix: MPS-24 2.6c — sidebar category links hit tag route, not home catch-all

Operator review of 2.6b: clicking any sidebar category landed on a
page that looked exactly like the shop home (lanes), ignoring the
tag filter.

Root cause: _facet_nav.j2 built category links as
{absolute_url}/tag/{slug}. absolute_url() includes the shop slug
(/s/{id}/{shop_slug}), so the link became
/s/{id}/{shop_slug}/tag/{slug}. The tag detail route is
/s/{shop_id}/tag/{slug} — no shop-slug segment — so that path missed
shop_tag_detail and fell through to the shop_slug catch-all
(/s/{shop_id}/{slug:.*}), rendering the shop home.

Fix: macros now take a tag_base arg =
request.shop.absolute_url(request, slug=False) (= /s/{id}).
Category links build {tag_base}/tag/{slug} — matches
shop_tag_detail exactly. The All link keeps the slugged base_url
(shop home). All three callers (shop_tag.j2, home.j2, shop.j2)
pass both.

Regression coverage:
- test_facet_category_link_renders_tag_detail_not_home (new)
- test_tag_detail_renders_facet_sidebar (asserts slug-less link,
  asserts NOT slugged link)

Docs: CLAUDE.md facet-nav note, ticket Phase 2.6c.
This commit is contained in:
russell@unturf.com 2026-05-15 20:00:02 -04:00
parent 8970e960fb
commit 2640b035bc
No known key found for this signature in database
7 changed files with 92 additions and 13 deletions

View file

@ -319,6 +319,26 @@ picker is Phase 2).
| `tests/test_models.py` | `TestTagSuggestPureFunctions` — 11 unit tests over tokenize / stem / cluster |
| `tests/test_functional.py` | `test_suggest_clusters_renders_candidates`, `test_apply_suggestion_creates_tag_and_attaches_products`, `test_dismiss_suggestion_adds_to_stopwords`, `test_apply_suggestion_rejects_empty_input` |
### Phase 2.6c — fix sidebar category links falling through to shop-home catch-all (shipped 2026-05-15)
Defect from 2.6b operator review: clicking any category in the desktop
sidebar navigated to a page that "looked exactly like home" (screenshots
in chat). Root cause: the facet macro built category links as
`{absolute_url}/tag/{slug}` where `absolute_url` includes the shop slug
(`/s/{id}/{shop_slug}`). The resulting path `/s/{id}/{shop_slug}/tag/{slug}`
does **not** match the tag detail route `/s/{shop_id}/tag/{slug}` — it
falls through to the `shop_slug` catch-all (`/s/{shop_id}/{slug:.*}`)
and renders the shop home / lanes, ignoring the tag entirely.
Fix: `_facet_nav.j2` macros take a new `tag_base` arg =
`request.shop.absolute_url(request, slug=False)` (= `/s/{id}`, no shop
slug). Category links now build `{tag_base}/tag/{slug}` which matches
`shop_tag_detail` exactly. The "All" link still uses the slugged
`base_url` (shop home). All three call sites (shop_tag.j2, home.j2,
shop.j2) updated. Regression test:
`test_facet_category_link_renders_tag_detail_not_home` +
hardened assertions in `test_tag_detail_renders_facet_sidebar`.
### Phase 2.6b — facet nav on shop home (layout 2) + mobile SERP rows under each lane (shipped 2026-05-15)
Follow-up to 2.6 after operator review on tablet: layout 2 (sectioned