Phase 888: registry pull opts auto-resolve + host/search pull mixin extract (v0.8.855)
Non-breaking refactor — buildGuildGossipRpcPullOptsFromRegistry() resolves rpcMethod from the gossip RPC registry for all pull paths; fetchMessageSearchGuildGossipRpcPullByConfig for search mesh; platform-host-rpc-pull-mixin shared by mesh RPC mixin. Mesh sync/member page and search mixins drop manual RPC id wiring. test:ci-phase888 passes (46/50, cutover deferred).
This commit is contained in:
@@ -92,6 +92,8 @@ Application facade: one `PearcordPlatform` class that wires identity, database,
|
|||||||
|
|
||||||
**Phase 822 (v0.8.789):** Triple-peer topology via `guild-mesh-topology` + `getMeshStabilityStats`. Bundle: `npm run test:ci-phase822`.
|
**Phase 822 (v0.8.789):** Triple-peer topology via `guild-mesh-topology` + `getMeshStabilityStats`. Bundle: `npm run test:ci-phase822`.
|
||||||
|
|
||||||
|
**Phase 888 (v0.8.855):** Registry pull opts auto-resolve (`buildGuildGossipRpcPullOptsFromRegistry`) + host/search pull mixin extract + message search config pull. Bundle: `npm run test:ci-phase888`.
|
||||||
|
|
||||||
**Phase 887 (v0.8.854):** Registry RPC method resolve + targeted export pull mixin + handler manifest validation. Bundle: `npm run test:ci-phase887`.
|
**Phase 887 (v0.8.854):** Registry RPC method resolve + targeted export pull mixin + handler manifest validation. Bundle: `npm run test:ci-phase887`.
|
||||||
|
|
||||||
**Phase 886 (v0.8.853):** Registry-driven handler map + `bindGuildGossipRpcHandlers()` + wire bind mixin extract. Bundle: `npm run test:ci-phase886`.
|
**Phase 886 (v0.8.853):** Registry-driven handler map + `bindGuildGossipRpcHandlers()` + wire bind mixin extract. Bundle: `npm run test:ci-phase886`.
|
||||||
|
|||||||
@@ -10,9 +10,15 @@ const {
|
|||||||
requestGuildGossipRpcFromPeers
|
requestGuildGossipRpcFromPeers
|
||||||
} = require('./gossip-rpc-session')
|
} = require('./gossip-rpc-session')
|
||||||
const { pickFirstGuildRpcResponse } = require('./gossip-rpc-validators')
|
const { pickFirstGuildRpcResponse } = require('./gossip-rpc-validators')
|
||||||
const { buildGuildGossipRpcPullOpts } = require('./gossip-rpc-pull-config')
|
const {
|
||||||
const { buildTargetedGuildGossipRpcFetchPayload } = require('./gossip-rpc-payload')
|
buildTargetedGuildGossipRpcFetchPayload,
|
||||||
const { lookupGuildGossipRpcPullRegistryEntryByConfig, resolveGuildGossipRpcMethodId } = require('./gossip-rpc-registry')
|
buildMessageSearchGuildGossipRpcFetchPayload
|
||||||
|
} = require('./gossip-rpc-payload')
|
||||||
|
const {
|
||||||
|
lookupGuildGossipRpcPullRegistryEntryByConfig,
|
||||||
|
resolveGuildGossipRpcMethodId
|
||||||
|
} = require('./gossip-rpc-registry')
|
||||||
|
const { buildGuildGossipRpcPullOptsFromRegistry } = require('./gossip-rpc-registry-pull')
|
||||||
|
|
||||||
/** Shared peer resolve + wire prep for guild gossip RPC fanout (Phase 880). */
|
/** Shared peer resolve + wire prep for guild gossip RPC fanout (Phase 880). */
|
||||||
async function prepareGuildGossipRpcFanoutRequest (platform, opts = {}) {
|
async function prepareGuildGossipRpcFanoutRequest (platform, opts = {}) {
|
||||||
@@ -129,7 +135,7 @@ async function fetchTargetedGuildGossipRpcPullHit (
|
|||||||
const requestIdFn = typeof nextRequestId === 'function' ? nextRequestId : () => nextRequestId
|
const requestIdFn = typeof nextRequestId === 'function' ? nextRequestId : () => nextRequestId
|
||||||
return fetchGuildGossipRpcPullHit(
|
return fetchGuildGossipRpcPullHit(
|
||||||
platform,
|
platform,
|
||||||
buildGuildGossipRpcPullOpts(configKey, {
|
buildGuildGossipRpcPullOptsFromRegistry(configKey, {
|
||||||
targetMemberId: opts.targetMemberId || null,
|
targetMemberId: opts.targetMemberId || null,
|
||||||
rpcMethod,
|
rpcMethod,
|
||||||
buildPayload: async ({ guildId }) =>
|
buildPayload: async ({ guildId }) =>
|
||||||
@@ -148,13 +154,34 @@ async function fetchTargetedGuildGossipRpcPullHit (
|
|||||||
async function fetchGuildGossipRpcPullByConfig (platform, configKey, overrides = {}) {
|
async function fetchGuildGossipRpcPullByConfig (platform, configKey, overrides = {}) {
|
||||||
const entry = lookupGuildGossipRpcPullRegistryEntryByConfig(configKey)
|
const entry = lookupGuildGossipRpcPullRegistryEntryByConfig(configKey)
|
||||||
if (!entry) return null
|
if (!entry) return null
|
||||||
const opts = buildGuildGossipRpcPullOpts(configKey, overrides)
|
const opts = buildGuildGossipRpcPullOptsFromRegistry(configKey, overrides)
|
||||||
if (!opts) return null
|
if (!opts) return null
|
||||||
if (entry.pullKind === 'hostHit') return fetchGuildGossipRpcFromHostHit(platform, opts)
|
if (entry.pullKind === 'hostHit') return fetchGuildGossipRpcFromHostHit(platform, opts)
|
||||||
if (entry.pullKind === 'pullMerged') return fetchGuildGossipRpcPullMerged(platform, opts)
|
if (entry.pullKind === 'pullMerged') return fetchGuildGossipRpcPullMerged(platform, opts)
|
||||||
return fetchGuildGossipRpcPullHit(platform, opts)
|
return fetchGuildGossipRpcPullHit(platform, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Message search merge pull via registry config + payload builder (Phase 888). */
|
||||||
|
async function fetchMessageSearchGuildGossipRpcPullByConfig (
|
||||||
|
platform,
|
||||||
|
guildId,
|
||||||
|
query,
|
||||||
|
opts = {},
|
||||||
|
requestId
|
||||||
|
) {
|
||||||
|
if (!platform.guild?.guild || platform.guild.guild.id !== guildId) return null
|
||||||
|
return fetchGuildGossipRpcPullByConfig(platform, 'messageSearchMerge', {
|
||||||
|
buildPayload: async ({ guildId: gid }) =>
|
||||||
|
buildMessageSearchGuildGossipRpcFetchPayload({
|
||||||
|
guildId: gid,
|
||||||
|
requestId,
|
||||||
|
query,
|
||||||
|
opts,
|
||||||
|
requestedBy: platform.identity?.user?.id || null
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** Targeted pullHit via registry config + RPC method resolve (Phase 887). */
|
/** Targeted pullHit via registry config + RPC method resolve (Phase 887). */
|
||||||
async function fetchTargetedGuildGossipRpcPullByConfig (
|
async function fetchTargetedGuildGossipRpcPullByConfig (
|
||||||
platform,
|
platform,
|
||||||
@@ -182,5 +209,6 @@ module.exports = {
|
|||||||
fetchGuildGossipRpcPullMerged,
|
fetchGuildGossipRpcPullMerged,
|
||||||
fetchTargetedGuildGossipRpcPullHit,
|
fetchTargetedGuildGossipRpcPullHit,
|
||||||
fetchTargetedGuildGossipRpcPullByConfig,
|
fetchTargetedGuildGossipRpcPullByConfig,
|
||||||
fetchGuildGossipRpcPullByConfig
|
fetchGuildGossipRpcPullByConfig,
|
||||||
|
fetchMessageSearchGuildGossipRpcPullByConfig
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -11,6 +11,7 @@ const payload = require('./gossip-rpc-payload')
|
|||||||
const registry = require('./gossip-rpc-registry')
|
const registry = require('./gossip-rpc-registry')
|
||||||
const responders = require('./gossip-rpc-responders')
|
const responders = require('./gossip-rpc-responders')
|
||||||
const handlerBind = require('./gossip-rpc-handler-bind')
|
const handlerBind = require('./gossip-rpc-handler-bind')
|
||||||
|
const registryPull = require('./gossip-rpc-registry-pull')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
...peer,
|
...peer,
|
||||||
@@ -22,5 +23,6 @@ module.exports = {
|
|||||||
...payload,
|
...payload,
|
||||||
...registry,
|
...registry,
|
||||||
...responders,
|
...responders,
|
||||||
...handlerBind
|
...handlerBind,
|
||||||
|
...registryPull
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
const { buildGuildGossipRpcPullOpts } = require('./gossip-rpc-pull-config')
|
||||||
|
const {
|
||||||
|
lookupGuildGossipRpcPullRegistryEntryByConfig,
|
||||||
|
resolveGuildGossipRpcMethodId
|
||||||
|
} = require('./gossip-rpc-registry')
|
||||||
|
|
||||||
|
/** Merge pull config with registry-resolved rpcMethod when omitted (Phase 888). */
|
||||||
|
function buildGuildGossipRpcPullOptsFromRegistry (configKey, overrides = {}) {
|
||||||
|
const entry = lookupGuildGossipRpcPullRegistryEntryByConfig(configKey)
|
||||||
|
if (!entry) return null
|
||||||
|
const rpcMethod =
|
||||||
|
overrides.rpcMethod != null
|
||||||
|
? overrides.rpcMethod
|
||||||
|
: resolveGuildGossipRpcMethodId(entry.methodKey)
|
||||||
|
if (rpcMethod == null) return null
|
||||||
|
return buildGuildGossipRpcPullOpts(configKey, { ...overrides, rpcMethod })
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { buildGuildGossipRpcPullOptsFromRegistry }
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
const { fetchGuildGossipRpcPullByConfig } = require('../../../gossip-rpc-pull')
|
||||||
|
|
||||||
|
/** Host-prefer registry config RPC pull helper (Phase 888). */
|
||||||
|
const platformHostRpcPullMixin = {
|
||||||
|
async _fetchHostGuildGossipRpcPullByConfig (configKey, overrides = {}) {
|
||||||
|
return fetchGuildGossipRpcPullByConfig(this, configKey, overrides)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { platformHostRpcPullMixin }
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const sharedScope = require('../../../platform-pearcord-shared-imports')
|
|
||||||
const {
|
const {
|
||||||
fetchGuildGossipRpcPullByConfig,
|
|
||||||
resolveGuildGossipRpcHostPeerId,
|
resolveGuildGossipRpcHostPeerId,
|
||||||
markRpcResponse,
|
markRpcResponse,
|
||||||
buildGuildSyncHostRpcFetchPayload,
|
buildGuildSyncHostRpcFetchPayload,
|
||||||
buildMemberPageHostRpcFetchPayload
|
buildMemberPageHostRpcFetchPayload
|
||||||
} = require('../../../gossip-rpc-pull')
|
} = require('../../../gossip-rpc-pull')
|
||||||
|
const { platformHostRpcPullMixin } = require('./platform-host-rpc-pull-mixin')
|
||||||
|
|
||||||
/** Guild sync + member page protomux-rpc pull helpers (Phase 882 extract). */
|
/** Guild sync + member page protomux-rpc pull helpers (Phase 882 extract). */
|
||||||
const platformMeshRpcPullMixin = {
|
const platformMeshRpcPullMixin = {
|
||||||
|
...platformHostRpcPullMixin,
|
||||||
|
|
||||||
async _tryMemberPageRequestRpc (offset = 0) {
|
async _tryMemberPageRequestRpc (offset = 0) {
|
||||||
const guildId = this.guild?.guild?.id
|
const guildId = this.guild?.guild?.id
|
||||||
const userId = this.identity?.user?.id
|
const userId = this.identity?.user?.id
|
||||||
if (!guildId || !userId) return null
|
if (!guildId || !userId) return null
|
||||||
const off = Math.max(0, Number(offset) || 0)
|
const off = Math.max(0, Number(offset) || 0)
|
||||||
const page = await fetchGuildGossipRpcPullByConfig(this, 'memberPageHost', {
|
const page = await this._fetchHostGuildGossipRpcPullByConfig('memberPageHost', {
|
||||||
rpcMethod: sharedScope.RPC.MEMBER_PAGE_REQUEST,
|
|
||||||
buildPayload: async ({ guildId: gid }) =>
|
buildPayload: async ({ guildId: gid }) =>
|
||||||
buildMemberPageHostRpcFetchPayload({
|
buildMemberPageHostRpcFetchPayload({
|
||||||
guildId: gid,
|
guildId: gid,
|
||||||
@@ -42,9 +42,8 @@ const platformMeshRpcPullMixin = {
|
|||||||
const wm = this._getGuildSyncWatermark(guildId)
|
const wm = this._getGuildSyncWatermark(guildId)
|
||||||
const ch = channelId || this.activeChannelId || null
|
const ch = channelId || this.activeChannelId || null
|
||||||
const hostPublicKey = await this._lookupGuildHostPublicKey(this.guild.guild)
|
const hostPublicKey = await this._lookupGuildHostPublicKey(this.guild.guild)
|
||||||
const bundle = await fetchGuildGossipRpcPullByConfig(this, 'guildSyncHost', {
|
const bundle = await this._fetchHostGuildGossipRpcPullByConfig('guildSyncHost', {
|
||||||
hostPublicKey,
|
hostPublicKey,
|
||||||
rpcMethod: sharedScope.RPC.GUILD_SYNC_REQUEST,
|
|
||||||
beforeRequest: async (platform) =>
|
beforeRequest: async (platform) =>
|
||||||
platform.guild.guild.ownerId === platform.identity?.user?.id,
|
platform.guild.guild.ownerId === platform.identity?.user?.id,
|
||||||
buildPayload: async ({ guildId: gid }) =>
|
buildPayload: async ({ guildId: gid }) =>
|
||||||
@@ -99,6 +98,7 @@ const platformMeshRpcPullMixin = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_fanoutGuildSyncRequestWithAckWatermarks (channelId) {
|
_fanoutGuildSyncRequestWithAckWatermarks (channelId) {
|
||||||
|
const sharedScope = require('../../../platform-pearcord-shared-imports')
|
||||||
if (sharedScope.isRpcGossipRequestEnabled?.()) {
|
if (sharedScope.isRpcGossipRequestEnabled?.()) {
|
||||||
void this._tryGuildSyncRequestRpc(channelId)
|
void this._tryGuildSyncRequestRpc(channelId)
|
||||||
.then((rpc) => {
|
.then((rpc) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const searchScope = require('pearcord-search')
|
|||||||
const sharedScope = require('../../../platform-pearcord-shared-imports')
|
const sharedScope = require('../../../platform-pearcord-shared-imports')
|
||||||
const { id } = require('../../../platform-class-imports')
|
const { id } = require('../../../platform-class-imports')
|
||||||
const {
|
const {
|
||||||
fetchGuildGossipRpcPullByConfig,
|
fetchMessageSearchGuildGossipRpcPullByConfig,
|
||||||
buildMessageSearchGuildGossipRpcFetchPayload
|
buildMessageSearchGuildGossipRpcFetchPayload
|
||||||
} = require('../../../gossip-rpc-pull')
|
} = require('../../../gossip-rpc-pull')
|
||||||
const { platformSearchRpcRespondersMixin } = require('./platform-search-rpc-responders-mixin')
|
const { platformSearchRpcRespondersMixin } = require('./platform-search-rpc-responders-mixin')
|
||||||
@@ -15,17 +15,13 @@ const platformSearchMeshGossipMixin = {
|
|||||||
async _fetchGuildSearchFromMeshRpc (guildId, query, opts = {}) {
|
async _fetchGuildSearchFromMeshRpc (guildId, query, opts = {}) {
|
||||||
if (!this.guild?.guild || this.guild.guild.id !== guildId) return null
|
if (!this.guild?.guild || this.guild.guild.id !== guildId) return null
|
||||||
const requestId = id()
|
const requestId = id()
|
||||||
return fetchGuildGossipRpcPullByConfig(this, 'messageSearchMerge', {
|
return fetchMessageSearchGuildGossipRpcPullByConfig(
|
||||||
rpcMethod: sharedScope.RPC.MESSAGE_SEARCH_REQUEST,
|
this,
|
||||||
buildPayload: async ({ guildId: gid }) =>
|
guildId,
|
||||||
buildMessageSearchGuildGossipRpcFetchPayload({
|
query,
|
||||||
guildId: gid,
|
opts,
|
||||||
requestId,
|
requestId
|
||||||
query,
|
)
|
||||||
opts,
|
|
||||||
requestedBy: this.identity.user?.id || null
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async _fetchGuildSearchFromMeshOnce (guildId, query, opts = {}) {
|
async _fetchGuildSearchFromMeshOnce (guildId, query, opts = {}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user