@caelo-cms/provisioning 0.12.4 → 0.12.5

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.
Files changed (117) hide show
  1. package/dist/agent-db.js +8 -3
  2. package/dist/cli-routing.d.ts.map +1 -1
  3. package/dist/cli-routing.js +6 -5
  4. package/dist/cli-routing.js.map +1 -1
  5. package/dist/cli.js +18 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/gcp-names.d.ts +51 -0
  8. package/dist/gcp-names.d.ts.map +1 -1
  9. package/dist/gcp-names.js +75 -0
  10. package/dist/gcp-names.js.map +1 -1
  11. package/dist/infra-contract.d.ts +1 -1
  12. package/dist/infra-contract.d.ts.map +1 -1
  13. package/dist/infra-contract.js +42 -1
  14. package/dist/infra-contract.js.map +1 -1
  15. package/dist/install-state.d.ts +8 -0
  16. package/dist/install-state.d.ts.map +1 -1
  17. package/dist/install-state.js +12 -0
  18. package/dist/install-state.js.map +1 -1
  19. package/dist/install-version.d.ts +110 -0
  20. package/dist/install-version.d.ts.map +1 -0
  21. package/dist/install-version.js +162 -0
  22. package/dist/install-version.js.map +1 -0
  23. package/dist/lifecycle.d.ts +6 -1
  24. package/dist/lifecycle.d.ts.map +1 -1
  25. package/dist/lifecycle.js +46 -1
  26. package/dist/lifecycle.js.map +1 -1
  27. package/dist/release-candidate.d.ts +67 -0
  28. package/dist/release-candidate.d.ts.map +1 -0
  29. package/dist/release-candidate.js +138 -0
  30. package/dist/release-candidate.js.map +1 -0
  31. package/dist/reporting-job-setup.d.ts +102 -0
  32. package/dist/reporting-job-setup.d.ts.map +1 -0
  33. package/dist/reporting-job-setup.js +347 -0
  34. package/dist/reporting-job-setup.js.map +1 -0
  35. package/dist/self-hosted-upgrade.d.ts.map +1 -1
  36. package/dist/self-hosted-upgrade.js +18 -3
  37. package/dist/self-hosted-upgrade.js.map +1 -1
  38. package/dist/stack-contract.d.ts +30 -5
  39. package/dist/stack-contract.d.ts.map +1 -1
  40. package/dist/stack-contract.js +74 -10
  41. package/dist/stack-contract.js.map +1 -1
  42. package/dist/upgrade/admin-image-jobs.d.ts +13 -5
  43. package/dist/upgrade/admin-image-jobs.d.ts.map +1 -1
  44. package/dist/upgrade/admin-image-jobs.js +22 -2
  45. package/dist/upgrade/admin-image-jobs.js.map +1 -1
  46. package/dist/upgrade/converge.d.ts.map +1 -1
  47. package/dist/upgrade/converge.js +99 -9
  48. package/dist/upgrade/converge.js.map +1 -1
  49. package/dist/upgrade/release-images.d.ts +6 -2
  50. package/dist/upgrade/release-images.d.ts.map +1 -1
  51. package/dist/upgrade/release-images.js +5 -5
  52. package/dist/upgrade/release-images.js.map +1 -1
  53. package/dist/upgrader-iam-preflight.d.ts.map +1 -1
  54. package/dist/upgrader-iam-preflight.js +19 -1
  55. package/dist/upgrader-iam-preflight.js.map +1 -1
  56. package/dist/upgrader-setup.d.ts.map +1 -1
  57. package/dist/upgrader-setup.js +16 -1
  58. package/dist/upgrader-setup.js.map +1 -1
  59. package/dist/wizard.d.ts +7 -0
  60. package/dist/wizard.d.ts.map +1 -1
  61. package/dist/wizard.js +20 -5
  62. package/dist/wizard.js.map +1 -1
  63. package/dist/wizards/gcp-cost.d.ts +7 -11
  64. package/dist/wizards/gcp-cost.d.ts.map +1 -1
  65. package/dist/wizards/gcp-cost.js +47 -36
  66. package/dist/wizards/gcp-cost.js.map +1 -1
  67. package/dist/wizards/gcp-firebase.d.ts +4 -0
  68. package/dist/wizards/gcp-firebase.d.ts.map +1 -1
  69. package/dist/wizards/gcp-firebase.js +2 -0
  70. package/dist/wizards/gcp-firebase.js.map +1 -1
  71. package/dist/wizards/gcp-install-job.d.ts +10 -0
  72. package/dist/wizards/gcp-install-job.d.ts.map +1 -1
  73. package/dist/wizards/gcp-install-job.js +41 -10
  74. package/dist/wizards/gcp-install-job.js.map +1 -1
  75. package/dist/wizards/gcp.d.ts +7 -0
  76. package/dist/wizards/gcp.d.ts.map +1 -1
  77. package/dist/wizards/gcp.js +191 -9
  78. package/dist/wizards/gcp.js.map +1 -1
  79. package/package.json +2 -2
  80. package/src/cli-routing.test.ts +1 -1
  81. package/src/cli-routing.ts +6 -5
  82. package/src/cli.ts +18 -1
  83. package/src/cpu-idle.test.ts +7 -2
  84. package/src/gcp-names.ts +87 -0
  85. package/src/infra-contract.test.ts +6 -3
  86. package/src/infra-contract.ts +42 -1
  87. package/src/install-state.ts +12 -0
  88. package/src/install-version.test.ts +366 -0
  89. package/src/install-version.ts +205 -0
  90. package/src/lifecycle.ts +65 -3
  91. package/src/release-candidate.test.ts +191 -0
  92. package/src/release-candidate.ts +172 -0
  93. package/src/reporting-job-setup.test.ts +392 -0
  94. package/src/reporting-job-setup.ts +431 -0
  95. package/src/self-hosted-upgrade.ts +18 -3
  96. package/src/stack-contract.test.ts +24 -0
  97. package/src/stack-contract.ts +87 -9
  98. package/src/stack-converge-secrets.test.ts +2 -0
  99. package/src/stack-converge.test.ts +3 -3
  100. package/src/upgrade/admin-image-jobs.ts +35 -6
  101. package/src/upgrade/converge.ts +137 -8
  102. package/src/upgrade/release-images.test.ts +2 -2
  103. package/src/upgrade/release-images.ts +6 -4
  104. package/src/upgrade/upgrade.test.ts +165 -4
  105. package/src/upgrader-iam-preflight.test.ts +58 -0
  106. package/src/upgrader-iam-preflight.ts +21 -0
  107. package/src/upgrader-job.test.ts +3 -0
  108. package/src/upgrader-setup.test.ts +6 -0
  109. package/src/upgrader-setup.ts +18 -0
  110. package/src/wizard.ts +30 -5
  111. package/src/wizards/gcp-cost.test.ts +11 -13
  112. package/src/wizards/gcp-cost.ts +49 -36
  113. package/src/wizards/gcp-firebase.ts +6 -0
  114. package/src/wizards/gcp-install-job.ts +46 -12
  115. package/src/wizards/gcp.ts +250 -7
  116. package/stacks/aws/index.ts +10 -0
  117. package/stacks/azure/index.ts +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caelo-cms/provisioning",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
