Commit Graph

32 Commits

Author SHA1 Message Date
giles
93f830ff13 Commit transaction before fetching cart-mini fragment
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 54s
The cart-mini fragment is fetched via HTTP from the cart app, which
uses its own DB connection. Without committing first, the cart app
sees stale data (no new item). Commit the transaction, start a new
one so after_request can still commit cleanly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:55:40 +00:00
giles
06e700820e Replace shared _added.html with market-owned version using cart-mini fragment
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 53s
The shared _added.html imported _types/cart/_cart.html which only
exists in the cart app. Market now has its own _added.html that:
- Fetches cart-mini fragment for the OOB mini cart update
- Uses market's own _types/product/_cart.html macros
- Drops cart summary/show_cart (not visible on product pages)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:49:09 +00:00
giles
d92d4840ed Rename product blueprint URL param slug → product_slug
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 57s
The app-level url_value_preprocessor pops "slug" and "page_slug"
into g.post_slug, with page_slug overwriting the product slug.
Renaming the blueprint param to product_slug eliminates the
collision entirely. Views now use g.product_slug (set by blueprint
preprocessor) and have clean signatures with no **_kw hacks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:26:20 +00:00
giles
291c829c7f Let resolve_product run fully for POST, just skip redirects
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m0s
Instead of skipping resolve_product entirely for POST (leaving
g.item_data unset and breaking templates), run the full resolution
but suppress canonical-slug redirects. This sets g.item_data for
the context processor so d.slug and other template vars work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:22:04 +00:00
giles
e0b640f15b Pass product data to cart _added.html template
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
resolve_product skips for POST so g.item_data (and thus d) is not
set. Pass d={slug} directly in the render_template call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:21:16 +00:00
giles
25228881aa Fix product slug: extract from URL path instead of g.post_slug
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 53s
App-level preprocessor pops slug then page_slug into g.post_slug,
overwriting the product slug with the page slug ("market"). Extract
the product slug directly from the request path after "/product/".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:12:00 +00:00
giles
97bc694ff0 Skip resolve_product redirects for POST requests (cart, like)
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m4s
resolve_product's canonical slug redirect causes a 302 loop on POST
/cart/ because it redirects to the GET product detail page. POST
endpoints only need g.product_slug to look up the product — skip
the full resolution/redirect logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:06:05 +00:00
giles
d014203776 Fix url_for endpoint name in product slug redirect
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 56s
Use fully qualified "market.browse.product.product_detail" instead
of "product.product_detail" which doesn't exist in the URL map.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:02:04 +00:00
giles
f53d2841e9 Fix product slug resolution: fall back to g.post_slug
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 55s
App-level url_value_preprocessor pops slug into g.post_slug before
the blueprint preprocessor runs, leaving values empty. Fall back to
g.post_slug so resolve_product and cart route get the slug.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:57:42 +00:00
giles
3c9ff1210a Fix cart route missing slug param (popped by app-level preprocessor)
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 57s
App-level url_value_preprocessor pops slug from values, so the
product blueprint's cart() never receives it. Use g.product_slug
(set by resolve_product before_request) instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:51:50 +00:00
giles
e49668b301 Add fragment blueprint + sync shared: micro-frontend infrastructure
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m19s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:27:47 +00:00
giles
139eb3ac1f Rename coop_title to market_title, update shared submodule
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m52s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 08:33:20 +00:00
giles
3c87832fdf Add global + page-scoped market listings with infinite scroll
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m4s
- New all_markets blueprint at / with paginated grid and HTMX infinite scroll
- New page_markets blueprint at /<slug>/ for page-scoped market listing
- list_marketplaces service method (via shared submodule update)
- Updated slug preprocessor to handle both /<slug>/ and /<page_slug>/<market_slug>/
- Removed inline markets_listing() route (replaced by all_markets blueprint)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 23:34:58 +00:00
giles
4671bc616e Inline federation publication for products
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m0s
Replace emit_event("product.listed") with direct try_publish().
Update shared submodule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 07:55:57 +00:00
giles
a80547c7fa Update shared submodule + emit product events for federation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 52s
- Emit product.listed events when products are created
- Updated shared with federation handlers, delivery, anchoring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 16:00:04 +00:00
giles
05cba16cef Fix category highlighting and revert current_local_href breakage
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 43s
- Update shared submodule: category selector uses slug comparison
  instead of current_local_href for active state
