feat(agentctl): runGuildMeshTripleMemberRolesJourney for Phase 808
3-peer custom role assignment; both guests see target member role badge. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
Agent control plane for Pearcord — send the same IPC messages the UI sends, read `view` snapshots, and run scripted journeys against a **live worker** or an in-process **headless** session.
|
||||
|
||||
**Phase 808 (v0.8.775):** `runGuildMeshTripleMemberRolesJourney` (3-peer roles). Bundle: `npm run test:ci-phase808`.
|
||||
|
||||
**Phase 807 (v0.8.774):** `runGuildMeshTripleTypingJourney` (3-peer typing). Bundle: `npm run test:ci-phase807`.
|
||||
|
||||
**Phase 806 (v0.8.773):** `runGuildMeshTripleReactionsJourney` (3-peer reactions). Bundle: `npm run test:ci-phase806`.
|
||||
|
||||
+65
@@ -6012,6 +6012,71 @@ class HeadlessSession {
|
||||
}
|
||||
}
|
||||
|
||||
/** Phase 808: 3-peer mesh — host assigns custom role; both guests see it on target member. */
|
||||
async runGuildMeshTripleMemberRolesJourney () {
|
||||
const { connectGuildMeshTriple } = require('./mesh-helpers')
|
||||
const base = path.join(os.tmpdir(), `pearcord-agentctl-roles808-${Date.now()}`)
|
||||
const host = new HeadlessSession({ storagePath: path.join(base, 'host') })
|
||||
const guest1 = new HeadlessSession({ storagePath: path.join(base, 'guest1') })
|
||||
const guest2 = new HeadlessSession({ storagePath: path.join(base, 'guest2') })
|
||||
await host.start()
|
||||
await guest1.start()
|
||||
await guest2.start()
|
||||
try {
|
||||
await host.registerUser({ username: 'rlhost808', displayName: 'Roles Host 808' })
|
||||
await host.createGuild({ name: 'Roles Triple 808', publicListing: false })
|
||||
await host.wait({ mode: 'guild' }, 45000)
|
||||
const invite = await host.platform.createInvite().catch(() => null)
|
||||
const code = invite?.shareCode || invite?.code
|
||||
if (!code) throw new Error('host invite missing')
|
||||
await guest1.registerUser({ username: 'rlguest808a', displayName: 'Roles Guest 808a' })
|
||||
await guest2.registerUser({ username: 'rlguest808b', displayName: 'Roles Guest 808b' })
|
||||
await guest1.ipc({ type: 'join-invite', code })
|
||||
await guest2.ipc({ type: 'join-invite', code })
|
||||
await guest1.wait({ mode: 'guild' }, 45000)
|
||||
await guest2.wait({ mode: 'guild' }, 45000)
|
||||
await connectGuildMeshTriple(
|
||||
host.platform,
|
||||
guest1.platform,
|
||||
guest2.platform,
|
||||
50000
|
||||
)
|
||||
await host.wait({ meshPeersMin: 1 }, 30000)
|
||||
await guest1.wait({ meshPeersMin: 1 }, 30000)
|
||||
await guest2.wait({ meshPeersMin: 1 }, 30000)
|
||||
await new Promise((r) => setTimeout(r, 2000))
|
||||
const guest1UserId = (await guest1.refreshView()).user?.id
|
||||
if (!guest1UserId) throw new Error('guest1 user id missing')
|
||||
const role = await host.createGuildCustomRole('Mesh Role 808', {
|
||||
color: '#5865f2'
|
||||
})
|
||||
if (!role?.id) throw new Error('role create failed')
|
||||
await host.setMemberCustomRoles(guest1UserId, [role.id])
|
||||
for (const p of [host.platform, guest1.platform, guest2.platform]) {
|
||||
if (typeof p.requestGuildSyncFanout === 'function') {
|
||||
p.requestGuildSyncFanout()
|
||||
}
|
||||
}
|
||||
const rxWait = {
|
||||
memberCustomRolesIncludes: { userId: guest1UserId, roleId: role.id }
|
||||
}
|
||||
await guest1.wait(rxWait, 90000)
|
||||
await guest2.wait(rxWait, 90000)
|
||||
const g1v = await guest1.refreshView()
|
||||
const g2v = await guest2.refreshView()
|
||||
const hit1 = (g1v.members || []).find((m) => m.userId === guest1UserId)
|
||||
const hit2 = (g2v.members || []).find((m) => m.userId === guest1UserId)
|
||||
const ok1 = (hit1?.customRoleIds || []).map(String).includes(String(role.id))
|
||||
const ok2 = (hit2?.customRoleIds || []).map(String).includes(String(role.id))
|
||||
if (!ok1 || !ok2) throw new Error('guest missing custom role on triple mesh')
|
||||
return { roleId: role.id, guest1UserId, guest1Roles: hit1?.customRoleIds, guest2View: hit2?.customRoleIds }
|
||||
} finally {
|
||||
await host.close()
|
||||
await guest1.close()
|
||||
await guest2.close()
|
||||
}
|
||||
}
|
||||
|
||||
/** Phase 787: 2-peer mesh — host assigns custom role; guest member list reflects role. */
|
||||
async runGuildMeshMemberRolesJourney () {
|
||||
const { connectGuildMeshPeers } = require('./mesh-helpers')
|
||||
|
||||
Reference in New Issue
Block a user