diff --git a/modules/mesh-catalog/heard.ts b/modules/mesh-catalog/heard.ts index 85d34ddc..daff5043 100644 --- a/modules/mesh-catalog/heard.ts +++ b/modules/mesh-catalog/heard.ts @@ -59,19 +59,19 @@ export const BUILD_EVENTS = [ * version the catalogue calls current. */ export function placeable(body: Built): - | { place: true; module: string; commit: string } - | { place: false; why: string; fault: boolean } { + | { placed: "yes"; module: string; commit: string } + | { placed: "no"; why: string; fault: boolean } { if (body["check-outcome"] != null || body.check != null) { - return { place: false, why: "a merge check or a try: nothing of it merged", fault: false }; + return { placed: "no", why: "a merge check or a try: nothing of it merged", fault: false }; } if (body["dry-run"]) { - return { place: false, why: "a dry run is looked at, never taken in", fault: false }; + return { placed: "no", why: "a dry run is looked at, never taken in", fault: false }; } if (body.failed) { - return { place: false, why: "a failed build made no module-version", fault: false }; + return { placed: "no", why: "a failed build made no module-version", fault: false }; } if (!body.module || !body.commit) { - return { place: false, why: "it named no module or no commit", fault: true }; + return { placed: "no", why: "it named no module or no commit", fault: true }; } - return { place: true, module: body.module, commit: body.commit }; + return { placed: "yes", module: body.module, commit: body.commit }; } diff --git a/modules/mesh-catalog/index.ts b/modules/mesh-catalog/index.ts index f8878883..13a98d2d 100644 --- a/modules/mesh-catalog/index.ts +++ b/modules/mesh-catalog/index.ts @@ -33,7 +33,7 @@ const graph = Graph.fromEnv(); const placeTheBuild = async (event: { body: unknown }): Promise => { const body = (event.body ?? {}) as Built; const placing = placeable(body); - if (!placing.place) { + if (placing.placed === "no") { // A check, a try, a dry run and a failure are the build seat's ordinary outcomes: passed over. One // that names no module or commit is a fault in the builder, said rather than dropped, so it does // not look like a missing event. diff --git a/modules/mesh-catalog/test/heard.test.ts b/modules/mesh-catalog/test/heard.test.ts index eff6e326..c2630f9e 100644 --- a/modules/mesh-catalog/test/heard.test.ts +++ b/modules/mesh-catalog/test/heard.test.ts @@ -26,9 +26,9 @@ test("the catalogue hears the build seat that builds now, not only the retired o }); test("a walk's build is placed, under its module and commit", () => { - assert.deepEqual(placeable(walkBuild), { place: true, module: "mailu", commit: walkBuild.commit }); + assert.deepEqual(placeable(walkBuild), { placed: "yes", module: "mailu", commit: walkBuild.commit }); // A walk that took the check's build of the same key says so, and is placed all the same (ADR 0350 ยง2). - assert.equal(placeable({ ...walkBuild, reused: "the check's build" } as never).place, true); + assert.equal(placeable({ ...walkBuild, reused: "the check's build" } as never).placed, "yes"); }); test("a merge check, a try, a dry run and a failure are passed over without a fault", () => { @@ -39,8 +39,8 @@ test("a merge check, a try, a dry run and a failure are passed over without a fa [{ ...walkBuild, failed: "exit status 1" }, "failed"], ] as const) { const placing = placeable(body); - assert.equal(placing.place, false); - if (!placing.place) { + assert.equal(placing.placed, "no"); + if (placing.placed === "no") { assert.match(placing.why, new RegExp(why)); assert.equal(placing.fault, false); } @@ -49,6 +49,6 @@ test("a merge check, a try, a dry run and a failure are passed over without a fa test("an outcome that names no module or commit is said as the builder's fault", () => { const placing = placeable({ repository: walkBuild.repository, commit: walkBuild.commit }); - assert.equal(placing.place, false); - if (!placing.place) assert.equal(placing.fault, true); + assert.equal(placing.placed, "no"); + if (placing.placed === "no") assert.equal(placing.fault, true); });