feat: bulk importer for bottle eval samples (eval:bottle:import) #499
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
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 #499"
general
weight: 0.35
mattmck
What
npm run eval:bottle:import --workspace=swatchwatch-functions -- --dir <folder> [--dry-run] [--labels labels.csv]: a bulk importer that turns a folder of bottle photos or phone clips into bottle eval samples through the existing admin API (catalog/search,catalog/shade/{id},bottle-eval-admin/samples,…/frames). No DB or storage access, so it works against local or the deployed dev environment with a real admin token.Folder layout
labels.csvoverrides the folder name field by field; a brand + shade label is accepted as a catalog label only on an exact (case/whitespace-insensitive) brand + shade-name match fromcatalog/search, else it falls back tobrandText+shadeText(--require-catalogmakes that an error). Several exact hits count as ambiguous.front|bottom|glass|box(any case, suffix after a separator OK), jpg/jpeg/png/heic/heif/webp or mp4/mov/m4v; photo beats clip; extras listed as ignored. Photos are re-encoded with sharp (orientation applied, ≤ 2048 px JPEG). HEIC sharp cannot decode falls back tosips(macOS) / ffmpeg.--frames-per-clip nkeeps n sharp frames at leastlen/2napart, each its own sample (clip frame k/n)..bottle-eval-import.jsonper take folder (sampleId per variant + uploaded surfaces with source and frameId), rewritten atomically after every API call. Re-runs skip recorded surfaces and add missing ones;--resetignores manifests.--dry-runcalls only the catalog search and needs no token.Code:
packages/functions/src/eval/bottle/import/(cli.ts,api.ts, purelayout.ts/frames.ts/manifest.ts), tests intests/bottle-eval-import.unit.test.cjs(layout parsing incl. odd names, labels.csv, exact-match rules, sharpness ranking with sharp, clip frame selection, manifest merge/parse, args). Docs: functions README "Importing bottle eval samples in bulk", CLAUDE.md Dev Commands, root README commands table.Example dry run (synthetic folder, local host,
--frames-per-clip 2)Verification
npm run test --workspace=swatchwatch-functions: 3114 pass, 0 fail;npm run typecheckandnpm run lintclean (lint shows only pre-existing web warnings).boxframe and left the up-to-date variant alone; exit 1 for the unlabelled folder. Those local samples were deleted afterwards.🤖 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 command to bulk-import bottle evaluation samples from folders, with dry-run support, CSV label overrides, and catalog matching.
Supports photos and selected frames from video clips, with resumable imports that skip previously recorded work and an option to reset import progress.
Documentation
Added command usage, options, supported media, and setup requirements to the project documentation.
Tests
* Added coverage for import behavior, label parsing and resolution, clip-frame selection, and resumable imports.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->