feat(web): Looks page — vibe-driven look recommendations from owned polishes #370
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 #370"
general
weight: 0.35
mattmck
What
A new Looks page at
/polishes/looks. You pick a vibe (occasion, mood, finish, Owned only) and get three complete nail looks (Base / Accent or Tip / Topper) built from the polishes you own. Any step you don't own is filled from the catalog and marked Add. MVP ofdocs/looks-experience-plan.md.apps/web/src/lib/looks.ts. It is pure and seeded like "Pick for me", with 26 unit tests. It has 18 named templates (Glazed Donut, Office Neutral, Soft Chrome, Galaxy Fade, Cyber Violet, Berry Gradient, French Modern, Monochrome Slick, Classic Red, Milk Bath, …).- Base: picked by OKLAB distance plus a finish penalty from the shared
finishCompatibility.- Accent: must fall within harmony bounds (
generateHarmonyColorsof the chosen base), and contrast with the base is rewarded.- Topper: comes from
TOPPER_FINISHES(imported frompick-for-me.ts, not edited).- Diversity: no base is reused, and two bases must be at least
LOOK_MIN_BASE_DISTANCEapart unless their finish families differ.- The module header documents every rule and constant.
lib/looks-url.ts, with?occasion=&mood=&finish=&owned=1&seed=. Changes userouter.push, so back/forward and shared links reproduce the same looks.- swatch strip
- steps with Owned ✓ / Add pills
- "Buy from brand" on catalog steps; steps with no catalog match get a "Find a shade like this" link to color search
- per-step Swap offering the next 3 owned candidates
- difficulty/time badge
- Wear this, which opens the existing
ManiLogFormprefilled with the owned polishes and their roles (color/accent/topper)- Save to your account (see "Saved looks on the server" below), with a For your vibe / Saved (N) switch to see saved looks and Wear / Remove them
- Zero owned: catalog looks, plus a nudge to import or use Rapid Add.
- Owned-only with fewer than 3 viable looks: the page says so instead of padding.
- Collection load fails: template looks plus a notice.
looks.generatedandlooks.wear_clicked, sent viametrics-events.tsand documented indocs/observability-plan.md.lgthe vibe collapses to a one-line summary that expands on tap. Cards use container queries.Saved looks on the server (the stretch goal)
20261019020500000_user-look(renumbered from20261019013934159afterdevgained20261019020000000_enable-signed-off-indie-sources, so it still sorts last; the release runbook is updated to match): auser_looktable withuser_idFK (cascade),look_key,template_id,name,vibe jsonb,steps jsonbandsaved_at.UNIQUE (user_id, look_key), and CHECKs mirror the validator.docs/schema.sqlis updated.GET/POST/DELETE /api/looks(functions/looks.ts,withCors(withAuth(...)), every statement scoped byuser_id):- POST is an upsert on the look key and keeps the newest 30 per user in the same transaction. Bodies over 8 KB get 413.
- DELETE takes
?key=and returns 404 for anyone else's key.- 13 unit tests cover auth, validation, the cap and cross-user isolation. The full functions suite (2,059) passes.
types/looks.ts: the vibe enums,SavedLook*types,savedLookKey()and the one validation rulevalidateSavedLookInput(), used by both the API and the web's localStorage parser.shade. So saving a look that names someone else's privateuser_submittedshade id reveals nothing. The access-control-reviewer agent found no access-control issues. It flagged one low-severity bug (multibyte text could pass the validator but trip the DB byte CHECK, giving a 500), which is fixed and tested.- Saves made offline, or before this endpoint existed (they used the same localStorage key), wait in a pending list and upload on the next visit.
- The last server list is cached for display only and never uploaded, so a look deleted on your phone doesn't come back from your laptop.
- If a remove fails, the look is restored and a toast says so.
swatchwatch_looks_verify, dropped afterwards; the shared dev DB was not touched). Up → down → up worked. I ran this branch's Functions host against it and checked with curl and in the browser:- save (201)
- re-save as an upsert
- bad body (400)
- another user's delete (404) and list (empty)
- no auth (401)
- a pre-endpoint local save uploading on load
- a delete made on "another device" not coming back
- an offline save staying pending, with a "saved on this device" toast, then uploading after the host restarted
- the Saved tab with Wear / Remove at 375px
Judgment calls (please review)
1. Client-side, no
/api/looks. This follows the "Pick for me" pattern, as the brief asked. Types live inapps/web/src/lib/looks.ts, not inpackages/shared, because nothing server-side uses them yet. The plan's sharedLooktypes can move there when the endpoint lands.2. Catalog gap fill. Catalog search results carry no hexes, so gaps come from
GET /api/polishes?family=<color family>&pageSize=60, one request per missing color family. The page sends at most 6 family requests plus one for topper finishes. Families are found with the sharedclassifyHexColorFamily. Results are cached per family for the session. Looks first render from owned polishes only, then re-render once catalog rows arrive.3. Default vibe is Everyday + Soft + any finish, with seed 1. There is no "trending" data yet.
4. Finish preference overrides the base step's preferred finishes. Flake is the exception: it adds or keeps a topper step instead.
5. Owned only:
- required steps (base and non-optional accents) must be owned
- optional accents and toppers are dropped instead of being marked Add
- templates that can't be built are skipped
6. Shuffle is one button above the cards that reshuffles all three looks (new seed in the URL). There is no per-card shuffle. Per-step Swap covers changing one look.
7. Ranking: an owned base gets a strong bonus (
OWNED_BASE_BONUS= 4), so a look you can wear outranks a slightly better vibe match you'd have to buy for. A side effect: with a small collection (the local dev DB has about 20 polishes), Shuffle often reorders the same templates.8. Rules added after testing on real data:
- Toppers and flakies are never a base or accent.
- A look with a topper step never gets a glitter base (no glitter-on-glitter).
- The finish penalty counts against the base threshold, so a near-miss glitter is not an "Office Neutral".
- A swap never offers a polish another step of the same look already uses.
- A polish used by an earlier look is never a later look's base.
-
metallicis listed beforechromein the preferred finishes, becausechromehas no built-in finish family and was making clashes grade as "unknown".9.
ManiLogFormgot an optionalinitialEntriesprop ({ shadeId, role }[]). It is a ~5-line change in the state initializer. #349 also touches mani-log role prefill, so watch for a small merge overlap there.10. App shell fix, outside the Looks scope: on phones the mobile header icon nav widened every page to about 612px, causing horizontal scroll (
/manistoo). Fixed withmin-w-0on the main column and the nav.app-shell.tsxalso gets the new nav entry.11. Saved looks persist per account, with a pending localStorage fallback. The table is
user_look(singular, matchingwishlist_share), not the plan'suser_looks. I dropped the plan'stelemetry_contextandsourcecolumns; a server-sidelooks.savedevent is emitted instead.12. Not done from the plan: a recommendation endpoint, skin-tone / nail-shape inputs, Include toppers and Color Lab toggles, Share, shopping-list modal with prices, detail drawer, and the
NEXT_PUBLIC_FEATURE_LOOKSflag. The page is linked directly rather than flagged. A status note at the top ofdocs/looks-experience-plan.mdlists these.Merge notes
devmoved three times while this was open (#371/#374, #373, #372). Each sync mergedorigin/devinto this branch; conflicts were README rows, the two new telemetry events next to other sessions' events (metrics-events.ts, its test,docs/observability-plan.md) and the add-guard surface list. All were kept-both resolutions. Since #374, Looks polish links usedetailHrefwith the page's ownreturnTo(vibe + seed), andreturnToLabelknows "Looks". After each sync: typecheck, lint, all tests andbuild:webpass.Decisions needed
NEXT_PUBLIC_FEATURE_LOOKSflag. My recommendation is to ship it unflagged. This blocks nothing; adding a flag later is small.GET /api/looksnow means "my saved looks". If a server-side recommendation endpoint is added later, my recommendation isGET /api/looks/recommendationsrather than overloading/api/looks. This blocks nothing today.20261019013934159_user-lookbefore (or with) the web deploy. My recommendation is the normal migrate-then-deploy. Until it runs, saves keep working on-device (pending) and upload once the table exists, so nothing breaks.Verification
npm run typecheck,npm run lint,npm test(web 500, devtools 140, functions 2,059; all pass),npm run build:web(static export) andnpm run build:functionsall pass. The pre-commit hook ran the full repo test suite on every commit.- vibe changes
- Shuffle and Back
- Swap
- Save and the saved-looks section
- Wear this, which opens the mani dialog prefilled as Color / Accent / Topper (cancelled, so nothing was written)
- owned-only
- zero-owned account (dev user 2): catalog looks with Buy-from-brand links and the nudge
- no horizontal scroll at 375px
:3000. I ran this branch's web app on:3100behind a throwaway local CORS proxy. No Azure resources were touched.- Back/Forward after a Shuffle is no longer reported as
trigger: shuffle; the trigger is now tied to the URL state it produced.- hex→OKLAB conversions are memoized on the recommender path: about 150 → 35 ms for a synthetic 2,000-polish collection, with identical results and tests unchanged.
🤖 Generated with Claude Code