The receipt claims the catalogue the beds read
A bed installs a catalogue module by reading its manifest from MESH_LAB_CATALOG at run time, so a receipt naming no catalogue commit cannot say whether a catalogue change was ever proven. Claimed under either spelling of the variable; not built, because a manifest is read, not compiled (novox/hq 04-ISSUES/073).
This commit is contained in:
@@ -164,7 +164,10 @@ export MESH_LAB_ROUTE_PROXY=<somewhere>/route-proxy
|
|||||||
|
|
||||||
`MESH_LAB_HOST_BINARY` and `MESH_LAB_MODULES` do double duty: the repository each sits in is what
|
`MESH_LAB_HOST_BINARY` and `MESH_LAB_MODULES` do double duty: the repository each sits in is what
|
||||||
`suite` rebuilds and what the receipt claims. Point the run at a repository and it is built and
|
`suite` rebuilds and what the receipt claims. Point the run at a repository and it is built and
|
||||||
claimed; leave it out and it is neither.
|
claimed; leave it out and it is neither. `MESH_LAB_CATALOG` is claimed without being built: a bed
|
||||||
|
installs a catalogue module by reading its manifest from that checkout when it runs, so the
|
||||||
|
receipt names the catalogue's commit too, and a run taken before a manifest changed says so
|
||||||
|
(novox/hq 04-ISSUES/073).
|
||||||
|
|
||||||
Check before running a long suite — it says which of these are missing rather than skipping
|
Check before running a long suite — it says which of these are missing rather than skipping
|
||||||
quietly:
|
quietly:
|
||||||
|
|||||||
+12
-1
@@ -10,7 +10,7 @@
|
|||||||
* pointed at is neither built nor claimed.
|
* pointed at is neither built nor claimed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { dirname } from "node:path";
|
import { basename, dirname } from "node:path";
|
||||||
|
|
||||||
export interface Repositories {
|
export interface Repositories {
|
||||||
/** Absolute path to the repository root, by name. */
|
/** Absolute path to the repository root, by name. */
|
||||||
@@ -24,5 +24,16 @@ export function repositories(env: NodeJS.ProcessEnv = process.env): Repositories
|
|||||||
if (host) found["mesh-host"] = dirname(host);
|
if (host) found["mesh-host"] = dirname(host);
|
||||||
const modules = env["MESH_LAB_MODULES"];
|
const modules = env["MESH_LAB_MODULES"];
|
||||||
if (modules) found["mesh-controller"] = dirname(dirname(modules));
|
if (modules) found["mesh-controller"] = dirname(dirname(modules));
|
||||||
|
// The catalogue is read, not built: a bed installs a module by reading its manifest from this
|
||||||
|
// checkout at run time (novox/hq 04-ISSUES/073). A receipt that did not name the catalogue's
|
||||||
|
// commit could not say whether a catalogue change had been proven — the beds used to carry
|
||||||
|
// their own copies of the manifests, and then it could not.
|
||||||
|
const catalogue = env["MESH_LAB_CATALOG"];
|
||||||
|
if (catalogue) found["mesh-catalog"] = catalogueRoot(catalogue);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** MESH_LAB_CATALOG is accepted under either spelling — the checkout, or its `modules` directory. */
|
||||||
|
export function catalogueRoot(catalogue: string): string {
|
||||||
|
return basename(catalogue) === "modules" ? dirname(catalogue) : catalogue;
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,12 +104,28 @@ test("every repository the receipt claims was built by the run", () => {
|
|||||||
MESH_LAB_HOST_BINARY: "/repo/host/mesh-host",
|
MESH_LAB_HOST_BINARY: "/repo/host/mesh-host",
|
||||||
MESH_LAB_MODULES: "/repo/control/examples/modules",
|
MESH_LAB_MODULES: "/repo/control/examples/modules",
|
||||||
MESH_LAB_BUILDER: "/repo/control/build/mesh-builder",
|
MESH_LAB_BUILDER: "/repo/control/build/mesh-builder",
|
||||||
|
MESH_LAB_CATALOG: "/repo/catalog/modules",
|
||||||
};
|
};
|
||||||
const built = new Set(planned(env).map((b) => b.in));
|
const built = new Set(planned(env).map((b) => b.in));
|
||||||
for (const [name, directory] of Object.entries(repositories(env))) {
|
for (const [name, directory] of Object.entries(repositories(env))) {
|
||||||
// mesh-lab is the exception, and it is not an omission: it is TypeScript run from source, so
|
// mesh-lab is the exception, and it is not an omission: it is TypeScript run from source, so
|
||||||
// the code under test *is* the code running. There is nothing to build and nothing to go stale.
|
// the code under test *is* the code running. There is nothing to build and nothing to go stale.
|
||||||
if (name === "mesh-lab") continue;
|
if (name === "mesh-lab") continue;
|
||||||
|
// mesh-catalog is the other exception, for the other reason: what a bed takes from it is a
|
||||||
|
// manifest, read from disk when the bed runs. There is nothing built from it that could go
|
||||||
|
// stale — and claiming it is the whole point, since a bed that carried its own copy of the
|
||||||
|
// manifest was proving the copy (novox/hq 04-ISSUES/073).
|
||||||
|
if (name === "mesh-catalog") continue;
|
||||||
assert.ok(built.has(directory), `${name} (${directory}) is claimed but never built`);
|
assert.ok(built.has(directory), `${name} (${directory}) is claimed but never built`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The catalogue is claimed by the receipt, under either spelling the beds accept.
|
||||||
|
//
|
||||||
|
// A bed reads the manifest it installs from the catalogue checkout (novox/hq 04-ISSUES/073), so a
|
||||||
|
// receipt that names no catalogue commit cannot say whether a change there was ever proven.
|
||||||
|
test("the receipt claims the catalogue the beds read, however it was named", () => {
|
||||||
|
assert.equal(repositories({ MESH_LAB_CATALOG: "/repo/catalog/modules" })["mesh-catalog"], "/repo/catalog");
|
||||||
|
assert.equal(repositories({ MESH_LAB_CATALOG: "/repo/catalog" })["mesh-catalog"], "/repo/catalog");
|
||||||
|
assert.equal(repositories({})["mesh-catalog"], undefined);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user