Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(selfie): stop the scan hanging forever when the vision runtime is slow or missing
nirholas95ec2b467640
diff --git a/data/changelog.json b/data/changelog.jsonindex 1ec3eaa2b..130295338 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,16 @@{"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-09-11",+ "title": "Selfie to avatar is unstuck: a scan that used to wait forever now finishes in seconds",+ "summary": "Uploading a photo on the selfie page could sit on the same message indefinitely and never start the scan, with no error and nothing to retry. One copy of the face-tracking runtime held at our CDN was telling browsers to expect 11 MB and then sending a third of that, so the page waited for bytes that were never coming. That copy is gone, and three changes make the failure impossible to repeat silently: the face-tracking runtime now loads from three.ws first instead of a public CDN, any wait on it gives up after fifteen seconds and builds your avatar from the photo as it is, and a photo is never rejected for having no face in it just because the detector could not load. A new check also walks every large file on the site the way a browser asks for it and fails loudly when the bytes do not add up. Measured after the fix: a selfie became a rigged, animation-ready avatar in about fifteen seconds, and still finished in under a minute with the face-tracking runtime completely unreachable.",+ "tags": [+ "fix",+ "infra"+ ],+ "link": "/create/selfie"+ },{"date": "2026-09-10","title": "Fourteen paid endpoints now offer Solana first, matching what the catalog advertises",diff --git a/docs/selfie-to-avatar.md b/docs/selfie-to-avatar.mdindex 66e55a109..0f37c37ca 100644--- a/docs/selfie-to-avatar.md+++ b/docs/selfie-to-avatar.md@@ -76,11 +76,49 @@ Request body: `name` (1-120, required), `photos` (1-6 image URLs or data URIs) *- **Bring your own key.** If no platform reconstruction backend is configured, the server returns `402 { code: 'regen_needs_byok', providers: ['meshy','tripo'] }` and the page shows a key-entry form. Meshy and Tripo run image-to-3D with your own API key; credit exhaustion surfaces as `402 insufficient_credits`.- **Single frame.** Despite "captures several angles automatically" in some copy, the scanner takes one manual still per slot; side angles are an optional manual add.- **Timing.** The build screen says "1-2 minutes"; polling gives up after 8 minutes, and a job still reported running 10 minutes after submit (possible when a pending job resumes across a reload) stops with a "taking unusually long" message pointing you to your dashboard, since the avatar may still finish server-side.-- **Quality gating.** Only a frontal with no detectable face hard-blocks. Blur, illustrations, or multiple faces are surfaced as warnings you can proceed past.+- **Quality gating.** Only a frontal with no detectable face hard-blocks. Blur, illustrations, or multiple faces are surfaced as warnings you can proceed past. If the face detector itself cannot load, the gate steps aside rather than blocking: an unavailable model is not evidence about your photo, and the worker runs its own face pass regardless.+- **Vision models are on a deadline.** The client-side refinement pass (subject matte, reframe, face box) needs MediaPipe's 11 MB runtime plus a model file. Every wait on one is capped at 15 seconds (`withVisionDeadline` in [src/shared/mediapipe-assets.js](../src/shared/mediapipe-assets.js)); past that the raw photo is submitted and the reconstruction proceeds. Before that cap existed, an asset that never finished downloading left the page on "Processing your face..." indefinitely, with the reconstruction request never sent. The runtime is served from three.ws (`public/vendor/mediapipe/`) and only falls back to a public CDN when our own origin definitively lacks the file.- **Error handling.** Camera denial distinguishes `NotAllowedError` ("Camera access was denied... use Upload instead") from other failures. Job failures map to friendly messages (no face, content-safety flag, blur, service unavailable, timeout, out-of-memory). Poll tolerates up to 5 consecutive network errors with backoff before "Lost connection to the avatar engine." Rate limits (`429`) start a 60-second cooldown with a live countdown. Pending jobs resume across reloads.- **Output.** glTF 2.0 GLB with a Mixamo-standard humanoid rig, 52 ARKit blendshapes, and 15 visemes. Private avatars return a short-lived signed `url`; `model_url` is the public CDN URL once you make it public.- **Error copy.** The worker classifies a failure as either the caller's input or a service fault. An input rejection ("no face detected in any of the provided photos") or a plan refusal is relayed verbatim, and the status response carries `errorKind: 'input'` so the client shows that text as-is instead of rewriting an unrecognised message into generic "try a clearer photo" advice; a service fault is masked into neutral retry copy, because its raw text can carry a vendor name or an operator-only correlation id. Your visibility choice rides along to the Forge store, so a private capture never surfaces in a public gallery.+## Verifying it end to end++`npm run verify:selfie` drives the real page in a real browser: it uploads a+photograph into the frontal slot, submits it, and follows the job until the+avatar engine returns a GLB or fails. Nothing in it calls the API behind the+page's back, so the capture gates, the reconstruct call, the poll loop and the+viewer are all exercised the way a visitor exercises them.++```bash+npm run audit:web:login # mint the QA session the reconstruct call needs+npm run verify:selfie # generates a portrait, runs the whole flow+```++Without `--photo` it generates one through the platform's own free text-to-image+lane (`POST /api/v1/ai/image`, five free images per day per IP, no payment),+because the reconstruction worker's only hard input rejection is a frame with no+detectable face. Useful flags:++| Flag | What it does |+|---|---|+| `--photo=<path>` | Use a photograph you already have instead of generating one |+| `--origin=http://localhost:3000` | Run against a dev server; the QA session is replayed onto that origin and `/api` proxies to production |+| `--stall-vision` | Hang every request for MediaPipe's runtime, to prove the flow still submits without it |+| `--timeout=<ms>` | How long to wait for the build (default 10 minutes) |+| `--out=<dir>` | Where screenshots and `run.json` land (default `scripts/.selfie-verify/`) |++The run prints the pipeline's own event trail (`submit -> preview -> building ->+progress -> done`), which is the fastest way to see where a failure happened: no+`building` event means the reconstruction request was never sent, and the+problem is in the browser rather than in the engine.++`--stall-vision` is the regression harness for the 2026-09-11 stall. Measured+with the vision runtime completely unreachable: the flow gives up on refinement+after two 15-second deadlines, submits the unrefined photo, and still returns a+rigged avatar (58 seconds end to end, against 12 seconds when the runtime loads+normally).+## Related- [Avatar reconstruction pipeline](./avatar-reconstruction.md): the full engine: MediaPipe face-texture transfer, geometry morph, the fixed pre-rigged head template, and the Cloud Run worker.diff --git a/src/face-quality.js b/src/face-quality.jsindex ae3fc6891..93667da40 100644--- a/src/face-quality.js+++ b/src/face-quality.js@@ -22,7 +22,7 @@import { SLOT_PRESETS, gradeFrame, grayFaceStats } from './selfie-gates.js';-import { loadVision, modelUrl, visionWasmBase } from './shared/mediapipe-assets.js';+import { loadVision, modelUrl, visionWasmBase, withVisionDeadline } from './shared/mediapipe-assets.js';// The tasks-vision module is a real dependency, so it ships in our bundle// instead of being pulled from a CDN at runtime; the WASM runtime and model come// from the shared resolver (our vendored copy first).@@ -49,7 +49,8 @@ function loadLandmarker() {runningMode: 'VIDEO',numFaces: 1,});- })().catch((err) => {+ })();+ _landmarkerPromise = withVisionDeadline(_landmarkerPromise, 'face landmarker').catch((err) => {_landmarkerPromise = null;throw err;});@@ -73,7 +74,8 @@ function loadImageLandmarker() {numFaces: 1,outputFaceBlendshapes: false,});- })().catch((err) => {+ })();+ _imageLandmarkerPromise = withVisionDeadline(_imageLandmarkerPromise, 'image face landmarker').catch((err) => {_imageLandmarkerPromise = null;throw err;});diff --git a/src/selfie-refine.js b/src/selfie-refine.jsindex 1376135a2..8d8174907 100644--- a/src/selfie-refine.js+++ b/src/selfie-refine.js@@ -29,7 +29,7 @@import { GATES } from './selfie-gates.js';import { log } from './shared/log.js';-import { loadVision, modelUrl, visionWasmBase } from './shared/mediapipe-assets.js';+import { loadVision, modelUrl, visionWasmBase, withVisionDeadline } from './shared/mediapipe-assets.js';// MediaPipe tasks-vision — same pinned build the face stack uses, so the WASM// runtime is shared/cached across the landmarker and the segmenter.@@ -184,7 +184,13 @@ export function assessPhotoQuality(m) {const issues = [];const shortEdge = Math.max(1, Math.min(m.width, m.height));- if (!m.faceCount) {+ // A null count means the detector never loaded. That is not evidence about+ // the photo, so the gate steps aside rather than telling someone their+ // perfectly good selfie has no face in it. The reconstruction worker runs+ // its own face pass and stays the authority either way.+ const faceCountKnown = typeof m.faceCount === 'number';++ if (faceCountKnown && !m.faceCount) {return {verdict: 'block',issues: ['no-face'],@@ -194,7 +200,7 @@ export function assessPhotoQuality(m) {};}- if (m.faceCount > 1) issues.push('multiple-faces');+ if (faceCountKnown && m.faceCount > 1) issues.push('multiple-faces');if (m.faceBox) {const faceRel = m.faceBox.w / shortEdge;@@ -340,7 +346,8 @@ async function loadSegmenter() {outputConfidenceMasks: true,outputCategoryMask: false,});- })().catch((err) => {+ })();+ _segmenterPromise = withVisionDeadline(_segmenterPromise, 'selfie segmenter').catch((err) => {_segmenterPromise = null; // allow a retry on the next photolog.warn('[selfie-refine] segmenter load failed:', err);return null;@@ -361,7 +368,8 @@ async function loadFaceDetector() {baseOptions: { modelAssetPath: FACE_DETECTOR_MODEL_URL, delegate: 'GPU' },runningMode: 'IMAGE',});- })().catch((err) => {+ })();+ _detectorPromise = withVisionDeadline(_detectorPromise, 'face detector').catch((err) => {_detectorPromise = null;log.warn('[selfie-refine] face detector load failed:', err);return null;@@ -441,7 +449,10 @@ function fitWithin(w, h, max) {export async function assessPhoto(bitmap) {const { w, h } = dimsOf(bitmap);try {- const face = await detectFaceBox(bitmap);+ // Availability and result are separate answers: a detector that never+ // loaded must not read as "this photo has no face in it".+ const detector = await loadFaceDetector();+ const face = detector ? await detectFaceBox(bitmap) : null;// Sample at a small fixed size — quality metrics don't need full res and// this keeps the per-pixel passes cheap.@@ -478,7 +489,7 @@ export async function assessPhoto(bitmap) {const assessment = assessPhotoQuality({width: w,height: h,- faceCount: face ? face.count : 0,+ faceCount: detector ? (face ? face.count : 0) : null,faceBox: faceBoxPx,sharpness: laplacianVariance(grey, s.w, s.h),flatness: flatnessScore(grey, s.w, s.h),diff --git a/src/shared/mediapipe-assets.js b/src/shared/mediapipe-assets.jsindex 8c8aa10bd..4cb0427ad 100644--- a/src/shared/mediapipe-assets.js+++ b/src/shared/mediapipe-assets.js@@ -60,34 +60,103 @@ export function loadVision() {}let _wasmBase = null;+let _wasmBaseProbe = null;++/**+ * Ask one host whether it serves the WASM runtime.+ *+ * Three answers, not two. A non-ok status means the file is genuinely not+ * there. A deadline that expired means nothing about the file: page startup+ * routinely blocks the main thread long enough for a four-second fetch+ * deadline to expire on a request the server answers in under ten+ * milliseconds, which is exactly how the vendored copy was losing to a CDN on+ * every real page load of /create/selfie.+ *+ * @param {string} base+ * @returns {Promise<'present' | 'absent' | 'stalled'>}+ */+async function probeWasmHost(base) {+ try {+ const res = await fetch(`${base}/vision_wasm_internal.wasm`, {+ method: 'HEAD',+ signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),+ });+ return res.ok ? 'present' : 'absent';+ } catch (err) {+ const name = err?.name;+ return name === 'TimeoutError' || name === 'AbortError' ? 'stalled' : 'absent';+ }+}++async function resolveWasmBase() {+ const local = `${LOCAL_BASE}/wasm`;+ // Our own copy ships with the deploy, so only a definitive "not there"+ // sends the runtime to a third-party CDN. An inconclusive probe keeps it.+ if ((await probeWasmHost(local)) !== 'absent') return local;+ for (const base of CDN_WASM_BASES) {+ if ((await probeWasmHost(base)) === 'present') return base;+ }+ // Nothing answered. Return the first CDN anyway rather than throwing here:+ // MediaPipe's own loader gives a better error than a probe.+ return CDN_WASM_BASES[0];+}/*** Directory to hand `FilesetResolver.forVisionTasks()`. Prefers the copy under- * public/vendor/mediapipe/wasm and falls back to jsDelivr then unpkg, probing- * once per page and remembering the answer.+ * public/vendor/mediapipe/wasm and falls back to jsDelivr then unpkg.+ *+ * Every caller on a page shares one probe: face quality, selfie refinement,+ * face mocap and body mocap all ask for this within the same tick, and four+ * identical HEAD requests raced each other before the answer was memoised.** @returns {Promise<string>}*/-export async function visionWasmBase() {- if (_wasmBase) return _wasmBase;- for (const base of [LOCAL_BASE + '/wasm', ...CDN_WASM_BASES]) {- try {- const res = await fetch(`${base}/vision_wasm_internal.wasm`, {- method: 'HEAD',- signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),- });- if (res.ok) {- _wasmBase = base;- return base;- }- } catch {- // Unreachable or blocked: try the next host.- }+export function visionWasmBase() {+ if (_wasmBase) return Promise.resolve(_wasmBase);+ if (!_wasmBaseProbe) {+ _wasmBaseProbe = resolveWasmBase().then((base) => {+ _wasmBase = base;+ _wasmBaseProbe = null;+ return base;+ });}- // Nothing answered the probe. Return the first CDN anyway rather than- // throwing here: MediaPipe's own loader gives a better error than a probe.- _wasmBase = CDN_WASM_BASES[0];- return _wasmBase;+ return _wasmBaseProbe;+}++/**+ * Milliseconds a vision model may take to load before the caller gives up.+ *+ * The runtime is an 11 MB WASM binary plus a model file, so a cold load is+ * seconds, not milliseconds, and this has to sit well above that. It exists+ * because the alternative is unbounded: MediaPipe's loader has no deadline of+ * its own, so an asset that never finishes downloading leaves the caller+ * awaiting forever. Every vision feature here is an enhancement over a path+ * that already works without it, so a slow load has to degrade rather than+ * hang. On 2026-09-11 a single truncated response for the WASM binary held+ * /create/selfie on "Processing your face..." with no error and no timeout,+ * and the reconstruction request was never sent.+ */+export const VISION_LOAD_DEADLINE_MS = 15_000;++/**+ * Bound a vision-model load. Resolves with the model, or rejects once the+ * deadline passes, so the caller's existing failure path runs instead of the+ * await never settling.+ *+ * @template T+ * @param {Promise<T>} promise+ * @param {string} label Named in the timeout error, e.g. 'face detector'.+ * @param {number} [ms]+ * @returns {Promise<T>}+ */+export function withVisionDeadline(promise, label, ms = VISION_LOAD_DEADLINE_MS) {+ let timer;+ const deadline = new Promise((_resolve, reject) => {+ timer = setTimeout(() => {+ reject(new Error(`${label} did not load within ${ms}ms`));+ }, ms);+ });+ return Promise.race([promise, deadline]).finally(() => clearTimeout(timer));}/**diff --git a/tests/mediapipe-assets.test.js b/tests/mediapipe-assets.test.jsnew file mode 100644index 000000000..eb4c51ff4--- /dev/null+++ b/tests/mediapipe-assets.test.js@@ -0,0 +1,160 @@+/**+ * Where the MediaPipe WASM runtime comes from (src/shared/mediapipe-assets.js).+ *+ * The vendored copy under public/vendor/mediapipe exists so that face quality,+ * selfie refinement and mocap keep working when a CDN is blocked. Production+ * was defeating it: on a real /create/selfie load the HEAD probe hit its+ * four-second deadline while the main thread was busy (the same request answers+ * in single-digit milliseconds when the page is idle), the resolver read that+ * as "not there", and every vision feature silently loaded from jsDelivr.+ *+ * These tests pin the rule that fixes it: only a definitive answer moves the+ * runtime off our own origin, and all the callers on a page share one probe.+ */++import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';++const isLocal = (base) => base.includes('/vendor/mediapipe/wasm') && !base.includes('cdn.');++async function freshModule() {+ vi.resetModules();+ return await import('../src/shared/mediapipe-assets.js');+}++/** A fetch stub that answers per host: 'ok' | 'missing' | 'stall' | 'offline'. */+function stubFetch(plan) {+ return vi.fn(async (url, opts) => {+ const key = String(url).includes('cdn.jsdelivr.net')+ ? 'jsdelivr'+ : String(url).includes('unpkg.com')+ ? 'unpkg'+ : 'local';+ const verdict = plan[key] || 'ok';+ if (verdict === 'stall') {+ const err = new Error('signal timed out');+ err.name = 'TimeoutError';+ throw err;+ }+ if (verdict === 'offline') throw new TypeError('Failed to fetch');+ if (verdict === 'missing') return { ok: false, status: 404 };+ expect(opts?.method).toBe('HEAD');+ return { ok: true, status: 200 };+ });+}++let realFetch;+beforeEach(() => { realFetch = globalThis.fetch; });+afterEach(() => { globalThis.fetch = realFetch; });++describe('visionWasmBase', () => {+ it('uses the vendored copy when our origin answers the probe', async () => {+ globalThis.fetch = stubFetch({ local: 'ok' });+ const { visionWasmBase } = await freshModule();+ expect(isLocal(await visionWasmBase())).toBe(true);+ });++ it('keeps the vendored copy when the probe stalls, because a deadline is not evidence', async () => {+ globalThis.fetch = stubFetch({ local: 'stall' });+ const { visionWasmBase } = await freshModule();+ const base = await visionWasmBase();+ expect(isLocal(base)).toBe(true);+ expect(globalThis.fetch).toHaveBeenCalledTimes(1);+ });++ it('falls back to jsDelivr only when our origin definitively lacks the file', async () => {+ globalThis.fetch = stubFetch({ local: 'missing', jsdelivr: 'ok' });+ const { visionWasmBase } = await freshModule();+ expect(await visionWasmBase()).toContain('cdn.jsdelivr.net');+ });++ it('walks past a CDN that is missing the file to the next one', async () => {+ globalThis.fetch = stubFetch({ local: 'missing', jsdelivr: 'missing', unpkg: 'ok' });+ const { visionWasmBase } = await freshModule();+ expect(await visionWasmBase()).toContain('unpkg.com');+ });++ it('returns the first CDN when nothing answers, so MediaPipe raises the real error', async () => {+ globalThis.fetch = stubFetch({ local: 'missing', jsdelivr: 'offline', unpkg: 'offline' });+ const { visionWasmBase } = await freshModule();+ expect(await visionWasmBase()).toContain('cdn.jsdelivr.net');+ });++ it('probes once for every caller on the page, not once per caller', async () => {+ globalThis.fetch = stubFetch({ local: 'ok' });+ const { visionWasmBase } = await freshModule();+ const bases = await Promise.all([visionWasmBase(), visionWasmBase(), visionWasmBase(), visionWasmBase()]);+ expect(new Set(bases).size).toBe(1);+ expect(globalThis.fetch).toHaveBeenCalledTimes(1);+ });++ it('remembers the answer for later callers', async () => {+ globalThis.fetch = stubFetch({ local: 'ok' });+ const { visionWasmBase } = await freshModule();+ await visionWasmBase();+ await visionWasmBase();+ expect(globalThis.fetch).toHaveBeenCalledTimes(1);+ });+});++describe('withVisionDeadline', () => {+ it('passes a model through when it loads in time', async () => {+ const { withVisionDeadline } = await freshModule();+ await expect(withVisionDeadline(Promise.resolve('landmarker'), 'face landmarker', 50))+ .resolves.toBe('landmarker');+ });++ it('rejects with the label once the deadline passes, instead of awaiting forever', async () => {+ const { withVisionDeadline } = await freshModule();+ const never = new Promise(() => {});+ await expect(withVisionDeadline(never, 'selfie segmenter', 10))+ .rejects.toThrow(/selfie segmenter did not load within 10ms/);+ });++ it('relays the real load failure when one arrives before the deadline', async () => {+ const { withVisionDeadline } = await freshModule();+ await expect(withVisionDeadline(Promise.reject(new Error('wasm 404')), 'face detector', 1000))+ .rejects.toThrow('wasm 404');+ });++ it('leaves no timer running once the load resolves', async () => {+ vi.useFakeTimers();+ try {+ const { withVisionDeadline } = await freshModule();+ await withVisionDeadline(Promise.resolve('ok'), 'face landmarker', 5000);+ expect(vi.getTimerCount()).toBe(0);+ } finally {+ vi.useRealTimers();+ }+ });++ it('does not leave the late rejection of an abandoned load unhandled', async () => {+ const { withVisionDeadline } = await freshModule();+ let rejectLate;+ const slow = new Promise((_r, reject) => { rejectLate = reject; });+ const unhandled = [];+ const onUnhandled = (err) => unhandled.push(err);+ process.on('unhandledRejection', onUnhandled);+ try {+ await expect(withVisionDeadline(slow, 'selfie segmenter', 5)).rejects.toThrow(/did not load/);+ rejectLate(new Error('network died later'));+ await new Promise((resolve) => setTimeout(resolve, 20));+ expect(unhandled).toEqual([]);+ } finally {+ process.off('unhandledRejection', onUnhandled);+ }+ });+});++describe('modelUrl', () => {+ it('serves the vendored face landmarker from our own origin', async () => {+ const { modelUrl } = await freshModule();+ expect(modelUrl('face_landmarker/face_landmarker/float16/1/face_landmarker.task'))+ .toContain('/vendor/mediapipe/face_landmarker.task');+ });++ it('leaves the larger models on Google’s bucket', async () => {+ const { modelUrl } = await freshModule();+ expect(modelUrl('pose_landmarker/pose_landmarker_full/float16/1/pose_landmarker_full.task'))+ .toBe('https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_full/float16/1/pose_landmarker_full.task');+ });+});diff --git a/tests/selfie-refine.test.js b/tests/selfie-refine.test.jsindex 420a38c34..2f530269b 100644--- a/tests/selfie-refine.test.js+++ b/tests/selfie-refine.test.js@@ -87,6 +87,26 @@ describe('assessPhotoQuality', () => {expect(r.primary).toBe('no-face');});+ it('does not block when the detector never loaded, since that says nothing about the photo', () => {+ // null means "no detector", which is how the 2026-09-11 stall surfaced:+ // with the face model unreachable, a perfectly good selfie was being told+ // it had no face in it, and the reconstruction request was never sent.+ const r = assessPhotoQuality({ ...sharpClearFace, faceCount: null, faceBox: null });+ expect(r.verdict).not.toBe('block');+ expect(r.issues).not.toContain('no-face');+ });++ it('does not flag multiple faces when the count is unknown', () => {+ const r = assessPhotoQuality({ ...sharpClearFace, faceCount: null, faceBox: null });+ expect(r.issues).not.toContain('multiple-faces');+ });++ it('still blocks a photo the detector really did examine and found no face in', () => {+ const r = assessPhotoQuality({ ...sharpClearFace, faceCount: 0, faceBox: null });+ expect(r.verdict).toBe('block');+ expect(r.primary).toBe('no-face');+ });+it('passes a sharp, well-framed real photo', () => {const r = assessPhotoQuality(sharpClearFace);expect(r.verdict).toBe('good');