diff --git a/modules/mesh-catalog/index.ts b/modules/mesh-catalog/index.ts index 416f31a..ce85050 100644 --- a/modules/mesh-catalog/index.ts +++ b/modules/mesh-catalog/index.ts @@ -49,7 +49,15 @@ interface Built { replay?: boolean; } -await on("mesh-build-machine.built", async (event) => { +/** + * What a build means for the graph, wherever it came from. + * + * Two emitters say the same thing and neither is a mistake: the build machine says it as it happens, + * and the control plane says what it already held when this module asks what it missed + * (novox/hq ADR 0134). A replay is marked as one in its body, so nothing acts on a module that moved + * months ago — see `replay` above. + */ +const placeTheBuild = async (event: { body: unknown }): Promise => { const body = event.body as Built; if (!body.module || !body.commit) { // Said rather than dropped: a build that announced itself without saying what it built is a @@ -91,7 +99,11 @@ await on("mesh-build-machine.built", async (event) => { because: next.because, }); } -}); +}; + +// As it happens, and what the mesh already held when this module asked what it missed. +await on("mesh-build-machine.built", placeTheBuild); +await on("mesh-controller.built-before", placeTheBuild); // **And ask for what was built before this catalogue existed** (novox/hq 04-ISSUES/050). // diff --git a/modules/mesh-catalog/module.json b/modules/mesh-catalog/module.json index 60316c3..f6dd5c7 100644 --- a/modules/mesh-catalog/module.json +++ b/modules/mesh-catalog/module.json @@ -29,7 +29,8 @@ "broker": "/var/lib/mesh/mesh-catalog/broker" }, "consumes": [ - "mesh-build-machine.built" + "mesh-build-machine.built", + "mesh-controller.built-before" ], "emits": [ "registered",