Phase 911: export mesh lookup entry resolve + mixin method keys (v0.8.878)

Non-breaking refactor — lookupExportMeshFetchRegistryEntryIfName()
deduplicates entry lookup chain; listExportMeshFetchMixinMethodKeysForEntry()
centralizes mixin method key lists; listExportMeshFetchNamedMixinRegistryNames()
extends named map module; diagnostics include exportMeshFetchNamedMixinRegistryNames.
Default gossip v1 unchanged; fleet v2 cutover still deferred.

Verification: test:ci-phase911, boot gate, pearcord.log scan.
This commit is contained in:
Raven Scott
2026-06-04 20:17:05 -04:00
parent ec0cfb8a75
commit fdc9afa075
9 changed files with 65 additions and 24 deletions
+2
View File
@@ -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 911 (v0.8.878):** Export mesh lookup entry resolve + mixin method keys. Bundle: `npm run test:ci-phase911`.
**Phase 910 (v0.8.877):** Export mesh pull config derive + mixin method lookup. Bundle: `npm run test:ci-phase910`.
**Phase 909 (v0.8.876):** Export mesh named mixin map extract + entry field lookup. Bundle: `npm run test:ci-phase909`.
+6 -5
View File
@@ -2,6 +2,7 @@
const { buildGuildExportMeshGossipWaitCallback } = require('./gossip-rpc-export-mesh-gossip-wait-build')
const { exportMeshFetchNamedMixinMap } = require('./gossip-rpc-export-mesh-registry-named')
const { listExportMeshFetchMixinMethodKeysForEntry } = require('./gossip-rpc-export-mesh-registry-lists')
const { fetchGuildExportMeshFromMesh, fetchGuildExportMeshResourceOnce } = require('./gossip-rpc-export-mesh-fetch-once')
/** Build platform mesh fetch mixin methods from a registry entry (Phase 899, Phase 906). */
@@ -57,13 +58,13 @@ function buildGuildExportMeshFetchMixinsFromRegistry (registry) {
return mixins
}
/** Pick one registry entry's methods from a consolidated mixin (Phase 902, Phase 906). */
/** Pick one registry entry's methods from a consolidated mixin (Phase 902, Phase 906, Phase 911). */
function pickGuildExportMeshFetchMixinMethods (entry, mixin) {
return {
[entry.resolveWaiterMethod]: mixin[entry.resolveWaiterMethod],
[entry.fetchFromMeshMethod]: mixin[entry.fetchFromMeshMethod],
[entry.fetchOnceMethod]: mixin[entry.fetchOnceMethod]
const picked = {}
for (const methodKey of listExportMeshFetchMixinMethodKeysForEntry(entry)) {
picked[methodKey] = mixin[methodKey]
}
return picked
}
/** Build consolidated + named platform export mesh fetch mixins (Phase 904, Phase 906, Phase 909). */
+10 -6
View File
@@ -13,16 +13,19 @@ function listExportMeshFetchRegistryEntryField (registry, keys, field) {
function listExportMeshFetchMixinMethodsFromRegistry (registry, keys) {
const methods = []
for (const name of keys) {
const entry = registry[name]
methods.push(
entry.resolveWaiterMethod,
entry.fetchFromMeshMethod,
entry.fetchOnceMethod
)
methods.push(...listExportMeshFetchMixinMethodKeysForEntry(registry[name]))
}
return methods
}
function listExportMeshFetchMixinMethodKeysForEntry (entry) {
return [
entry.resolveWaiterMethod,
entry.fetchFromMeshMethod,
entry.fetchOnceMethod
]
}
function findExportMeshFetchRegistryName (registry, keys, predicate) {
return keys.find((key) => predicate(registry[key], key)) || null
}
@@ -53,6 +56,7 @@ module.exports = {
listExportMeshFetchRegistryKeys,
listExportMeshFetchRegistryEntryField,
listExportMeshFetchMixinMethodsFromRegistry,
listExportMeshFetchMixinMethodKeysForEntry,
listExportMeshPullConfigKeysFromRegistry,
findExportMeshFetchRegistryName,
findExportMeshFetchRegistryNameByEntryField,
@@ -0,0 +1,9 @@
'use strict'
/** Resolve a cloned registry entry when a registry name is present (Phase 911). */
function lookupExportMeshFetchRegistryEntryIfName (name, lookupEntry) {
if (!name) return null
return lookupEntry(name)
}
module.exports = { lookupExportMeshFetchRegistryEntryIfName }
+20 -9
View File
@@ -2,6 +2,7 @@
const { exportMeshFetchRegistry } = require('./gossip-rpc-export-mesh-registry')
const { cloneExportMeshFetchRegistryEntry } = require('./gossip-rpc-export-mesh-registry-entry')
const { lookupExportMeshFetchRegistryEntryIfName } = require('./gossip-rpc-export-mesh-registry-lookup-entry')
const {
buildExportMeshFetchRegistrySnapshotFromKeys,
buildExportMeshFetchRegistryDiagnosticsPayload
@@ -15,6 +16,7 @@ const {
} = require('./gossip-rpc-export-mesh-registry-lists')
const {
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames,
lookupExportMeshFetchRegistryNameByNamedMixinExport
} = require('./gossip-rpc-export-mesh-registry-named')
@@ -58,23 +60,31 @@ function lookupExportMeshFetchRegistryNameByWaitersKey (waitersKey) {
}
function lookupExportMeshFetchRegistryEntryByPullConfig (pullConfigKey) {
const name = lookupExportMeshFetchRegistryNameByPullConfig(pullConfigKey)
return name ? lookupExportMeshFetchRegistryEntry(name) : null
return lookupExportMeshFetchRegistryEntryIfName(
lookupExportMeshFetchRegistryNameByPullConfig(pullConfigKey),
lookupExportMeshFetchRegistryEntry
)
}
function lookupExportMeshFetchRegistryEntryByMixinMethod (methodName) {
const name = lookupExportMeshFetchRegistryNameByMixinMethod(methodName)
return name ? lookupExportMeshFetchRegistryEntry(name) : null
return lookupExportMeshFetchRegistryEntryIfName(
lookupExportMeshFetchRegistryNameByMixinMethod(methodName),
lookupExportMeshFetchRegistryEntry
)
}
function lookupExportMeshFetchRegistryEntryByWaitersKey (waitersKey) {
const name = lookupExportMeshFetchRegistryNameByWaitersKey(waitersKey)
return name ? lookupExportMeshFetchRegistryEntry(name) : null
return lookupExportMeshFetchRegistryEntryIfName(
lookupExportMeshFetchRegistryNameByWaitersKey(waitersKey),
lookupExportMeshFetchRegistryEntry
)
}
function lookupExportMeshFetchRegistryEntryByNamedMixinExport (exportKey) {
const name = lookupExportMeshFetchRegistryNameByNamedMixinExport(exportKey)
return name ? lookupExportMeshFetchRegistryEntry(name) : null
return lookupExportMeshFetchRegistryEntryIfName(
lookupExportMeshFetchRegistryNameByNamedMixinExport(exportKey),
lookupExportMeshFetchRegistryEntry
)
}
function buildExportMeshFetchRegistrySnapshot () {
@@ -89,7 +99,8 @@ function buildExportMeshFetchRegistryDiagnosticsSnapshot () {
registrySnapshot: buildExportMeshFetchRegistrySnapshotFromKeys(exportMeshFetchRegistry, registryKeys),
mixinMethods: listExportMeshFetchMixinMethods(),
waitersKeys: listExportMeshFetchWaitersKeys(),
namedMixinExportKeys: listExportMeshFetchNamedMixinExportKeys()
namedMixinExportKeys: listExportMeshFetchNamedMixinExportKeys(),
namedMixinRegistryNames: listExportMeshFetchNamedMixinRegistryNames()
})
}
+5
View File
@@ -10,6 +10,10 @@ function listExportMeshFetchNamedMixinExportKeys () {
return Object.keys(exportMeshFetchNamedMixinMap)
}
function listExportMeshFetchNamedMixinRegistryNames () {
return Object.values(exportMeshFetchNamedMixinMap)
}
function lookupExportMeshFetchRegistryNameByNamedMixinExport (exportKey) {
return exportMeshFetchNamedMixinMap[exportKey] || null
}
@@ -17,5 +21,6 @@ function lookupExportMeshFetchRegistryNameByNamedMixinExport (exportKey) {
module.exports = {
exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames,
lookupExportMeshFetchRegistryNameByNamedMixinExport
}
+4 -2
View File
@@ -24,14 +24,16 @@ function buildExportMeshFetchRegistryDiagnosticsPayload ({
registrySnapshot,
mixinMethods,
waitersKeys,
namedMixinExportKeys
namedMixinExportKeys,
namedMixinRegistryNames
}) {
return {
exportMeshFetchRegistryKeys: registryKeys,
exportMeshFetchRegistrySnapshot: registrySnapshot,
exportMeshFetchMixinMethods: mixinMethods,
exportMeshFetchWaitersKeys: waitersKeys,
exportMeshFetchNamedMixinExportKeys: namedMixinExportKeys
exportMeshFetchNamedMixinExportKeys: namedMixinExportKeys,
exportMeshFetchNamedMixinRegistryNames: namedMixinRegistryNames
}
}
+7 -2
View File
@@ -7,7 +7,7 @@ const {
listExportMeshFetchMixinMethods,
listExportMeshFetchWaitersKeys
} = require('./gossip-rpc-export-mesh-registry-lookup')
const { exportMeshFetchNamedMixinMap } = require('./gossip-rpc-export-mesh-registry-named')
const { exportMeshFetchNamedMixinMap, listExportMeshFetchNamedMixinRegistryNames } = require('./gossip-rpc-export-mesh-registry-named')
const { exportMeshFetchRegistryStringFields } = require('./gossip-rpc-export-mesh-registry-validate-fields')
const { assertUniqueExportMeshRegistryValue } = require('./gossip-rpc-export-mesh-registry-validate-unique')
@@ -45,12 +45,17 @@ function validateExportMeshFetchRegistryAlignment () {
}
}
for (const registryName of Object.values(exportMeshFetchNamedMixinMap)) {
for (const registryName of listExportMeshFetchNamedMixinRegistryNames()) {
if (!exportMeshFetchRegistry[registryName]) {
throw new Error(`export mesh named mixin missing registry entry: ${registryName}`)
}
}
const namedRegistryNames = listExportMeshFetchNamedMixinRegistryNames()
if (namedRegistryNames.length !== Object.keys(exportMeshFetchNamedMixinMap).length) {
throw new Error(`export mesh named mixin registry name count ${namedRegistryNames.length}`)
}
const mixinMethods = listExportMeshFetchMixinMethods()
if (mixinMethods.length !== keys.length * 3) {
throw new Error(`export mesh mixin method count ${mixinMethods.length}`)
+2
View File
@@ -12,6 +12,7 @@ const meshMixin = require('./gossip-rpc-export-mesh-mixin')
const meshValidators = require('./gossip-rpc-export-mesh-validators')
const meshRegistry = require('./gossip-rpc-export-mesh-registry')
const meshRegistryLookup = require('./gossip-rpc-export-mesh-registry-lookup')
const meshRegistryLookupEntry = require('./gossip-rpc-export-mesh-registry-lookup-entry')
const meshRegistryLists = require('./gossip-rpc-export-mesh-registry-lists')
const meshRegistryNamed = require('./gossip-rpc-export-mesh-registry-named')
const meshRegistrySnapshot = require('./gossip-rpc-export-mesh-registry-snapshot')
@@ -36,6 +37,7 @@ module.exports = {
...meshValidators,
...meshRegistry,
...meshRegistryLookup,
...meshRegistryLookupEntry,
...meshRegistryLists,
...meshRegistryNamed,
...meshRegistrySnapshot,