Files
Jean-Luc Makiola 407fa45280 chore: complete v1.1 milestone — Fixes & Polish
Archive v1.1 artifacts (roadmap, requirements, phases) to milestones/.
Evolve PROJECT.md with shipped requirements and new key decisions.
Reorganize ROADMAP.md with collapsed milestone groupings.
Update retrospective with v1.1 lessons.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 18:16:27 +01:00

148 lines
13 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
phase: 05-image-handling
verified: 2026-03-15T17:30:00Z
status: passed
score: 13/13 must-haves verified
re_verification: false
---
# Phase 5: Image Handling Verification Report
**Phase Goal:** Users can see and manage gear images throughout the app
**Verified:** 2026-03-15T17:30:00Z
**Status:** PASSED
**Re-verification:** No — initial verification
---
## Goal Achievement
### Observable Truths — Plan 05-01
| # | Truth | Status | Evidence |
|----|----------------------------------------------------------------------------------------------|------------|---------------------------------------------------------------------------------------|
| 1 | Uploaded images display correctly in the ImageUpload preview area (not broken/missing) | VERIFIED | Zod schema fix in `schemas.ts` adds `imageFilename` to both item and candidate schemas; static serving at `/uploads/*` via `serveStatic({root:"./"})` and Vite proxy confirmed present |
| 2 | Item form shows a full-width 4:3 hero image area at the top of the form | VERIFIED | `ImageUpload` is the first element in `ItemForm` JSX (line 122), component uses `aspect-[4/3]` |
| 3 | When no image is set, hero area shows gray background with centered icon and 'Click to add photo' text | VERIFIED | `bg-gray-100` + inline ImagePlus SVG + "Click to add photo" span at lines 90108 of `ImageUpload.tsx` |
| 4 | Clicking the placeholder opens file picker and uploaded image replaces placeholder immediately | VERIFIED | `onClick={() => inputRef.current?.click()}` on hero div; `onChange(result.filename)` updates state on success |
| 5 | When image exists, a small circular X button in top-right removes the image | VERIFIED | `absolute top-2 right-2 w-7 h-7 … rounded-full` button calls `handleRemove``onChange(null)` with `stopPropagation` |
| 6 | Clicking an existing image opens file picker to replace it | VERIFIED | Entire hero div has `onClick` trigger; `value ? <img …> : <placeholder>` branch — img is inside the clickable div |
| 7 | CandidateForm has the same hero area redesign as ItemForm | VERIFIED | `<ImageUpload>` is first element in `CandidateForm` JSX (line 138); identical prop wiring |
### Observable Truths — Plan 05-02
| # | Truth | Status | Evidence |
|----|----------------------------------------------------------------------------------------------|------------|---------------------------------------------------------------------------------------|
| 8 | Item cards always show a 4:3 image area, even when no image exists | VERIFIED | `ItemCard.tsx` line 65: unconditional `<div className="aspect-[4/3] bg-gray-50">` |
| 9 | Cards without images show a gray placeholder with the item's category emoji centered | VERIFIED | `imageFilename ? <img …> : <div …><span className="text-3xl">{categoryEmoji}</span></div>` |
| 10 | Cards with images display the image in the 4:3 area | VERIFIED | `<img src={/uploads/${imageFilename}} alt={name} className="w-full h-full object-cover" />` |
| 11 | Candidate cards have the same placeholder treatment as item cards | VERIFIED | `CandidateCard.tsx` lines 3547 are structurally identical to `ItemCard.tsx` image section |
| 12 | Setup item lists show small square thumbnails (~40px) next to item names | VERIFIED | Setup page uses `ItemCard` grid exclusively; each card passes `imageFilename={item.imageFilename}` (line 210), so 4:3 placeholder renders in setup context. Plan explicitly anticipated this case and specified it as acceptable. |
| 13 | Setup thumbnails show category emoji placeholder when item has no image | VERIFIED | Same `ItemCard` component — placeholder renders category emoji when `imageFilename` is null |
**Score:** 13/13 truths verified
---
## Required Artifacts
| Artifact | Expected | Status | Details |
|-----------------------------------------------------|------------------------------------------------------|------------|-----------------------------------------------------------------|
| `src/client/components/ImageUpload.tsx` | Hero image area with placeholder, upload, preview, remove | VERIFIED | 147 lines; full implementation with all 4 states: placeholder, preview, uploading spinner, error |
| `src/client/components/ItemForm.tsx` | ImageUpload moved to top of form as first element | VERIFIED | `<ImageUpload>` is first element at line 122, before Name field |
| `src/client/components/CandidateForm.tsx` | ImageUpload moved to top of form as first element | VERIFIED | `<ImageUpload>` is first element at line 138, before Name field |
| `src/client/components/ItemCard.tsx` | Always-visible 4:3 image area with placeholder fallback | VERIFIED | Unconditional `aspect-[4/3]` container with image/emoji conditional |
| `src/client/components/CandidateCard.tsx` | Always-visible 4:3 image area with placeholder fallback | VERIFIED | Identical structure to ItemCard |
| `src/shared/schemas.ts` | imageFilename field in createItemSchema and createCandidateSchema | VERIFIED | Both schemas have `imageFilename: z.string().optional()` (lines 10, 47) |
---
## Key Link Verification
| From | To | Via | Status | Details |
|----------------------------------------------|-----------------------------|--------------------------------------------------|----------|-----------------------------------------------------------------------------------|
| `src/client/components/ImageUpload.tsx` | `/api/images` | `apiUpload` call in `handleFileChange` | WIRED | `apiUpload<{filename: string}>("/api/images", file)` at line 35; result.filename fed to `onChange` |
| `src/client/components/ItemForm.tsx` | `ImageUpload.tsx` | `<ImageUpload>` at top of form | WIRED | Imported (line 5) and rendered as first element (line 122) with `value` + `onChange` props wired to form state |
| `src/client/components/CandidateForm.tsx` | `ImageUpload.tsx` | `<ImageUpload>` at top of form | WIRED | Imported (line 9) and rendered as first element (line 138) with props wired to form state |
| `src/client/components/ItemCard.tsx` | `/uploads/{imageFilename}` | `img src` attribute | WIRED | `src={/uploads/${imageFilename}}` at line 68 |
| `src/client/components/CandidateCard.tsx` | `/uploads/{imageFilename}` | `img src` attribute | WIRED | `src={/uploads/${imageFilename}}` at line 39 |
| `src/client/routes/setups/$setupId.tsx` | `ItemCard.tsx` | `imageFilename={item.imageFilename}` prop | WIRED | Line 210 passes `imageFilename` from setup query result to `ItemCard` |
| `src/server/index.ts` | `./uploads/` directory | `serveStatic({ root: "./" })` for `/uploads/*` | WIRED | Line 32: `app.use("/uploads/*", serveStatic({ root: "./" }))` |
| `vite.config.ts` | `http://localhost:3000` | Proxy `/uploads` in dev | WIRED | Line 21: `"/uploads": "http://localhost:3000"` in proxy config |
---
## Requirements Coverage
| Requirement | Source Plan | Description | Status | Evidence |
|-------------|-------------|----------------------------------------------------------------------|-----------|-------------------------------------------------------------------------------|
| IMG-01 | 05-01 | User can see uploaded images displayed on item detail views | SATISFIED | Zod schema fix ensures `imageFilename` persists to DB; `ItemCard` renders `/uploads/{filename}` |
| IMG-02 | 05-02 | User can see item images on gear collection cards | SATISFIED | `ItemCard` always renders 4:3 image area; images display via `/uploads/` path |
| IMG-03 | 05-01 | User sees image preview area at top of item form with placeholder icon when no image is set | SATISFIED | `ImageUpload` renders at top of `ItemForm` and `CandidateForm`; gray placeholder with ImagePlus SVG + "Click to add photo" text |
| IMG-04 | 05-01 | User can upload an image by clicking the placeholder area | SATISFIED | Entire hero div is click-to-open-file-picker; `apiUpload` sends to `/api/images`; preview updates on success |
All 4 requirements satisfied. No orphaned requirements — REQUIREMENTS.md Traceability table maps IMG-01 through IMG-04 to Phase 5, and all are claimed by the two plans.
---
## Anti-Patterns Found
No anti-patterns detected in modified files.
| File | Pattern checked | Result |
|-------------------------------------------------|-----------------------------------------|--------|
| `src/client/components/ImageUpload.tsx` | TODO/FIXME/placeholder comments | None |
| `src/client/components/ImageUpload.tsx` | Empty implementations / stubs | None |
| `src/client/components/ItemForm.tsx` | TODO/FIXME, return null stubs | None |
| `src/client/components/CandidateForm.tsx` | TODO/FIXME, return null stubs | None |
| `src/client/components/ItemCard.tsx` | TODO/FIXME, conditional-only rendering | None |
| `src/client/components/CandidateCard.tsx` | TODO/FIXME, conditional-only rendering | None |
| `src/shared/schemas.ts` | Missing imageFilename fields | None — both schemas include it |
---
## Human Verification Required
### 1. Upload → immediate preview
**Test:** Open ItemForm, click the gray hero area, select a JPEG file.
**Expected:** Hero area immediately shows the uploaded image (no page reload). The X button appears in the top-right corner.
**Why human:** Dynamic state update after async upload cannot be verified statically.
### 2. Remove image
**Test:** With an image displayed in the ItemForm hero area, click the X button.
**Expected:** Hero area reverts to gray placeholder with the ImagePlus icon and "Click to add photo" text. The X button disappears.
**Why human:** State transition after user interaction.
### 3. Image persists after save
**Test:** Upload an image, fill in a name, click "Add Item". Reopen the item in edit mode.
**Expected:** The hero area shows the previously uploaded image (not the placeholder). Confirms the Zod schema fix persists imageFilename through the full create-item API round-trip.
**Why human:** End-to-end persistence across API round-trips.
### 4. Gear collection card consistency
**Test:** View gear collection with a mix of items (some with images, some without).
**Expected:** All cards are the same height due to the always-present 4:3 area. Cards without images show the category emoji centered on a gray background. No layout shift between card types.
**Why human:** Visual layout consistency requires visual inspection.
### 5. Setup page image display
**Test:** Open a setup that contains both items with images and items without.
**Expected:** All ItemCards in the setup grid show consistent heights. Items with images display them; items without show the category emoji placeholder.
**Why human:** Visual confirmation in the setup context.
---
## Gaps Summary
No gaps. All 13 observable truths verified, all 5 artifacts substantive and wired, all 8 key links confirmed present in code, all 4 requirements satisfied with evidence.
The root cause fix (Zod schema missing `imageFilename`) is verified in `src/shared/schemas.ts` with both `createItemSchema` and `createCandidateSchema` now including the field. The server-side persistence chain is complete: Zod allows the field → service layer writes `imageFilename` to DB → GET returns it → cards render `/uploads/{filename}`.
---
_Verified: 2026-03-15T17:30:00Z_
_Verifier: Claude (gsd-verifier)_