@astralarium/repo-deploy-release 0.1.0 → 0.2.0

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.
package/dist/src/app.d.ts CHANGED
@@ -113,6 +113,11 @@ export interface ReleaseApp {
113
113
  /** Work `stage`/`deploy` wait out on the idle slot; absent, they replace
114
114
  * the idle slot's build at once. */
115
115
  ongoingWork?: OngoingWork;
116
+ /** Retries the app's queue consumers take (`@astralarium/repo-postgres/queue`
117
+ * `consumeClaimed`'s `maxRetries`); `testRelease` checks each consumer's
118
+ * `max_retries` against it; unset, it checks the targets declare
119
+ * no consumers. */
120
+ queueMaxRetries?: number;
116
121
  }
117
122
  /** `app`, validated (`releaseAppSchema`); throws `ExpectedError` naming
118
123
  * each problem. */
package/dist/src/app.js CHANGED
@@ -57,6 +57,7 @@ const releaseAppSchema = z
57
57
  buildEnv: z.record(text, text).optional(),
58
58
  retireBuilds: hook().optional(),
59
59
  ongoingWork: hook().optional(),
60
+ queueMaxRetries: z.number().int().nonnegative().optional(),
60
61
  })
61
62
  .check((ctx) => {
62
63
  for (const [env, release] of Object.entries(ctx.value.envs))
@@ -7,6 +7,9 @@ export declare function checkSite({ target, blocks, packages }: ReleasedTarget):
7
7
  * provisioned, a real id none of `others` binds. A target without a
8
8
  * database (`dbUrlVar`) binds none. */
9
9
  export declare function checkDatabase(released: ReleasedTarget, others: readonly ReleasedTarget[]): void;
10
+ /** Every queue consumer of `released` declares `max_retries` of
11
+ * `maxRetries`; with `maxRetries` undefined, `released` declares none. */
12
+ export declare function checkQueueRetries({ blocks, packages }: ReleasedTarget, maxRetries: number | undefined): void;
10
13
  /** A blue/green target's web worker binds both slot scripts. */
11
14
  export declare function checkSlotBindings({ target, blocks }: ReleasedTarget): void;
12
15
  /** Each script of `targets` belongs to one target. */
@@ -1,5 +1,6 @@
1
1
  /** Assertions the release suites run on an app's released targets:
2
- * site, database, slot bindings, scripts and wrangler-bundled envs. */
2
+ * site, database, queue retries, slot bindings, scripts and
3
+ * wrangler-bundled envs. */
3
4
  import { expect } from "vitest";
4
5
  import { scriptsOf } from "../src/target.js";
5
6
  /** A Hyperdrive id. */
@@ -35,6 +36,19 @@ export function checkDatabase(released, others) {
35
36
  expect(own[0]).toMatch(HYPERDRIVE_ID);
36
37
  expect(others.flatMap(ids)).not.toContain(own[0]);
37
38
  }
39
+ /** Every queue consumer of `released` declares `max_retries` of
40
+ * `maxRetries`; with `maxRetries` undefined, `released` declares none. */
41
+ export function checkQueueRetries({ blocks, packages }, maxRetries) {
42
+ for (const pkg of packages) {
43
+ const consumers = blocks[pkg]?.queues?.consumers ?? [];
44
+ if (maxRetries === undefined) {
45
+ expect(consumers.map(({ queue }) => queue), `${pkg} queue consumers without queueMaxRetries`).toEqual([]);
46
+ continue;
47
+ }
48
+ for (const { queue, max_retries } of consumers)
49
+ expect(max_retries, `${pkg} ${queue} max_retries`).toBe(maxRetries);
50
+ }
51
+ }
38
52
  /** A blue/green target's web worker binds both slot scripts. */
39
53
  export function checkSlotBindings({ target, blocks }) {
40
54
  if (target.kind !== "blue-green")
@@ -19,6 +19,12 @@ export interface ReleasedBlock extends WranglerEnv {
19
19
  name: string;
20
20
  class_name?: string;
21
21
  }[];
22
+ queues?: {
23
+ consumers?: {
24
+ queue: string;
25
+ max_retries?: number;
26
+ }[];
27
+ };
22
28
  }
23
29
  /** A target with the env blocks of its packages. */
24
30
  export interface ReleasedTarget {
@@ -4,7 +4,7 @@ import { describe, it } from "vitest";
4
4
  import { envNames } from "../src/app.js";
5
5
  import { assertReleaseConfig, isBootstrapping } from "../src/check.js";
6
6
  import { readEnvBlock, resolveTarget, } from "../src/target.js";
7
- import { checkDatabase, checkScripts, checkSite, checkSlotBindings, } from "./release-checks.js";
7
+ import { checkDatabase, checkQueueRetries, checkScripts, checkSite, checkSlotBindings, } from "./release-checks.js";
8
8
  /** Packages of `target`: the web and slotted workers, or an in-place
9
9
  * env's workers. */
10
10
  const packagesOf = (target) => target.kind === "blue-green"
@@ -33,6 +33,7 @@ export function releasedTargets(app) {
33
33
  * secrets templates, every declared target's. */
34
34
  export function testRelease(app) {
35
35
  const targets = releasedTargets(app);
36
+ const { queueMaxRetries } = app;
36
37
  it("declares the release its wrangler configs and secrets templates commit: bootstrapping exactly the envs with a config gap", () => {
37
38
  assertReleaseConfig(app);
38
39
  });
@@ -46,6 +47,11 @@ export function testRelease(app) {
46
47
  it("shares one Hyperdrive config between its workers, a real one of its own once provisioned, or none without a database", () => {
47
48
  checkDatabase(released, targets.filter((t) => t.env !== released.env));
48
49
  });
50
+ it(queueMaxRetries === undefined
51
+ ? "declares no queue consumers, the app lacking queue retries"
52
+ : "gives each queue consumer the app's queue retries", () => {
53
+ checkQueueRetries(released, queueMaxRetries);
54
+ });
49
55
  });
50
56
  describe.each(targets.filter((t) => t.target.kind === "blue-green"))("the $env blue/green target", (released) => {
51
57
  it("binds both slot scripts in the web worker", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astralarium/repo-deploy-release",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/astralarium/repo/tree/main/packages/repo-deploy-release#readme",
6
6
  "repository": {
@@ -32,11 +32,11 @@
32
32
  "json5": "^2.2.3",
33
33
  "postgres": "^3.4.9",
34
34
  "zod": "^4.6.7",
35
- "@astralarium/repo-deploy-info": "^0.1.0",
36
- "@astralarium/repo-deploy-workflows": "^0.1.0",
35
+ "@astralarium/repo-deploy-info": "^0.1.1",
36
+ "@astralarium/repo-postgres": "^0.2.0",
37
+ "@astralarium/repo-telemetry": "^0.2.0",
37
38
  "@astralarium/repo-package-files": "^0.1.0",
38
- "@astralarium/repo-telemetry": "^0.1.0",
39
- "@astralarium/repo-postgres": "^0.1.0"
39
+ "@astralarium/repo-deploy-workflows": "^0.1.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^24.2.0",
@@ -44,9 +44,9 @@
44
44
  "typescript": "^6.0.3",
45
45
  "vitest": "^5.0.3",
46
46
  "wrangler": "^4.132.0",
47
- "@astralarium/repo-config-eslint": "^0.1.0",
48
47
  "@astralarium/repo-config-typescript": "^0.1.0",
49
- "@astralarium/repo-config-vitest": "^0.1.0"
48
+ "@astralarium/repo-config-vitest": "^0.2.0",
49
+ "@astralarium/repo-config-eslint": "^0.3.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "vitest": "^5.0.3"