Changeset 3f32994 in Klonkt


Ignore:
Timestamp:
07/28/2026 08:47:48 AM (6 weeks ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
b1512e0
Parents:
c52dc82
Message:

Link-preview backfill hing achter een her-fetch die hij niet nodig had

Een YouTube-post van sound-fabrics bleef een kale link, terwijl de resolver op
precies die inhoud gewoon een kaart met titel en thumbnail teruggaf. De backfill
in de self-heal stond namelijk NA de her-fetch van de note, en als die bron even
niet antwoordt slaat de lus de hele rij over met continue. Daar had de preview
niets mee te maken: die wordt opgelost uit de content die we al in de database
hebben. Nu staat hij vooraan in de lus, los van de origine, met zijn eigen
try/catch zodat hij de heling ook nooit blokkeert.

Dit is dezelfde soort fout als de body-cap: een afhankelijkheid toegevoegd die er
inhoudelijk niet hoort, en die stilletjes precies de gevallen wegneemt waar het
om gaat.

Changed files:
src/services/ActivityPubService.js

  • embed-backfill verplaatst naar de kop van de self-heal-lus, voor fetchNoteAP
  • SELFHEAL_VERSION 17 -> 18

remarks: 214 tests groen. Resolver was al direct geverifieerd op deze exacte
note-content: oembed, titel In The Air Tonight (AI Citypop), met thumbnail.

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    rc52dc82 r3f32994  
    28492849// during a flux window, e.g. a fleet-wide update), and drops notes that are gone
    28502850// (404/410). Bump SELFHEAL_VERSION only on a release that warrants a re-sync.
    2851 const SELFHEAL_VERSION = 17; // v17: re-resolve link previews now that OpenGraph works and big pages are read instead of refused
     2851const SELFHEAL_VERSION = 18; // v18: link previews no longer hang behind the note re-fetch (an unreachable origin skipped the whole row)
    28522852async function fetchNoteAP(url) {
    28532853  try {
     
    31623162    let healed = 0, failed = 0;
    31633163    for (const r of rows) {
     3164      // Link previews first, and deliberately BEFORE the note re-fetch. A
     3165      // preview is resolved from the content we already hold, so hanging it
     3166      // behind a remote fetch meant one unreachable origin skipped the whole
     3167      // row (`continue` below) and the card never appeared. It needs nothing
     3168      // from the origin, so it must not depend on it.
     3169      if (!r.quote_json && !r.embed_json) {
     3170        try {
     3171          const ej = await resolveExternalEmbed(r.content);
     3172          if (ej) db.prepare('UPDATE ap_timeline SET embed_json = ? WHERE id = ?').run(ej, r.id);
     3173        } catch { /* best-effort, never blocks the heal */ }
     3174      }
    31643175      try {
    31653176        const note = await fetchNoteAP(r.id);
     
    31853196          const ai = actorInfo(await fetchActor(r.author_uri), r.author_uri);
    31863197          if (ai.emojis) { try { db.prepare('UPDATE ap_timeline SET author_emoji_json = ? WHERE id = ?').run(JSON.stringify(ai.emojis), r.id); } catch { /* ignore */ } }
    3187         }
    3188         // v16: link previews. A post from before the embed pipeline has no
    3189         // card at all, which is why nothing showed. Only for rows that have no
    3190         // quote (a quote already IS the card) and no embed yet, so this costs
    3191         // one page fetch per candidate and never repeats.
    3192         if (!r.quote_json) {
    3193           const ej = await resolveExternalEmbed(html || r.content).catch(() => null);
    3194           if (ej) { try { db.prepare('UPDATE ap_timeline SET embed_json = ? WHERE id = ?').run(ej, r.id); } catch { /* ignore */ } }
    31953198        }
    31963199        // v14: same for the booster's display name ("X boosted"). The row stores
Note: See TracChangeset for help on using the changeset viewer.