From 2640b035bc1c1fe96bd8cc8006dd156ff59642d0 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Fri, 15 May 2026 20:00:02 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20MPS-24=202.6c=20=E2=80=94=20sidebar=20ca?= =?UTF-8?q?tegory=20links=20hit=20tag=20route,=20not=20home=20catch-all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- CLAUDE.md | 9 ++++++ docs/tickets/mps-24.md | 20 ++++++++++++ make_post_sell/templates/_facet_nav.j2 | 19 ++++++----- make_post_sell/templates/home.j2 | 5 +-- make_post_sell/templates/shop.j2 | 5 +-- make_post_sell/templates/shop_tag.j2 | 5 +-- make_post_sell/tests/test_functional.py | 42 +++++++++++++++++++++++++ 7 files changed, 92 insertions(+), 13 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 52db8d2..b7b7687 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -498,6 +498,15 @@ and `details()` (mobile/tablet `
` accordion). Both call the same internal `facet_form()` so the controls stay identical across viewports — only the wrapper differs. +Macros take TWO base URLs: `base_url` (slugged shop home, for the +"All" link) and `tag_base` (`request.shop.absolute_url(request, +slug=False)` = `/s/{id}`, no shop slug). Category links MUST use +`{tag_base}/tag/{slug}` so they match the `shop_tag_detail` route +(`/s/{shop_id}/tag/{slug}`). Using the slugged URL produces +`/s/{id}/{shop_slug}/tag/{slug}` which falls through to the +`shop_slug` catch-all and silently renders the shop home instead of +the filtered tag page (the 2.6b→2.6c defect). + Every page that opts into categorization (operator picks `home_layout >= 1`, or tag detail page) includes BOTH variants in the markup. CSS hides one per viewport: `details.facet-details` hidden ≥800px, `aside diff --git a/docs/tickets/mps-24.md b/docs/tickets/mps-24.md index de078a4..4ce8042 100644 --- a/docs/tickets/mps-24.md +++ b/docs/tickets/mps-24.md @@ -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 diff --git a/make_post_sell/templates/_facet_nav.j2 b/make_post_sell/templates/_facet_nav.j2 index 72a884d..36c2ae0 100644 --- a/make_post_sell/templates/_facet_nav.j2 +++ b/make_post_sell/templates/_facet_nav.j2 @@ -11,7 +11,12 @@ Args: variant — "sidebar" (desktop