feat(mobile): manual add form that learns the scanned barcode (#109) #424
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #424"
general
weight: 0.35
mattmck
Summary
A bottle the catalog doesn't know no longer dead-ends on mobile. New Expo screen
/polishes/new, Add a polish, which mirrors the web's/polishes/new:GET /api/reference/finishes, picked in order with the first one as the main finish (falls back toCANONICAL_FINISHES), and color. Color uses the By color palette (12 hue stops + neutral, then five lightness steps) or a typed hex, plus an optional color name. Then I own it / Wishlist, bottles (owned only), 0–5 star rating and notes.barcode,barcodeFormat,brandandnamefill the form, with the same rules as the web'sscanPrefillFromParams. A scanned barcode is shown read-only and sent withPOST /api/polishes, so the API remembers it for this user (user_shade_barcode).dupesForNewShade). The user picks Add anyway / Wishlist instead / Cancel. The prompt is the existingconfirmDupes(pulled out ofconfirmAddWithDupes). A slow or failed load of the owned list (2 s timeout) never blocks the add.router.replaceto/polishes/[id]). The Collection tab and Home panel refetch through a smallcollection-eventssignal, which also rewrites their offline cache.src/lib/manual-add.ts: params, validation, request building, finish options and the new-shade dupe check. The client getscreatePolishandlistReferenceFinishTypes, both additive.Refs #109
Test plan
npm run build,npm run lint,npm run typecheck(root): cleannpm run lint --workspace=apps/mobileandnpm run typecheck --workspace=apps/mobile: clean, no warnings in the touched filesnpm run test --workspace=apps/mobile: 97/97 pass. 25 of them are new: 23 inmanual-add.test.tsand 2 incollection-events.test.tsnpx expo export --platform ios(fromapps/mobile): succeedsBearer dev:1): the exact bodybuildCreateRequestbuilds (UPC-A036000291452,upc_a) gave 201 / shade 525.psqlon 55432 shows auser_shade_barcoderow: user 1, gtin0036000291452,UPC_A. A malformed barcode returns 400barcode must be a valid EAN/UPC barcode.Decisions needed
1. Color is optional, and there is no black default. The web form requires a color name and always sends a hex (default
#000000). Mobile sendsvendorHexonly when a color was picked or typed, so an untouched form never writes black to a new shade. The color name is optional and defaults to the color family label of the hex ("Teal"), or""without a hex. The add guard is skipped when no color is given (nothing to compare).2. Wishlist sends no
quantity. The web form sends the form's quantity with every status. Mobile sendsstatusalways (D5) andquantityonly for owned (1–99), matchingstatusChangePatch. "Wishlist instead" from the guard drops the quantity too.3. Brand/name prefill from Rapid Add comes from the user's typed hints, not OCR.
POST /api/capture/{id}/checkreturns no OCR'd brand/name (only candidates), so the Add manually button carries the brand/shade hint fields. Feeding label OCR text in would need an API change (out of scope).4. The Search query goes in as the shade name (not split into brand + name).
5. Fields left out compared with the web: collection, size, purchase price/currency and tags (not in the brief). Editing existing polishes and photos are also out of scope.
6. Collection refresh uses an in-process event,
src/lib/collection-events.ts, instead of a refetch on focus. The Collection refetches page 1 (rewriting its AsyncStorage cache) and the Home panel recounts.7. The local dev DB keeps the smoke-test shade. Shade 525 "Manual Add Test — Overnight Teal 109" is owned by dev user 1, with barcode
036000291452learned for that user. Delete it if it gets in the way of other local tests.8. Commit trailer: the session brief asked for
Claude Fable 5.1; the commits carryClaude Opus 5.5, the model that actually ran this session.🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Added a manual polish form for entering brand, shade, finishes, color, collection status, quantity, rating, and notes.
You can open the form from an uncatalogued barcode scan or from search results with no matches. Scanned barcode details and search text are carried into the form.
Before saving, the app can flag potential near-duplicates and lets you choose whether to add the polish to your collection or wishlist.
Bug Fixes
Collection views now refresh after a polish is added.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->