| … | … | @@ -653,8 +653,25 @@ async function addPeer (did) { |
| 653 | 653 | // the BASELINE source: a DID whose records hpp already holds on this box (wj62/loser-club on tabertron) |
| 654 | 654 | // reads them from the AUTHORITATIVE shared store (bypasses the membrane fork/desync); a non-co-hosted DID |
| 655 | 655 | // rebuilds its repo from the FIREHOSE BACKFILL (subscribeRepos(0) — each #commit frame carries the bytes). |
| 656 | | let coHosted = false |
| 657 | | try { const s = await getRecordStore(did); coHosted = s ? (await s.records()).length > 0 : false } catch {} |
| 656 | // ⛔ CO-HOSTED MEANS hpp HOLDS IT, NOT "WE HAVE SOME RECORDS FOR IT". This was |
| 657 | // `(await store.records()).length > 0`, which is SELF-FULFILLING — the gate below says so in its own |
| 658 | // comment: our own putPost populates the shared store for ingested peers too. So the first time we |
| 659 | // glanced at a DID it acquired records, became "co-hosted" for ever, and from then on every boot |
| 660 | // tailed from the CURRENT END and could never fill a gap. |
| 661 | // |
| 662 | // Measured on a handset (hyper-social #53): ashatron viewed once in August, then frozen — posts 16 |
| 663 | // days stale and the PREVIOUS avatar rendering as current, because the profile record was inside the |
| 664 | // hole. It reads as corruption rather than as a sync gap, which is the worst way for it to fail. |
| 665 | // |
| 666 | // hpp's config is the authority (the same source /api/track calls HOSTED-FIRST for the same reason). |
| 667 | // A DID we actually host is authoritative on disk and rightly tails from the end; anything else |
| 668 | // rebuilds from the firehose, which is the only copy that can close a gap. |
| 669 | // |
| 670 | // ⚠ Non-hosted DIDs therefore replay from seq 0 on each boot. That is idempotent (putPost/putProfile |
| 671 | // dedup by content signature, so a replay re-reads without re-writing) but it re-reads frames every |
| 672 | // launch. The real answer is a persisted per-DID fold cursor so a boot resumes instead of replaying; |
| 673 | // until that exists, correct-and-costly beats cheap-and-frozen. |
| 674 | const coHosted = (HOSTED_DIDS || []).includes(did) |
| 658 | 675 | console.log(JSON.stringify({ msg: 'firehose-only (noRepo) DID', did, baseline: coHosted ? 'shared-store' : 'firehose-backfill' })) |
| 659 | 676 | const peer = router.add(did, { verifyKey, noRepo: true, onError: (e) => console.error('[peer]', did, e.message) }) |
| 660 | 677 | byDid.set(did, peer); peers.push(peer) |