OverviewFilesCommitsIssuesDocsReleasesPeers

atproto-room commits / c33f27e

0.2.31: LabelRoom records its last projection (diagnostic)
Re-signed ver:1 labels sat in both co-owners' signed logs while the gateway served the old ones, and nothing said whether projectTo had run. lastProjection = {at, appended, coreLength, logLength}. Test-first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c33f27ead6643f841444991552f734b2921dc03d
by plankatron <fleeky@gmail.com> · 2026-10-14T17:08:17.000Z

Changed files (3) +24 -1

lib/label-room.js +4 -0
……@@ -44,6 +44,9 @@ export class LabelRoom {
4444 this.holds = holds
4545 this.lease = holds ? null : new Lease(statebase, { self, ttlMs })
4646 this._projected = new WeakMap() // feed core -> Set of label hexes already appended
47 // The last projectTo run: { at, appended, coreLength, logLength }. A diagnostic (2026-10-14: re-signed labels
48 // sat in the signed log while the gateway served the old ones, and nothing said whether projection had run).
49 this.lastProjection = null
4750 }
4851
4952 // A mod records a label intent (label/negate). Authority to WRITE is StateBase admission.
……@@ -83,6 +86,7 @@ export class LabelRoom {
8386 have.add(hex)
8487 appended++
8588 }
89 this.lastProjection = { at: Date.now(), appended, coreLength: feedCore.length, logLength: Object.keys(map).length }
8690 return appended
8791 }
8892
package.json +1 -1
……@@ -1,6 +1,6 @@
11{
22 "name": "atproto-room",
3 "version": "0.2.30",
3 "version": "0.2.31",
44 "description": "Attestation-gated, encrypted multi-writer room engine — StateBase (keet-model admission) + Lease + signer + RepoBase + LabelBase/LabelRoom + serve-membrane. Extracted from hyper-proto-peer; consumed by the atproto peer (repo devices) and the co-authored labeler.",
55 "type": "module",
66 "main": "index.js",
test/label-room-presence.test.mjs +19 -0
……@@ -112,4 +112,23 @@ const E2 = 'did:plc:e2jevhuurrhlm36ufk7fklpg'
112112 assert(log[0].ver === 1 && verifyLabel(log[0], labeler.didKey), 'and it now carries ver: 1 and verifies')
113113 assert(await r.tick() === 0, 'a second tick re-signs nothing')
114114}
115// ⛔ THE PROJECTION MUST BE OBSERVABLE. 2026-10-14: the re-signed (ver:1) member labels were in both co-owners'
116// signed logs, yet the gateway still served the old ones, and nothing could say whether projectTo had run since
117// boot or how long the served label core was. projectTo records its last run.
118{
119 const sb = mockSb()
120 const r = new LabelRoom(sb, { ...KP, holds: () => true })
121 assert(r.lastProjection === null, 'no projection before the first projectTo')
122 await r.label(E2, 'loser-club-member', { cts: '2026-10-14T00:00:09.000Z' })
123 await r.tick()
124 const dir = mkdtempSync(join(tmpdir(), 'lrp2-'))
125 const store = new Corestore(dir)
126 const feed = store.get({ name: 'labels', valueEncoding: 'binary' })
127 await r.projectTo(feed)
128 const p = r.lastProjection
129 assert(p && p.appended === 1 && p.coreLength === 1 && p.logLength === 1 && typeof p.at === 'number', 'lastProjection records appended / coreLength / logLength / at')
130 await r.projectTo(feed)
131 assert(r.lastProjection.appended === 0 && r.lastProjection.coreLength === 1, 'an idempotent run is recorded too')
132 await feed.close(); try { await store.close() } catch {}; rmSync(dir, { recursive: true, force: true })
133}
115134console.log('\nLABEL-ROOM PRESENCE OK')