The catalogue is named or absent, the scanner reads both key orders, the loader has unit tests
Review findings: a sibling-path fallback read a catalogue the receipt never claimed; a manifest literal naming its version first slipped the fence; the shared loader thirteen beds install through had no test short of a lab run.
This commit is contained in:
@@ -241,7 +241,9 @@ export const FILTER_MODULE = "nftables";
|
||||
|
||||
/**
|
||||
* The catalogue's `modules/` directory: MESH_LAB_CATALOG under either spelling (the checkout, or
|
||||
* its modules directory), else the checkout beside this one, the way the main layout has it.
|
||||
* its modules directory). Named, or absent — never guessed from a sibling path: the receipt claims
|
||||
* the catalogue the run was pointed at (src/repos.ts), and a catalogue read from somewhere the
|
||||
* receipt does not name is the drift this exists to close.
|
||||
*
|
||||
* Beds used to build the manifests they install inline, as literals copied from the catalogue when
|
||||
* each bed was written. The copies did not move when the catalogue did, so a catalogue change was
|
||||
@@ -251,16 +253,14 @@ export const FILTER_MODULE = "nftables";
|
||||
*/
|
||||
export function catalogueDir(): string {
|
||||
const named = process.env["MESH_LAB_CATALOG"];
|
||||
const candidates = named
|
||||
? [resolve(named, "modules"), resolve(named)]
|
||||
: [resolve(process.cwd(), "..", "mesh-catalog", "modules")];
|
||||
if (!named) throw new Error("MESH_LAB_CATALOG is not set to a checkout of mesh-catalog (or its modules directory)");
|
||||
const candidates = [resolve(named, "modules"), resolve(named)];
|
||||
for (const dir of candidates) {
|
||||
// Known by the registry's manifest, which genesis reads from the catalogue and always will —
|
||||
// not the control plane's, which lives in the control plane's own repository (ADR 0069).
|
||||
if (existsSync(resolve(dir, "distribution", "module.json"))) return dir;
|
||||
}
|
||||
throw new Error(
|
||||
`no catalogue: MESH_LAB_CATALOG=${named ?? "(unset)"} and nothing at ${candidates.join(", ")}`);
|
||||
throw new Error(`no catalogue: MESH_LAB_CATALOG=${named} and no distribution/module.json under ${candidates.join(" or ")}`);
|
||||
}
|
||||
|
||||
/** Whether a catalogue is where a bed will look — for a skip guard, which says so instead of failing. */
|
||||
|
||||
Reference in New Issue
Block a user