OverviewFilesCommitsIssuesDocsReleasesPeers

favela-peer commits / 40fe11d

0.0.66: an observation from a DID is source:bsky (I2)
One observation feed carries every outside network; a row says which. Test-first; 420/420. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40fe11dadc811c76999912bc58ad924cd9004cbe
by plankatron <fleeky@gmail.com> · 2026-10-14T23:37:29.000Z

Changed files (3) +20 -2

lib/peer.js +2 -1
……@@ -838,7 +838,8 @@ export class Peer {
838838 const ms = Number(fm.at)
839839 out.push({
840840 kind,
841 source: 'fediverse',
841 // One observation feed carries every outside network (hyper-social #82, I2): a bsky actor is a DID.
842 source: fm.actor.startsWith('did:') ? 'bsky' : 'fediverse',
842843 author: fm.actor,
843844 at: Number.isFinite(ms) && ms > 0 ? new Date(ms).toISOString() : '',
844845 target: t && t.feed === mine ? t : null,
package.json +1 -1
……@@ -1,6 +1,6 @@
11{
22 "name": "favela-peer",
3 "version": "0.0.65",
3 "version": "0.0.66",
44 "description": "The favela daemon \u2014 feeds and documents of markdown records over Hypercore. No atproto, no ActivityPub.",
55 "type": "module",
66 "scripts": {
test/notifications.test.js +17 -0
……@@ -240,3 +240,20 @@ test('an observation feed is never scanned as an ordinary feed', async (t) => {
240240 const n = await me.peer.notifications()
241241 t.ok(n.every((x) => x.author !== gw.feed.key.toString('hex')), 'no row is attributed to the bridge feed itself')
242242})
243
244// ⛔ A bsky actor is a DID, not a URL (hyper-social #82, I2): the same observation feed carries both networks, and a
245// row says which one it came from so the surface can link the right place.
246test('★ an observation whose actor is a DID is marked source:bsky', async (t) => {
247 const me = await mkPeer()
248 const gw = await gatewayFeed()
249 t.teardown(() => Promise.all([me.peer.close(), gw.feed.close()]))
250 await gw.feed.put(OBSERVATION, 'b1', obs('follow', { actor: 'did:plc:alicealicealice', activity: 'at://did:plc:alicealicealice/app.bsky.graph.follow/3x' }))
251 await gw.feed.put(OBSERVATION, 'f1', obs('follow'))
252 await gw.feed.update()
253 me.peer.feeds.set(Peer.nameFor(gw.feed.key), gw.feed)
254 me.peer.observers.set(gw.feed.key.toString('hex'), gw.root)
255 const rows = (await me.peer.notifications()).filter((x) => x.kind === 'follow')
256 const by = Object.fromEntries(rows.map((x) => [x.author, x.source]))
257 t.is(by['did:plc:alicealicealice'], 'bsky')
258 t.is(by['https://prsm.space/users/alice'], 'fediverse')
259})