6
  "description": "Pulumi-driven provisioning for Caelo CMS — `bunx @caelo-cms/provisioning --provider <self-hosted|gcp|aws|azure>` brings up a TLS-served install with Postgres + storage + secrets manager + the admin + the API gateway.",
@@ -40,7 +40,7 @@
40
40
  "prepublishOnly": "tsc -b --force && bun build ../platform-updater/src/agent-db.ts --target=bun --outfile=dist/agent-db.js && tsc --project stacks/gcp/tsconfig.json && tsc --project stacks/gcp-firebase/tsconfig.json"
41
41
  },
42
42
  "dependencies": {
43
- "@caelo-cms/shared": "^0.12.4",
43
+ "@caelo-cms/shared": "^0.12.5",
44
44
  "@clack/prompts": "1.8.1",
45
45
  "@pulumi/command": "^1",
46
46
  "@pulumi/gcp": "^10",
@@ -61,7 +61,7 @@ describe("initDelegatesToWizard", () => {
61
61
  describe("CLI_COMMANDS / cliUsage", () => {
62
62
  it("prints the usage line operators already know, built from the catalogue", () => {
63
63
  expect(cliUsage().split("\n")[0]).toBe(
64
- "Usage: cms-provision [wizard] [--provider <name> --domain <d> [--staging-domain <host>] --owner-email <e> --region <r> [--scheduler-interval-minutes 1-15]] [--local|--install-job] | <init|up|migrate|status|upgrade|backup|restore|rotate-secret|truncate|destroy|regenerate-caddy|admin-domain|staging-domain|owner-reset|setup-link|state migrate|attach|pulumi-output-sync|version> [options]",
64
+ "Usage: cms-provision [wizard] [--provider <name> --domain <d> [--staging-domain <host>] --owner-email <e> --region <r> [--version x.y.z[-rc.N]] [--scheduler-interval-minutes 1-15]] [--local|--install-job] | <init|up|migrate|status|upgrade|backup|restore|rotate-secret|truncate|destroy|regenerate-caddy|admin-domain|staging-domain|owner-reset|setup-link|state migrate|attach|pulumi-output-sync|version> [options]",
65
65
  );
66
66
  });
67
67
 
@@ -70,9 +70,9 @@ export interface CliCommandDoc {
70
70
  export const CLI_COMMANDS: readonly CliCommandDoc[] = [
71
71
  {
72
72
  name: "init",
73
- args: "--domain <d> --owner-email <e> [--staging-domain <host>] [--version x.y.z] [--tls acme|internal] [--http-port 80] [--https-port 443]",
73
+ args: "[--provider self-hosted|gcp|gcp-firebase] --domain <d> --owner-email <e> [--staging-domain <host>] [--version x.y.z[-rc.N]] [--accept-release-candidate] [--tls acme|internal] [--http-port 80] [--https-port 443]",
74
74
  summary:
75
- "Self-hosted only: write the install's config with fresh secrets, verify the signed release images and start the Docker Compose stack; prints the Owner setup link. Cloud providers run the wizard instead.",
75
+ "Set up a new install from verified, signed release images (--version names the release): self-hosted writes the config with fresh secrets, starts the Docker Compose stack and prints the Owner setup link, gcp and gcp-firebase run the wizard; a release candidate (x.y.z-rc.N) is for test installs only and asks for confirmation on Google Cloud, or takes --accept-release-candidate.",
76
76
  },
77
77
  {
78
78
  name: "up",
@@ -94,9 +94,9 @@ export const CLI_COMMANDS: readonly CliCommandDoc[] = [
94
94
  },
95
95
  {
96
96
  name: "upgrade",
97
- args: "[--version x.y.z] [--channel stable|rc|beta] [--region <r>] [--skip-verify] [--skip-health-check] [--install <id|domain|all>] [--project <gcp-project-id>]",
97
+ args: "[--version x.y.z[-rc.N]] [--channel stable|rc|beta] [--accept-release-candidate] [--region <r>] [--skip-verify] [--skip-health-check] [--install <id|domain|all>] [--project <gcp-project-id>]",
98
98
  summary:
99
- "Roll the install to a newer release (latest stable by default) after verifying the image signatures.",
99
+ "Roll the install to a newer release (latest stable by default; --channel rc takes the newest release candidate or stable release, whichever is newer) after verifying the image signatures; on Google Cloud a release candidate asks for confirmation first, or takes --accept-release-candidate.",
100
100
  },
101
101
  {
102
102
  name: "backup",
@@ -181,8 +181,9 @@ export const CLI_COMMANDS: readonly CliCommandDoc[] = [
181
181
  /** The text `cms-provision --help` prints, built from {@link CLI_COMMANDS}. */
182
182
  export function cliUsage(): string {
183
183
  return (
184
- `Usage: cms-provision [wizard] [--provider <name> --domain <d> [--staging-domain <host>] --owner-email <e> --region <r> [--scheduler-interval-minutes 1-15]] [--local|--install-job] | <${CLI_COMMANDS.map((c) => c.name).join("|")}> [options]\n` +
184
+ `Usage: cms-provision [wizard] [--provider <name> --domain <d> [--staging-domain <host>] --owner-email <e> --region <r> [--version x.y.z[-rc.N]] [--scheduler-interval-minutes 1-15]] [--local|--install-job] | <${CLI_COMMANDS.map((c) => c.name).join("|")}> [options]\n` +
185
185
  "With several installs on this machine, pick one with --install <install-id or domain> (status, upgrade and backup also take --install all); in a terminal you are asked otherwise.\n" +
186
+ "--version installs the release it names (otherwise the newest stable one). A release candidate (x.y.z-rc.N) is for test installs only: Caelo's Google Cloud registry keeps its images for 14 days, so installing or upgrading to one there asks for confirmation (--accept-release-candidate in a script).\n" +
186
187
  "Pass --no-wizard with no sub-command to print this usage instead of the wizard."
187
188
  );
188
189
  }
package/src/cli.ts CHANGED
@@ -78,6 +78,7 @@ import {
78
78
  selfHostedSiteUrl,
79
79
  } from "./compose.js";
80
80
  import { tightenPrivateTree, writePrivateFile } from "./private-file.js";
81
+ import { ACCEPT_RELEASE_CANDIDATE_FLAG } from "./release-candidate.js";
81
82
  import { selfCommand } from "./self-command.js";
82
83
  import { ensureSelfHostedDbTls, selfHostedDbTlsServerCertSha256 } from "./self-hosted-db-tls.js";
83
84
  import { ensureInternalSecret, writeInternalSecret } from "./self-hosted-internal-secret.js";
@@ -1303,6 +1304,8 @@ async function lifecycleUpgrade(): Promise<void> {
1303
1304
  // bunx @caelo-cms/provisioning upgrade --channel rc
1304
1305
  // P21 ship 4 — `--skip-verify` opts out of cosign signature checks.
1305
1306
  // Default verifies; skip only for forks/staging using unsigned images.
1307
+ // #1558 — on Google Cloud a release candidate asks for confirmation;
1308
+ // `--accept-release-candidate` gives it where no prompt can ask.
1306
1309
  const version = arg("version");
1307
1310
  const channelArg = arg("channel");
1308
1311
  const channel: "stable" | "rc" | "beta" | undefined =
@@ -1335,6 +1338,9 @@ async function lifecycleUpgrade(): Promise<void> {
1335
1338
  ...(channel ? { channel } : {}),
1336
1339
  ...(skipVerify ? { skipVerify: true } : {}),
1337
1340
  ...(skipHealthCheck ? { skipHealthCheck: true } : {}),
1341
+ ...(process.argv.includes(ACCEPT_RELEASE_CANDIDATE_FLAG)
1342
+ ? { acceptReleaseCandidate: true }
1343
+ : {}),
1338
1344
  });
1339
1345
  }
1340
1346
  async function lifecycleBackup(): Promise<void> {
@@ -1743,7 +1749,8 @@ async function waitForDomainMappingCert(target: {
1743
1749
  * §11.C — interactive wizard. Loaded lazily so the bare-CLI startup
1744
1750
  * cost stays small (clack + kleur are pulled in only when needed).
1745
1751
  * Reads `--provider`, `--domain`, `--owner-email`, `--project-id`, `--region`,
1746
- * `--scheduler-interval-minutes` (#1140), `--non-interactive` and the run mode (`--local` / `--install-job`, default:
1752
+ * `--scheduler-interval-minutes` (#1140), `--version` and
1753
+ * `--accept-release-candidate` (#1558), `--non-interactive` and the run mode (`--local` / `--install-job`, default:
1747
1754
  * the install job in Cloud Shell, local elsewhere — run-mode.ts) from argv.
1748
1755
  */
1749
1756
  async function wizardCommand(): Promise<void> {
@@ -1760,6 +1767,12 @@ async function wizardCommand(): Promise<void> {
1760
1767
  console.error((e as Error).message);
1761
1768
  process.exit(2);
1762
1769
  }
1770
+ const version = arg("version");
1771
+ if (version === undefined && process.argv.includes("--version")) {
1772
+ // A bare trailing `--version` would otherwise install `latest` silently.
1773
+ console.error("--version needs a release version, e.g. --version 0.12.5-rc.1");
1774
+ process.exit(2);
1775
+ }
1763
1776
  await runWizard({
1764
1777
  ...(schedulerIntervalMinutes !== undefined ? { schedulerIntervalMinutes } : {}),
1765
1778
  runMode: chooseRunMode(process.argv, process.env),
@@ -1770,6 +1783,10 @@ async function wizardCommand(): Promise<void> {
1770
1783
  ownerEmail: arg("owner-email"),
1771
1784
  projectId: arg("project-id"),
1772
1785
  region: arg("region"),
1786
+ ...(version !== undefined ? { version } : {}),
1787
+ ...(process.argv.includes(ACCEPT_RELEASE_CANDIDATE_FLAG)
1788
+ ? { acceptReleaseCandidate: true }
1789
+ : {}),
1773
1790
  });
1774
1791
  }
1775
1792
 
@@ -48,8 +48,13 @@ describe("planCpuIdle", () => {
48
48
  });
49
49
 
50
50
  describe("the stacks set cpuIdle", () => {
51
- it("the gateway runs request-billed", () => {
52
- expect(SERVICE_CPU_IDLE.gateway).toBe(true);
51
+ it("every service runs request-billed, the admin included (#1361)", () => {
52
+ expect(SERVICE_CPU_IDLE).toEqual({
53
+ admin: true,
54
+ gateway: true,
55
+ "staging-gateway": true,
56
+ "mcp-auth-proxy": true,
57
+ });
53
58
  });
54
59
 
55
60
  for (const provider of ["gcp", "gcp-firebase"]) {
package/src/gcp-names.ts CHANGED
@@ -246,6 +246,93 @@ export function auditServiceAccountEmail(projectId: string, env: string): string
246
246
  return `${auditServiceAccountId(env)}@${projectId}.iam.gserviceaccount.com`;
247
247
  }
248
248
 
249
+ /**
250
+ * #1359 — Cloud Run job that runs a Stage's whole quality audit (the
251
+ * findings checks and the Lighthouse fan-out to {@link auditJobName}) and
252
+ * reports back to the admin, one execution per audit (reporting-job-setup.ts).
253
+ */
254
+ export function auditRunnerJobName(env: string): string {
255
+ return `${gcpNamePrefix(env)}-audit-run`;
256
+ }
257
+
258
+ /** Full resource name of the audit runner job, as the admin's env carries it. */
259
+ export function auditRunnerJobResource(projectId: string, region: string, env: string): string {
260
+ return `projects/${projectId}/locations/${region}/jobs/${auditRunnerJobName(env)}`;
261
+ }
262
+
263
+ /**
264
+ * Account id of the audit runner's own service account: reads the staged
265
+ * build and the Lighthouse results, runs the Lighthouse job, and reports to
266
+ * the admin through IAP — no database, no secret (reporting-job-setup.ts).
267
+ * `caelo-production-audit-run` is 26 of the 30 characters an id may have.
268
+ */
269
+ export function auditRunnerServiceAccountId(env: string): string {
270
+ return `${gcpNamePrefix(env)}-audit-run`;
271
+ }
272
+
273
+ /** Email of the audit runner's service account. */
274
+ export function auditRunnerServiceAccountEmail(projectId: string, env: string): string {
275
+ return `${auditRunnerServiceAccountId(env)}@${projectId}.iam.gserviceaccount.com`;
276
+ }
277
+
278
+ /**
279
+ * #1360 — Cloud Run job that crawls a site import and reports each page to
280
+ * the admin, one execution per attempt (reporting-job-setup.ts). The admin
281
+ * renders the pages it asks for through the capture job.
282
+ */
283
+ export function importCrawlJobName(env: string): string {
284
+ return `${gcpNamePrefix(env)}-import`;
285
+ }
286
+
287
+ /** Full resource name of the crawl job, as the admin's env carries it. */
288
+ export function importCrawlJobResource(projectId: string, region: string, env: string): string {
289
+ return `projects/${projectId}/locations/${region}/jobs/${importCrawlJobName(env)}`;
290
+ }
291
+
292
+ /**
293
+ * Account id of the crawl job's own service account: reports to the admin
294
+ * through IAP and fetches robots.txt and sitemaps through the SSRF guard —
295
+ * no database, no secret, no bucket, no other job (reporting-job-setup.ts).
296
+ * `caelo-production-import` is 23 of the 30 characters an id may have.
297
+ */
298
+ export function importCrawlServiceAccountId(env: string): string {
299
+ return `${gcpNamePrefix(env)}-import`;
300
+ }
301
+
302
+ /** Email of the crawl job's service account. */
303
+ export function importCrawlServiceAccountEmail(projectId: string, env: string): string {
304
+ return `${importCrawlServiceAccountId(env)}@${projectId}.iam.gserviceaccount.com`;
305
+ }
306
+
307
+ /**
308
+ * #1574 — Cloud Run job that carries a build: one execution per Stage,
309
+ * Publish live or production build nobody else waits for, holding the
310
+ * admin request the build runs in (reporting-job-setup.ts).
311
+ */
312
+ export function buildCarrierJobName(env: string): string {
313
+ return `${gcpNamePrefix(env)}-build`;
314
+ }
315
+
316
+ /** Full resource name of the build carrier's job, as the admin's env carries it. */
317
+ export function buildCarrierJobResource(projectId: string, region: string, env: string): string {
318
+ return `projects/${projectId}/locations/${region}/jobs/${buildCarrierJobName(env)}`;
319
+ }
320
+
321
+ /**
322
+ * Account id of the build carrier's own service account: it reports to the
323
+ * admin through IAP and holds nothing else — no database, no secret, no
324
+ * bucket, no other job (reporting-job-setup.ts). `caelo-production-build`
325
+ * is 22 of the 30 characters an id may have.
326
+ */
327
+ export function buildCarrierServiceAccountId(env: string): string {
328
+ return `${gcpNamePrefix(env)}-build`;
329
+ }
330
+
331
+ /** Email of the build carrier's service account. */
332
+ export function buildCarrierServiceAccountEmail(projectId: string, env: string): string {
333
+ return `${buildCarrierServiceAccountId(env)}@${projectId}.iam.gserviceaccount.com`;
334
+ }
335
+
249
336
  /**
250
337
  * #1217 — Cloud Run job that runs every server-side browser render
251
338
  * (screenshots, rendered HTML) of the install, one execution per render, so
@@ -20,8 +20,11 @@ describe("infrastructure contract steps", () => {
20
20
  );
21
21
  });
22
22
 
23
- it("is at 24: public_role revoke (3), URL-map redirects role (4), no gateway cms_admin login (5), ops-bucket list (6), gateway proxy hops (7), quality-audit job (8), converge job (9), remote MCP (10), Google sign-in (11), project-level sign-in client (12), edge security headers (13), capture job (14), database verify-full TLS (15), MCP-Auth-Proxy (16), staging database (17), scheduler tick (18), scheduler tick as JSON (19), staging gateway (20), gateway budget and plain-gcp repairs (21), per-path Cloud Armor rules (22), site security headers on the backend bucket (23), the static bucket read for those headers (24)", () => {
24
- expect(INFRA_CONTRACT_VERSION).toBe(24);
23
+ it("is at 27: public_role revoke (3), URL-map redirects role (4), no gateway cms_admin login (5), ops-bucket list (6), gateway proxy hops (7), quality-audit job (8), converge job (9), remote MCP (10), Google sign-in (11), project-level sign-in client (12), edge security headers (13), capture job (14), database verify-full TLS (15), MCP-Auth-Proxy (16), staging database (17), scheduler tick (18), scheduler tick as JSON (19), staging gateway (20), gateway budget and plain-gcp repairs (21), per-path Cloud Armor rules (22), site security headers on the backend bucket (23), the static bucket read for those headers (24), the quality-audit runner (25), the site-import crawler (26), the build carrier (27)", () => {
24
+ expect(INFRA_CONTRACT_VERSION).toBe(27);
25
+ expect(INFRA_CONTRACT_STEPS[27]).toContain("#1574");
26
+ expect(INFRA_CONTRACT_STEPS[26]).toContain("#1360");
27
+ expect(INFRA_CONTRACT_STEPS[25]).toContain("#1359");
25
28
  expect(INFRA_CONTRACT_STEPS[24]).toContain("static bucket");
26
29
  expect(INFRA_CONTRACT_STEPS[23]).toContain("#1454");
27
30
  expect(INFRA_CONTRACT_STEPS[3]).toContain("#633");
@@ -54,6 +57,6 @@ describe("infrastructure contract steps", () => {
54
57
  });
55
58
 
56
59
  it("names a version a newer release added by number", () => {
57
- expect(infraStepsText(24, 25)).toBe("infrastructure step 25 (see that release's notes)");
60
+ expect(infraStepsText(27, 28)).toBe("infrastructure step 28 (see that release's notes)");
58
61
  });
59
62
  });
@@ -22,7 +22,7 @@
22
22
  * whose app-roll references infrastructure an install does not have yet fails
23
23
  * at roll time, after migrations ran.
24
24
  */
25
- export const INFRA_CONTRACT_VERSION = 24;
25
+ export const INFRA_CONTRACT_VERSION = 27;
26
26
 
27
27
  // History (why each bump happened — an install below a number needs the
28
28
  // converge that introduced it):
@@ -200,6 +200,44 @@ export const INFRA_CONTRACT_VERSION = 24;
200
200
  // static bucket only, an IAM binding the in-cloud upgrader may not
201
201
  // make (stack-contract.ts `admin-static-bucket-read`). Other providers
202
202
  // have nothing to converge for it.
203
+ // 25 — #1359: the quality-audit runner (reporting-job-setup.ts), the job a
204
+ // Stage's whole audit runs in instead of the admin's process. Its
205
+ // service account (token creator on itself, logWriter, IAP access to
206
+ // the admin, object viewer on the staging and audit-results buckets,
207
+ // run-with-overrides and viewer on the Lighthouse job), the job
208
+ // `caelo-<env>-audit-run`, the admin's run-with-overrides and viewer
209
+ // on it, the upgrader's actAs on its account, the operator-access
210
+ // job's CAELO_OPERATOR_ACCESS_IAP_SERVICE_ACCOUNTS (so its sync keeps
211
+ // the account on IAP) and CAELO_AUDIT_RUNNER_JOB /
212
+ // CAELO_AUDIT_RUNNER_SERVICE_ACCOUNT on the admin. The new admin
213
+ // starts every Stage audit on that job and the app-roll moves its
214
+ // image, so an in-cloud upgrader must not roll an install onto it
215
+ // before it exists.
216
+ // 26 — #1360: the site-import crawler (reporting-job-setup.ts), the job a
217
+ // site import's crawl runs in instead of the admin's process. Its
218
+ // service account (token creator on itself, logWriter, IAP access to
219
+ // the admin; no bucket, no other job: the admin renders every page),
220
+ // the job `caelo-<env>-import`, the admin's run-with-overrides and
221
+ // viewer on it, the upgrader's actAs on its account, the account in
222
+ // the operator-access job's CAELO_OPERATOR_ACCESS_IAP_SERVICE_ACCOUNTS
223
+ // and CAELO_IMPORT_CRAWL_JOB / CAELO_IMPORT_CRAWL_SERVICE_ACCOUNT on
224
+ // the admin. The new admin starts every crawl on that job and the
225
+ // app-roll moves its image, so an in-cloud upgrader must not roll an
226
+ // install onto it before it exists.
227
+ // 27 — #1574: the build carrier (reporting-job-setup.ts), the job whose one
228
+ // report holds the admin request a Stage, Publish live or production
229
+ // build runs in when nobody else waits for it (an agent's Stage, a
230
+ // button whose tab closed), so the admin can run on request-billed
231
+ // CPU (#1361). Its service account (token creator on itself,
232
+ // logWriter, IAP access to the admin; nothing else: the build stays
233
+ // in the admin), the job `caelo-<env>-build`, the admin's
234
+ // run-with-overrides and viewer on it, the upgrader's actAs on its
235
+ // account, the account in the operator-access job's
236
+ // CAELO_OPERATOR_ACCESS_IAP_SERVICE_ACCOUNTS and
237
+ // CAELO_BUILD_CARRIER_JOB / CAELO_BUILD_CARRIER_SERVICE_ACCOUNT on the
238
+ // admin. The new admin starts those builds on that job and the
239
+ // app-roll moves its image, so an in-cloud upgrader must not roll an
240
+ // install onto it before it exists.
203
241
  //
204
242
  // #1029 is deliberately NOT a bump. The upgrader job's stage 1 moves the job
205
243
  // onto the target's ops image with rights it has held on itself since
@@ -238,6 +276,9 @@ export const INFRA_CONTRACT_STEPS: Readonly<Record<number, string>> = {
238
276
  22: "per-path Cloud Armor rules for the visitor and staging gateways on Google Cloud load-balancer installs: a tighter ban on sign-up, login and password reset, a captcha throttle, the general ban only on the visitor API, and fewer false positives from the OWASP rules (#1339)",
239
277
  23: "the admin's permission on Google Cloud load-balancer installs to set the site's security headers on the static backend bucket at Publish live (#1454)",
240
278
  24: "the admin's permission on Google Cloud load-balancer installs to read the static bucket's settings, without which Publish live could not set the site's security headers (#1454)",
279
+ 25: "the quality-audit runner: a job of its own that runs each Stage's quality audit and reports the result to the admin, its service account and grants (#1359)",
280
+ 26: "the site-import crawler: a job of its own that crawls each site import and reports every page to the admin, its service account and grants (#1360)",
281
+ 27: "the build carrier: a job of its own that holds the request a Stage, Publish live or production build runs in when nobody else waits for it, its service account and grants (#1574)",
241
282
  };
242
283
 
243
284
  /**
@@ -487,6 +487,18 @@ export function stateStoreFor(installId: string): StateStore {
487
487
  return store;
488
488
  }
489
489
 
490
+ /**
491
+ * Drop this process's copies of the install's bucket documents, so the next
492
+ * read fetches install.json and progress.json from its ops bucket again: for
493
+ * a decision taken under a lock that another process may have changed them
494
+ * before (the install job's launcher, #1558). No-op for local state, which
495
+ * is read from disk every time.
496
+ */
497
+ export function forgetCachedState(installId: string): void {
498
+ const backend = readLocalMetadata(installId)?.stateBackend;
499
+ if (backend?.kind === "gcs") gcsStores.delete(`${installId}\0${backend.bucket}`);
500
+ }
501
+
490
502
  /**
491
503
  * The authoritative metadata of an install picked from {@link listInstalls}:
492
504
  * for an install whose state lives in its ops bucket, the bucket's copy