Pipeline files: a run job may ask for an abso key on its own project for the length of the job (abso: reader or writer). A writer key follows the same rule as secrets: no pipeline a draft can start. A uses step can't ask for one, since it runs on the server. Version 94 of shared· infra-pipeline· Oct 10 (2026-10-10 10:52 UTC) · Not checked
Version 93 · Files at version 94
2 files, 49 lines added, 8 removed.
--- a/src/pipeline/pipeline.ts
+++ b/src/pipeline/pipeline.ts
@@ -8,7 +8,8 @@
8 8 // (`on`), optionally which spaces it runs for (`only`), its `jobs`, and which 9 9 // jobs make a version green (`required`). A job runs a command (`run`) or a 10 10 // built-in step (`uses`), after the jobs it `needs`, and may take another 11 − // job's kept files (`from`) and named `secrets`.
11 + // job's kept files (`from`) and named `secrets`, and a run job may ask for an 12 + // abso key on its own project (`abso: reader` or `writer`) for the length of the job. 13 14 // What the check refuses: a cycle in needs; needs, required or from naming a 14 15 // job that doesn't exist; secrets in a pipeline a draft can start, since a @@ -39,6 +40,8 @@
39 40 readonly keep: readonly string[]; 40 41 readonly cache: readonly string[]; 41 42 readonly secrets: readonly string[]; 43 + /** An abso key on the project for the job's length (abso 343): none unless asked. */ 44 + readonly abso?: "reader" | "writer"; 42 45 /** The built-in step's own settings (deploy's worker, staging, live; notify's to), as written. */ 43 46 readonly with: Readonly<Record<string, unknown>>; @@ -89,7 +92,7 @@
89 92 const TRIGGERS = ["publish", "draft", "green", "land", "hand"] as const; 90 93 const SIZES: readonly Size[] = ["small", "standard", "large"]; 91 94 const MACHINE_KEYS = ["image", "dockerfile", "size"] as const; 92 − const JOB_KEYS = ["needs", "run", "uses", "from", "keep", "cache", "secrets", ...MACHINE_KEYS] as const;
95 + const JOB_KEYS = ["needs", "run", "uses", "from", "keep", "cache", "secrets", "abso", ...MACHINE_KEYS] as const; 93 96 const PIPELINE_KEYS = ["on", "only", "jobs", "required"] as const; 94 97 /** avcs.json's keys for today's CI (worker/src/ci.ts) and the merge queue: read elsewhere, left alone here. */ 95 98 const AVCS_JSON_KEYS = ["setup", "check", "build", "out", "queue", "whole"] as const; @@ -238,18 +241,22 @@
239 242 // Secrets go only where no draft can reach them: a draft runs code nobody 240 243 // has published, which could send a secret anywhere. 241 − const holding = jobs.filter((j) => j.secrets.length > 0);
244 + // A writer key (343) the same: it changes the project, so only published work may hold one. 245 + const holding = jobs.filter((j) => j.secrets.length > 0 || j.abso === "writer"); 242 246 if (holding.length) { 243 247 const who = holding.map((j) => j.name).join(", "); 248 + const what = holding.every((j) => j.secrets.length === 0) 250 + : holding.some((j) => j.abso === "writer") 251 + ? "secrets or a writer key" 253 + const verb = `hold${holding.length === 1 ? "s" : ""}`; 244 254 if (on?.includes("draft")) 245 − say(
246 − `${at}.on`,
247 − `includes draft, but ${who} hold${holding.length === 1 ? "s" : ""} secrets; a draft runs unpublished code`,
248 − );
255 + say(`${at}.on`, `includes draft, but ${who} ${verb} ${what}; a draft runs unpublished code`); 249 256 if (!only || only.some((s) => s !== "shared")) 252 − `must be shared, because ${who} hold${holding.length === 1 ? "s" : ""} secrets and a named draft's version is no one's published work`,
259 + `must be shared, because ${who} ${verb} ${what} and a named draft's version is no one's published work`, @@ -281,6 +288,11 @@
281 288 secrets.forEach((s, i) => { 282 289 if (!SECRET.test(s)) say(`${at}.secrets[${i}]`, `${q(s)} isn't a secret name: upper-case letters, digits and _`); 291 + if (j.abso !== undefined) { 292 + if (j.abso !== "reader" && j.abso !== "writer") say(`${at}.abso`, `must be reader or writer, not ${q(j.abso)}`); 293 + else if (j.uses !== undefined) 294 + say(`${at}.abso`, "gives a run job a key; a uses step runs on the server and has none"); 284 296 const withs: Record<string, unknown> = {}; 285 297 for (const k of settings) if (j[k] !== undefined) withs[k] = j[k]; 286 298 if (uses === "deploy" && typeof j.worker !== "string") @@ -308,6 +320,7 @@
308 320 keep: list(j.keep, `${at}.keep`, say, "a list of file patterns"), 309 321 cache: list(j.cache, `${at}.cache`, say, "a list of files"), 323 + ...((j.abso === "reader" || j.abso === "writer") && j.uses === undefined ? { abso: j.abso } : {}), 312 325 ...machine(j, at, say, false), --- a/src/pipeline/test/pipeline.test.ts
+++ b/src/pipeline/test/pipeline.test.ts
@@ -245,6 +245,34 @@
245 245 has(ps, "pipelines.p.jobs.c.packages[2]", /isn't an npm package name/); 248 + it("abso: a run job may ask for a reader or writer key; a writer key only where secrets may go", () => { 249 + const read = checkPipelines(one({ a: { run: "abso status", abso: "reader" }, b: { run: "true" } })); 251 + const jobs = read.ok ? read.file.pipelines[0]!.jobs : []; 252 + assert.equal(jobs.find((j) => j.name === "a")?.abso, "reader"); 253 + assert.equal(jobs.find((j) => j.name === "b")?.abso, undefined); 254 + ok(checkPipelines(one({ a: { run: "abso publish -m x", abso: "writer" } }, { only: ["shared"] }))); 255 + const ps = problems( 258 + a: { run: "x", abso: "owner" }, 259 + b: { uses: "deploy", worker: "w", abso: "reader" }, 260 + c: { run: "x", abso: "writer" }, 264 + has(ps, "pipelines.p.jobs.a.abso", /must be reader or writer, not "owner"/); 265 + has(ps, "pipelines.p.jobs.b.abso", /a uses step runs on the server/); 266 + has(ps, "pipelines.p.only", /c holds a writer key and a named draft's version is no one's published work/); 268 + problems(checkPipelines(one({ c: { run: "x", abso: "writer" } }, { on: ["draft"], only: ["shared"] }))), 270 + /includes draft, but c holds a writer key/, 272 + // A reader key is fine where a draft runs: it changes nothing. 273 + ok(checkPipelines(one({ a: { run: "abso status", abso: "reader" } }, { on: ["draft"] }))); 248 276 it("npm-publish: an optional dist-tag", () => { 249 277 const pack = { run: "npm pack --pack-destination out", keep: ["out"] }; 250 278 const read = checkPipelines(