Skip to content

Run 2: Input and Validation

GEN-MEDIA-0001 scenarios 0002.FS (Input Detection and Routing), 0003.FS (Accepted Formats and Size Limits), and 0004.FS (URL Scheme and Reachability Validation). All stories compose ImageDropZone in focused context.

#CriterionVerification CommandExpected Output
1On branch jmpicnic/uc-stories with Run 1 checkpoint commitgit -C <worktree> log --oneline -1 --grep='Run 1 complete'Commit hash
2Branch up-to-date with basegit -C <worktree> fetch origin jmpicnic/item-image-upload-components && git -C <worktree> merge-base --is-ancestor origin/jmpicnic/item-image-upload-components HEADExit 0
3Use-case mock data existstest -f <worktree>/src/use-cases/general-behaviors/entity-media/_shared/mock-data.tsExit 0
4Directory structure existstest -d <worktree>/src/use-cases/general-behaviors/entity-media/set-entity-imageExit 0
ArtifactPathFormatDescription
3 scenario descriptionsset-entity-image/0002-input-detection/description.mdx, 0003-formats-and-size/description.mdx, 0004-url-validation/description.mdxMDXOne per scenario
8 input storiesset-entity-image/0002-input-detection/*.stories.tsxTypeScriptOne per input method + error cases
4 format storiesset-entity-image/0003-formats-and-size/*.stories.tsxTypeScriptAccepted/rejected formats, size limits
4 URL storiesset-entity-image/0004-url-validation/*.stories.tsxTypeScriptURL validation scenarios
#TaskPersonaDepends OnStatusAcceptance Criteria
2.1Create scenario directories: 0002-input-detection/, 0003-formats-and-size/, 0004-url-validation/fePendingDirectories exist under set-entity-image/
2.2Create 0002-input-detection/description.mdxfe2.1PendingMDX renders
2.3Create 0003-formats-and-size/description.mdxfe2.1PendingMDX renders
2.4Create 0004-url-validation/description.mdxfe2.1PendingMDX renders
2.50002-input-detection/file-pick.stories.tsx — file selection via OS dialogfe2.2PendingStory renders, play function simulates file input, playground exposes format controls
2.60002-input-detection/drag-and-drop.stories.tsx — drag-over statesfe2.2PendingStory shows idle, drag-over highlight, drop-accepted
2.70002-input-detection/clipboard-image.stories.tsx — paste image blobfe2.2PendingStory simulates paste, shows data: URI preview routing
2.80002-input-detection/clipboard-html.stories.tsx — paste HTML with URLfe2.2PendingStory extracts URL from HTML markup
2.90002-input-detection/url-entry.stories.tsx — HTTPS URL text entryfe2.2PendingStory shows URL detection, validation, reachability
2.100002-input-detection/camera-capture.stories.tsx — camera affordancefe2.2PendingStory demonstrates camera routing
2.110002-input-detection/unrecognized.stories.tsx — non-image text errorfe2.2PendingStory shows inline error message, retry
2.120002-input-detection/data-uri.stories.tsx — data:/blob: URI handlingfe2.2PendingStory shows decode + routing or error
2.130003-formats-and-size/accepted.stories.tsx — JPEG/PNG/WebP/HEICfe2.3PendingStory renders accepted format, playground toggles format
2.140003-formats-and-size/rejected.stories.tsx — BMP/SVG rejectionfe2.3PendingStory shows plain-language error
2.150003-formats-and-size/limit-exceeded.stories.tsx — oversized filefe2.3PendingStory shows compression attempt then error
2.160003-formats-and-size/auto-compressed.stories.tsx — successful compressionfe2.3PendingStory shows optimization message
2.170004-url-validation/valid-https.stories.tsx — valid URL successfe2.4PendingStory passes validation, playground exposes URL input
2.180004-url-validation/rejected-scheme.stories.tsx — http/javascript/file rejectionfe2.4PendingStory shows scheme error message
2.190004-url-validation/unreachable.stories.tsx — 404/timeoutfe2.4PendingStory shows unreachable error message
2.200004-url-validation/wrong-content-type.stories.tsx — non-image contentfe2.4PendingStory shows content-type error message
2.21Wave gate: lint, tsc, build-storybook, test, VRTfe2.5–2.20PendingAll checks pass
2.22Quality review of all new filesqr2.21PendingNo anti-patterns, consistent style, description.mdx in every scenario dir
2.1 (scenario dirs)
├─► 2.2–2.4 (3 description.mdx, parallelizable)
2.5–2.20 (16 stories, parallelizable within each scenario)
2.21 (wave gate)
2.22 (quality review)

All 16 story tasks are parallelizable. All share mock data from Run 1.

#CriterionVerification CommandExpected Output
13 scenario directories existls -d <set-dir>/0002-* <set-dir>/0003-* <set-dir>/0004-* 2>/dev/null | wc -l3
23 scenario description.mdx filesfind <set-dir> -path '*/000[234]-*/description.mdx' | wc -l3
38 input story filesfind <set-dir>/0002-input-detection -name '*.stories.tsx' | wc -l8
44 format/size story filesfind <set-dir>/0003-formats-and-size -name '*.stories.tsx' | wc -l4
54 URL story filesfind <set-dir>/0004-url-validation -name '*.stories.tsx' | wc -l4
6Lint passesnpm run lint --prefix <ux-prototype>Exit 0
7TypeScript compilesnpx tsc --noEmit --project <ux-prototype>Exit 0
8Storybook buildsnpm run build-storybook --prefix <ux-prototype>Exit 0
9Unit tests passnpm run test --prefix <ux-prototype>Exit 0
10VRT baselines currentnpx playwright test --project=vrt --prefix <ux-prototype>Exit 0
11Rebased onto base branchgit -C <worktree> fetch origin jmpicnic/item-image-upload-components && git -C <worktree> rebase origin/jmpicnic/item-image-upload-componentsExit 0, no conflicts
12Post-rebase checks pass (lint, tsc, build, test)Re-run criteria 6–10 after rebaseAll pass

Implement Storybook use case stories for GEN-MEDIA-0001 scenarios 0002.FS, 0003.FS, and 0004.FS in the ux-prototype repository. Working directory: <worktree-path>.

Read the specification — sections “0002.FS — Input Detection and Routing”, “0003.FS — Accepted Formats and Size Limits”, “0004.FS — URL Scheme and Reachability Validation”.

All stories compose ImageDropZone in focused context (not full-app). Use mock data from _shared/mock-data.ts. Follow the pattern established by Run 1 view stories. Each story needs a primary export with play function and either a Playground export or per-input-mode named exports.

Review all new input-*, formats-*, size-*, and url-* story files. Verify: canary-only imports, mock data usage, play function coverage, error message text matches specification, sidebar title conventions.

ArtifactSource RunPath
Use-case mock dataRun 1src/use-cases/general-behaviors/entity-media/_shared/mock-data.ts
Directory structureRun 1src/use-cases/general-behaviors/entity-media/set-entity-image/
ArtifactConsumer RunPath
16 story filesRuns 3, 4 (pattern reference)set-entity-image/input-*, formats-*, size-*, url-*