diff --git a/.prettierignore b/.prettierignore index f08ea3e5e7..aefbc2e0b0 100644 --- a/.prettierignore +++ b/.prettierignore @@ -13,10 +13,6 @@ public/demo-documents/ scratch/ .claude/worktrees/ .impeccable/ -# tests/worker-visual-capture.test.ts asserts on the exact source text of this -# file (line-level guards on redaction/normalization order); prettier's -# line-wrapping would break those assertions, so it owns its own layout. -worker/main.ts # Generated by `supabase gen types`; keep the generator's formatting so # regeneration stays churn-free. src/lib/supabase/database.types.ts diff --git a/tests/worker-visual-capture.test.ts b/tests/worker-visual-capture.test.ts index 1e61e0f100..5b90343d6e 100644 --- a/tests/worker-visual-capture.test.ts +++ b/tests/worker-visual-capture.test.ts @@ -74,9 +74,8 @@ describe("worker visual capture hardening", () => { expect(workerSource).toContain("const classification = redactImageClassification(args.classification);"); expect(workerSource).toContain("let classification = redactImageClassification(resolved.classification);"); expect(workerSource).toContain("caption: classification.caption"); - expect(workerSource).toContain( - "const structuredProfile = normalizeStructuredVisualProfile(redactCaptionMetadataValue(metadata.structured_visual_profile), {", - ); + expect(workerSource).toContain("const structuredProfile = normalizeStructuredVisualProfile("); + expect(workerSource).toContain("redactCaptionMetadataValue(metadata.structured_visual_profile)"); }); it("computes perceptual duplicate groups before caption budget selection", () => { diff --git a/worker/main.ts b/worker/main.ts index 922dfc62eb..29cd7d21d3 100644 --- a/worker/main.ts +++ b/worker/main.ts @@ -752,7 +752,9 @@ async function getCachedImageClassification(ownerId: string | null, imageHash: s : "unclear"; const score = Number(metadata.clinical_relevance_score); const labels = cachedImageLabels(metadata.labels); - const cachedCaption = redactCaptionIdentifiers(cleanString(String(data.caption || "").trim() || "Extracted source image.")); + const cachedCaption = redactCaptionIdentifiers( + cleanString(String(data.caption || "").trim() || "Extracted source image."), + ); const assessment = assessClinicalImageUse({ imageType, searchable: Boolean(metadata.searchable), @@ -761,10 +763,13 @@ async function getCachedImageClassification(ownerId: string | null, imageHash: s labels, skipReason: typeof metadata.skip_reason === "string" ? metadata.skip_reason : null, }); - const structuredProfile = normalizeStructuredVisualProfile(redactCaptionMetadataValue(metadata.structured_visual_profile), { - fallbackText: cachedCaption, - fallbackConfidence: score, - }); + const structuredProfile = normalizeStructuredVisualProfile( + redactCaptionMetadataValue(metadata.structured_visual_profile), + { + fallbackText: cachedCaption, + fallbackConfidence: score, + }, + ); return { image_type: imageType, @@ -813,8 +818,8 @@ async function setCachedImageClassification(args: { clinical_signal_score: classification.clinical_signal_score, admin_signal_score: classification.admin_signal_score, structured_visual_profile: (classification as ImageClassificationWithVisualProfile).structured_visual_profile, - structured_extraction_confidence: - (classification as ImageClassificationWithVisualProfile).structured_extraction_confidence, + structured_extraction_confidence: (classification as ImageClassificationWithVisualProfile) + .structured_extraction_confidence, image_policy_version: clinicalImagePolicyVersion, visual_intelligence_version: visualIntelligenceVersion, image_caption_cache_version: imageCaptionCacheVersion,