OverviewFilesCommitsIssuesDocsReleasesPeers

atproto-did-peer commits / 2911f10

0.2.13: diagnose() reports lastAppendAt per DID
The router already tracked when each DID's firehose last appended (_lastAppend, the refresh timer's liveness signal); nothing could read it. The gateway's metrics show it as 'how long since this peer advanced'. Test first: fork.test.mjs asserts it (red: undefined); npm test green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2911f10597aba87b1daa419b9f4eee1953ab5522
by plankatron <fleeky@gmail.com> · 2026-10-13T22:37:16.000Z

Changed files (3) +7 -1

lib/did-peer.js +3 -0
……@@ -1138,6 +1138,9 @@ export class DidPeerRouter {
11381138 fronts,
11391139 denied,
11401140 staleFrontMs: this._staleFrontMs,
1141 // did -> ms timestamp of the last firehose append seen from any co-owner: the liveness signal the
1142 // refresh timer already uses, now visible to an operator (the gateway's metrics).
1143 lastAppendAt: Object.fromEntries(this._lastAppend),
11411144 relay: this.relay ? { sources: this.relay.sourceCount ? this.relay.sourceCount() : null } : null
11421145 }
11431146 }
package.json +1 -1
……@@ -1,6 +1,6 @@
11{
22 "name": "atproto-did-peer",
3 "version": "0.2.12",
3 "version": "0.2.13",
44 "description": "Keyless, direction-free P2P reader/seeder for an atproto DID's repo+firehose Hypercores: announce-push discovery + event-driven head reconciliation + a keyless read surface. The shared primitive beneath atproto-bridge, atproto-relay and favela (extracted from atproto-bridge did-peer.js).",
55 "type": "module",
66 "main": "index.js",
test/fork.test.mjs +3 -0
……@@ -143,6 +143,9 @@ assert(!!forkRow, 'the rival is still FRONTED (it is tracked, not ignored)')
143143assert(forkRow.rev > canonRevs[3], 'the rival really does carry the higher rev')
144144assert(forkRow.forkRejected > 0, 'diagnose NAMES the rejection (forkRejected > 0) — an operator can see the disagreement')
145145assert(diag.fronts.find((f) => f.served).rev === canonRevs[3], 'diagnose reports the authoritative front as the served one')
146// The gateway's metrics show how long ago each DID's firehose last advanced — the 'is this peer alive'
147// signal. It existed (_lastAppend) and nothing could read it.
148assert(typeof diag.lastAppendAt[DID] === 'number' && diag.lastAppendAt[DID] > 0, 'diagnose reports when the DID\'s firehose last appended')
146149
147150// 3. The gate is not a permanent lock-out: with the whole canonical line gone (the rebuild case — a peer
148151// that rebuilt its cores comes back on a new line), the surviving line is served.