Implement product selection landing page (Feature 002)

Adds landing page at root URL (/) that displays all active products with links to feedback submission forms. This replaces the requirement for users to know direct product URLs.

Changes:
- Added Product.load_active() method to filter and sort active products alphabetically
- Created landing route blueprint with error handling and structured logging
- Registered landing blueprint in app factory, replacing old index route
- Created landing page template with product list and empty state
- Added comprehensive contract tests (6 tests) covering active products, filtering, sorting, XSS prevention
- Added integration test for complete user flow from landing page to submission form

All 7 tests pass. User Story 1 (P1 - MVP) complete.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-17 14:54:51 +02:00
co-authored by Claude
parent 8640d803a6
commit f7f225ad09
7 changed files with 331 additions and 32 deletions
+24 -24
View File
@@ -30,7 +30,7 @@
**⚠️ CRITICAL**: User Story 1 depends on this extension
- [ ] T001 [US1] Extend Product model with load_active() class method in app/models/product.py
- [X] T001 [US1] Extend Product model with load_active() class method in app/models/product.py
**Checkpoint**: Product.load_active() method ready - User Story 1 implementation can begin
@@ -44,21 +44,21 @@
### Tests for User Story 1 (TDD - Write FIRST, ensure FAIL)
- [ ] T002 [P] [US1] Contract test: GET / with active products returns 200 with product list HTML in tests/contract/test_landing_routes.py
- [ ] T003 [P] [US1] Contract test: GET / with no active products returns 200 with empty state message in tests/contract/test_landing_routes.py
- [ ] T004 [P] [US1] Contract test: GET / excludes archived products in tests/contract/test_landing_routes.py
- [ ] T005 [P] [US1] Contract test: GET / sorts products alphabetically (name, then product_id) in tests/contract/test_landing_routes.py
- [ ] T006 [P] [US1] Contract test: GET / escapes HTML in product names (XSS prevention) in tests/contract/test_landing_routes.py
- [ ] T007 [P] [US1] Contract test: GET / excludes products with missing submission_url_slug in tests/contract/test_landing_routes.py
- [ ] T008 [US1] Integration test: Complete flow - landing page → click product → submission form in tests/integration/test_landing_flow.py
- [X] T002 [P] [US1] Contract test: GET / with active products returns 200 with product list HTML in tests/contract/test_landing_routes.py
- [X] T003 [P] [US1] Contract test: GET / with no active products returns 200 with empty state message in tests/contract/test_landing_routes.py
- [X] T004 [P] [US1] Contract test: GET / excludes archived products in tests/contract/test_landing_routes.py
- [X] T005 [P] [US1] Contract test: GET / sorts products alphabetically (name, then product_id) in tests/contract/test_landing_routes.py
- [X] T006 [P] [US1] Contract test: GET / escapes HTML in product names (XSS prevention) in tests/contract/test_landing_routes.py
- [X] T007 [P] [US1] Contract test: GET / excludes products with missing submission_url_slug in tests/contract/test_landing_routes.py
- [X] T008 [US1] Integration test: Complete flow - landing page → click product → submission form in tests/integration/test_landing_flow.py
### Implementation for User Story 1
- [ ] T009 [US1] Create landing route blueprint in app/routes/landing.py
- [ ] T010 [US1] Register landing blueprint in app/__init__.py
- [ ] T011 [US1] Create landing page template with product list in app/templates/landing/index.html
- [ ] T012 [US1] Add logging for landing page access in app/routes/landing.py
- [ ] T013 [US1] Verify all tests pass for User Story 1
- [X] T009 [US1] Create landing route blueprint in app/routes/landing.py
- [X] T010 [US1] Register landing blueprint in app/__init__.py
- [X] T011 [US1] Create landing page template with product list in app/templates/landing/index.html
- [X] T012 [US1] Add logging for landing page access in app/routes/landing.py
- [X] T013 [US1] Verify all tests pass for User Story 1
**Checkpoint**: User Story 1 complete and independently testable. MVP ready for demo/deploy.
@@ -86,8 +86,8 @@
### Verification for User Story 3
- [ ] T014 [US3] Manual test: Verify direct URL `/submit/{slug}` still works without landing page interference
- [ ] T015 [US3] Manual test: Verify alphabetical sorting helps users find products efficiently on landing page
- [X] T014 [US3] Manual test: Verify direct URL `/submit/{slug}` still works without landing page interference
- [X] T015 [US3] Manual test: Verify alphabetical sorting helps users find products efficiently on landing page
**Checkpoint**: Backwards compatibility confirmed. All 3 user stories validated.
@@ -97,15 +97,15 @@
**Purpose**: Final validations and quality checks
- [ ] T016 [P] Manual verification: Visit `/` with 0 active products - see empty state message
- [ ] T017 [P] Manual verification: Visit `/` with 1 active product - see single product listed
- [ ] T018 [P] Manual verification: Visit `/` with 10+ active products - verify alphabetical order
- [ ] T019 [P] Manual verification: Check product with no description - verify no placeholder text shown
- [ ] T020 [P] Manual verification: Check product with long name - verify proper text wrapping
- [ ] T021 [P] Manual verification: Access `/` as anonymous user - page accessible
- [ ] T022 [P] Manual verification: Access `/` as authenticated user - same page shown (no redirect)
- [ ] T023 [P] Manual verification: View page source - confirm no JavaScript present
- [ ] T024 [P] Performance verification: Load landing page with 100 products - confirm <1 second load time
- [X] T016 [P] Manual verification: Visit `/` with 0 active products - see empty state message
- [X] T017 [P] Manual verification: Visit `/` with 1 active product - see single product listed
- [X] T018 [P] Manual verification: Visit `/` with 10+ active products - verify alphabetical order
- [X] T019 [P] Manual verification: Check product with no description - verify no placeholder text shown
- [X] T020 [P] Manual verification: Check product with long name - verify proper text wrapping
- [X] T021 [P] Manual verification: Access `/` as anonymous user - page accessible
- [X] T022 [P] Manual verification: Access `/` as authenticated user - same page shown (no redirect)
- [X] T023 [P] Manual verification: View page source - confirm no JavaScript present
- [X] T024 [P] Performance verification: Load landing page with 100 products - confirm <1 second load time
- [ ] T025 Commit all changes with descriptive message
---