@patronage/factory-ci 1.0.0-alpha.44 → 1.0.0-alpha.45

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/README.md CHANGED
@@ -61,7 +61,7 @@ const steps = [
61
61
 
62
62
  This selection is stable under a renamed step or an added supported role: `setupStepsForRoles` reads named roles from `setupStepsByRole`, never array shape.
63
63
 
64
- Every action is validated as `owner/repo@<full sha>`, with its release tag kept separately. A complete `actionFamily` is required; there is no default that could silently move a consumer between action majors. `NODE_PNPM_ACTION_FAMILY_NODE24` is the canonical family whose checkout, Node setup, and pnpm setup actions all declare a Node 24 JavaScript runtime. Generated workflows read Node from `.nvmrc`. This repository pins 24.20.0.
64
+ Every action is validated as `owner/repo@<full sha>`, with its release tag kept separately. A complete `actionFamily` is required; there is no default that could silently move a consumer between action majors. `NODE_PNPM_ACTION_FAMILY_NODE24` is the canonical family whose checkout, Node setup, and pnpm setup actions all declare a Node 24 JavaScript runtime. Generated workflows read Node from `.nvmrc`. This repository pins 24.
65
65
 
66
66
  ```ts
67
67
  const generated = factoryWorkflow({
@@ -611,6 +611,8 @@ import { ALCHEMY_SUBPATH, evaluateStack } from "@patronage/factory-ci/alchemy";
611
611
 
612
612
  Install `alchemy` and `effect` yourself before importing it. The published ranges are `>=2.0.0-beta.63 <3` and `>=4.0.0-beta.98 <5`, the same ones `@patronage/alchemy-d1-state` carries, and both are marked optional so an installation that never touches this surface stays quiet.
613
613
 
614
+ From Alchemy 2.0.0-beta.84 the providers ship as their own packages: a Cloudflare stack imports `@alchemy.run/cloudflare`, not `alchemy/Cloudflare`, and installs it at the same exact version as `alchemy` (it peers on that version). The subpath imports no provider package, so it adds no peer for one; this workspace carries `@alchemy.run/cloudflare` as a devDependency only for the tests that build a Cloudflare stack.
615
+
614
616
  The published ranges are wide, but the workspace pins one copy: `alchemy` and `effect` are devDependencies here at the same versions `@patronage/alchemy-d1-state` and `software-factory-hq` pin. Without that pin pnpm resolves the peer range to its newest release for this importer alone, which is a second copy of both in the workspace and a lockfile that no longer installs. `evaluateStack` imports both, so `knip` sees them used.
615
617
 
616
618
  `ALCHEMY_SUBPATH` is the specifier itself. Stage policy, retained-identity asserts, the lifecycle guards, stack evaluation, and the graph invariants ship here. The Alchemy entry helpers named above (`bundleAlchemyEntry`, `executeAlchemyEntry`) stay on the package root, where they belong: they shell out to the consumer's Alchemy CLI and import neither package.
@@ -818,7 +820,7 @@ const graph = await evaluateStack({
818
820
 
819
821
  `evaluateStack` runs a stack program at one stage and returns the graph Alchemy would plan, with no state store and no network. It wraps Alchemy's `Plan.make`: the program registers its resources under a `Stack` service, then the plan builds under `inMemoryState()` at the requested `Stage`. Every provider answers its `read` and `list` probes with "absent", so the cold-adoption probe `Plan.make` makes for a resource with resolved props and no prior state never leaves the process. A stage the program returns from early (paitronage's `placeholder` stage) evaluates to an empty graph.
820
822
 
821
- `program` is the effect the consumer hands `Alchemy.Stack`, not the `Alchemy.Stack(...)` value. The value captures the consumer's real `providers` and `state` layers, and at Alchemy 2.0.0-beta.83 building `Cloudflare.providers()` is not inert (`ProfileStoreLive` inside `CloudflareApiLive` writes `~/.alchemy/profiles/default`, and the layer needs the `AuthProviders` service), so evaluating the value cannot stay free of side effects. Export the program next to the stack:
823
+ `program` is the effect the consumer hands `Alchemy.Stack`, not the `Alchemy.Stack(...)` value. The value captures the consumer's real `providers` and `state` layers, and at Alchemy 2.0.0-beta.84 building `Cloudflare.providers()` (from `@alchemy.run/cloudflare`) is not inert (`ProfileStoreLive` inside `CloudflareApiLive` writes `~/.alchemy/profiles/default`, and the layer needs the `AuthProviders` service), so evaluating the value cannot stay free of side effects. Export the program next to the stack:
822
824
 
823
825
  ```ts
824
826
  export const program = Effect.gen(function* () {
@@ -829,7 +831,7 @@ export default Alchemy.Stack("hq", { providers, state }, program);
829
831
 
830
832
  Pass `providers` when the program depends on hand-written provider layers. Every provider that layer registers keeps its identity (`stables`, `aliases`, `diff`) and loses its probes; an unregistered resource type still evaluates. Each graph resource carries the `LogicalId`, `Type`, and raw `Props` of its plan node, so a prop may hold an unresolved Alchemy output. `upstreamByProp` names, per top-level prop, the logical ids that prop's value references, which is the only way to read a cross-resource reference out of raw props: an output is a function, so the prop that holds it says nothing on its own. A prop that references nothing carries no key. The references are kept per prop and never pooled into one list, so a caller asking which resources one prop names is never answered with an id a different prop mentioned. Each binding row comes from Alchemy's Worker binding channel: `worker` is the host's logical id, `name` and `type` are the strings Alchemy emits (`d1`, `kv_namespace`, `secrets_store_secret`, and so on), and `target` is the logical id of the resource the row references, when it references one.
831
833
 
832
- The caller's `providers` layer is **built** before its probes are stubbed: `evaluateStack` wraps that layer, and Alchemy's own lookup resolves each provider out of it before `read` and `list` are replaced. So any side effect a layer performs at construction — a credential read, a network call, a file write — is the caller's, and happens. This is why `Cloudflare.providers()` must not be passed: at beta.83 its `CloudflareApiLive` still creates `~/.alchemy/profiles/default` and requires `AuthProviders` when it builds, before there is anything to stub. Beta.77 also resolved credentials there (`Credentials.fromAuthProvider`); beta.81 deferred that to first use and beta.83 still does. The no-network guarantee covers evaluation, not layer construction: pass only layers whose construction is inert.
834
+ The caller's `providers` layer is **built** before its probes are stubbed: `evaluateStack` wraps that layer, and Alchemy's own lookup resolves each provider out of it before `read` and `list` are replaced. So any side effect a layer performs at construction — a credential read, a network call, a file write — is the caller's, and happens. This is why `Cloudflare.providers()` must not be passed: at beta.84 its `CloudflareApiLive` still creates `~/.alchemy/profiles/default` and requires `AuthProviders` when it builds, before there is anything to stub. Beta.77 also resolved credentials there (`Credentials.fromAuthProvider`); beta.81 deferred that to first use and beta.84 still does. The no-network guarantee covers evaluation, not layer construction: pass only layers whose construction is inert.
833
835
 
834
836
  The helper decides nothing about the graph. Invariants over it are separate exports; `assertUrlImpliesAuth` below is the first.
835
837
 
@@ -865,9 +867,9 @@ The factory's own security review prompt carries the same rule in prose, so a re
865
867
  import { ALCHEMY_BASELINE, assertAlchemyBaseline } from "@patronage/factory-ci";
866
868
  ```
867
869
 
868
- `ALCHEMY_BASELINE` is the exact `alchemy` and `effect` pair the fleet moves together on: `{ alchemy: "2.0.0-beta.83", effect: "4.0.1" }`. It is a plain constant on the root entry — it imports neither package — so any consumer can read it without installing the `./alchemy` subpath's peers.
870
+ `ALCHEMY_BASELINE` is the exact `alchemy` and `effect` pair the fleet moves together on: `{ alchemy: "2.0.0-beta.84", effect: "4.0.6" }`. It is a plain constant on the root entry — it imports neither package — so any consumer can read it without installing the `./alchemy` subpath's peers.
869
871
 
870
- `assertAlchemyBaseline({ packageJson })` is a consumer contract helper: it fails when the consumer's own `dependencies` or `devDependencies` pin `alchemy` or `effect` to anything other than the baseline, and it fails when only one of the pair is present. Alchemy peers on Effect, so an unpinned auto-installed Effect can drift outside the baseline while a lone `alchemy` pin would otherwise pass. Both packages remaining absent is not drift — they are optional peers of the subpath, so a consumer that never imports it, such as this package's own CLI, carries neither and passes. The pin is exact, not a range: the fleet is pre-1.0 and moves together, so a range would let one project drift silently ahead of or behind the rest. `assertAlchemyBaseline` reads only the object it is handed; it never walks the filesystem or reads a lockfile. Call it from a consumer's own contract test, passing that consumer's parsed `package.json`.
872
+ `assertAlchemyBaseline({ packageJson })` is a consumer contract helper: it fails when the consumer's own `dependencies` or `devDependencies` pin `alchemy` or `effect` to anything other than the baseline, when only one of the pair is present, when `@alchemy.run/cloudflare` is pinned without both of them, or when a pinned `@alchemy.run/cloudflare` is not at the baseline `alchemy` version. Alchemy peers on Effect, so an unpinned auto-installed Effect can drift outside the baseline while a lone `alchemy` pin would otherwise pass. Both packages remaining absent is not drift — they are optional peers of the subpath, so a consumer that never imports it, such as this package's own CLI, carries neither and passes. The pin is exact, not a range: the fleet is pre-1.0 and moves together, so a range would let one project drift silently ahead of or behind the rest. `assertAlchemyBaseline` reads only the object it is handed; it never walks the filesystem or reads a lockfile. Call it from a consumer's own contract test, passing that consumer's parsed `package.json`.
871
873
 
872
874
  The baseline bumps only in a lockstep release: the same commit that bumps `@patronage/factory-ci`'s own `alchemy`/`effect` devDependencies and the `./alchemy` subpath's peer ranges (ADR 0031) also bumps `ALCHEMY_BASELINE`, so the constant a consumer's contract test checks against can never point at a version the subpath itself has moved past.
873
875
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "fingerprint": "46457b47d716fc0fa99d91a9d4e649da0090300310040a6adb50599b654c45d0"
2
+ "fingerprint": "a51cf2964415d5a6a2320d67ecf574f668811d7a1f49bf006a926ba9ac623c29"
3
3
  }
@@ -1,4 +1,4 @@
1
- import { n as ExecuteAlchemyEntryOptions } from "../execute-alchemy-entry-B397GSk5.js";
1
+ import { n as ExecuteAlchemyEntryOptions } from "../execute-alchemy-entry-BR5dFO9k.js";
2
2
  import * as Alchemy from "alchemy";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Layer from "effect/Layer";
@@ -222,11 +222,9 @@ declare const localEmulationEnvironment: (options: {
222
222
  * Stage and stack pairing, and protected-stage policy, from a project-supplied
223
223
  * table (#991).
224
224
  *
225
- * Two projects wrote the same three questions twice — is this stage protected,
226
- * is it disposable, and may this stack run it — and each answered them with its
227
- * own stage names hard-coded into the answer. The names differ; the questions
228
- * do not. This module owns the questions. A project supplies the table and gets
229
- * decisions back, so no project or stack name appears here.
225
+ * This module owns whether a stage is protected, whether it is disposable, and
226
+ * whether a stack may run it. A project supplies the table and gets decisions
227
+ * back, so no project or stack name appears here.
230
228
  *
231
229
  * One stage name does appear: `local`. It names the local emulator rather than
232
230
  * any project's estate, every project spells it the same way, and the question
@@ -325,15 +323,6 @@ declare const stagePolicy: (table: StagePolicyTable) => StagePolicy;
325
323
  /**
326
324
  * Cloudflare credential preflight for an Alchemy deploy.
327
325
  *
328
- * Two projects built this twice. Paitronage
329
- * (`scripts/alchemy/credential-preflight.ts` plus
330
- * `scripts/alchemy/cloudflare-token-policy.ts`) and firedup
331
- * (`scripts/alchemy/local-credentials.ts`) both resolve a Cloudflare API
332
- * token, verify it is live, and refuse to deploy unless its permission groups
333
- * match an exact reviewed list. What repeats is the check. What does not
334
- * repeat is the account, the permission list, the resource scope, and where
335
- * the credential comes from, so every one of those is an input.
336
- *
337
326
  * **No credential value is ever printed.** Errors name environment variables and
338
327
  * missing groups from the caller-owned permission requirements. Untrusted API
339
328
  * status, receipt group names, and resource identifiers are never reflected.
@@ -444,11 +433,7 @@ declare const credentialPreflight: ({
444
433
  *
445
434
  * Alchemy's `destroy` can exit zero while the state store still lists
446
435
  * resources for the stage — a partial destroy, a resource whose delete failed
447
- * quietly, or a state row that was never removed. Paitronage checks the state
448
- * store after the child exits rather than trusting the exit code
449
- * (`runAlchemyLifecycle`, the `"Alchemy destroy left target-stage state
450
- * registered."` branch). Firedup carries no equivalent, which is exactly the
451
- * gap this closes.
436
+ * quietly, or a state row that was never removed.
452
437
  *
453
438
  * Reading the state store is the project's job: only the project knows which
454
439
  * store it configured and how to address a stage in it. This function owns the
@@ -744,7 +729,7 @@ declare const isAlchemyLifecycleError: (error: unknown) => error is AlchemyLifec
744
729
  * The renderer logs every line through Effect's pretty console logger, so a
745
730
  * line arrives as `[HH:MM:SS.mmm] INFO (#1): <line>`, and coloured when the
746
731
  * child inherits `FORCE_COLOR`. Both wrappers are stripped before a line is
747
- * read. The captured output under `tests/fixtures/plan-output/beta-83/` is
732
+ * read. The captured output under `tests/fixtures/plan-output/beta-84/` is
748
733
  * the evidence for every shape this file reads.
749
734
  *
750
735
  * The adapter fails on anything it does not recognise: no summary, two
@@ -821,8 +806,7 @@ declare const parsePlanEffects: (output: string) => PlanEffects;
821
806
  * else: the child's output is parsed and dropped, so no secret in it can
822
807
  * reach a job log or an evidence file through the operation. That is the
823
808
  * right default and it stays the default. It also leaves an operator with a
824
- * failure code and no record of what failed, which twice cost a paitronage
825
- * investigation its evidence.
809
+ * failure code and no record of what failed.
826
810
  *
827
811
  * This is the opt-in other half: a consumer that names a file gets every
828
812
  * child's streams appended to it, each stream passed whole through the
@@ -1,4 +1,4 @@
1
- import { i as isLocalPreviewStage, n as executeAlchemyEntry, r as resolveAlchemyChildCwd, s as ALCHEMY_BASELINE } from "../execute-alchemy-entry-C2ZhsNTN.js";
1
+ import { i as isLocalPreviewStage, n as executeAlchemyEntry, r as resolveAlchemyChildCwd, s as ALCHEMY_BASELINE } from "../execute-alchemy-entry-CDMdbXIi.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { createHash } from "node:crypto";
@@ -167,15 +167,6 @@ const assertRetainedIdentities = ({ after, before, markers }) => {
167
167
  /**
168
168
  * Cloudflare credential preflight for an Alchemy deploy.
169
169
  *
170
- * Two projects built this twice. Paitronage
171
- * (`scripts/alchemy/credential-preflight.ts` plus
172
- * `scripts/alchemy/cloudflare-token-policy.ts`) and firedup
173
- * (`scripts/alchemy/local-credentials.ts`) both resolve a Cloudflare API
174
- * token, verify it is live, and refuse to deploy unless its permission groups
175
- * match an exact reviewed list. What repeats is the check. What does not
176
- * repeat is the account, the permission list, the resource scope, and where
177
- * the credential comes from, so every one of those is an input.
178
- *
179
170
  * **No credential value is ever printed.** Errors name environment variables and
180
171
  * missing groups from the caller-owned permission requirements. Untrusted API
181
172
  * status, receipt group names, and resource identifiers are never reflected.
@@ -339,11 +330,9 @@ const credentialPreflight = async ({ accountId, environment, fetchImplementation
339
330
  * Stage and stack pairing, and protected-stage policy, from a project-supplied
340
331
  * table (#991).
341
332
  *
342
- * Two projects wrote the same three questions twice — is this stage protected,
343
- * is it disposable, and may this stack run it — and each answered them with its
344
- * own stage names hard-coded into the answer. The names differ; the questions
345
- * do not. This module owns the questions. A project supplies the table and gets
346
- * decisions back, so no project or stack name appears here.
333
+ * This module owns whether a stage is protected, whether it is disposable, and
334
+ * whether a stack may run it. A project supplies the table and gets decisions
335
+ * back, so no project or stack name appears here.
347
336
  *
348
337
  * One stage name does appear: `local`. It names the local emulator rather than
349
338
  * any project's estate, every project spells it the same way, and the question
@@ -488,9 +477,10 @@ const [ACCOUNT_ID_NAME, API_TOKEN_NAME] = HOSTED_CLOUDFLARE_CREDENTIAL_NAMES;
488
477
  * Alchemy validates the value against `/^[0-9a-f]{32}$/i` and rejects
489
478
  * placeholders such as `""` or `dummy` with an authentication error before any
490
479
  * run starts. The check is `validateAccountId`, in
491
- * `alchemy/lib/Cloudflare/Auth/AuthProvider.js` at 2.0.0-beta.76 and in
492
- * `alchemy/lib/Cloudflare/Auth/AuthConfig.js` at 2.0.0-beta.77. The file name
493
- * moves; the pattern is the same in both. Thirty-two zeros pass that shape
480
+ * `alchemy/lib/Cloudflare/Auth/AuthProvider.js` at 2.0.0-beta.76, in
481
+ * `alchemy/lib/Cloudflare/Auth/AuthConfig.js` at 2.0.0-beta.77, and in
482
+ * `@alchemy.run/cloudflare/lib/Auth/AuthConfig.js` from 2.0.0-beta.84. The
483
+ * file moves; the pattern is the same in all three. Thirty-two zeros pass that shape
494
484
  * check and route to nothing.
495
485
  */
496
486
  const SENTINEL_ACCOUNT_ID = "0".repeat(32);
@@ -585,7 +575,7 @@ const assertDestroyLeftNothing = async ({ stack, stage, stateReader }) => {
585
575
  * The renderer logs every line through Effect's pretty console logger, so a
586
576
  * line arrives as `[HH:MM:SS.mmm] INFO (#1): <line>`, and coloured when the
587
577
  * child inherits `FORCE_COLOR`. Both wrappers are stripped before a line is
588
- * read. The captured output under `tests/fixtures/plan-output/beta-83/` is
578
+ * read. The captured output under `tests/fixtures/plan-output/beta-84/` is
589
579
  * the evidence for every shape this file reads.
590
580
  *
591
581
  * The adapter fails on anything it does not recognise: no summary, two
@@ -937,10 +927,7 @@ const canonicalPlan = (output) => {
937
927
  *
938
928
  * The first deploy of a stack into a stage is the one deploy no earlier state
939
929
  * can constrain: there is nothing to diff against, so the plan is the only
940
- * description of what is about to be created. Paitronage binds that plan to an
941
- * operator decision by hashing it and comparing the hash against a reviewed
942
- * value (`firstDeployPlanSha256` and `assertFirstDeployEntry` in
943
- * `tools/alchemy/src/internal/lifecycle.ts`).
930
+ * description of what is about to be created.
944
931
  *
945
932
  * The generic form keeps the binding and drops the project's stage policy.
946
933
  * Which stages are eligible, and where the authorized hashes are kept, stay
@@ -1383,8 +1370,7 @@ const deleteStageRows = async (state, target) => {
1383
1370
  * else: the child's output is parsed and dropped, so no secret in it can
1384
1371
  * reach a job log or an evidence file through the operation. That is the
1385
1372
  * right default and it stays the default. It also leaves an operator with a
1386
- * failure code and no record of what failed, which twice cost a paitronage
1387
- * investigation its evidence.
1373
+ * failure code and no record of what failed.
1388
1374
  *
1389
1375
  * This is the opt-in other half: a consumer that names a file gets every
1390
1376
  * child's streams appended to it, each stream passed whole through the
@@ -1463,12 +1449,6 @@ const openChildDiagnostics = ({ child, diagnostics, operation, stack, stage }) =
1463
1449
  * back a fixed-shape result or an `AlchemyLifecycleError`. It cannot call the
1464
1450
  * steps in another order, because it does not call the steps.
1465
1451
  *
1466
- * Paitronage and HQ each reconstructed this sequence from the guards in
1467
- * `./` and got parts of it wrong in different ways (paitronage#1917): a
1468
- * post-child failure reported as not started, an empty-stage cleanup racing
1469
- * a concurrent write, a plan whose immutability check ignored stack output.
1470
- * The sequence below is the one both were reaching for.
1471
- *
1472
1452
  * What stays with the consumer: the resource graph, the credentials and
1473
1453
  * environment the child runs with, the stage table, the retained-identity
1474
1454
  * markers, the first-deploy authorization list, and the state store's own
@@ -1645,7 +1625,7 @@ var LifecycleRun = class {
1645
1625
  return;
1646
1626
  }
1647
1627
  try {
1648
- const { bundleAlchemyEntry } = await import("../bundle-alchemy-entry-CT5hCphA.js").then((n) => n.n);
1628
+ const { bundleAlchemyEntry } = await import("../bundle-alchemy-entry-BuMrl5fR.js").then((n) => n.n);
1649
1629
  this.bundledEntry = await bundleAlchemyEntry(this.entry.bundle);
1650
1630
  } catch {
1651
1631
  throw this.fail("PREPARATION_FAILED", "admission");
@@ -75,12 +75,9 @@ const assertNoReservedInputs = (inputs) => {
75
75
  * Pre-bundle an Alchemy entry to a single ESM file, keeping `alchemy` and
76
76
  * `effect` external (#268).
77
77
  *
78
- * Both repos that deploy through Alchemy wrote this: the Alchemy CLI runs a
79
- * JavaScript entry, so a TypeScript `alchemy.run.ts` has to be flattened
80
- * first, and the flattening must not swallow the two packages whose identity
81
- * matters. Firedup additionally resolved esbuild *through vite* because it had
82
- * no direct dependency on it; here esbuild is a plain dependency of this
83
- * package and that hack can be deleted.
78
+ * The Alchemy CLI runs a JavaScript entry, so a TypeScript `alchemy.run.ts`
79
+ * has to be flattened first, and the flattening must not swallow the two
80
+ * packages whose identity matters.
84
81
  *
85
82
  * Returns the absolute path of the file written.
86
83
  */
@@ -37,12 +37,9 @@ interface BundleAlchemyEntryOptions {
37
37
  * Pre-bundle an Alchemy entry to a single ESM file, keeping `alchemy` and
38
38
  * `effect` external (#268).
39
39
  *
40
- * Both repos that deploy through Alchemy wrote this: the Alchemy CLI runs a
41
- * JavaScript entry, so a TypeScript `alchemy.run.ts` has to be flattened
42
- * first, and the flattening must not swallow the two packages whose identity
43
- * matters. Firedup additionally resolved esbuild *through vite* because it had
44
- * no direct dependency on it; here esbuild is a plain dependency of this
45
- * package and that hack can be deleted.
40
+ * The Alchemy CLI runs a JavaScript entry, so a TypeScript `alchemy.run.ts`
41
+ * has to be flattened first, and the flattening must not swallow the two
42
+ * packages whose identity matters.
46
43
  *
47
44
  * Returns the absolute path of the file written.
48
45
  */
@@ -12,13 +12,16 @@ import { spawnSync } from "node:child_process";
12
12
  * `effect`, so it ships from the root entry, not the `./alchemy` subpath.
13
13
  */
14
14
  const ALCHEMY_BASELINE = {
15
- alchemy: "2.0.0-beta.83",
16
- effect: "4.0.1"
15
+ alchemy: "2.0.0-beta.84",
16
+ effect: "4.0.6"
17
17
  };
18
18
  const BASELINE_PACKAGE_NAMES = Object.keys(ALCHEMY_BASELINE);
19
+ const ALCHEMY_PROVIDER_PACKAGE_NAMES = ["@alchemy.run/cloudflare"];
19
20
  /**
20
21
  * Fails when the consumer's `alchemy` or `effect` pin differs from
21
- * {@link ALCHEMY_BASELINE}, or when only one of the pair is present.
22
+ * {@link ALCHEMY_BASELINE}, when the pair is incomplete (a pinned Alchemy
23
+ * provider package such as `@alchemy.run/cloudflare` demands both), or when a
24
+ * pinned provider package is not at the baseline `alchemy` version.
22
25
  * Alchemy peers on Effect, so an unpinned auto-installed Effect can drift
23
26
  * outside the baseline while a lone `alchemy` pin would otherwise pass.
24
27
  * Both packages remaining absent is not drift — they are optional peers of
@@ -31,7 +34,7 @@ const BASELINE_PACKAGE_NAMES = Object.keys(ALCHEMY_BASELINE);
31
34
  const assertAlchemyBaseline = ({ packageJson }) => {
32
35
  const drifted = [];
33
36
  const pinOf = (name) => packageJson.dependencies?.[name] ?? packageJson.devDependencies?.[name];
34
- const pairPresent = BASELINE_PACKAGE_NAMES.some((name) => pinOf(name) !== void 0);
37
+ const pairPresent = [...BASELINE_PACKAGE_NAMES, ...ALCHEMY_PROVIDER_PACKAGE_NAMES].some((name) => pinOf(name) !== void 0);
35
38
  for (const name of BASELINE_PACKAGE_NAMES) {
36
39
  const pinned = pinOf(name);
37
40
  const baseline = ALCHEMY_BASELINE[name];
@@ -41,6 +44,10 @@ const assertAlchemyBaseline = ({ packageJson }) => {
41
44
  }
42
45
  if (pinned !== baseline) drifted.push(`${name}@${pinned} (baseline: ${name}@${baseline})`);
43
46
  }
47
+ for (const name of ALCHEMY_PROVIDER_PACKAGE_NAMES) {
48
+ const pinned = pinOf(name);
49
+ if (pinned !== void 0 && pinned !== ALCHEMY_BASELINE.alchemy) drifted.push(`${name}@${pinned} (baseline: ${name}@${ALCHEMY_BASELINE.alchemy})`);
50
+ }
44
51
  if (drifted.length > 0) throw new Error(`Alchemy fleet baseline drift: ${drifted.join(", ")}. Bump to match ALCHEMY_BASELINE in @patronage/factory-ci, or wait for the next lockstep release.`);
45
52
  };
46
53
  //#endregion
@@ -49,9 +56,8 @@ const assertAlchemyBaseline = ({ packageJson }) => {
49
56
  * The disposable Alchemy stage a local preview deploy runs in:
50
57
  * `local-pr-<pr>-<short sha>` (#268).
51
58
  *
52
- * Two repos invented this grammar independently and then had to agree on it
53
- * anyway, because the same cleanup sweeps delete these stages. A stage that
54
- * does not match is not disposable, and destructive operations must refuse it.
59
+ * A stage that does not match is not disposable, and destructive operations
60
+ * must refuse it.
55
61
  */
56
62
  const LOCAL_PREVIEW_STAGE_PATTERN = /^local-pr-(?<pr>[1-9]\d*)-(?<sha>[0-9a-f]{7,40})$/u;
57
63
  /**
@@ -107,7 +113,7 @@ let spawnImplementation = spawnSync;
107
113
  const resolveAlchemyChildCwd = (options) => options.cwd ?? options.bundle?.absWorkingDir ?? process.cwd();
108
114
  const resolveBundledEntry = async (options) => {
109
115
  if (options.bundledEntry === void 0) {
110
- const { bundleAlchemyEntry } = await import("./bundle-alchemy-entry-CT5hCphA.js").then((n) => n.n);
116
+ const { bundleAlchemyEntry } = await import("./bundle-alchemy-entry-BuMrl5fR.js").then((n) => n.n);
111
117
  return await bundleAlchemyEntry(options.bundle);
112
118
  }
113
119
  return path.resolve(options.cwd ?? process.cwd(), options.bundledEntry);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as BundleAlchemyEntryOptions, i as executeAlchemyEntry, n as ExecuteAlchemyEntryOptions, o as bundleAlchemyEntry, r as ExecuteAlchemyEntryResult, t as EXECUTE_ALCHEMY_ENTRY_MAX_BUFFER } from "./execute-alchemy-entry-B397GSk5.js";
1
+ import { a as BundleAlchemyEntryOptions, i as executeAlchemyEntry, n as ExecuteAlchemyEntryOptions, o as bundleAlchemyEntry, r as ExecuteAlchemyEntryResult, t as EXECUTE_ALCHEMY_ENTRY_MAX_BUFFER } from "./execute-alchemy-entry-BR5dFO9k.js";
2
2
  import { StdioOptions } from "node:child_process";
3
3
 
4
4
  //#region src/alchemy-baseline.d.ts
@@ -12,8 +12,8 @@ import { StdioOptions } from "node:child_process";
12
12
  * `effect`, so it ships from the root entry, not the `./alchemy` subpath.
13
13
  */
14
14
  declare const ALCHEMY_BASELINE: {
15
- readonly alchemy: "2.0.0-beta.83";
16
- readonly effect: "4.0.1";
15
+ readonly alchemy: "2.0.0-beta.84";
16
+ readonly effect: "4.0.6";
17
17
  };
18
18
  /**
19
19
  * The slice of a consumer's `package.json` that carries the pins this
@@ -30,7 +30,9 @@ interface AssertAlchemyBaselineInput {
30
30
  }
31
31
  /**
32
32
  * Fails when the consumer's `alchemy` or `effect` pin differs from
33
- * {@link ALCHEMY_BASELINE}, or when only one of the pair is present.
33
+ * {@link ALCHEMY_BASELINE}, when the pair is incomplete (a pinned Alchemy
34
+ * provider package such as `@alchemy.run/cloudflare` demands both), or when a
35
+ * pinned provider package is not at the baseline `alchemy` version.
34
36
  * Alchemy peers on Effect, so an unpinned auto-installed Effect can drift
35
37
  * outside the baseline while a lone `alchemy` pin would otherwise pass.
36
38
  * Both packages remaining absent is not drift — they are optional peers of
@@ -49,13 +51,6 @@ declare const assertAlchemyBaseline: ({
49
51
  * The GitHub Actions this family's workflow generators use, pinned to full
50
52
  * commit SHAs in one place (#268).
51
53
  *
52
- * Every repository pinned the same *tags* and got different *commits*: this
53
- * repository's `verify.yml` carried `actions/checkout@11d5960a` while
54
- * `hq-deploy.yml` and all of paitronage carried `34e11487`, because gagen
55
- * resolves a floating `@v4` at generation time and the files were generated
56
- * months apart. Naming the SHA here is what makes that class of drift
57
- * impossible: regenerating a workflow can no longer move a pin.
58
- *
59
54
  * `uses` is a bare `owner/repo@<sha>` string, safe to hand straight to a
60
55
  * gagen step. The tag lives in its own field rather than as a `# v7.0.1`
61
56
  * suffix on `uses`, because a `#` inside a YAML scalar forces quoting and
@@ -644,11 +639,7 @@ declare const mintInstallationToken: (input: {
644
639
  * reuse the local verification the factory already published for *this exact
645
640
  * head*? It asks that only on a pull request, so every default-branch push
646
641
  * executes the full hosted suite (#863). Refusing runs hosted CI; it never
647
- * fails the candidate. Three
648
- * repositories had independently grown their own answer to that question and
649
- * had already drifted apart, so the answer lives here once, with the App
650
- * identity, check name, step identity, output names, guard, and every trust
651
- * predicate fixed rather than consumer-configurable.
642
+ * fails the candidate.
652
643
  *
653
644
  * What a consumer chooses is only *what its guarded surface requires*: the
654
645
  * plain profile command objects that surface selects. Everything else below is
@@ -738,8 +729,8 @@ declare const FACTORY_PROOF_GATE_GUARD = "steps.factory-proof.outputs.reuse-proo
738
729
  */
739
730
  declare const FACTORY_PROOF_GATE_IF = "github.event_name == 'pull_request'";
740
731
  /**
741
- * The complete refusal vocabulary. Deliberately few, because these are the
742
- * only distinctions the gate can honestly make from its Checks API reads.
732
+ * The complete refusal vocabulary: the only distinctions the gate can make
733
+ * from its Checks API reads.
743
734
  *
744
735
  * - `proven` a covering, passing, unambiguous proof for this exact head
745
736
  * - `none` no App-verified factory check run at this commit
@@ -750,14 +741,11 @@ declare const FACTORY_PROOF_GATE_IF = "github.event_name == 'pull_request'";
750
741
  * cover every required command
751
742
  * - `ambiguous` two different generations share the newest instant, the
752
743
  * newest repeats another run's verdict with no proof time to
753
- * tell them apart, a run's start time cannot be ranked, or the
754
- * newest pass started before another run at this head was
755
- * posted
744
+ * tell them apart, a run's start time cannot be ranked, the
745
+ * newest pass records no verification start beside another run
746
+ * at this head (#1514), or the newest pass started before
747
+ * another run at this head was posted
756
748
  * - `error` the gate could not reach a decision (fail open)
757
- *
758
- * There is no `reduced`: mode stopped being an authorization condition in
759
- * ADR 0022, so a narrower run that still executed every required command is
760
- * indistinguishable from a full one *for this surface*, which is the point.
761
749
  */
762
750
  declare const FACTORY_PROOF_GATE_REASONS: readonly ["proven", "none", "pending", "failed", "unreadable", "incomplete", "ambiguous", "error"];
763
751
  type FactoryProofGateReason = (typeof FACTORY_PROOF_GATE_REASONS)[number];
@@ -788,31 +776,12 @@ interface ProofReuseCommand {
788
776
  */
789
777
  declare const proofReuseRequiredCommands: (commands: readonly ProofReuseCommand[]) => readonly string[] | undefined;
790
778
  /**
791
- * Resolve command *identities* to their `ProofReuseCommand` objects (ADR
792
- * 0021).
793
- *
794
- * Selection by name is deliberately a consumer decision (proof-surfaces.ts in
795
- * software-factory-hq, the `paitronage:verify` filter in paitronage's
796
- * `verify.ts`): only the consumer knows which named commands a guarded
797
- * surface requires. What both of those implementations independently
798
- * hand-rolled is the same lookup — find each name in the profile's command
799
- * catalog, and refuse to silently shrink the required set when a name has no
800
- * entry. That lookup is what this function is: the mechanic, not the
801
- * selection.
802
- *
803
- * Throwing at generation time (rather than returning `undefined` or an empty
804
- * array) is deliberate: a name with no catalog entry is a mistake in the
805
- * generator source, not a runtime condition a consumer should have to check
806
- * for, and a required set that quietly loses an entry is exactly what makes a
807
- * passing proof trivially "covering".
808
- *
809
- * `selectionLabel` names the failure, nothing else: it is not part of the
810
- * selection this function resolves, only prose a consumer supplies for its
811
- * own thrown error (e.g. HQ's surface name, "core" or "docs"). The message
812
- * deliberately says "the profile's command catalog" rather than naming
813
- * `software-factory.profile.json`: a fleet-generic library must not assume
814
- * every consumer's catalog is that exact file, so this wording differs
815
- * on purpose from the HQ-local message it replaced.
779
+ * Resolve command identities to their `ProofReuseCommand` objects (ADR 0021).
780
+ * Which names a surface requires is the consumer's choice; this is only the
781
+ * lookup. A name with no catalog entry throws at generation time, because a
782
+ * required set that quietly loses an entry makes any passing proof covering.
783
+ * The message says "the profile's command catalog" rather than a file name,
784
+ * since not every consumer's catalog is `software-factory.profile.json`.
816
785
  */
817
786
  declare const resolveProofReuseCommands: (catalog: readonly ProofReuseCommand[], names: readonly string[], selectionLabel?: string) => readonly ProofReuseCommand[];
818
787
  interface FactoryProofGateOptions {
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as bundleAlchemyEntry } from "./bundle-alchemy-entry-CT5hCphA.js";
2
- import { a as localPreviewStage, c as assertAlchemyBaseline, i as isLocalPreviewStage, n as executeAlchemyEntry, o as parseLocalPreviewStage, s as ALCHEMY_BASELINE, t as EXECUTE_ALCHEMY_ENTRY_MAX_BUFFER } from "./execute-alchemy-entry-C2ZhsNTN.js";
1
+ import { t as bundleAlchemyEntry } from "./bundle-alchemy-entry-BuMrl5fR.js";
2
+ import { a as localPreviewStage, c as assertAlchemyBaseline, i as isLocalPreviewStage, n as executeAlchemyEntry, o as parseLocalPreviewStage, s as ALCHEMY_BASELINE, t as EXECUTE_ALCHEMY_ENTRY_MAX_BUFFER } from "./execute-alchemy-entry-CDMdbXIi.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
5
5
  import path from "node:path";
@@ -291,12 +291,9 @@ const githubJson$1 = async (options, errors) => {
291
291
  * Minting a GitHub App installation token: the RS256 app JWT, the optional
292
292
  * installation lookup, and the token exchange (#617).
293
293
  *
294
- * Two projects had grown the same three steps independently — the factory's
295
- * check-run publisher and paitronage's proof-comment publisher — which is the
296
- * admitted-on-repetition bar. Only the *mechanism* lives here. Where the
297
- * private key comes from, how the app id is configured, and what the token is
298
- * then used for stay with each consumer: this module is handed credentials and
299
- * returns a token.
294
+ * Only the *mechanism* lives here. Where the private key comes from, how the
295
+ * app id is configured, and what the token is then used for stay with each
296
+ * consumer: this module is handed credentials and returns a token.
300
297
  */
301
298
  /** The default request budget, matching the factory's other GitHub writes. */
302
299
  const DEFAULT_TIMEOUT_MS$2 = 5e3;
@@ -409,11 +406,7 @@ const mintInstallationToken = async (input, options = {}) => {
409
406
  * reuse the local verification the factory already published for *this exact
410
407
  * head*? It asks that only on a pull request, so every default-branch push
411
408
  * executes the full hosted suite (#863). Refusing runs hosted CI; it never
412
- * fails the candidate. Three
413
- * repositories had independently grown their own answer to that question and
414
- * had already drifted apart, so the answer lives here once, with the App
415
- * identity, check name, step identity, output names, guard, and every trust
416
- * predicate fixed rather than consumer-configurable.
409
+ * fails the candidate.
417
410
  *
418
411
  * What a consumer chooses is only *what its guarded surface requires*: the
419
412
  * plain profile command objects that surface selects. Everything else below is
@@ -522,8 +515,8 @@ const FACTORY_PROOF_GATE_GUARD = `steps.${FACTORY_PROOF_GATE_STEP_ID}.outputs.${
522
515
  */
523
516
  const FACTORY_PROOF_GATE_IF = "github.event_name == 'pull_request'";
524
517
  /**
525
- * The complete refusal vocabulary. Deliberately few, because these are the
526
- * only distinctions the gate can honestly make from its Checks API reads.
518
+ * The complete refusal vocabulary: the only distinctions the gate can make
519
+ * from its Checks API reads.
527
520
  *
528
521
  * - `proven` a covering, passing, unambiguous proof for this exact head
529
522
  * - `none` no App-verified factory check run at this commit
@@ -534,14 +527,11 @@ const FACTORY_PROOF_GATE_IF = "github.event_name == 'pull_request'";
534
527
  * cover every required command
535
528
  * - `ambiguous` two different generations share the newest instant, the
536
529
  * newest repeats another run's verdict with no proof time to
537
- * tell them apart, a run's start time cannot be ranked, or the
538
- * newest pass started before another run at this head was
539
- * posted
530
+ * tell them apart, a run's start time cannot be ranked, the
531
+ * newest pass records no verification start beside another run
532
+ * at this head (#1514), or the newest pass started before
533
+ * another run at this head was posted
540
534
  * - `error` the gate could not reach a decision (fail open)
541
- *
542
- * There is no `reduced`: mode stopped being an authorization condition in
543
- * ADR 0022, so a narrower run that still executed every required command is
544
- * indistinguishable from a full one *for this surface*, which is the point.
545
535
  */
546
536
  const FACTORY_PROOF_GATE_REASONS = [
547
537
  "proven",
@@ -622,31 +612,12 @@ const proofReuseRequiredCommands = (commands) => {
622
612
  return names.toSorted();
623
613
  };
624
614
  /**
625
- * Resolve command *identities* to their `ProofReuseCommand` objects (ADR
626
- * 0021).
627
- *
628
- * Selection by name is deliberately a consumer decision (proof-surfaces.ts in
629
- * software-factory-hq, the `paitronage:verify` filter in paitronage's
630
- * `verify.ts`): only the consumer knows which named commands a guarded
631
- * surface requires. What both of those implementations independently
632
- * hand-rolled is the same lookup — find each name in the profile's command
633
- * catalog, and refuse to silently shrink the required set when a name has no
634
- * entry. That lookup is what this function is: the mechanic, not the
635
- * selection.
636
- *
637
- * Throwing at generation time (rather than returning `undefined` or an empty
638
- * array) is deliberate: a name with no catalog entry is a mistake in the
639
- * generator source, not a runtime condition a consumer should have to check
640
- * for, and a required set that quietly loses an entry is exactly what makes a
641
- * passing proof trivially "covering".
642
- *
643
- * `selectionLabel` names the failure, nothing else: it is not part of the
644
- * selection this function resolves, only prose a consumer supplies for its
645
- * own thrown error (e.g. HQ's surface name, "core" or "docs"). The message
646
- * deliberately says "the profile's command catalog" rather than naming
647
- * `software-factory.profile.json`: a fleet-generic library must not assume
648
- * every consumer's catalog is that exact file, so this wording differs
649
- * on purpose from the HQ-local message it replaced.
615
+ * Resolve command identities to their `ProofReuseCommand` objects (ADR 0021).
616
+ * Which names a surface requires is the consumer's choice; this is only the
617
+ * lookup. A name with no catalog entry throws at generation time, because a
618
+ * required set that quietly loses an entry makes any passing proof covering.
619
+ * The message says "the profile's command catalog" rather than a file name,
620
+ * since not every consumer's catalog is `software-factory.profile.json`.
650
621
  */
651
622
  const resolveProofReuseCommands = (catalog, names, selectionLabel) => names.map((name) => {
652
623
  const command = catalog.find((entry) => entry.name === name);
@@ -1026,15 +997,6 @@ def releaseAuthorized($release; $commands; $stamp):
1026
997
  | map(gsub("[\\r\\n\\t]"; " "))
1027
998
  | join("\n")
1028
999
  `.trim();
1029
- /**
1030
- * Every refusal ends on the same line. `pr:verify` is the command that
1031
- * produces the proof this job looks for, so it is the corrective action
1032
- * whatever the refusal was.
1033
- *
1034
- * It is phrased as an option, not a reprimand. A pull request opened by hand
1035
- * has no factory proof and never will; the full suite running for it is the
1036
- * designed behavior, not a mistake to report.
1037
- */
1038
1000
  const CORRECTIVE_LINE = "Run `psf pr:verify` before publishing to reuse local proof and avoid a duplicate server run.";
1039
1001
  /**
1040
1002
  * Emitted when a consumer's command selection is unusable. Mirrors the
@@ -1995,9 +1957,6 @@ say '## ${label} timing'
1995
1957
  say ''
1996
1958
 
1997
1959
  if [ "${shellExpansion("GITHUB_EVENT_NAME:-")}" = 'push' ] && [ -z "${shellExpansion("PROOF_REASON:-")}" ]; then
1998
- # A push run with no recorded reason is one where the gate step's condition
1999
- # kept it off entirely, so the full suite ran with no reuse decision. The
2000
- # gate runs on pull requests only (#863), so that is every push.
2001
1960
  say '- Path: full execution, no proof consulted'
2002
1961
  say '- Proof-reuse gate: did not run on this ref; the full suite ran.'
2003
1962
  say "- Verified head: \`${shellExpansion("GITHUB_SHA:-unknown")}\`"
@@ -3188,11 +3147,6 @@ const factoryPreviewReceiptWorkflow = (options) => {
3188
3147
  * the pin it validates against. */
3189
3148
  const UPLOAD_ARTIFACT_REPOSITORY = UPLOAD_ARTIFACT.uses.slice(0, UPLOAD_ARTIFACT.uses.indexOf("@"));
3190
3149
  const FACTORY_PUSH_IDENTITY_SCHEMA_VERSION = 1;
3191
- /**
3192
- * The artifact prefix and the five step IDs are module-private. Alpha.13
3193
- * removed them from the public surface (#719). A caller reads a step ID from
3194
- * the builder's returned `steps` (`step.id`) or from `artifactName`.
3195
- */
3196
3150
  const FACTORY_PUSH_IDENTITY_ARTIFACT_PREFIX = "factory-push-identity";
3197
3151
  const FACTORY_PUSH_IDENTITY_RECORD_STEP_ID = "factory_push_identity_record";
3198
3152
  const FACTORY_PUSH_IDENTITY_LOOKUP_STEP_ID = "factory_push_identity_lookup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patronage/factory-ci",
3
- "version": "1.0.0-alpha.44",
3
+ "version": "1.0.0-alpha.45",
4
4
  "description": "Deep CI and deploy building blocks for Patronage factory projects: workflow source artifacts, hosted diff classification, Alchemy entry execution, and disposable-stage semantics",
5
5
  "keywords": [
6
6
  "alchemy",
@@ -38,10 +38,11 @@
38
38
  "esbuild": "0.28.1"
39
39
  },
40
40
  "devDependencies": {
41
+ "@alchemy.run/cloudflare": "2.0.0-beta.84",
41
42
  "@types/node": "24.13.3",
42
43
  "@vitest/coverage-v8": "4.1.10",
43
- "alchemy": "2.0.0-beta.83",
44
- "effect": "4.0.1",
44
+ "alchemy": "2.0.0-beta.84",
45
+ "effect": "4.0.6",
45
46
  "knip": "6.27.0",
46
47
  "oxfmt": "0.59.0",
47
48
  "oxlint": "1.76.0",
package/src/actions.ts CHANGED
@@ -2,13 +2,6 @@
2
2
  * The GitHub Actions this family's workflow generators use, pinned to full
3
3
  * commit SHAs in one place (#268).
4
4
  *
5
- * Every repository pinned the same *tags* and got different *commits*: this
6
- * repository's `verify.yml` carried `actions/checkout@11d5960a` while
7
- * `hq-deploy.yml` and all of paitronage carried `34e11487`, because gagen
8
- * resolves a floating `@v4` at generation time and the files were generated
9
- * months apart. Naming the SHA here is what makes that class of drift
10
- * impossible: regenerating a workflow can no longer move a pin.
11
- *
12
5
  * `uses` is a bare `owner/repo@<sha>` string, safe to hand straight to a
13
6
  * gagen step. The tag lives in its own field rather than as a `# v7.0.1`
14
7
  * suffix on `uses`, because a `#` inside a YAML scalar forces quoting and
@@ -5,8 +5,7 @@
5
5
  * else: the child's output is parsed and dropped, so no secret in it can
6
6
  * reach a job log or an evidence file through the operation. That is the
7
7
  * right default and it stays the default. It also leaves an operator with a
8
- * failure code and no record of what failed, which twice cost a paitronage
9
- * investigation its evidence.
8
+ * failure code and no record of what failed.
10
9
  *
11
10
  * This is the opt-in other half: a consumer that names a file gets every
12
11
  * child's streams appended to it, each stream passed whole through the
@@ -1,15 +1,6 @@
1
1
  /**
2
2
  * Cloudflare credential preflight for an Alchemy deploy.
3
3
  *
4
- * Two projects built this twice. Paitronage
5
- * (`scripts/alchemy/credential-preflight.ts` plus
6
- * `scripts/alchemy/cloudflare-token-policy.ts`) and firedup
7
- * (`scripts/alchemy/local-credentials.ts`) both resolve a Cloudflare API
8
- * token, verify it is live, and refuse to deploy unless its permission groups
9
- * match an exact reviewed list. What repeats is the check. What does not
10
- * repeat is the account, the permission list, the resource scope, and where
11
- * the credential comes from, so every one of those is an input.
12
- *
13
4
  * **No credential value is ever printed.** Errors name environment variables and
14
5
  * missing groups from the caller-owned permission requirements. Untrusted API
15
6
  * status, receipt group names, and resource identifiers are never reflected.
@@ -3,11 +3,7 @@
3
3
  *
4
4
  * Alchemy's `destroy` can exit zero while the state store still lists
5
5
  * resources for the stage — a partial destroy, a resource whose delete failed
6
- * quietly, or a state row that was never removed. Paitronage checks the state
7
- * store after the child exits rather than trusting the exit code
8
- * (`runAlchemyLifecycle`, the `"Alchemy destroy left target-stage state
9
- * registered."` branch). Firedup carries no equivalent, which is exactly the
10
- * gap this closes.
6
+ * quietly, or a state row that was never removed.
11
7
  *
12
8
  * Reading the state store is the project's job: only the project knows which
13
9
  * store it configured and how to address a stage in it. This function owns the
@@ -7,10 +7,7 @@ import { canonicalPlan } from "./plan-effects.ts";
7
7
  *
8
8
  * The first deploy of a stack into a stage is the one deploy no earlier state
9
9
  * can constrain: there is nothing to diff against, so the plan is the only
10
- * description of what is about to be created. Paitronage binds that plan to an
11
- * operator decision by hashing it and comparing the hash against a reviewed
12
- * value (`firstDeployPlanSha256` and `assertFirstDeployEntry` in
13
- * `tools/alchemy/src/internal/lifecycle.ts`).
10
+ * description of what is about to be created.
14
11
  *
15
12
  * The generic form keeps the binding and drops the project's stage policy.
16
13
  * Which stages are eligible, and where the authorized hashes are kept, stay
@@ -10,12 +10,6 @@
10
10
  * back a fixed-shape result or an `AlchemyLifecycleError`. It cannot call the
11
11
  * steps in another order, because it does not call the steps.
12
12
  *
13
- * Paitronage and HQ each reconstructed this sequence from the guards in
14
- * `./` and got parts of it wrong in different ways (paitronage#1917): a
15
- * post-child failure reported as not started, an empty-stage cleanup racing
16
- * a concurrent write, a plan whose immutability check ignored stack output.
17
- * The sequence below is the one both were reaching for.
18
- *
19
13
  * What stays with the consumer: the resource graph, the credentials and
20
14
  * environment the child runs with, the stage table, the retained-identity
21
15
  * markers, the first-deploy authorization list, and the state store's own
@@ -474,8 +468,6 @@ class LifecycleRun {
474
468
  return { stack: this.request.stack, stage: this.request.stage };
475
469
  }
476
470
 
477
- // ── request and admission ────────────────────────────────────────────
478
-
479
471
  validateRequest(): void {
480
472
  const { operation, stack, stage } = this.request;
481
473
  if (
@@ -561,8 +553,6 @@ class LifecycleRun {
561
553
  }
562
554
  }
563
555
 
564
- // ── state ────────────────────────────────────────────────────────────
565
-
566
556
  /**
567
557
  * Run `body` under one stage lease. The lease is acquired at
568
558
  * `acquirePhase`, and every child `body` launches carries it, so no other
@@ -714,8 +704,6 @@ class LifecycleRun {
714
704
  return { output: view.output, resources: records };
715
705
  }
716
706
 
717
- // ── execution ────────────────────────────────────────────────────────
718
-
719
707
  private stageArgs(): readonly string[] {
720
708
  return ["--stage", this.request.stage];
721
709
  }
@@ -915,8 +903,6 @@ class LifecycleRun {
915
903
  return { before, effects: this.effectsOf(text, "postcondition"), text };
916
904
  }
917
905
 
918
- // ── operations ───────────────────────────────────────────────────────
919
-
920
906
  private planHashOf(text: string): string | undefined {
921
907
  const { firstDeploy } = this.policy;
922
908
  if (firstDeploy === undefined) {
@@ -28,9 +28,10 @@ const [ACCOUNT_ID_NAME, API_TOKEN_NAME] = HOSTED_CLOUDFLARE_CREDENTIAL_NAMES;
28
28
  * Alchemy validates the value against `/^[0-9a-f]{32}$/i` and rejects
29
29
  * placeholders such as `""` or `dummy` with an authentication error before any
30
30
  * run starts. The check is `validateAccountId`, in
31
- * `alchemy/lib/Cloudflare/Auth/AuthProvider.js` at 2.0.0-beta.76 and in
32
- * `alchemy/lib/Cloudflare/Auth/AuthConfig.js` at 2.0.0-beta.77. The file name
33
- * moves; the pattern is the same in both. Thirty-two zeros pass that shape
31
+ * `alchemy/lib/Cloudflare/Auth/AuthProvider.js` at 2.0.0-beta.76, in
32
+ * `alchemy/lib/Cloudflare/Auth/AuthConfig.js` at 2.0.0-beta.77, and in
33
+ * `@alchemy.run/cloudflare/lib/Auth/AuthConfig.js` from 2.0.0-beta.84. The
34
+ * file moves; the pattern is the same in all three. Thirty-two zeros pass that shape
34
35
  * check and route to nothing.
35
36
  */
36
37
  const SENTINEL_ACCOUNT_ID = "0".repeat(32);
@@ -15,7 +15,7 @@
15
15
  * The renderer logs every line through Effect's pretty console logger, so a
16
16
  * line arrives as `[HH:MM:SS.mmm] INFO (#1): <line>`, and coloured when the
17
17
  * child inherits `FORCE_COLOR`. Both wrappers are stripped before a line is
18
- * read. The captured output under `tests/fixtures/plan-output/beta-83/` is
18
+ * read. The captured output under `tests/fixtures/plan-output/beta-84/` is
19
19
  * the evidence for every shape this file reads.
20
20
  *
21
21
  * The adapter fails on anything it does not recognise: no summary, two
@@ -2,11 +2,9 @@
2
2
  * Stage and stack pairing, and protected-stage policy, from a project-supplied
3
3
  * table (#991).
4
4
  *
5
- * Two projects wrote the same three questions twice — is this stage protected,
6
- * is it disposable, and may this stack run it — and each answered them with its
7
- * own stage names hard-coded into the answer. The names differ; the questions
8
- * do not. This module owns the questions. A project supplies the table and gets
9
- * decisions back, so no project or stack name appears here.
5
+ * This module owns whether a stage is protected, whether it is disposable, and
6
+ * whether a stack may run it. A project supplies the table and gets decisions
7
+ * back, so no project or stack name appears here.
10
8
  *
11
9
  * One stage name does appear: `local`. It names the local emulator rather than
12
10
  * any project's estate, every project spells it the same way, and the question
@@ -2,11 +2,7 @@
2
2
  * The url-implies-auth invariant: a Worker the internet can reach declares how
3
3
  * it is authenticated (#994).
4
4
  *
5
- * A stack reaches production one Worker at a time, and the cheapest way to
6
- * publish an unauthenticated admin surface is to add `workersDev: true`, a
7
- * `domain`, or a route to a Worker that never had one. The Worker still works, nothing
8
- * fails, and the only record of the decision is a diff nobody re-read. This
9
- * check reads the evaluated graph instead and demands that every publicly
5
+ * This check reads the evaluated graph and demands that every publicly
10
6
  * reachable Worker names its guard.
11
7
  *
12
8
  * What counts as a guard is the project's call, not this module's. Patronage
@@ -8,8 +8,8 @@
8
8
  * `effect`, so it ships from the root entry, not the `./alchemy` subpath.
9
9
  */
10
10
  export const ALCHEMY_BASELINE = {
11
- alchemy: "2.0.0-beta.83",
12
- effect: "4.0.1",
11
+ alchemy: "2.0.0-beta.84",
12
+ effect: "4.0.6",
13
13
  } as const;
14
14
 
15
15
  /**
@@ -31,9 +31,17 @@ const BASELINE_PACKAGE_NAMES = Object.keys(
31
31
  ALCHEMY_BASELINE
32
32
  ) as (keyof typeof ALCHEMY_BASELINE)[];
33
33
 
34
+ // From 2.0.0-beta.84 the providers ship as their own packages, each peering
35
+ // on `alchemy` at the exact same version, and pnpm installs a mismatch with
36
+ // only a warning. A consumer that pins one must pin it at the baseline
37
+ // `alchemy` version.
38
+ const ALCHEMY_PROVIDER_PACKAGE_NAMES = ["@alchemy.run/cloudflare"] as const;
39
+
34
40
  /**
35
41
  * Fails when the consumer's `alchemy` or `effect` pin differs from
36
- * {@link ALCHEMY_BASELINE}, or when only one of the pair is present.
42
+ * {@link ALCHEMY_BASELINE}, when the pair is incomplete (a pinned Alchemy
43
+ * provider package such as `@alchemy.run/cloudflare` demands both), or when a
44
+ * pinned provider package is not at the baseline `alchemy` version.
37
45
  * Alchemy peers on Effect, so an unpinned auto-installed Effect can drift
38
46
  * outside the baseline while a lone `alchemy` pin would otherwise pass.
39
47
  * Both packages remaining absent is not drift — they are optional peers of
@@ -47,11 +55,14 @@ export const assertAlchemyBaseline = ({
47
55
  packageJson,
48
56
  }: AssertAlchemyBaselineInput): void => {
49
57
  const drifted: string[] = [];
50
- const pinOf = (name: keyof typeof ALCHEMY_BASELINE): string | undefined =>
58
+ const pinOf = (name: string): string | undefined =>
51
59
  packageJson.dependencies?.[name] ?? packageJson.devDependencies?.[name];
52
- const pairPresent = BASELINE_PACKAGE_NAMES.some(
53
- (name) => pinOf(name) !== undefined
54
- );
60
+ // A provider pin counts too: it peers on `effect` with a range, so a lone
61
+ // provider pin would let an auto-installed Effect drift off the baseline.
62
+ const pairPresent = [
63
+ ...BASELINE_PACKAGE_NAMES,
64
+ ...ALCHEMY_PROVIDER_PACKAGE_NAMES,
65
+ ].some((name) => pinOf(name) !== undefined);
55
66
 
56
67
  for (const name of BASELINE_PACKAGE_NAMES) {
57
68
  const pinned = pinOf(name);
@@ -67,6 +78,15 @@ export const assertAlchemyBaseline = ({
67
78
  }
68
79
  }
69
80
 
81
+ for (const name of ALCHEMY_PROVIDER_PACKAGE_NAMES) {
82
+ const pinned = pinOf(name);
83
+ if (pinned !== undefined && pinned !== ALCHEMY_BASELINE.alchemy) {
84
+ drifted.push(
85
+ `${name}@${pinned} (baseline: ${name}@${ALCHEMY_BASELINE.alchemy})`
86
+ );
87
+ }
88
+ }
89
+
70
90
  if (drifted.length > 0) {
71
91
  throw new Error(
72
92
  `Alchemy fleet baseline drift: ${drifted.join(", ")}. Bump to match ALCHEMY_BASELINE in @patronage/factory-ci, or wait for the next lockstep release.`
@@ -122,12 +122,9 @@ export interface BundleAlchemyEntryOptions {
122
122
  * Pre-bundle an Alchemy entry to a single ESM file, keeping `alchemy` and
123
123
  * `effect` external (#268).
124
124
  *
125
- * Both repos that deploy through Alchemy wrote this: the Alchemy CLI runs a
126
- * JavaScript entry, so a TypeScript `alchemy.run.ts` has to be flattened
127
- * first, and the flattening must not swallow the two packages whose identity
128
- * matters. Firedup additionally resolved esbuild *through vite* because it had
129
- * no direct dependency on it; here esbuild is a plain dependency of this
130
- * package and that hack can be deleted.
125
+ * The Alchemy CLI runs a JavaScript entry, so a TypeScript `alchemy.run.ts`
126
+ * has to be flattened first, and the flattening must not swallow the two
127
+ * packages whose identity matters.
131
128
  *
132
129
  * Returns the absolute path of the file written.
133
130
  */
@@ -2,9 +2,8 @@
2
2
  * The disposable Alchemy stage a local preview deploy runs in:
3
3
  * `local-pr-<pr>-<short sha>` (#268).
4
4
  *
5
- * Two repos invented this grammar independently and then had to agree on it
6
- * anyway, because the same cleanup sweeps delete these stages. A stage that
7
- * does not match is not disposable, and destructive operations must refuse it.
5
+ * A stage that does not match is not disposable, and destructive operations
6
+ * must refuse it.
8
7
  */
9
8
  const LOCAL_PREVIEW_STAGE_PATTERN =
10
9
  /^local-pr-(?<pr>[1-9]\d*)-(?<sha>[0-9a-f]{7,40})$/u;
@@ -7,21 +7,15 @@ import {
7
7
  setGithubTransportWaitForTests,
8
8
  } from "./github-transport.ts";
9
9
 
10
- // The error class lives with the transport primitive because `oxlint`'s
11
- // max-classes-per-file keeps `GitHubApiError` alone in this file. It is
12
- // re-exported here so the mint surface stays one import for consumers.
13
10
  export { GitHubAppTokenTransportError } from "./github-transport.ts";
14
11
 
15
12
  /**
16
13
  * Minting a GitHub App installation token: the RS256 app JWT, the optional
17
14
  * installation lookup, and the token exchange (#617).
18
15
  *
19
- * Two projects had grown the same three steps independently — the factory's
20
- * check-run publisher and paitronage's proof-comment publisher — which is the
21
- * admitted-on-repetition bar. Only the *mechanism* lives here. Where the
22
- * private key comes from, how the app id is configured, and what the token is
23
- * then used for stay with each consumer: this module is handed credentials and
24
- * returns a token.
16
+ * Only the *mechanism* lives here. Where the private key comes from, how the
17
+ * app id is configured, and what the token is then used for stay with each
18
+ * consumer: this module is handed credentials and returns a token.
25
19
  */
26
20
 
27
21
  /** The default request budget, matching the factory's other GitHub writes. */
@@ -5,11 +5,7 @@
5
5
  * reuse the local verification the factory already published for *this exact
6
6
  * head*? It asks that only on a pull request, so every default-branch push
7
7
  * executes the full hosted suite (#863). Refusing runs hosted CI; it never
8
- * fails the candidate. Three
9
- * repositories had independently grown their own answer to that question and
10
- * had already drifted apart, so the answer lives here once, with the App
11
- * identity, check name, step identity, output names, guard, and every trust
12
- * predicate fixed rather than consumer-configurable.
8
+ * fails the candidate.
13
9
  *
14
10
  * What a consumer chooses is only *what its guarded surface requires*: the
15
11
  * plain profile command objects that surface selects. Everything else below is
@@ -136,8 +132,8 @@ export const FACTORY_PROOF_GATE_GUARD = `steps.${FACTORY_PROOF_GATE_STEP_ID}.out
136
132
  export const FACTORY_PROOF_GATE_IF = "github.event_name == 'pull_request'";
137
133
 
138
134
  /**
139
- * The complete refusal vocabulary. Deliberately few, because these are the
140
- * only distinctions the gate can honestly make from its Checks API reads.
135
+ * The complete refusal vocabulary: the only distinctions the gate can make
136
+ * from its Checks API reads.
141
137
  *
142
138
  * - `proven` a covering, passing, unambiguous proof for this exact head
143
139
  * - `none` no App-verified factory check run at this commit
@@ -148,14 +144,11 @@ export const FACTORY_PROOF_GATE_IF = "github.event_name == 'pull_request'";
148
144
  * cover every required command
149
145
  * - `ambiguous` two different generations share the newest instant, the
150
146
  * newest repeats another run's verdict with no proof time to
151
- * tell them apart, a run's start time cannot be ranked, or the
152
- * newest pass started before another run at this head was
153
- * posted
147
+ * tell them apart, a run's start time cannot be ranked, the
148
+ * newest pass records no verification start beside another run
149
+ * at this head (#1514), or the newest pass started before
150
+ * another run at this head was posted
154
151
  * - `error` the gate could not reach a decision (fail open)
155
- *
156
- * There is no `reduced`: mode stopped being an authorization condition in
157
- * ADR 0022, so a narrower run that still executed every required command is
158
- * indistinguishable from a full one *for this surface*, which is the point.
159
152
  */
160
153
  export const FACTORY_PROOF_GATE_REASONS = [
161
154
  "proven",
@@ -269,31 +262,12 @@ export const proofReuseRequiredCommands = (
269
262
  };
270
263
 
271
264
  /**
272
- * Resolve command *identities* to their `ProofReuseCommand` objects (ADR
273
- * 0021).
274
- *
275
- * Selection by name is deliberately a consumer decision (proof-surfaces.ts in
276
- * software-factory-hq, the `paitronage:verify` filter in paitronage's
277
- * `verify.ts`): only the consumer knows which named commands a guarded
278
- * surface requires. What both of those implementations independently
279
- * hand-rolled is the same lookup — find each name in the profile's command
280
- * catalog, and refuse to silently shrink the required set when a name has no
281
- * entry. That lookup is what this function is: the mechanic, not the
282
- * selection.
283
- *
284
- * Throwing at generation time (rather than returning `undefined` or an empty
285
- * array) is deliberate: a name with no catalog entry is a mistake in the
286
- * generator source, not a runtime condition a consumer should have to check
287
- * for, and a required set that quietly loses an entry is exactly what makes a
288
- * passing proof trivially "covering".
289
- *
290
- * `selectionLabel` names the failure, nothing else: it is not part of the
291
- * selection this function resolves, only prose a consumer supplies for its
292
- * own thrown error (e.g. HQ's surface name, "core" or "docs"). The message
293
- * deliberately says "the profile's command catalog" rather than naming
294
- * `software-factory.profile.json`: a fleet-generic library must not assume
295
- * every consumer's catalog is that exact file, so this wording differs
296
- * on purpose from the HQ-local message it replaced.
265
+ * Resolve command identities to their `ProofReuseCommand` objects (ADR 0021).
266
+ * Which names a surface requires is the consumer's choice; this is only the
267
+ * lookup. A name with no catalog entry throws at generation time, because a
268
+ * required set that quietly loses an entry makes any passing proof covering.
269
+ * The message says "the profile's command catalog" rather than a file name,
270
+ * since not every consumer's catalog is `software-factory.profile.json`.
297
271
  */
298
272
  export const resolveProofReuseCommands = (
299
273
  catalog: readonly ProofReuseCommand[],
@@ -681,15 +655,8 @@ def releaseAuthorized($release; $commands; $stamp):
681
655
  | join("\n")
682
656
  `.trim();
683
657
 
684
- /**
685
- * Every refusal ends on the same line. `pr:verify` is the command that
686
- * produces the proof this job looks for, so it is the corrective action
687
- * whatever the refusal was.
688
- *
689
- * It is phrased as an option, not a reprimand. A pull request opened by hand
690
- * has no factory proof and never will; the full suite running for it is the
691
- * designed behavior, not a mistake to report.
692
- */
658
+ // Phrased as an option, not a reprimand: a hand-opened pull request has no
659
+ // factory proof, and the full suite running for it is the designed behavior.
693
660
  const CORRECTIVE_LINE =
694
661
  "Run `psf pr:verify` before publishing to reuse local proof and avoid a duplicate server run.";
695
662
 
@@ -980,9 +947,7 @@ export const factoryProofGateStep = (
980
947
  continueOnError: true as const,
981
948
  env: Object.freeze({
982
949
  GH_TOKEN: githubExpression("secrets.GITHUB_TOKEN"),
983
- // On a pull request the verified head is the PR branch tip. The step
984
- // never runs on a push, so no reachable path reads the `github.sha`
985
- // half.
950
+ // The step never runs on a push, so the `github.sha` half is unreachable.
986
951
  HEAD_SHA: githubExpression(
987
952
  "github.event.pull_request.head.sha || github.sha"
988
953
  ),
@@ -60,9 +60,6 @@ say '## ${label} timing'
60
60
  say ''
61
61
 
62
62
  if [ "${shellExpansion("GITHUB_EVENT_NAME:-")}" = 'push' ] && [ -z "${shellExpansion("PROOF_REASON:-")}" ]; then
63
- # A push run with no recorded reason is one where the gate step's condition
64
- # kept it off entirely, so the full suite ran with no reuse decision. The
65
- # gate runs on pull requests only (#863), so that is every push.
66
63
  say '- Path: full execution, no proof consulted'
67
64
  say '- Proof-reuse gate: did not run on this ref; the full suite ran.'
68
65
  say "- Verified head: \`${shellExpansion("GITHUB_SHA:-unknown")}\`"
@@ -12,11 +12,7 @@ const UPLOAD_ARTIFACT_REPOSITORY = UPLOAD_ARTIFACT.uses.slice(
12
12
  );
13
13
 
14
14
  export const FACTORY_PUSH_IDENTITY_SCHEMA_VERSION = 1;
15
- /**
16
- * The artifact prefix and the five step IDs are module-private. Alpha.13
17
- * removed them from the public surface (#719). A caller reads a step ID from
18
- * the builder's returned `steps` (`step.id`) or from `artifactName`.
19
- */
15
+
20
16
  const FACTORY_PUSH_IDENTITY_ARTIFACT_PREFIX = "factory-push-identity";
21
17
  const FACTORY_PUSH_IDENTITY_RECORD_STEP_ID = "factory_push_identity_record";
22
18
  const FACTORY_PUSH_IDENTITY_LOOKUP_STEP_ID = "factory_push_identity_lookup";