feat: Registry-verified badge + registryData data flow + V3 error recording
- ClinicSnapshot.tsx: 'Registry 검증' badge (ShieldCheck icon), district/branches/brandGroup pills, external links (강남언니/네이버플레이스/구글맵) when source=registry - report.ts: add source and registryData fields to ClinicSnapshot type - transformReport.ts: ApiMetadata now accepts source/registryData; passes to clinicSnapshot - useReport.ts: DB load path extracts scrape_data.source + scrape_data.registryData → transformApiReport - V3 dual-write error recording: discover-channels, collect-channel-data, generate-report now write error_message + error status to analysis_runs on catch instead of silently swallowing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
36d2f1cf49
commit
ae87953fa0
7 files changed
+143
-4
No files matched your search
@@ -828,7 +828,15 @@ Deno.serve(async (req) => {
|
||||
}).eq("id", runId);
|
||||
|
||||
} catch (e) {
|
||||
console.error("V3 dual-write error:", e);
|
||||
const errMsg = e instanceof Error ? e.message : String(e);
|
||||
console.error("V3 dual-write error:", errMsg);
|
||||
// Best-effort: record error into analysis_run so it's visible in DB
|
||||
try {
|
||||
await supabase.from("analysis_runs").update({
|
||||
error_message: `V3 dual-write failed: ${errMsg}`,
|
||||
status: "collection_error",
|
||||
}).eq("id", runId);
|
||||
} catch { /* ignore secondary failure */ }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -773,7 +773,23 @@ Deno.serve(async (req) => {
|
||||
}
|
||||
} catch (e) {
|
||||
// V3 write failure should not block the pipeline
|
||||
console.error("V3 dual-write error:", e);
|
||||
const errMsg = e instanceof Error ? e.message : String(e);
|
||||
console.error("V3 dual-write error:", errMsg);
|
||||
// Best-effort: record error so it's visible in DB
|
||||
try {
|
||||
if (runId) {
|
||||
await supabase.from("analysis_runs").update({
|
||||
error_message: `V3 dual-write (discover) failed: ${errMsg}`,
|
||||
status: "error",
|
||||
}).eq("id", runId);
|
||||
} else {
|
||||
// runId not yet created — fall back to marketing_reports
|
||||
await supabase.from("marketing_reports").update({
|
||||
status: "v3_write_error",
|
||||
updated_at: new Date().toISOString(),
|
||||
}).eq("id", saved.id);
|
||||
}
|
||||
} catch { /* ignore secondary failure */ }
|
||||
}
|
||||
|
||||
return new Response(
|
||||
|
||||
@@ -337,7 +337,16 @@ ${JSON.stringify(scrapeData.branding || {}, null, 2).slice(0, 1000)}
|
||||
status: "complete",
|
||||
pipeline_completed_at: new Date().toISOString(),
|
||||
}).eq("id", v3RunId);
|
||||
} catch (e) { console.error("V3 run update error:", e); }
|
||||
} catch (e) {
|
||||
const errMsg = e instanceof Error ? e.message : String(e);
|
||||
console.error("V3 run update error:", errMsg);
|
||||
try {
|
||||
await supabase.from("analysis_runs").update({
|
||||
error_message: `V3 report update failed: ${errMsg}`,
|
||||
status: "report_error",
|
||||
}).eq("id", v3RunId);
|
||||
} catch { /* ignore secondary failure */ }
|
||||
}
|
||||
}
|
||||
if (v3ClinicId) {
|
||||
try {
|
||||
@@ -362,6 +371,9 @@ ${JSON.stringify(scrapeData.branding || {}, null, 2).slice(0, 1000)}
|
||||
socialHandles: report.socialHandles,
|
||||
address: clinic.address || "",
|
||||
services: clinic.services || [],
|
||||
// Registry metadata — available when discovered via clinic_registry DB
|
||||
source: scrapeData.source || "scrape",
|
||||
registryData: scrapeData.registryData || null,
|
||||
},
|
||||
}),
|
||||
{ headers: { ...corsHeaders, "Content-Type": "application/json" } },
|
||||
|
||||
Reference in new issue
Block a user