Changeset 355364c in Klonkt


Ignore:
Timestamp:
06/26/2026 09:33:42 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
5ceed61
Parents:
d71ed03
Message:

fix(cirkel): migrate ALL circle links, not just status='active'

Old pull-protocol health statuses ('error'/'outdated') are irrelevant now: a
peer that removed /.klonkt/* shows as 'error' but still has a working AP actor.
The active-only filter dropped such links (e.g. sound-fabrics: 5 links -> only 2
migrated). Migrate every non-removed link; bump the run flag to v2 so instances
re-migrate and pick up the previously-skipped ones.

Co-Authored-By: Claude <noreply@…>

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scripts/migrate-circles.mjs

    rd71ed03 r355364c  
    2424    SELECT cl.remote_url AS url, s.id AS sid, s.slug AS slug
    2525    FROM circle_links cl JOIN sites s ON s.id = cl.local_site_id
    26     WHERE cl.status = 'active'
     26    WHERE cl.status != 'removed'
    2727  `).all();
    2828} catch (e) { console.log('no circle_links table — nothing to migrate'); process.exit(0); }
  • src/services/ActivityPubService.js

    rd71ed03 r355364c  
    10701070  if (_circlesMigrating) return; _circlesMigrating = true;
    10711071  try {
    1072     let done; try { done = db.prepare('SELECT value FROM app_settings WHERE key = ?').get('circles_migrated_v1'); } catch { return; }
     1072    let done; try { done = db.prepare('SELECT value FROM app_settings WHERE key = ?').get('circles_migrated_v2'); } catch { return; }
    10731073    if (done && done.value === '1') return;
     1074    // Migrate EVERY link the user added (not only status='active'): the old
     1075    // 'error'/'outdated' statuses came from the pull-protocol's health checks
     1076    // (now irrelevant) — e.g. a peer that removed /.klonkt/* shows up as error
     1077    // but still has a working AP actor.
    10741078    let links = [];
    1075     try { links = db.prepare("SELECT cl.remote_url AS url, s.id AS sid, s.slug AS slug FROM circle_links cl JOIN sites s ON s.id = cl.local_site_id WHERE cl.status = 'active'").all(); } catch { /* no legacy table */ }
     1079    try { links = db.prepare("SELECT cl.remote_url AS url, s.id AS sid, s.slug AS slug FROM circle_links cl JOIN sites s ON s.id = cl.local_site_id WHERE cl.status != 'removed'").all(); } catch { /* no legacy table */ }
    10761080    let ok = 0;
    10771081    for (const l of links) {
     
    10811085      } catch { /* best-effort per link */ }
    10821086    }
    1083     try { db.prepare('INSERT OR REPLACE INTO app_settings (key, value) VALUES (?, ?)').run('circles_migrated_v1', '1'); } catch { /* ignore */ }
     1087    try { db.prepare('INSERT OR REPLACE INTO app_settings (key, value) VALUES (?, ?)').run('circles_migrated_v2', '1'); } catch { /* ignore */ }
    10841088    if (links.length) console.log(`[AP] circle migration: ${ok}/${links.length} legacy link(s) -> auto-boost`);
    10851089  } catch { /* never block boot */ } finally { _circlesMigrating = false; }
Note: See TracChangeset for help on using the changeset viewer.