Phase 846: runGuildMeshQuadChannelSettingsJourney and meshQuadChannelSettingsReady
Four-peer channel slowmode fanout extends Phase 799 triple settings slice. 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 846 (v0.8.813):** `runGuildMeshQuadChannelSettingsJourney` (4-peer channel slowmode). Bundle: `npm run test:ci-phase846`.
|
||||
|
||||
**Phase 845 (v0.8.812):** `runGuildMeshQuadChannelTopicJourney` (4-peer channel topic + forum tags). Bundle: `npm run test:ci-phase845`.
|
||||
|
||||
**Phase 844 (v0.8.811):** `runGuildMeshQuadStickerJourney` (4-peer custom sticker). Bundle: `npm run test:ci-phase844`.
|
||||
|
||||
@@ -247,6 +247,19 @@ function matchView (view, spec) {
|
||||
if (!topic || String(topic).length < 1) return false
|
||||
continue
|
||||
}
|
||||
if (key === 'meshQuadChannelSettingsReady') {
|
||||
if (!expected) return true
|
||||
const peers = Number(view?.stats?.peers) || 0
|
||||
if (peers < 2) return false
|
||||
const gid = view?.guild?.id
|
||||
const rail = gid ? view.guildSyncHealthRail?.[gid] : null
|
||||
if (rail?.meshBounded) return false
|
||||
const chId = view?.activeChannelId
|
||||
const sec =
|
||||
Number(view?.channelSettings?.[chId]?.slowmodeSeconds) || 0
|
||||
if (sec < 1) return false
|
||||
continue
|
||||
}
|
||||
if (key === 'meshQuadUnreadReady') {
|
||||
if (!expected) return true
|
||||
const peers = Number(view?.stats?.peers) || 0
|
||||
|
||||
+76
@@ -8578,6 +8578,82 @@ class HeadlessSession {
|
||||
}
|
||||
}
|
||||
|
||||
/** Phase 846: 4-peer mesh — host slowmode visible in all three guests' channelSettings. */
|
||||
async runGuildMeshQuadChannelSettingsJourney () {
|
||||
const { connectGuildMeshQuad } = require('./mesh-helpers')
|
||||
const base = path.join(os.tmpdir(), `pearcord-agentctl-chset846-${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') })
|
||||
const guest3 = new HeadlessSession({ storagePath: path.join(base, 'guest3') })
|
||||
await host.start()
|
||||
await guest1.start()
|
||||
await guest2.start()
|
||||
await guest3.start()
|
||||
try {
|
||||
await host.registerUser({ username: 'cshost846', displayName: 'ChSet Host 846' })
|
||||
await host.createGuild({ name: 'ChSet Quad 846', 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: 'csguest846a', displayName: 'ChSet Guest 846a' })
|
||||
await guest2.registerUser({ username: 'csguest846b', displayName: 'ChSet Guest 846b' })
|
||||
await guest3.registerUser({ username: 'csguest846c', displayName: 'ChSet Guest 846c' })
|
||||
await guest1.ipc({ type: 'join-invite', code })
|
||||
await guest2.ipc({ type: 'join-invite', code })
|
||||
await guest3.ipc({ type: 'join-invite', code })
|
||||
await guest1.wait({ mode: 'guild' }, 45000)
|
||||
await guest2.wait({ mode: 'guild' }, 45000)
|
||||
await guest3.wait({ mode: 'guild' }, 45000)
|
||||
const chId = (await host.refreshView()).activeChannelId
|
||||
if (!chId) throw new Error('active channel missing')
|
||||
await guest1.ipc({ type: 'select-channel', channelId: chId })
|
||||
await guest2.ipc({ type: 'select-channel', channelId: chId })
|
||||
await guest3.ipc({ type: 'select-channel', channelId: chId })
|
||||
await guest1.wait({ activeChannelId: chId }, 30000)
|
||||
await guest2.wait({ activeChannelId: chId }, 30000)
|
||||
await guest3.wait({ activeChannelId: chId }, 30000)
|
||||
await connectGuildMeshQuad(
|
||||
host.platform,
|
||||
guest1.platform,
|
||||
guest2.platform,
|
||||
guest3.platform,
|
||||
55000
|
||||
)
|
||||
const quadWait = { meshQuadReady: true, membersMin: 4 }
|
||||
await host.wait(quadWait, 30000)
|
||||
await guest1.wait(quadWait, 30000)
|
||||
await guest2.wait(quadWait, 30000)
|
||||
await guest3.wait(quadWait, 30000)
|
||||
const slowSec = 60
|
||||
await host.platform.setChannelSlowmode(chId, slowSec)
|
||||
for (const p of [host.platform, guest1.platform, guest2.platform, guest3.platform]) {
|
||||
if (typeof p.requestGuildSyncFanout === 'function') {
|
||||
p.requestGuildSyncFanout()
|
||||
}
|
||||
}
|
||||
const settingsWait = {
|
||||
meshQuadChannelSettingsReady: true,
|
||||
channelSlowmodeAt: { channelId: chId, minSeconds: slowSec }
|
||||
}
|
||||
await guest1.wait(settingsWait, 90000)
|
||||
await guest2.wait(settingsWait, 90000)
|
||||
await guest3.wait(settingsWait, 90000)
|
||||
const g3v = await guest3.refreshView()
|
||||
const sec3 = Number(g3v.channelSettings?.[chId]?.slowmodeSeconds) || 0
|
||||
if (sec3 < slowSec) {
|
||||
throw new Error('guest3 missing channel slowmode on quad mesh')
|
||||
}
|
||||
return { channelId: chId, slowmodeSeconds: slowSec, guest3Seconds: sec3 }
|
||||
} finally {
|
||||
await host.close()
|
||||
await guest1.close()
|
||||
await guest2.close()
|
||||
await guest3.close()
|
||||
}
|
||||
}
|
||||
|
||||
/** Phase 829: 4-peer mesh — drop one guest, survivors stay synced, rejoin + recovery burst. */
|
||||
async runGuildMeshQuadChurnRejoinJourney () {
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user