- Keep current_local_href commented out in category_context() to
  avoid overriding the base template value used by brand filters

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:29:06 +00:00
giles
1aa3659bb8 Uncomment current_local_href in category_context for subcategory highlighting
The category selector compares current_local_href against sub.local_href
to determine the active subcategory. This was commented out, so no
subcategory was ever highlighted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:17:12 +00:00
giles
28938e38b5 Fix cart count: query DB directly instead of cross-app API
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 42s
Two bugs fixed:

1. First htmx add didn't update mini cart count because the context
   processor's API call couldn't see the uncommitted transaction.
   Fix: pass cart_count/cart_total explicitly from the route handler.

2. Page refresh always showed cart count 0 because the internal API
   call to the cart service failed to resolve cart identity correctly.
   Fix: replace the API call with a direct DB query using the same
   shared database and session, matching how the cart app itself works.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:39:43 +00:00
giles
8c2358022a Fix undefined calendar_total/calendar_cart_entries in product cart template
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 40s
The _added.html template's summary macro expects calendar_total and
calendar_cart_entries from the cart/events domain. The market app has
no calendar entries, so pass a no-op function and empty list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:15:07 +00:00
giles
44f475857b Fix AttributeError on g.cart in product cart route
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 42s
g.cart was never populated in the market app — the cart loader
before_request hook was only registered in the cart microservice.
Replace the dead filter-building code with an actual query that
loads cart items inline, scoped to the current user/session.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:11:49 +00:00
giles
478636f799 feat: decouple market from shared_lib, add app-owned models
Phase 1-3 of decoupling:
- path_setup.py adds project root to sys.path
- Market-owned models in market/models/ (market, market_place)
- All imports updated: shared.infrastructure, shared.db, shared.browser, etc.
- MarketPlace uses container_type/container_id instead of post_id FK

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 12:46:32 +00:00
giles
fd205b9b61 fix: inject post data via blueprint context processor
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 33s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 00:17:13 +00:00
giles
863429d51b fix: add post header bar to market pages and show market name
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 36s
- Add post header row to market/index.html template chain
- Fix OOB templates to include post header on HTMX navigation
- Show market name instead of static coop_title in header
- Restore trailing slash on POST /cart/ route; fix templates to
  include trailing slash in cart URLs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:55:16 +00:00
giles
93e1e6d41e fix: remove trailing slash from POST /cart route
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 39s
Templates generate URLs without trailing slash via market_url(), but
the route required one. POST requests don't get redirected by Werkzeug,
causing a 405 MethodNotAllowed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:52:25 +00:00
giles
6a378a2425 fix: use cart_url() instead of url_for('cart.view_cart') for cross-app redirect
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 57s
The market app doesn't have a cart blueprint registered, so url_for()
would fail. Uses the cross-app cart_url() helper instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 21:45:54 +00:00
giles
ce1847e06c feat: set market_place_id on CartItem when adding to cart (Phase 3)
Track which market a cart item came from by setting market_place_id
from g.market.id on new CartItem creation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 20:49:37 +00:00
giles
9b2687b039 feat: restructure market app with per-market URL scoping
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 41s
- URL structure changes from /<route> to /<market_slug>/<route>
- Root / shows markets listing page
- app.py: url_value_preprocessor, url_defaults, hydrate_market (events app pattern)
- Browse queries (db_nav, db_products_nocounts, db_products_counts) accept market_id
- _productInfo reads g.market.id to scope all queries
- save_nav accepts market_id, sets on new NavTop rows
- API save_nav passes g.market.id
- Scraper default URLs point to /suma-market/ on port 8001

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:08:48 +00:00
giles
88c38c0e74 fix: add cart identity stub for product blueprint
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 40s
Product routes lazily import current_cart_identity from cart.services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 01:18:53 +00:00
giles
efe769a0fc fix: add cart services stub for product blueprint dependency
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Product routes import total() from cart.services — provide a minimal
copy so the market image can start independently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 01:16:00 +00:00
giles
601a696ecb fix: add register_product to bp/__init__.py (needed by browse)
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 00:34:39 +00:00
giles
e737a953a6 fix: add proper register_market_bp export to bp/__init__.py
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 00:28:46 +00:00
giles
6271a715a1 feat: initialize market app with browsing, product, and scraping code
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Split from coop monolith. Includes:
- Market/browse/product blueprints
- Product sync API
- Suma scraping pipeline
- Templates for market, browse, and product views
- Dockerfile and CI workflow for independent deployment
2026-02-09 23:16:34 +00:00