Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
show on this site's /mcp
CLI
abso show 94 --json
JSON
/christopher/abso-core/versions/94?format=json

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.

of shared·infra-pipeline··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 @@
88// (`on`), optionally which spaces it runs for (`only`), its `jobs`, and which
99// jobs make a version green (`required`). A job runs a command (`run`) or a
1010// 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.
1213//
1314// What the check refuses: a cycle in needs; needs, required or from naming a
1415// job that doesn't exist; secrets in a pipeline a draft can start, since a
@@ -39,6 +40,8 @@
3940 readonly keep: readonly string[];
4041 readonly cache: readonly string[];
4142 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";
4245 /** The built-in step's own settings (deploy's worker, staging, live; notify's to), as written. */
4346 readonly with: Readonly<Record<string, unknown>>;
4447}
@@ -89,7 +92,7 @@
8992const TRIGGERS = ["publish", "draft", "green", "land", "hand"] as const;
9093const SIZES: readonly Size[] = ["small", "standard", "large"];
9194const 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;
9396const PIPELINE_KEYS = ["on", "only", "jobs", "required"] as const;
9497/** avcs.json's keys for today's CI (worker/src/ci.ts) and the merge queue: read elsewhere, left alone here. */
9598const AVCS_JSON_KEYS = ["setup", "check", "build", "out", "queue", "whole"] as const;
@@ -238,18 +241,22 @@
238241
239242 // Secrets go only where no draft can reach them: a draft runs code nobody
240243 // 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");
242246 if (holding.length) {
243247 const who = holding.map((j) => j.name).join(", ");
248+ const what = holding.every((j) => j.secrets.length === 0)
249+ ? "a writer key"
250+ : holding.some((j) => j.abso === "writer")
251+ ? "secrets or a writer key"
252+ : "secrets";
253+ const verb = `hold${holding.length === 1 ? "s" : ""}`;
244254 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`);
249256 if (!only || only.some((s) => s !== "shared"))
250257 say(
251258 `${at}.only`,
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`,
253260 );
254261 }
255262
@@ -281,6 +288,11 @@
281288 secrets.forEach((s, i) => {
282289 if (!SECRET.test(s)) say(`${at}.secrets[${i}]`, `${q(s)} isn't a secret name: upper-case letters, digits and _`);
283290 });
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");
295+ }
284296 const withs: Record<string, unknown> = {};
285297 for (const k of settings) if (j[k] !== undefined) withs[k] = j[k];
286298 if (uses === "deploy" && typeof j.worker !== "string")
@@ -308,6 +320,7 @@
308320 keep: list(j.keep, `${at}.keep`, say, "a list of file patterns"),
309321 cache: list(j.cache, `${at}.cache`, say, "a list of files"),
310322 secrets,
323+ ...((j.abso === "reader" || j.abso === "writer") && j.uses === undefined ? { abso: j.abso } : {}),
311324 with: withs,
312325 ...machine(j, at, say, false),
313326 };
--- a/src/pipeline/test/pipeline.test.ts
+++ b/src/pipeline/test/pipeline.test.ts
@@ -245,6 +245,34 @@
245245 has(ps, "pipelines.p.jobs.c.packages[2]", /isn't an npm package name/);
246246 });
247247
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" } }));
250+ ok(read);
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(
256+ checkPipelines(
257+ one({
258+ a: { run: "x", abso: "owner" },
259+ b: { uses: "deploy", worker: "w", abso: "reader" },
260+ c: { run: "x", abso: "writer" },
261+ }),
262+ ),
263+ );
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/);
267+ has(
268+ problems(checkPipelines(one({ c: { run: "x", abso: "writer" } }, { on: ["draft"], only: ["shared"] }))),
269+ "pipelines.p.on",
270+ /includes draft, but c holds a writer key/,
271+ );
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"] })));
274+ });
248276 it("npm-publish: an optional dist-tag", () => {
249277 const pack = { run: "npm pack --pack-destination out", keep: ["out"] };
250278 const read = checkPipelines(