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 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 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`. **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 { buildGuildExportMeshGossipWaitCallback } = require('./gossip-rpc-export-mesh-gossip-wait-build')
const { exportMeshFetchNamedMixinMap } = require('./gossip-rpc-export-mesh-registry-named') 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') const { fetchGuildExportMeshFromMesh, fetchGuildExportMeshResourceOnce } = require('./gossip-rpc-export-mesh-fetch-once')
/** Build platform mesh fetch mixin methods from a registry entry (Phase 899, Phase 906). */ /** Build platform mesh fetch mixin methods from a registry entry (Phase 899, Phase 906). */
@@ -57,13 +58,13 @@ function buildGuildExportMeshFetchMixinsFromRegistry (registry) {
return mixins 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) { function pickGuildExportMeshFetchMixinMethods (entry, mixin) {
return { const picked = {}
[entry.resolveWaiterMethod]: mixin[entry.resolveWaiterMethod], for (const methodKey of listExportMeshFetchMixinMethodKeysForEntry(entry)) {
[entry.fetchFromMeshMethod]: mixin[entry.fetchFromMeshMethod], picked[methodKey] = mixin[methodKey]
[entry.fetchOnceMethod]: mixin[entry.fetchOnceMethod]
} }
return picked
} }
/** Build consolidated + named platform export mesh fetch mixins (Phase 904, Phase 906, Phase 909). */ /** 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) { function listExportMeshFetchMixinMethodsFromRegistry (registry, keys) {
const methods = [] const methods = []
for (const name of keys) { for (const name of keys) {
const entry = registry[name] methods.push(...listExportMeshFetchMixinMethodKeysForEntry(registry[name]))
methods.push(
entry.resolveWaiterMethod,
entry.fetchFromMeshMethod,
entry.fetchOnceMethod
)
} }
return methods return methods
} }
function listExportMeshFetchMixinMethodKeysForEntry (entry) {
return [
entry.resolveWaiterMethod,
entry.fetchFromMeshMethod,
entry.fetchOnceMethod
]
}
function findExportMeshFetchRegistryName (registry, keys, predicate) { function findExportMeshFetchRegistryName (registry, keys, predicate) {
return keys.find((key) => predicate(registry[key], key)) || null return keys.find((key) => predicate(registry[key], key)) || null
} }
@@ -53,6 +56,7 @@ module.exports = {
listExportMeshFetchRegistryKeys, listExportMeshFetchRegistryKeys,
listExportMeshFetchRegistryEntryField, listExportMeshFetchRegistryEntryField,
listExportMeshFetchMixinMethodsFromRegistry, listExportMeshFetchMixinMethodsFromRegistry,
listExportMeshFetchMixinMethodKeysForEntry,
listExportMeshPullConfigKeysFromRegistry, listExportMeshPullConfigKeysFromRegistry,
findExportMeshFetchRegistryName, findExportMeshFetchRegistryName,
findExportMeshFetchRegistryNameByEntryField, 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 { exportMeshFetchRegistry } = require('./gossip-rpc-export-mesh-registry')
const { cloneExportMeshFetchRegistryEntry } = require('./gossip-rpc-export-mesh-registry-entry') const { cloneExportMeshFetchRegistryEntry } = require('./gossip-rpc-export-mesh-registry-entry')
const { lookupExportMeshFetchRegistryEntryIfName } = require('./gossip-rpc-export-mesh-registry-lookup-entry')
const { const {
buildExportMeshFetchRegistrySnapshotFromKeys, buildExportMeshFetchRegistrySnapshotFromKeys,
buildExportMeshFetchRegistryDiagnosticsPayload buildExportMeshFetchRegistryDiagnosticsPayload
@@ -15,6 +16,7 @@ const {
} = require('./gossip-rpc-export-mesh-registry-lists') } = require('./gossip-rpc-export-mesh-registry-lists')
const { const {
listExportMeshFetchNamedMixinExportKeys, listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames,
lookupExportMeshFetchRegistryNameByNamedMixinExport lookupExportMeshFetchRegistryNameByNamedMixinExport
} = require('./gossip-rpc-export-mesh-registry-named') } = require('./gossip-rpc-export-mesh-registry-named')
@@ -58,23 +60,31 @@ function lookupExportMeshFetchRegistryNameByWaitersKey (waitersKey) {
} }
function lookupExportMeshFetchRegistryEntryByPullConfig (pullConfigKey) { function lookupExportMeshFetchRegistryEntryByPullConfig (pullConfigKey) {
const name = lookupExportMeshFetchRegistryNameByPullConfig(pullConfigKey) return lookupExportMeshFetchRegistryEntryIfName(
return name ? lookupExportMeshFetchRegistryEntry(name) : null lookupExportMeshFetchRegistryNameByPullConfig(pullConfigKey),
lookupExportMeshFetchRegistryEntry
)
} }
function lookupExportMeshFetchRegistryEntryByMixinMethod (methodName) { function lookupExportMeshFetchRegistryEntryByMixinMethod (methodName) {
const name = lookupExportMeshFetchRegistryNameByMixinMethod(methodName) return lookupExportMeshFetchRegistryEntryIfName(
return name ? lookupExportMeshFetchRegistryEntry(name) : null lookupExportMeshFetchRegistryNameByMixinMethod(methodName),
lookupExportMeshFetchRegistryEntry
)
} }
function lookupExportMeshFetchRegistryEntryByWaitersKey (waitersKey) { function lookupExportMeshFetchRegistryEntryByWaitersKey (waitersKey) {
const name = lookupExportMeshFetchRegistryNameByWaitersKey(waitersKey) return lookupExportMeshFetchRegistryEntryIfName(
return name ? lookupExportMeshFetchRegistryEntry(name) : null lookupExportMeshFetchRegistryNameByWaitersKey(waitersKey),
lookupExportMeshFetchRegistryEntry
)
} }
function lookupExportMeshFetchRegistryEntryByNamedMixinExport (exportKey) { function lookupExportMeshFetchRegistryEntryByNamedMixinExport (exportKey) {
const name = lookupExportMeshFetchRegistryNameByNamedMixinExport(exportKey) return lookupExportMeshFetchRegistryEntryIfName(
return name ? lookupExportMeshFetchRegistryEntry(name) : null lookupExportMeshFetchRegistryNameByNamedMixinExport(exportKey),
lookupExportMeshFetchRegistryEntry
)
} }
function buildExportMeshFetchRegistrySnapshot () { function buildExportMeshFetchRegistrySnapshot () {
@@ -89,7 +99,8 @@ function buildExportMeshFetchRegistryDiagnosticsSnapshot () {
registrySnapshot: buildExportMeshFetchRegistrySnapshotFromKeys(exportMeshFetchRegistry, registryKeys), registrySnapshot: buildExportMeshFetchRegistrySnapshotFromKeys(exportMeshFetchRegistry, registryKeys),
mixinMethods: listExportMeshFetchMixinMethods(), mixinMethods: listExportMeshFetchMixinMethods(),
waitersKeys: listExportMeshFetchWaitersKeys(), waitersKeys: listExportMeshFetchWaitersKeys(),
namedMixinExportKeys: listExportMeshFetchNamedMixinExportKeys() namedMixinExportKeys: listExportMeshFetchNamedMixinExportKeys(),
namedMixinRegistryNames: listExportMeshFetchNamedMixinRegistryNames()
}) })
} }
+5
View File
@@ -10,6 +10,10 @@ function listExportMeshFetchNamedMixinExportKeys () {
return Object.keys(exportMeshFetchNamedMixinMap) return Object.keys(exportMeshFetchNamedMixinMap)
} }
function listExportMeshFetchNamedMixinRegistryNames () {
return Object.values(exportMeshFetchNamedMixinMap)
}
function lookupExportMeshFetchRegistryNameByNamedMixinExport (exportKey) { function lookupExportMeshFetchRegistryNameByNamedMixinExport (exportKey) {
return exportMeshFetchNamedMixinMap[exportKey] || null return exportMeshFetchNamedMixinMap[exportKey] || null
} }
@@ -17,5 +21,6 @@ function lookupExportMeshFetchRegistryNameByNamedMixinExport (exportKey) {
module.exports = { module.exports = {
exportMeshFetchNamedMixinMap, exportMeshFetchNamedMixinMap,
listExportMeshFetchNamedMixinExportKeys, listExportMeshFetchNamedMixinExportKeys,
listExportMeshFetchNamedMixinRegistryNames,
lookupExportMeshFetchRegistryNameByNamedMixinExport lookupExportMeshFetchRegistryNameByNamedMixinExport
} }
+4 -2
View File
@@ -24,14 +24,16 @@ function buildExportMeshFetchRegistryDiagnosticsPayload ({
registrySnapshot, registrySnapshot,
mixinMethods, mixinMethods,
waitersKeys, waitersKeys,
namedMixinExportKeys namedMixinExportKeys,
namedMixinRegistryNames
}) { }) {
return { return {
exportMeshFetchRegistryKeys: registryKeys, exportMeshFetchRegistryKeys: registryKeys,
exportMeshFetchRegistrySnapshot: registrySnapshot, exportMeshFetchRegistrySnapshot: registrySnapshot,
exportMeshFetchMixinMethods: mixinMethods, exportMeshFetchMixinMethods: mixinMethods,
exportMeshFetchWaitersKeys: waitersKeys, exportMeshFetchWaitersKeys: waitersKeys,
exportMeshFetchNamedMixinExportKeys: namedMixinExportKeys exportMeshFetchNamedMixinExportKeys: namedMixinExportKeys,
exportMeshFetchNamedMixinRegistryNames: namedMixinRegistryNames
} }
} }
+7 -2
View File
@@ -7,7 +7,7 @@ const {
listExportMeshFetchMixinMethods, listExportMeshFetchMixinMethods,
listExportMeshFetchWaitersKeys listExportMeshFetchWaitersKeys
} = require('./gossip-rpc-export-mesh-registry-lookup') } = 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 { exportMeshFetchRegistryStringFields } = require('./gossip-rpc-export-mesh-registry-validate-fields')
const { assertUniqueExportMeshRegistryValue } = require('./gossip-rpc-export-mesh-registry-validate-unique') 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]) { if (!exportMeshFetchRegistry[registryName]) {
throw new Error(`export mesh named mixin missing registry entry: ${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() const mixinMethods = listExportMeshFetchMixinMethods()
if (mixinMethods.length !== keys.length * 3) { if (mixinMethods.length !== keys.length * 3) {
throw new Error(`export mesh mixin method count ${mixinMethods.length}`) 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 meshValidators = require('./gossip-rpc-export-mesh-validators')
const meshRegistry = require('./gossip-rpc-export-mesh-registry') const meshRegistry = require('./gossip-rpc-export-mesh-registry')
const meshRegistryLookup = require('./gossip-rpc-export-mesh-registry-lookup') 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 meshRegistryLists = require('./gossip-rpc-export-mesh-registry-lists')
const meshRegistryNamed = require('./gossip-rpc-export-mesh-registry-named') const meshRegistryNamed = require('./gossip-rpc-export-mesh-registry-named')
const meshRegistrySnapshot = require('./gossip-rpc-export-mesh-registry-snapshot') const meshRegistrySnapshot = require('./gossip-rpc-export-mesh-registry-snapshot')
@@ -36,6 +37,7 @@ module.exports = {
...meshValidators, ...meshValidators,
...meshRegistry, ...meshRegistry,
...meshRegistryLookup, ...meshRegistryLookup,
...meshRegistryLookupEntry,
...meshRegistryLists, ...meshRegistryLists,
...meshRegistryNamed, ...meshRegistryNamed,
...meshRegistrySnapshot, ...meshRegistrySnapshot,