@astrofoundry/pi-astro 0.40.63 → 0.40.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ import {
10
10
  carefulTask,
11
11
  failureMessage,
12
12
  headText,
13
+ isPending,
13
14
  layoutMessages,
14
15
  majorLines,
15
16
  managerSummary,
@@ -18,6 +19,8 @@ import {
18
19
  readPostedArcane,
19
20
  releaseNotesFromJson,
20
21
  REPORT_PREFIX,
22
+ serviceText,
23
+ type ServiceLine,
21
24
  stackComponent,
22
25
  type StackEntry,
23
26
  stackOutcome,
@@ -94,6 +97,22 @@ function entry(r: ArcaneReport, stack: string): StackEntry {
94
97
  }
95
98
 
96
99
  describe("Arcane Daily Report layout", () => {
100
+ it("keeps a held service out of the stack's update and shows why it is held", () => {
101
+ const proxy = { stack: "bigcapital", service: "proxy", ref: "envoyproxy/envoy:v1.39.1", running: "v1.39.1", latest: "v1.39.6", status: "release", action: "edit tag", note: "" };
102
+ const holds = { "bigcapital/gotenberg": "Bigcapital needs Gotenberg 7", "bigcapital/proxy": "wait for the next bundle" };
103
+ const built = buildStacks({ ...updateReport, rows: [rows[5], proxy], holds });
104
+ const stack = built?.stacks[0];
105
+ expect(stack?.held).toBeUndefined();
106
+ expect(stack?.actionable).toBe(false);
107
+ expect(stack?.lines.map((l) => [l.service, l.held, isPending(l)])).toEqual([
108
+ ["gotenberg", "Bigcapital needs Gotenberg 7", false],
109
+ ["proxy", "wait for the next bundle", false],
110
+ ]);
111
+ expect(serviceText(stack?.lines[0] as ServiceLine)).toBe("• gotenberg: 7.10.2, newer major 8 available (a tag change by hand; Update does not apply it)\n-# ⏸ held: Bigcapital needs Gotenberg 7");
112
+ const partly = buildStacks({ ...updateReport, rows: [rows[5], proxy], holds: { "bigcapital/gotenberg": "x" } });
113
+ expect(partly?.stacks[0].actionable).toBe(true);
114
+ });
115
+
97
116
  it("marks the images our own CI builds and leaves out stopped stacks", () => {
98
117
  const own = { stack: "bigcapital", service: "server", ref: "ghcr.io/astrofoundry/bigcapital-server:astrofoundry", running: "?", latest: "new build", status: "update", action: "pull", note: "versions unavailable: private image" };
99
118
  const stopped = { ...own, stack: "grimoire-graphile-bootstrap", service: "bootstrap", ref: "ghcr.io/astronaute77/arcane-graphile-worker:latest", stopped: true };
@@ -63,9 +63,9 @@ export function crossesMajor(running: string | null, latest: string | null): boo
63
63
 
64
64
  const PENDING = new Set(["update", "release", "rebuild"]);
65
65
 
66
- /** A line whose stack-update would change something. */
67
- export function isPending(l: Pick<ServiceLine, "status">): boolean {
68
- return PENDING.has(l.status);
66
+ /** A line whose stack-update would change something; a held service keeps its version. */
67
+ export function isPending(l: Pick<ServiceLine, "status" | "held">): boolean {
68
+ return PENDING.has(l.status) && l.held === undefined;
69
69
  }
70
70
 
71
71
  export interface ServiceLine {
@@ -83,6 +83,8 @@ export interface ServiceLine {
83
83
  review?: Review;
84
84
  /** The image is one our own CI builds, so its update goes through Upgrade carefully. */
85
85
  own?: boolean;
86
+ /** Why this service is held (`<stack>/<service>` in `update-holds.json`); stack-update skips it. */
87
+ held?: string;
86
88
  }
87
89
 
88
90
  export type StackState = "offered" | "running" | "updated" | "rolled back" | "failed" | "current" | "planning";
@@ -166,12 +168,13 @@ export function buildStacks(report: unknown): ReportStacks | null {
166
168
  const running = releaseTag(r.running);
167
169
  const latest = releaseTag(r.latest);
168
170
  const own = r.ref ? isOwnImage(r.ref) : false;
169
- return { service: r.service, status: r.status, action: r.action ?? "", running, latest, tag: tagOf(r.ref ?? ""), ...(r.ref ? { ref: r.ref } : {}), major: PENDING.has(r.status) && crossesMajor(running, latest), note: r.note ?? "", ...(own ? { own } : {}) };
171
+ const held = holds[`${stack}/${r.service}`];
172
+ return { service: r.service, status: r.status, action: r.action ?? "", running, latest, tag: tagOf(r.ref ?? ""), ...(r.ref ? { ref: r.ref } : {}), major: PENDING.has(r.status) && crossesMajor(running, latest), note: r.note ?? "", ...(own ? { own } : {}), ...(held ? { held } : {}) };
170
173
  });
171
- const pending = lines.some((l) => PENDING.has(l.status));
174
+ const pending = lines.some(isPending);
172
175
  const held = holds[stack];
173
176
  if (stack === "arcane") {
174
- const offer = lines.map((l) => (PENDING.has(l.status) ? managerVersion(l) : null)).find((v) => v !== null) ?? null;
177
+ const offer = lines.map((l) => (isPending(l) ? managerVersion(l) : null)).find((v) => v !== null) ?? null;
175
178
  return { stack, lines, actionable: offer !== null && !held, ...(offer ? { manager: offer } : {}), ...(held ? { held } : {}), state: "offered" };
176
179
  }
177
180
  return { stack, lines, actionable: pending && !held, ...(held ? { held } : {}), state: "offered" };
@@ -212,7 +215,8 @@ export function serviceText(l: ServiceLine): string {
212
215
  const newer = PENDING.has(l.status) ? /newer major (\S+) available/.exec(l.note)?.[1] : undefined;
213
216
  if (newer) text += ` · newer major ${escapeDiscord(newer)} available`;
214
217
  const review = l.review ? `\n-# ${l.review.verdict ? `${VERDICT_MARK[l.review.verdict]}: ` : "notes: "}${escapeDiscord(l.review.reason)}` : "";
215
- return `• ${text}${review}`;
218
+ const held = l.held ? `\n-# ⏸ held: ${escapeDiscord(l.held)}` : "";
219
+ return `• ${text}${review}${held}`;
216
220
  }
217
221
 
218
222
  function stackText(s: StackEntry): string {
@@ -247,12 +247,13 @@ describe("report summaries", () => {
247
247
  stack("stirling-pdf", { plan: "careful" }),
248
248
  stack("supabase", { actionable: false, held: "review first" }),
249
249
  stack("paperless", { actionable: false, lines: [line({}), line({ service: "broker", status: "unknown", note: "registry timeout" })] }),
250
+ stack("bigcapital", { actionable: false, lines: [line({ held: "Bigcapital needs Gotenberg 8" })] }),
250
251
  ];
251
252
  const report = { date: "2026-10-24", stacks, messages: [{ id: "8", stacks: [], head: true }] } as unknown as ArcaneReport;
252
253
  expect(arcaneSummary(report, "2026-10-24", "6")).toEqual({
253
254
  area: "Arcane",
254
255
  line: "1 stack updated (media), mealie rolled back, stirling-pdf waits for you, supabase held",
255
- needs: ["stirling-pdf waits for you (Upgrade carefully)", "mealie automatic update rolled back", "supabase update held: review first", "paperless gotenberg 8.40.0: major 9 needs a tag change by hand", "paperless broker: the update check failed"],
256
+ needs: ["stirling-pdf waits for you (Upgrade carefully)", "mealie automatic update rolled back", "paperless gotenberg 8.40.0: major 9 needs a tag change by hand", "paperless broker: the update check failed"],
256
257
  channelId: "6",
257
258
  messageId: "8",
258
259
  });
@@ -401,15 +401,16 @@ export function toolsSummary(report: ToolsReport | null, date: string, channelId
401
401
  return { area: "Cortex tools", line: parts.join(", ") || "everything up to date", needs, channelId, ...(report.messages[0] ? { messageId: report.messages[0].id } : {}) };
402
402
  }
403
403
 
404
- /** A service line only the owner can act on: a failed check, or a newer major that needs a tag change by hand. */
404
+ /** A service line only the owner can act on: a failed check, or a newer major that needs a tag change by hand; a held service is the owner's own decision. */
405
405
  function byHand(stack: string, l: ArcaneReport["stacks"][number]["lines"][number]): string | null {
406
+ if (l.held !== undefined) return null;
406
407
  const where = `${escapeDiscord(stack)} ${escapeDiscord(l.service)}`;
407
408
  if (l.status === "unknown") return `${where}: the update check failed`;
408
409
  const newer = /newer major (\S+) available/.exec(l.note)?.[1];
409
410
  return newer ? `${where} ${escapeDiscord(l.running ?? l.tag)}: major ${escapeDiscord(newer)} needs a tag change by hand` : null;
410
411
  }
411
412
 
412
- /** The Arcane Daily Report after its automatic updates and checks: updated, rolled back, waiting for the owner, held, by hand. */
413
+ /** The Arcane Daily Report after its automatic updates and checks: updated, rolled back, waiting for the owner, held, by hand. Holds are the owner's own decisions, so they are not items. */
413
414
  export function arcaneSummary(report: ArcaneReport | null, date: string, channelId: string): ReportLine {
414
415
  if (!report || report.date !== date) return { area: "Arcane", line: "no report today; the bridge log has the reason", needs: ["the Arcane Daily Report did not run today; the bridge log has the reason"], channelId };
415
416
  const by = (pick: (s: ArcaneReport["stacks"][number]) => boolean) => report.stacks.filter(pick).map((s) => s.stack);
@@ -428,7 +429,6 @@ export function arcaneSummary(report: ArcaneReport | null, date: string, channel
428
429
  const needs = [
429
430
  ...waiting.map((s) => `${escapeDiscord(s.stack)} waits for you (${s.plan === "careful" ? "Upgrade carefully" : "major version"})`),
430
431
  ...report.stacks.filter((s) => s.plan === "auto" && (s.state === "rolled back" || s.state === "failed")).map((s) => `${escapeDiscord(s.stack)} automatic update ${s.state}`),
431
- ...report.stacks.filter((s) => s.held !== undefined).map((s) => `${escapeDiscord(s.stack)} update held: ${escapeDiscord(s.held ?? "")}`),
432
432
  ...report.stacks.flatMap((s) => s.lines.map((l) => byHand(s.stack, l)).filter((t): t is string => t !== null)),
433
433
  ...(report.holdsError ? [`update-holds.json is unreadable: ${escapeDiscord(report.holdsError)}`] : []),
434
434
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrofoundry/pi-astro",
3
- "version": "0.40.63",
3
+ "version": "0.40.64",
4
4
  "description": "Personal pi customizations (extensions, subagents, skills, prompts, themes) for the pi coding agent.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -53,7 +53,7 @@ Apply updates only when asked, one stack at a time, with `["stack-update", "<sta
53
53
 
54
54
  The answer is JSON with `status`: `updated`, `rolled back`, `failed` (with `reason`), or `nothing to do`, plus `services` (`service`, `from`, `to`, `applied`: `pull` or the new reference, `result`: `current`, `behind`, `unchecked`) and `commit`/`revert` when the Compose file changed. Report it in plain words.
55
55
 
56
- It refuses `arcane` (next section), stopped stacks (a redeploy would start them), a checkout with local or unpushed changes, and held stacks. Held stacks are listed in `update-holds.json` at the root of the GitOps repository, `{ "<stack>": "<reason>" }`; `update-report` returns them in `holds`, and the daily report shows the reason without a button. Change that file only when the caller asks, through the `git` commands.
56
+ It refuses `arcane` (next section), stopped stacks (a redeploy would start them), a checkout with local or unpushed changes, and held stacks. Held stacks are listed in `update-holds.json` at the root of the GitOps repository, `{ "<stack>": "<reason>" }`; a key `<stack>/<service>` holds one service, which `stack-update` skips while the rest of the stack updates. `update-report` returns them in `holds`, and the daily report shows the reason without a button. Change that file only when the caller asks, through the `git` commands.
57
57
 
58
58
  An update across a major version is refused without `--confirm`: summarise its release notes first (next section), get the caller's go, then run `["stack-update", "<stack>", "--confirm"]`, which asks an owner for approval.
59
59
 
@@ -58,7 +58,7 @@ Wrappers ship as TypeScript and run under Node 24 type stripping: erasable synta
58
58
  - `entry/specialist-install.sh` runs as root, so it runs only `/usr/bin`, `/bin`, `/usr/sbin`, `/sbin` and the Node it installed, never Homebrew or anything else the main user can write; it checks that `/usr/local/libexec/specialist-node` (and each `specialist-<tool>` folder) and its parents belong to root and are writable by nobody else. Arguments are checked before the root test (tests exercise that part). Downloads go to a root-only temporary directory and are verified before use: Node against `SHASUMS256.txt` and the LTS flag in `index.json`, npm tarballs against the registry's `sha512` integrity, arcane-cli against the release's checksums file. Inside `/Users/specialist` it works only as `specialist` (`sudo -u specialist -H`), from a staging directory root hands over, so a link the specialist plants cannot redirect a root write. Each component switches by rename after a check (every installed wrapper's `--help`, `--version` of the new binary) and restores the previous copy when the check fails. Older versions are refused; `rollback` swaps current and previous. `python`, `gcloud`, `bw`, and `jq` follow the same rules: version folders under `/usr/local/libexec/specialist-<tool>/` behind the links `current` and `previous`, sealed `root:wheel` and not writable by others, smoke-tested as `specialist` before `current` moves; `python` refuses a switch that breaks the current gcloud. Consumers use the `current` paths: `provision.sh` for `bw` and `jq`, `edge.json` for `gcloud` and `gcloudPython`. Nothing a wrapper runs with secrets may come from Homebrew.
59
59
  - `main()` waits for stdout and stderr to flush before `process.exit`: on a pipe, exiting right after a write drops everything past the 64 KiB buffer, which cut large answers such as `projects list --all` until 2026-09-25 (`lib/flush.test.ts`).
60
60
  - `arcane update-report [--all]` is `lib/image-updates.ts` over `lib/registry.ts`: a fresh `images updates check --all`, then `projects list --all` for the stack and service of each image reference, then the registries' tag lists and manifest digests (anonymous bearer tokens from each registry's challenge; digests by HEAD, which Docker Hub does not count as a pull; lscr.io is read from ghcr.io). A floating or major-series tag is resolved to the release tag whose digest matches the running and the latest build, searching the newest tags of the three commonest release shapes; a fixed tag is compared with the newest tag of the same shape; a digest pin with the newest release. Checks older than one minute before the run count as stale and show as unknown. Private images (anonymous access refused with 401 or 403) are excluded from rows, counts, and table, listed in `privateImages`, and counted in the summary line. The table is fixed-width text for a code block, because Discord renders no Markdown tables. The answer adds `holds` from `update-holds.json` at origin's branch head (`git show`, no working-tree read), or `holdsError` when that file is malformed.
61
- - `arcane stack-update <stack> [--confirm]` (`lib/stack-update.ts` for the pure parts) is deterministic: refuses `arcane`, held stacks (the checkout's `update-holds.json` after `pull --ff-only`; a malformed file is an error), a dirty or ahead checkout, stopped stacks, and an update across a major version without `--confirm` (which the gate turns into an owner approval). Pending rows come from a fresh per-image check resolved like `update-report`. `edit tag`/`edit digest` rows rewrite `image:` lines that name exactly the old reference (`replaceImageRef`, quoted or not, trailing comment kept) in the sync's `composePath`, then commit, push, and wait for `gitops list` to report success at that commit (20 min, polled every 30 s). Then `projects redeploy <stack> --yes` (35 min), container checks through `containers list --all` and `containers get` (`composeInfo.projectName`, health; 5 min, polled every 15 s; a job that exited with code 0 counts as done whatever health its image's inherited check left, as bigcapital's migration did on 2026-10-28), and a fresh check that each service is current. A failure after a commit reverts, pushes, waits for the sync, redeploys, and checks again (`rolled back`); a pull-only failure stays `failed`. Every outcome prints JSON with `status` and exits 0. Worst case about 125 minutes, so the gate's `timeoutMs` for arcane must exceed it (8,100,000). It holds the `arcane-gitops` lock, so a second checkout call waits up to 2 minutes and then fails as busy; the bridge also runs one Arcane update at a time.
61
+ - `arcane stack-update <stack> [--confirm]` (`lib/stack-update.ts` for the pure parts) is deterministic: refuses `arcane`, held stacks (the checkout's `update-holds.json` after `pull --ff-only`; a malformed file is an error; a `<stack>/<service>` key skips that service's rows instead), a dirty or ahead checkout, stopped stacks, and an update across a major version without `--confirm` (which the gate turns into an owner approval). Pending rows come from a fresh per-image check resolved like `update-report`. `edit tag`/`edit digest` rows rewrite `image:` lines that name exactly the old reference (`replaceImageRef`, quoted or not, trailing comment kept) in the sync's `composePath`, then commit, push, and wait for `gitops list` to report success at that commit (20 min, polled every 30 s). Then `projects redeploy <stack> --yes` (35 min), container checks through `containers list --all` and `containers get` (`composeInfo.projectName`, health; 5 min, polled every 15 s; a job that exited with code 0 counts as done whatever health its image's inherited check left, as bigcapital's migration did on 2026-10-28), and a fresh check that each service is current. A failure after a commit reverts, pushes, waits for the sync, redeploys, and checks again (`rolled back`); a pull-only failure stays `failed`. Every outcome prints JSON with `status` and exits 0. Worst case about 125 minutes, so the gate's `timeoutMs` for arcane must exceed it (8,100,000). It holds the `arcane-gitops` lock, so a second checkout call waits up to 2 minutes and then fails as busy; the bridge also runs one Arcane update at a time.
62
62
  - `arcane host <command>` runs over the forced-command key of user `spc-arcane` on VM 100. `HOST_COMMANDS` in `lib/arcane-host.ts` must list exactly the operations of `entry/remote/spc-arcane-op.py` (a test compares them); the tracked copies live in the arcane repository's `host/` (`spc-arcane-host-entry`, `spc-arcane-op`, `spc-arcane-sudoers`, `spc-arcane-install.sh`) with the probes in `host/spc-arcane-probes/`. The entry only splits words (letters, digits, space, `._:/+-`) and hands them to `sudo -n /usr/local/sbin/spc-arcane-op`, the one command its sudoers line allows; the op checks the name and every argument and runs the reviewed arcane-ops probes, which print only allowlisted fields. Manager steps (`manager-*`) are internal to `manager-upgrade`/`manager-rollback` and refused through `host`. Nothing on the host deletes data: a manager rollback restores the image and Compose file, not the data volume (R3 stays manual), `db-restore` only fills an empty database, and dumps are never pruned by the tool. `supabase-backup` writes the pre-change backup of `supabase/AGENTS.md` (both databases with `pg_dump -Fc`, each listed and fully decoded by `pg_restore`, `pg_dumpall --globals-only`, and the `supabase-db-config` volume, which must hold `pgsodium_root.key`) into `/var/backups/supabase-upgrades/<UTC>`, the folder of the earlier manual backups. `host-audit` compares the host's hashes with `host/<name>` of the `arcane-gitops` checkout after a pull. The `bigcapital-*` commands run the base-image upgrade of `bigcapital/README.md`: an online backup, a rehearsal on an internal Docker network (restore into the current MariaDB, upgrade with the build's, migrations, server health, Envoy validation; everything it created removed afterwards), the owner-approved switch (stop, quiescent dump, Redis `SAVE`, volume copies compared entry by entry, the stack left stopped for the GitOps commit, the old volumes untouched), and a verify against the switch's row counts and ledger totals.
63
63
  - `arcane manager-upgrade <version>` (`lib/arcane-manager.ts`) follows arcane/AGENTS.md "Manager upgrades": the official image's revision label must equal the release tag's commit (GitHub API), `manager-prepare` records `compose.before.yaml` and every container before the pin commit, the pin goes through the `arcane-gitops` checkout (`git` is exported from `lib/repo.ts` for this), the wait polls `gitops list` and the deployed Compose hash every 30 s for up to 30 minutes, then pull, cold backup, `up -d --no-deps --pull never`, and checks. Any failure before the restart reverts the pin (`stopped`); a failed check after it reverts the pin and runs `manager-rollback` (`rolled back`). The answer always exits 0 with `status`, so the bridge and the agent both see it.
64
64
  - `research` is a pure forced-command wrapper: every call is one JSON request on stdin to `request` on VM 110 (`10.1.100.10`, user `spc-research`, key `SSH_KEY_SANDBOX`), whose entry hands it to `spc-research-op` as `researcher` (tracked in the homelab repository's `06-space-x-proxmox/research/system/`). The op attaches one playwright-cli session per Discord thread (`t<id>`) to the shared Chrome over CDP on `127.0.0.1:9222` and opens its own tab; cookie, storage, `run-code`, and browser lifecycle commands are refused. `script` runs the agent's code in the thread folder as `researcher` (5 minutes), on a VM that reaches only the internet (Mira's Sandbox zone plus the VM's own nftables). Defaults stay on Cortex in `work/research/defaults.json`, out of the sandbox's reach. `captcha-help` is in `RISKY`, so its owner approval is the moment the owner solved the challenge in the live view (`research-browser.37pla.net`); the bridge renders that ticket with the channel's `liveView` link.
@@ -104,7 +104,7 @@ ${Object.entries(HOST_COMMANDS)
104
104
  .join("\n")}
105
105
  update-report [--all] fresh image update check for every stack, with running and latest release versions
106
106
  from the registries; JSON with a ready table (--all also lists up-to-date services) and
107
- the held stacks of ${HOLDS_FILE}. Images the registry throttled (toomanyrequests) are
107
+ the held stacks and services of ${HOLDS_FILE}. Images the registry throttled (toomanyrequests) are
108
108
  checked again after 5 and 20 seconds. Checks only: never pulls images or redeploys.
109
109
  stack-update <stack> [--confirm]
110
110
  apply every pending update of one stack: pinned tags and digests move in the stack's
@@ -112,7 +112,7 @@ ${Object.entries(HOST_COMMANDS)
112
112
  with a pull, containers the redeploy left on an old image are recreated one by one, and
113
113
  the stack is checked (containers running and healthy, images current). A failed check after a
114
114
  Compose change reverts it and redeploys; a pull alone cannot be undone. Refuses held
115
- stacks, stopped stacks, and arcane (manager-upgrade). An update across a major version
115
+ stacks, stopped stacks, and arcane (manager-upgrade); skips held services. An update across a major version
116
116
  needs --confirm, which asks an owner for approval.
117
117
  stack-rollback <stack> <commit>
118
118
  undo one earlier stack-update commit of the stack's Compose file: revert, push, start the
@@ -753,7 +753,8 @@ async function stackUpdate(config: ArcaneConfig, args: string[]): Promise<number
753
753
 
754
754
  const before = await withCli(config, (cli) => stackState(cli, stack, Date.now()));
755
755
  if (before.stopped) throw new UsageError(`${stack} is stopped; a redeploy would start it, so start it on purpose first`);
756
- const pending = pendingRows(before.rows);
756
+ // A held service keeps its version; the rest of the stack still updates.
757
+ const pending = pendingRows(before.rows).filter((r) => !holds[`${stack}/${r.service}`]);
757
758
  const answer = (status: StackStatus, extra: Record<string, unknown>) => printJson({ status, stack, ...extra });
758
759
  if (pending.length === 0) {
759
760
  answer("nothing to do", { unknown: before.rows.filter((r) => r.status === "unknown").map((r) => ({ service: r.service, note: r.note })) });
@@ -13,13 +13,16 @@ describe("update holds", () => {
13
13
  it("reads stack names with a reason", () => {
14
14
  expect(parseHolds('{"supabase": " coordinated release: review first "}')).toEqual({ supabase: "coordinated release: review first" });
15
15
  expect(parseHolds("{}")).toEqual({});
16
+ expect(parseHolds('{"paperless/gotenberg": "Paperless needs Gotenberg 8"}')).toEqual({ "paperless/gotenberg": "Paperless needs Gotenberg 8" });
16
17
  });
17
18
 
18
19
  it("refuses a malformed file instead of holding nothing", () => {
19
20
  expect(() => parseHolds("not json")).toThrow(/not JSON/);
20
- expect(() => parseHolds('["supabase"]')).toThrow(/object of stack name/);
21
+ expect(() => parseHolds('["supabase"]')).toThrow(/object of stack/);
21
22
  expect(() => parseHolds('{"supabase": ""}')).toThrow(/non-empty reason/);
22
- expect(() => parseHolds('{"../x": "why"}')).toThrow(/stack name/);
23
+ expect(() => parseHolds('{"../x": "why"}')).toThrow(/stack or stack\/service name/);
24
+ expect(() => parseHolds('{"a/b/c": "why"}')).toThrow(/stack or stack\/service name/);
25
+ expect(() => parseHolds('{"a/../b": "why"}')).toThrow(/stack or stack\/service name/);
23
26
  });
24
27
  });
25
28
 
@@ -2,11 +2,11 @@ import { UsageError } from "./errors.ts";
2
2
  import { parseTag, type UpdateRow } from "./image-updates.ts";
3
3
  import { parseImageRef } from "./registry.ts";
4
4
 
5
- /** Stacks whose updates wait for a person, tracked in the root of the GitOps repository: `{ "<stack>": "<reason>" }`. */
5
+ /** Stacks and services whose updates wait for a person, tracked in the root of the GitOps repository: `{ "<stack>": "<reason>", "<stack>/<service>": "<reason>" }`. */
6
6
  export const HOLDS_FILE = "update-holds.json";
7
- const STACK = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/;
7
+ const HOLD_KEY = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}(\/[A-Za-z0-9][A-Za-z0-9_.-]{0,127})?$/;
8
8
 
9
- /** The held stacks with their reasons; a malformed file is an error, never "nothing held". */
9
+ /** The held stacks and services with their reasons; a malformed file is an error, never "nothing held". */
10
10
  export function parseHolds(text: string): Record<string, string> {
11
11
  let value: unknown;
12
12
  try {
@@ -14,10 +14,10 @@ export function parseHolds(text: string): Record<string, string> {
14
14
  } catch {
15
15
  throw new UsageError(`${HOLDS_FILE} is not JSON`);
16
16
  }
17
- if (typeof value !== "object" || value === null || Array.isArray(value)) throw new UsageError(`${HOLDS_FILE} must be an object of stack name to reason`);
17
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new UsageError(`${HOLDS_FILE} must be an object of stack (or stack/service) name to reason`);
18
18
  const holds: Record<string, string> = {};
19
19
  for (const [stack, reason] of Object.entries(value)) {
20
- if (!STACK.test(stack) || typeof reason !== "string" || reason.trim().length === 0) throw new UsageError(`${HOLDS_FILE}: "${stack.slice(0, 40)}" needs a stack name and a non-empty reason`);
20
+ if (!HOLD_KEY.test(stack) || typeof reason !== "string" || reason.trim().length === 0) throw new UsageError(`${HOLDS_FILE}: "${stack.slice(0, 40)}" needs a stack or stack/service name and a non-empty reason`);
21
21
  holds[stack] = reason.trim().slice(0, 200);
22
22
  }
23
23
  return holds;