**Organization**: Tasks organized by user story to enable independent implementation and testing.
## Format: `[ID] [P?] [Story] Description`
- **[P]**: Can run in parallel (different files, no dependencies)
- **[Story]**: Which user story this task belongs to (e.g., US1)
- Include exact file paths in descriptions
---
## Phase 1: Setup (Shared Infrastructure)
**Purpose**: Add markdown rendering dependencies to existing project
- [X] T001 Add markdown2==2.4.12 and bleach==6.1.0 to requirements.txt
- [X] T002 Install dependencies with pip install -r requirements.txt
---
## Phase 2: Foundational (Blocking Prerequisites)
**Purpose**: No foundational tasks required - this is a pure presentation layer enhancement
**⚠️ Note**: This feature has no blocking prerequisites. User story implementation can begin immediately after setup.
**Checkpoint**: Dependencies installed - user story implementation can now begin
---
## Phase 3: User Story 1 - View Formatted AI Analysis (Priority: P1) 🎯 MVP
**Goal**: Product owners see AI analysis rendered as formatted HTML with headings, lists, tables, links, and proper security (XSS prevention, safe link attributes)
**Independent Test**: Navigate to any feedback detail page with AI analysis and verify markdown elements (headings, bold, lists, tables, links) are properly rendered as HTML formatting with security attributes
### Tests for User Story 1 (Test-First Discipline)
**⚠️ CRITICAL**: Write these tests FIRST, ensure they FAIL before implementation begins
- [X] T003 [P] [US1] Unit test for markdown conversion with None/empty input in tests/unit/test_markdown_utils.py
- [X] T004 [P] [US1] Unit test for markdown headings conversion in tests/unit/test_markdown_utils.py
- [X] T005 [P] [US1] Unit test for markdown lists conversion in tests/unit/test_markdown_utils.py
- [X] T006 [P] [US1] Unit test for markdown bold/italic conversion in tests/unit/test_markdown_utils.py
- [X] T007 [P] [US1] Unit test for markdown code blocks conversion in tests/unit/test_markdown_utils.py
- [X] T008 [P] [US1] Unit test for markdown tables conversion in tests/unit/test_markdown_utils.py
- [X] T009 [P] [US1] Unit test for markdown links with security attributes in tests/unit/test_markdown_utils.py
- [X] T010 [P] [US1] Unit test for XSS prevention (script/iframe injection) in tests/unit/test_markdown_utils.py
- [X] T011 [P] [US1] Unit test for image/embedded content exclusion in tests/unit/test_markdown_utils.py
- [X] T012 [P] [US1] Unit test for fallback to preformatted block on exception in tests/unit/test_markdown_utils.py
- [X] T013 [P] [US1] Unit test for warning logs on conversion issues in tests/unit/test_markdown_utils.py
- [X] T014 [P] [US1] Contract test for markdown template filter behavior in tests/contract/test_markdown_filter.py
- [X] T015 [P] [US1] Integration test for feedback detail page rendering with markdown in tests/integration/test_markdown_rendering.py
**Checkpoint**: All 13 tests written and failing - proceed to implementation
### Implementation for User Story 1
- [X] T016 [US1] Create app/utils/markdown_utils.py with markdown_filter function implementing conversion, sanitization, link security, and error handling per plan.md specifications
- [X] T017 [US1] Register markdown filter in app/__init__.py create_app function (add app.jinja_env.filters['markdown'] = markdown_filter)
- [X] T018 [US1] Update app/templates/dashboard/detail.html line 105 to use markdown filter (change {{ feedback.analysis|safe }} to {{ feedback.analysis|markdown(feedback.feedback_id) }})
**Checkpoint**: Run all tests - verify they now PASS. User Story 1 complete and independently functional.
---
## Phase 4: Polish & Cross-Cutting Concerns
**Purpose**: Final validation and documentation
- [X] T019 Run full test suite to verify no regressions (pytest tests/ -v) - ✅ COMPLETE: 123/128 tests passing (96%). All 65 markdown feature tests passing. 4 errors in unrelated performance tests (pre-existing fixture issues).
- [X] T020 [P] Manual testing per quickstart.md security verification (XSS prevention, link attributes) - ✅ COMPLETE: All security features verified. XSS protection working (scripts/iframes removed), links have proper security attributes (target="_blank", rel="noopener noreferrer nofollow").