From 60366a95aefc25b8974095ffb8b7d9f78ccae21e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Alves?= Date: Mon, 27 Jul 2026 06:20:21 +0000 Subject: [PATCH] fix(writer-pipeline): detect revista leads by URL when sourceKind missing Synthetic /revista-imprensa/ URLs without sourceKind skipped the publisher image probe and threw Mandatory featured image (ERRSIG 88492922d213). Paperclip-Issue: BIT-27615 Paperclip-Run: 17d5ee4b-579f-4833-943f-ea9e815e5dec --- writer-pipeline/src/store.ts | 2 ++ writer-pipeline/src/wp-publish.ts | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/writer-pipeline/src/store.ts b/writer-pipeline/src/store.ts index e4c7d00..c997489 100644 --- a/writer-pipeline/src/store.ts +++ b/writer-pipeline/src/store.ts @@ -70,6 +70,8 @@ export function upsertItem(store: StoreFile, item: AggregatedItem): { store: Sto skippedReason: prev.skippedReason, featuredImageUrl: item.featuredImageUrl ?? prev.featuredImageUrl, featuredImageCredit: item.featuredImageCredit ?? prev.featuredImageCredit, + // Preserve ingest provenance when a later upsert omits sourceKind (BIT-27615). + sourceKind: item.sourceKind ?? prev.sourceKind, }; } else next.items.push(item); return { store: next, isNew }; diff --git a/writer-pipeline/src/wp-publish.ts b/writer-pipeline/src/wp-publish.ts index 84c9d9b..da8a7ba 100644 --- a/writer-pipeline/src/wp-publish.ts +++ b/writer-pipeline/src/wp-publish.ts @@ -159,8 +159,15 @@ export async function resolveFeaturedImageForDraft(item: AggregatedItem): Promis webDavEnvError = e instanceof Error ? e.message : String(e); } - if (item.sourceKind === 'revista_imprensa') { - const publisherHome = publisherHomeUrlForRevistaLead(item.url); + // Synthetic /revista-imprensa/ leads are not real article pages (BIT-25590). Detect by + // URL path as well as sourceKind — store upserts that omit sourceKind used to fall + // through and throw Mandatory featured image (BIT-27615 / ERRSIG 88492922d213). + const revistaPublisherHome = publisherHomeUrlForRevistaLead(item.url); + const isRevistaLead = + item.sourceKind === 'revista_imprensa' || revistaPublisherHome != null; + + if (isRevistaLead) { + const publisherHome = revistaPublisherHome; if (publisherHome) { const fromPublisher = await featuredImageFromPageHtml(publisherHome, item.featuredImageCredit); if (fromPublisher) return fromPublisher; @@ -177,7 +184,7 @@ export async function resolveFeaturedImageForDraft(item: AggregatedItem): Promis return resolveFeaturedFromWebDavArchive(webDavCfg, item); } - if (item.sourceKind === 'revista_imprensa') { + if (isRevistaLead) { return null; } -- 2.47.3