@patronage/factory-ci 1.0.0-alpha.44 → 1.0.0-alpha.46
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 +10 -8
- package/dist/.build-fingerprint.json +1 -1
- package/dist/alchemy/index.d.ts +100 -134
- package/dist/alchemy/index.js +65 -76
- package/dist/{bundle-alchemy-entry-CT5hCphA.js → bundle-alchemy-entry-Ba1Ebp91.js} +15 -15
- package/dist/{execute-alchemy-entry-C2ZhsNTN.js → execute-alchemy-entry-CxQrjSg8.js} +18 -15
- package/dist/{execute-alchemy-entry-B397GSk5.d.ts → execute-alchemy-entry-D75saOiE.d.ts} +9 -14
- package/dist/index.d.ts +175 -257
- package/dist/index.js +59 -127
- package/package.json +15 -14
- package/src/actions.ts +0 -7
- package/src/alchemy/child-diagnostics.ts +1 -2
- package/src/alchemy/credential-preflight.ts +0 -9
- package/src/alchemy/destroy-postcondition.ts +1 -5
- package/src/alchemy/first-deploy-authorization.ts +1 -4
- package/src/alchemy/lifecycle.ts +88 -33
- package/src/alchemy/local-emulation.ts +4 -3
- package/src/alchemy/plan-effects.ts +1 -1
- package/src/alchemy/stage-policy.ts +3 -5
- package/src/alchemy/url-implies-auth.ts +1 -5
- package/src/alchemy-baseline.ts +27 -7
- package/src/bundle-alchemy-entry.ts +21 -13
- package/src/disposable-stage.ts +2 -3
- package/src/github-app-token.ts +3 -9
- package/src/proof-reuse-gate.ts +16 -56
- package/src/proof-reuse-presentation.ts +0 -3
- package/src/push-identity-workflow.ts +1 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @patronage/factory-ci
|
|
2
2
|
|
|
3
|
-
The CI and deploy building blocks that already repeat across Patronage **factory projects** — projects that carry a `software-factory.profile.json
|
|
3
|
+
The CI and deploy building blocks that already repeat across Patronage **factory projects** — projects that carry a `software-factory.profile.json` and are subject to factory CI and proof gating, whatever tool deploys them. Only the helpers that import Alchemy live on the `@patronage/factory-ci/alchemy` subpath; the entry bundler and runner below need no Alchemy import, and a project that deploys with plain Cloudflare tooling uses the rest of the package unchanged.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
pnpm add -E @patronage/factory-ci
|
|
@@ -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.
|
|
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({
|
|
@@ -483,7 +483,7 @@ The gate is a **step, not a job**, marked `continue-on-error`, with no `set -e`.
|
|
|
483
483
|
|
|
484
484
|
**Emit the step's `shell` verbatim.** `factoryProofGateStep()` sets `shell: bash --noprofile --norc {0}` (`FACTORY_PROOF_GATE_SHELL`) and a generator that drops it breaks the gate. GitHub's default for `run:` is `bash -e {0}` — errexit arrives from the invocation, not the script, so omitting `set -e` does not achieve it. Under the default the gate dies at the first non-zero command before its single `GITHUB_OUTPUT` write: no verdict, no `reason`, reuse silently collapsed to never while the job looks like healthy full CI. `shell: bash` is not a substitute; it expands to `bash --noprofile --norc -eo pipefail {0}`. The script is written to survive errexit as well, and its tests execute every case under both shells — a harness that runs this script under friendlier flags than the runner does is worse than no harness.
|
|
485
485
|
|
|
486
|
-
`assertProofReuseCoverage({ commands, skipped, surface })` is the compile-time guard in front of the runtime `incomplete` refusal: hand it the same selection and the command strings the workflow would skip, and it fails the consumer's build when the two drift apart. Coverage is exact executable coverage.
|
|
486
|
+
`assertProofReuseCoverage({ commands, skipped, surface })` is the compile-time guard in front of the runtime `incomplete` refusal: hand it the same selection and the command strings the workflow would skip, and it fails the consumer's build when the two drift apart. Coverage is exact executable coverage. There is no prose escape hatch: the `equivalents` input was removed before 1.0, so only an executed command can cover a skip. Extracting the skipped strings stays with the consumer — this package never parses workflow source, because establishing trust that way is what killed an earlier attempt.
|
|
487
487
|
|
|
488
488
|
`factoryProofTimingStartStep()` and `factoryProofReuseSummaryStep()` replace consumer-local proof timing summaries without taking over workflow topology. Put the start step immediately after the gate and the summary step after the guarded work. The helpers keep the established `Start CI timing` / `Record proof-reuse timing` names and distinguish proof reuse, full fallback with the gate's reason, and pushes where the gate's step condition kept it off entirely. Reuse links the exact source check and bound head; every path emits a cheap Actions notice. Both steps are `continue-on-error`: missing timing support or an unwritable presentation destination cannot change a required job's conclusion. These helpers change no trust predicate or guard.
|
|
489
489
|
|
|
@@ -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.
|
|
@@ -763,7 +765,7 @@ The optional `entry.envFile` selects the dotenv file for every child, including
|
|
|
763
765
|
The sequence, per operation:
|
|
764
766
|
|
|
765
767
|
- **`plan`** takes the stage lease, reads the persisted state, runs `deploy --dry-run`, reads the state again, and refuses with `STATE_CHANGED` if any resource record or the stack output differs — all under the one lease, so no other writer can reach the stage while the child plans. That refusal wins over the child's own exit status, because a planning child that wrote is the more serious finding. On an empty protected stage with a `firstDeploy` policy the result carries `planHash`, the value an operator authorizes.
|
|
766
|
-
- **`deploy`** starts with the same leased read-only plan, then admits it under the same lease. An empty protected stage is a first deploy: the plan may only `create` or `adopted` — `adopted` is the create of a resource the provider already finds, and it plans only for a record with no prior state — and its hash must be on `firstDeploy.authorizedHashes`, or the refusal is `FIRST_DEPLOY_UNAUTHORIZED` carrying the hash. A protected stage with state refuses `replace` and `delete` (`EFFECT_NOT_PERMITTED`), and every `retainedIdentities` marker must hold against the recorded values before the apply (`RESOURCE_IDENTITY_MISMATCH`); a protected stage with no markers is `INVALID_POLICY`, because a check with nothing in it must not read as a proof. A disposable stage is constrained by neither. Then the apply child (`--yes`, with `--adopt` when the policy says so), under the same lease. Then, still under it: the persisted state again, which must record every resource the plan created (`DEPLOY_INCOMPLETE`; the result's `created` names their FQNs — a planned create resolves to an FQN that was absent before the apply, or was recorded in flight, `creating` or `deleting`, and is exactly the FQN the create row names — a row carries the FQN, so an interrupted create recovers at any depth; the record must have left the in-flight state) and, on a protected stage, the same identities as before; then a second `deploy --dry-run`, bracketed by the same two-read check as the first so a convergence child that wrote is `STATE_CHANGED`, which must be a no-op (`NOT_CONVERGED`) except an `update` on a persisted FQN named in `nonConvergentResources`: a Worker carrying a write-only secret binding re-plans as `update` on every deploy because the value can never be read back. Only `update`, only on those FQNs. A task row (`run` or `drop`) prints only while the task still has work, so any task row is `NOT_CONVERGED` too.
|
|
768
|
+
- **`deploy`** starts with the same leased read-only plan, then admits it under the same lease. An empty protected stage is a first deploy: the plan may only `create` or `adopted` — `adopted` is the create of a resource the provider already finds, and it plans only for a record with no prior state — and its hash must be on `firstDeploy.authorizedHashes`, or the refusal is `FIRST_DEPLOY_UNAUTHORIZED` carrying the hash. A protected stage with state refuses `replace` and `delete` (`EFFECT_NOT_PERMITTED`), and every `retainedIdentities` marker must hold against the recorded values before the apply (`RESOURCE_IDENTITY_MISMATCH`); a protected stage with no markers is `INVALID_POLICY`, because a check with nothing in it must not read as a proof. A disposable stage is constrained by neither. Then the apply child (`--yes`, with `--adopt` when the policy says so), under the same lease. Then, still under it: the persisted state again, which must record every resource the plan created (`DEPLOY_INCOMPLETE`; the result's `created` names their FQNs — a planned create resolves to an FQN that was absent before the apply, or was recorded in flight, `creating` or `deleting`, and is exactly the FQN the create row names — a row carries the FQN, so an interrupted create recovers at any depth; the record must have left the in-flight state) and, on a protected stage, the same identities as before; then a second `deploy --dry-run`, bracketed by the same two-read check as the first so a convergence child that wrote is `STATE_CHANGED`, which must be a no-op (`NOT_CONVERGED`) except an `update` on a persisted FQN named in `nonConvergentResources`: a Worker carrying a write-only secret binding re-plans as `update` on every deploy because the value can never be read back. Only `update`, only on those FQNs. A task row (`run` or `drop`) prints only while the task still has work, so any task row is `NOT_CONVERGED` too. With `convergenceRetries: { attempts, delayMillis }` set (#1349; `attempts` 1 to 10, `delayMillis` 0 to 60 000 and below an explicit `ownershipTtlMillis`), a post-deploy plan that is only `NOT_CONVERGED` waits and re-plans read-only, up to `attempts` more times, under the same lease. The apply never repeats, every check above runs again on each attempt and stops the deploy at once, and an exhausted run is still `NOT_CONVERGED`. Omitted, there is no retry.
|
|
767
769
|
- **`destroy`** is refused on a protected stage. Then, under the stage lease, the destroy child, then the atomic stage view must be empty (`DESTROY_RESIDUE`) and the empty output row is removed in the same lease (`cleanup: "removed" | "absent"`). An unreadable store fails with `STATE_STORE_UNAVAILABLE`; it never reads as empty.
|
|
768
770
|
|
|
769
771
|
Ownership follows #1074 and #1107. Each operation runs under **one** stage lease, held from its first read to its last decision, and every child it launches — the dry runs, the apply, the destroy — runs inside that lease: the lifecycle spreads the lease's `childEnvironment()` into the child's environment, and the adapter in the child adopts it. The stage is never unowned while an operation runs, so no other writer can interleave between the admitted plan and the apply, and a second run on the stage is `STAGE_HELD`. Before anything read under the lease is decided on, the lifecycle **renews** the lease: renewal is the adapter's fenced operation, it changes no rows unless this holder's unexpired row is still there, and it fails with `lost` when the lease expired or was taken over — `OWNERSHIP_LOST`, and the decision is not made. Independently of that, every exit from a leased window passes the same fence check, whether the window returned or threw and wherever it threw from: a lease lost anywhere in the window — during the apply child, during a state read, under a child failure — is `OWNERSHIP_LOST` at the phase the run was in, ahead of whatever else was found there. The check sits outside the window's code, so no early return or new failure path inside it can skip acceptance. A fence that holds lets a genuine store or child failure through unchanged. A successful `release` is not that check: the adapter's release is idempotent by design and succeeds when the row is gone or belongs to a later holder, so it proves nothing, and the lifecycle infers nothing from it. A release that _fails_ is a different fact — the store could not be reached and this holder's row may still be there, blocking the stage until it expires — so after a successful operation it is reported as `LEASE_RELEASE_FAILED`; a failure inside the operation is reported ahead of it.
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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,
|
|
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
|
|
package/dist/alchemy/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { n as ExecuteAlchemyEntryOptions } from "../execute-alchemy-entry-
|
|
1
|
+
import { n as ExecuteAlchemyEntryOptions } from "../execute-alchemy-entry-D75saOiE.js";
|
|
2
2
|
import * as Alchemy from "alchemy";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
5
|
import { StateService } from "alchemy/State";
|
|
6
6
|
import { ProviderServices } from "alchemy/Stack";
|
|
7
|
-
|
|
8
|
-
//#region src/alchemy/evaluate-stack.d.ts
|
|
9
7
|
interface EvaluatedResource {
|
|
10
8
|
id: string;
|
|
11
9
|
type: string;
|
|
@@ -48,14 +46,7 @@ interface EvaluateStackInput {
|
|
|
48
46
|
* Run a stack program at `stage` and build the graph Alchemy would plan, with no state and no network:
|
|
49
47
|
* `Plan.make` runs under `inMemoryState()` and every provider read and list answers "absent".
|
|
50
48
|
*/
|
|
51
|
-
declare const evaluateStack: ({
|
|
52
|
-
name,
|
|
53
|
-
program,
|
|
54
|
-
providers,
|
|
55
|
-
stage
|
|
56
|
-
}: EvaluateStackInput) => Promise<EvaluatedGraph>;
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/alchemy/retained-identity.d.ts
|
|
49
|
+
export declare const evaluateStack: ({ name, program, providers, stage }: EvaluateStackInput) => Promise<EvaluatedGraph>;
|
|
59
50
|
/**
|
|
60
51
|
* Retained-identity asserts over Alchemy state snapshots (#991).
|
|
61
52
|
*
|
|
@@ -121,7 +112,13 @@ interface StateSnapshotScope {
|
|
|
121
112
|
interface StateSnapshot {
|
|
122
113
|
readonly resources: readonly StateSnapshotResource[];
|
|
123
114
|
}
|
|
124
|
-
type RetainedIdentityViolationReason =
|
|
115
|
+
type RetainedIdentityViolationReason =
|
|
116
|
+
/** No recorded resource matches the marker's fqn, type, and shape. */
|
|
117
|
+
"missing" |
|
|
118
|
+
/** The recorded identity is not the value the marker names. */
|
|
119
|
+
"unexpected" |
|
|
120
|
+
/** The identity differs between the two snapshots. */
|
|
121
|
+
"changed";
|
|
125
122
|
interface RetainedIdentityViolation {
|
|
126
123
|
readonly marker: RetainedIdentityMarker;
|
|
127
124
|
readonly reason: RetainedIdentityViolationReason;
|
|
@@ -131,7 +128,7 @@ interface RetainedIdentityViolation {
|
|
|
131
128
|
readonly before?: string;
|
|
132
129
|
}
|
|
133
130
|
/** Every retained identity that did not hold. */
|
|
134
|
-
declare class RetainedIdentityError extends Error {
|
|
131
|
+
export declare class RetainedIdentityError extends Error {
|
|
135
132
|
readonly violations: readonly RetainedIdentityViolation[];
|
|
136
133
|
constructor(violations: readonly RetainedIdentityViolation[]);
|
|
137
134
|
}
|
|
@@ -150,7 +147,7 @@ declare class RetainedIdentityError extends Error {
|
|
|
150
147
|
* unambiguously is never treated as a state with nothing in it, because that
|
|
151
148
|
* reading turns a broken read into a passing assert.
|
|
152
149
|
*/
|
|
153
|
-
declare const parseStateSnapshot: (text: string, scope?: StateSnapshotScope) => StateSnapshot;
|
|
150
|
+
export declare const parseStateSnapshot: (text: string, scope?: StateSnapshotScope) => StateSnapshot;
|
|
154
151
|
interface AssertRetainedIdentitiesOptions {
|
|
155
152
|
/**
|
|
156
153
|
* The state the operation would run against. Every marker is checked
|
|
@@ -172,13 +169,7 @@ interface AssertRetainedIdentitiesOptions {
|
|
|
172
169
|
* against asserts nothing, so it is a `TypeError` rather than a pass. So is an
|
|
173
170
|
* empty marker list: a check with nothing in it must not read as a proof.
|
|
174
171
|
*/
|
|
175
|
-
declare const assertRetainedIdentities: ({
|
|
176
|
-
after,
|
|
177
|
-
before,
|
|
178
|
-
markers
|
|
179
|
-
}: AssertRetainedIdentitiesOptions) => void;
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/alchemy/local-emulation.d.ts
|
|
172
|
+
export declare const assertRetainedIdentities: ({ after, before, markers }: AssertRetainedIdentitiesOptions) => void;
|
|
182
173
|
/**
|
|
183
174
|
* The child environment a local-emulation Alchemy run needs (#1168).
|
|
184
175
|
*
|
|
@@ -208,25 +199,22 @@ declare const assertRetainedIdentities: ({
|
|
|
208
199
|
* a sentinel there would break that deploy, and returning nothing instead
|
|
209
200
|
* would let a caller believe a local run was protected when it was not.
|
|
210
201
|
*/
|
|
211
|
-
declare const localEmulationEnvironment: (options: {
|
|
202
|
+
export declare const localEmulationEnvironment: (options: {
|
|
212
203
|
/**
|
|
213
204
|
* Where the opt-in is read from. Defaults to this process's environment. No
|
|
214
205
|
* other variable is read.
|
|
215
206
|
*/
|
|
216
|
-
readonly environment?: Readonly<Record<string, string | undefined>>;
|
|
207
|
+
readonly environment?: Readonly<Record<string, string | undefined>>;
|
|
208
|
+
/** The Alchemy stage the child runs. */
|
|
217
209
|
readonly stage: string;
|
|
218
210
|
}) => Readonly<Record<string, string>>;
|
|
219
|
-
//#endregion
|
|
220
|
-
//#region src/alchemy/stage-policy.d.ts
|
|
221
211
|
/**
|
|
222
212
|
* Stage and stack pairing, and protected-stage policy, from a project-supplied
|
|
223
213
|
* table (#991).
|
|
224
214
|
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
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.
|
|
215
|
+
* This module owns whether a stage is protected, whether it is disposable, and
|
|
216
|
+
* whether a stack may run it. A project supplies the table and gets decisions
|
|
217
|
+
* back, so no project or stack name appears here.
|
|
230
218
|
*
|
|
231
219
|
* One stage name does appear: `local`. It names the local emulator rather than
|
|
232
220
|
* any project's estate, every project spells it the same way, and the question
|
|
@@ -243,9 +231,9 @@ declare const localEmulationEnvironment: (options: {
|
|
|
243
231
|
*/
|
|
244
232
|
type StageMatcher = readonly string[] | RegExp | ((stage: string) => boolean);
|
|
245
233
|
/** Every stage the shared disposable grammar recognises. */
|
|
246
|
-
declare const LOCAL_PREVIEW_STAGES: StageMatcher;
|
|
234
|
+
export declare const LOCAL_PREVIEW_STAGES: StageMatcher;
|
|
247
235
|
/** A matcher that accepts a stage any of `matchers` accepts. */
|
|
248
|
-
declare const anyStage: (...matchers: readonly StageMatcher[]) => StageMatcher;
|
|
236
|
+
export declare const anyStage: (...matchers: readonly StageMatcher[]) => StageMatcher;
|
|
249
237
|
/** One stack's claim on stages, in either or both directions. */
|
|
250
238
|
interface StackStageOwnership {
|
|
251
239
|
/** The stack this entry describes. */
|
|
@@ -264,7 +252,9 @@ interface StackStageOwnership {
|
|
|
264
252
|
}
|
|
265
253
|
interface StagePolicyTable {
|
|
266
254
|
readonly stages: {
|
|
267
|
-
/** Stages that hold real state and refuse destructive operations. */
|
|
255
|
+
/** Stages that hold real state and refuse destructive operations. */
|
|
256
|
+
readonly protected: StageMatcher;
|
|
257
|
+
/** Stages a cleanup sweep may create and delete freely. */
|
|
268
258
|
readonly disposable: StageMatcher;
|
|
269
259
|
};
|
|
270
260
|
/**
|
|
@@ -274,12 +264,22 @@ interface StagePolicyTable {
|
|
|
274
264
|
*/
|
|
275
265
|
readonly stacks?: readonly StackStageOwnership[];
|
|
276
266
|
}
|
|
277
|
-
type StagePolicyErrorCode =
|
|
267
|
+
type StagePolicyErrorCode =
|
|
268
|
+
/** The stage is neither protected nor disposable. */
|
|
269
|
+
"UNKNOWN_STAGE" |
|
|
270
|
+
/** The table classifies the stage as both protected and disposable. */
|
|
271
|
+
"AMBIGUOUS_STAGE" |
|
|
272
|
+
/** A destructive operation was asked for on a protected stage. */
|
|
273
|
+
"PROTECTED_STAGE" |
|
|
274
|
+
/** The stack is not in the table's registry. */
|
|
275
|
+
"UNKNOWN_STACK" |
|
|
276
|
+
/** The stack and the stage are not paired by the table. */
|
|
277
|
+
"STAGE_NOT_OWNED";
|
|
278
278
|
/**
|
|
279
279
|
* A policy refusal. The `code` is the stable part: a project maps it onto its
|
|
280
280
|
* own lifecycle failure envelope, and the message is for a human.
|
|
281
281
|
*/
|
|
282
|
-
declare class StagePolicyError extends Error {
|
|
282
|
+
export declare class StagePolicyError extends Error {
|
|
283
283
|
readonly code: StagePolicyErrorCode;
|
|
284
284
|
constructor(code: StagePolicyErrorCode, message: string);
|
|
285
285
|
}
|
|
@@ -312,28 +312,17 @@ interface StagePolicy {
|
|
|
312
312
|
* classifies the stages of its own estate, and the emulated stage belongs to
|
|
313
313
|
* no estate.
|
|
314
314
|
*/
|
|
315
|
-
declare const isLocalEmulationStage: (stage: string) => boolean;
|
|
315
|
+
export declare const isLocalEmulationStage: (stage: string) => boolean;
|
|
316
316
|
/**
|
|
317
317
|
* Read a project's stage table and answer the stage questions from it.
|
|
318
318
|
*
|
|
319
319
|
* A stage the table classifies as both protected and disposable is a table
|
|
320
320
|
* defect, not a stage a caller may act on, so every query on it throws.
|
|
321
321
|
*/
|
|
322
|
-
declare const stagePolicy: (table: StagePolicyTable) => StagePolicy;
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region src/alchemy/credential-preflight.d.ts
|
|
322
|
+
export 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.
|
|
@@ -350,7 +339,7 @@ type CloudflareTokenKind = "account" | "user";
|
|
|
350
339
|
* project's own secret manager; an ambient token there means the run is not
|
|
351
340
|
* the run it claims to be.
|
|
352
341
|
*/
|
|
353
|
-
declare const HOSTED_CLOUDFLARE_CREDENTIAL_NAMES: readonly ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN"];
|
|
342
|
+
export declare const HOSTED_CLOUDFLARE_CREDENTIAL_NAMES: readonly ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN"];
|
|
354
343
|
/** The token and the reviewed policy document that describes it. */
|
|
355
344
|
interface CloudflareCredential {
|
|
356
345
|
/**
|
|
@@ -404,7 +393,7 @@ interface CredentialPreflightResult {
|
|
|
404
393
|
* mismatch: an unreachable API is a transient condition, and a token whose
|
|
405
394
|
* permissions are wrong is not.
|
|
406
395
|
*/
|
|
407
|
-
declare class CloudflareCredentialUnavailableError extends Error {
|
|
396
|
+
export declare class CloudflareCredentialUnavailableError extends Error {
|
|
408
397
|
constructor(message?: string);
|
|
409
398
|
}
|
|
410
399
|
/**
|
|
@@ -427,28 +416,13 @@ declare class CloudflareCredentialUnavailableError extends Error {
|
|
|
427
416
|
* Cloudflare could not be asked; every other error means the credential is
|
|
428
417
|
* wrong. Nothing it throws, and nothing it returns, carries a secret value.
|
|
429
418
|
*/
|
|
430
|
-
declare const credentialPreflight: ({
|
|
431
|
-
accountId,
|
|
432
|
-
environment,
|
|
433
|
-
fetchImplementation,
|
|
434
|
-
requiredPermissionGroups,
|
|
435
|
-
resolveCredential,
|
|
436
|
-
resourcesFor,
|
|
437
|
-
source,
|
|
438
|
-
tokenKind
|
|
439
|
-
}: CredentialPreflightOptions) => Promise<CredentialPreflightResult>;
|
|
440
|
-
//#endregion
|
|
441
|
-
//#region src/alchemy/destroy-postcondition.d.ts
|
|
419
|
+
export declare const credentialPreflight: ({ accountId, environment, fetchImplementation, requiredPermissionGroups, resolveCredential, resourcesFor, source, tokenKind }: CredentialPreflightOptions) => Promise<CredentialPreflightResult>;
|
|
442
420
|
/**
|
|
443
421
|
* The destroy postcondition: a destroyed stage owns nothing.
|
|
444
422
|
*
|
|
445
423
|
* Alchemy's `destroy` can exit zero while the state store still lists
|
|
446
424
|
* resources for the stage — a partial destroy, a resource whose delete failed
|
|
447
|
-
* quietly, or a state row that was never removed.
|
|
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.
|
|
425
|
+
* quietly, or a state row that was never removed.
|
|
452
426
|
*
|
|
453
427
|
* Reading the state store is the project's job: only the project knows which
|
|
454
428
|
* store it configured and how to address a stage in it. This function owns the
|
|
@@ -477,13 +451,7 @@ interface AssertDestroyLeftNothingOptions extends StageStateTarget {
|
|
|
477
451
|
* message that carries nothing the reader's own error said. Resource
|
|
478
452
|
* identifiers are names, never values.
|
|
479
453
|
*/
|
|
480
|
-
declare const assertDestroyLeftNothing: ({
|
|
481
|
-
stack,
|
|
482
|
-
stage,
|
|
483
|
-
stateReader
|
|
484
|
-
}: AssertDestroyLeftNothingOptions) => Promise<void>;
|
|
485
|
-
//#endregion
|
|
486
|
-
//#region src/alchemy/first-deploy-authorization.d.ts
|
|
454
|
+
export declare const assertDestroyLeftNothing: ({ stack, stage, stateReader }: AssertDestroyLeftNothingOptions) => Promise<void>;
|
|
487
455
|
interface FirstDeployPlanHashOptions {
|
|
488
456
|
/**
|
|
489
457
|
* The Alchemy CLI's plan output, verbatim. It is canonicalised and hashed
|
|
@@ -538,12 +506,7 @@ interface FirstDeployAuthorization {
|
|
|
538
506
|
* Throws a `PlanEffectsError` when the plan adapter cannot account for the
|
|
539
507
|
* output: an unreadable plan is refused, never hashed.
|
|
540
508
|
*/
|
|
541
|
-
declare const firstDeployPlanHash: ({
|
|
542
|
-
planText,
|
|
543
|
-
sourceSha,
|
|
544
|
-
stack,
|
|
545
|
-
stage
|
|
546
|
-
}: FirstDeployPlanHashOptions) => string;
|
|
509
|
+
export declare const firstDeployPlanHash: ({ planText, sourceSha, stack, stage }: FirstDeployPlanHashOptions) => string;
|
|
547
510
|
/**
|
|
548
511
|
* Admits a first deploy only when its plan hash is one the project
|
|
549
512
|
* authorized.
|
|
@@ -552,15 +515,7 @@ declare const firstDeployPlanHash: ({
|
|
|
552
515
|
* adds to the authorization list after reading the plan. It never carries the
|
|
553
516
|
* plan text.
|
|
554
517
|
*/
|
|
555
|
-
declare const firstDeployAuthorization: ({
|
|
556
|
-
authorizedHashes,
|
|
557
|
-
planText,
|
|
558
|
-
sourceSha,
|
|
559
|
-
stack,
|
|
560
|
-
stage
|
|
561
|
-
}: FirstDeployAuthorizationOptions) => FirstDeployAuthorization;
|
|
562
|
-
//#endregion
|
|
563
|
-
//#region src/alchemy/url-implies-auth.d.ts
|
|
518
|
+
export declare const firstDeployAuthorization: ({ authorizedHashes, planText, sourceSha, stack, stage }: FirstDeployAuthorizationOptions) => FirstDeployAuthorization;
|
|
564
519
|
/** One Worker the project has decided may stay reachable without a declared guard. */
|
|
565
520
|
interface UrlImpliesAuthAllowance {
|
|
566
521
|
/** The Worker's logical id, as the graph reports it. */
|
|
@@ -580,13 +535,17 @@ interface AssertUrlImpliesAuthOptions {
|
|
|
580
535
|
readonly allowlist?: readonly UrlImpliesAuthAllowance[];
|
|
581
536
|
}
|
|
582
537
|
/** Why one Worker failed the invariant. */
|
|
583
|
-
type UrlImpliesAuthViolationReason =
|
|
538
|
+
type UrlImpliesAuthViolationReason =
|
|
539
|
+
/** The Worker is reachable and the graph shows no guard and no allowance. */
|
|
540
|
+
"unauthenticated" |
|
|
541
|
+
/** An allowlist entry names the Worker but states no reason. */
|
|
542
|
+
"allowance-without-reason";
|
|
584
543
|
interface UrlImpliesAuthViolation {
|
|
585
544
|
readonly worker: string;
|
|
586
545
|
readonly reason: UrlImpliesAuthViolationReason;
|
|
587
546
|
}
|
|
588
547
|
/** Every offending Worker in one throw, so a stack is fixed in one pass. */
|
|
589
|
-
declare class UrlImpliesAuthError extends Error {
|
|
548
|
+
export declare class UrlImpliesAuthError extends Error {
|
|
590
549
|
readonly violations: readonly UrlImpliesAuthViolation[];
|
|
591
550
|
constructor(violations: readonly UrlImpliesAuthViolation[]);
|
|
592
551
|
}
|
|
@@ -601,12 +560,7 @@ declare class UrlImpliesAuthError extends Error {
|
|
|
601
560
|
* violation, and every violation in the graph is reported in one
|
|
602
561
|
* `UrlImpliesAuthError`.
|
|
603
562
|
*/
|
|
604
|
-
declare const assertUrlImpliesAuth: (graph: EvaluatedGraph, {
|
|
605
|
-
allowlist,
|
|
606
|
-
authBindingName
|
|
607
|
-
}: AssertUrlImpliesAuthOptions) => void;
|
|
608
|
-
//#endregion
|
|
609
|
-
//#region src/alchemy/secret-name-policy.d.ts
|
|
563
|
+
export declare const assertUrlImpliesAuth: (graph: EvaluatedGraph, { allowlist, authBindingName }: AssertUrlImpliesAuthOptions) => void;
|
|
610
564
|
/**
|
|
611
565
|
* A secret-name redaction policy for `executeAlchemyEntry`'s `redact` hook.
|
|
612
566
|
*
|
|
@@ -621,13 +575,13 @@ declare const assertUrlImpliesAuth: (graph: EvaluatedGraph, {
|
|
|
621
575
|
* covers less than the caller believes it covers.
|
|
622
576
|
*/
|
|
623
577
|
/** What a redacted value is replaced with. */
|
|
624
|
-
declare const SECRET_REDACTION_PLACEHOLDER = "[REDACTED]";
|
|
578
|
+
export declare const SECRET_REDACTION_PLACEHOLDER = "[REDACTED]";
|
|
625
579
|
/**
|
|
626
580
|
* The shortest value that may be replaced. A short value occurs in ordinary
|
|
627
581
|
* output by chance, so replacing it would erase unrelated text and hide what
|
|
628
582
|
* the run actually did.
|
|
629
583
|
*/
|
|
630
|
-
declare const MINIMUM_REDACTABLE_SECRET_LENGTH = 8;
|
|
584
|
+
export declare const MINIMUM_REDACTABLE_SECRET_LENGTH = 8;
|
|
631
585
|
interface SecretNamePolicyOptions {
|
|
632
586
|
/**
|
|
633
587
|
* The names of the values to redact. The project owns this list; this
|
|
@@ -658,12 +612,7 @@ interface SecretNamePolicyOptions {
|
|
|
658
612
|
* and gets no redaction. Empty names beside a populated `values` map is
|
|
659
613
|
* refused, because that is a caller who meant to declare something.
|
|
660
614
|
*/
|
|
661
|
-
declare const secretNamePolicy: ({
|
|
662
|
-
names,
|
|
663
|
-
values
|
|
664
|
-
}: SecretNamePolicyOptions) => ((text: string) => string);
|
|
665
|
-
//#endregion
|
|
666
|
-
//#region src/alchemy/lifecycle-failure.d.ts
|
|
615
|
+
export declare const secretNamePolicy: ({ names, values }: SecretNamePolicyOptions) => ((text: string) => string);
|
|
667
616
|
/**
|
|
668
617
|
* The lifecycle failure envelope (#1077).
|
|
669
618
|
*
|
|
@@ -679,7 +628,17 @@ declare const secretNamePolicy: ({
|
|
|
679
628
|
*/
|
|
680
629
|
type AlchemyLifecycleOperation = "plan" | "deploy" | "destroy";
|
|
681
630
|
/** Where in the sequence the failure was raised. */
|
|
682
|
-
type AlchemyLifecyclePhase =
|
|
631
|
+
type AlchemyLifecyclePhase =
|
|
632
|
+
/** The request itself or the policy is malformed. */
|
|
633
|
+
"request" |
|
|
634
|
+
/** A pre-mutation check refused the operation. */
|
|
635
|
+
"admission" |
|
|
636
|
+
/** The state store could not be read or owned. */
|
|
637
|
+
"state" |
|
|
638
|
+
/** The Alchemy child failed. */
|
|
639
|
+
"execution" |
|
|
640
|
+
/** A check after the child ran did not hold. */
|
|
641
|
+
"postcondition";
|
|
683
642
|
/**
|
|
684
643
|
* What the failure says about the target stage. `not-started` means no
|
|
685
644
|
* child ran. `read-only-started` means only a planning child ran: no child
|
|
@@ -692,7 +651,7 @@ type AlchemyLifecycleFailureCode = "INVALID_REQUEST" | "INVALID_POLICY" | "UNSUP
|
|
|
692
651
|
* The one sentence each code is reported with. The table is the whole
|
|
693
652
|
* vocabulary: a message that is not in it cannot be raised.
|
|
694
653
|
*/
|
|
695
|
-
declare const LIFECYCLE_FAILURE_MESSAGES: Readonly<Record<AlchemyLifecycleFailureCode, string>>;
|
|
654
|
+
export declare const LIFECYCLE_FAILURE_MESSAGES: Readonly<Record<AlchemyLifecycleFailureCode, string>>;
|
|
696
655
|
interface AlchemyLifecycleFailureFields {
|
|
697
656
|
/**
|
|
698
657
|
* The file the run's child output was being written to, on a child
|
|
@@ -711,7 +670,7 @@ interface AlchemyLifecycleFailureFields {
|
|
|
711
670
|
readonly planHash?: string;
|
|
712
671
|
}
|
|
713
672
|
/** A sanitized lifecycle failure. See the module comment. */
|
|
714
|
-
declare class AlchemyLifecycleError extends Error implements AlchemyLifecycleFailureFields {
|
|
673
|
+
export declare class AlchemyLifecycleError extends Error implements AlchemyLifecycleFailureFields {
|
|
715
674
|
readonly childDiagnosticsPath?: string;
|
|
716
675
|
readonly code: AlchemyLifecycleFailureCode;
|
|
717
676
|
readonly mutation: MutationCertainty;
|
|
@@ -724,9 +683,7 @@ declare class AlchemyLifecycleError extends Error implements AlchemyLifecycleFai
|
|
|
724
683
|
readonly message: string;
|
|
725
684
|
};
|
|
726
685
|
}
|
|
727
|
-
declare const isAlchemyLifecycleError: (error: unknown) => error is AlchemyLifecycleError;
|
|
728
|
-
//#endregion
|
|
729
|
-
//#region src/alchemy/plan-effects.d.ts
|
|
686
|
+
export declare const isAlchemyLifecycleError: (error: unknown) => error is AlchemyLifecycleError;
|
|
730
687
|
/**
|
|
731
688
|
* The plan-output adapter (#1077): the one reader of what the installed
|
|
732
689
|
* Alchemy CLI prints for a plan.
|
|
@@ -744,7 +701,7 @@ declare const isAlchemyLifecycleError: (error: unknown) => error is AlchemyLifec
|
|
|
744
701
|
* The renderer logs every line through Effect's pretty console logger, so a
|
|
745
702
|
* line arrives as `[HH:MM:SS.mmm] INFO (#1): <line>`, and coloured when the
|
|
746
703
|
* child inherits `FORCE_COLOR`. Both wrappers are stripped before a line is
|
|
747
|
-
* read. The captured output under `tests/fixtures/plan-output/beta-
|
|
704
|
+
* read. The captured output under `tests/fixtures/plan-output/beta-84/` is
|
|
748
705
|
* the evidence for every shape this file reads.
|
|
749
706
|
*
|
|
750
707
|
* The adapter fails on anything it does not recognise: no summary, two
|
|
@@ -761,13 +718,13 @@ declare const isAlchemyLifecycleError: (error: unknown) => error is AlchemyLifec
|
|
|
761
718
|
* reviewed at one moment and deployed at another is the same plan (#1232).
|
|
762
719
|
*/
|
|
763
720
|
/** The Alchemy version whose plan renderer this adapter reads. */
|
|
764
|
-
declare const PLAN_OUTPUT_ALCHEMY_VERSION: string;
|
|
721
|
+
export declare const PLAN_OUTPUT_ALCHEMY_VERSION: string;
|
|
765
722
|
/**
|
|
766
723
|
* Every action a resource row can carry. The first six are the actions the
|
|
767
724
|
* summary counts, in the order the renderer prints them; `noop` rows print
|
|
768
725
|
* under the summary but are never counted in it.
|
|
769
726
|
*/
|
|
770
|
-
declare const PLAN_ACTIONS: readonly ["create", "update", "adopted", "replace", "delete", "orphaned", "noop"];
|
|
727
|
+
export declare const PLAN_ACTIONS: readonly ["create", "update", "adopted", "replace", "delete", "orphaned", "noop"];
|
|
771
728
|
type PlanAction = (typeof PLAN_ACTIONS)[number];
|
|
772
729
|
/** One top-level resource row of a plan. */
|
|
773
730
|
interface PlanResourceEffect {
|
|
@@ -801,7 +758,7 @@ interface PlanEffects {
|
|
|
801
758
|
}
|
|
802
759
|
type PlanEffectsRejection = "no-summary" | "multiple-summaries" | "unknown-action" | "summary-unrecognized" | "count-mismatch" | "ambiguous-rows" | "effects-under-no-changes";
|
|
803
760
|
/** The adapter could not read the output. `reason` is the whole detail. */
|
|
804
|
-
declare class PlanEffectsError extends Error {
|
|
761
|
+
export declare class PlanEffectsError extends Error {
|
|
805
762
|
readonly reason: PlanEffectsRejection;
|
|
806
763
|
constructor(reason: PlanEffectsRejection);
|
|
807
764
|
}
|
|
@@ -811,9 +768,7 @@ declare class PlanEffectsError extends Error {
|
|
|
811
768
|
* Throws `PlanEffectsError` on output the adapter cannot account for. The
|
|
812
769
|
* output itself never appears in the error.
|
|
813
770
|
*/
|
|
814
|
-
declare const parsePlanEffects: (output: string) => PlanEffects;
|
|
815
|
-
//#endregion
|
|
816
|
-
//#region src/alchemy/child-diagnostics.d.ts
|
|
771
|
+
export declare const parsePlanEffects: (output: string) => PlanEffects;
|
|
817
772
|
/**
|
|
818
773
|
* The optional record of what an Alchemy child printed (#1260).
|
|
819
774
|
*
|
|
@@ -821,8 +776,7 @@ declare const parsePlanEffects: (output: string) => PlanEffects;
|
|
|
821
776
|
* else: the child's output is parsed and dropped, so no secret in it can
|
|
822
777
|
* reach a job log or an evidence file through the operation. That is the
|
|
823
778
|
* right default and it stays the default. It also leaves an operator with a
|
|
824
|
-
* failure code and no record of what failed
|
|
825
|
-
* investigation its evidence.
|
|
779
|
+
* failure code and no record of what failed.
|
|
826
780
|
*
|
|
827
781
|
* This is the opt-in other half: a consumer that names a file gets every
|
|
828
782
|
* child's streams appended to it, each stream passed whole through the
|
|
@@ -865,8 +819,6 @@ interface ChildDiagnostics {
|
|
|
865
819
|
*/
|
|
866
820
|
readonly redact: (text: string) => string;
|
|
867
821
|
}
|
|
868
|
-
//#endregion
|
|
869
|
-
//#region src/alchemy/lifecycle.d.ts
|
|
870
822
|
interface AlchemyLifecycleRequest {
|
|
871
823
|
readonly operation: AlchemyLifecycleOperation;
|
|
872
824
|
readonly stack: string;
|
|
@@ -983,6 +935,24 @@ interface AlchemyLifecyclePolicy {
|
|
|
983
935
|
* not converged whatever this list names.
|
|
984
936
|
*/
|
|
985
937
|
readonly nonConvergentResources?: readonly string[];
|
|
938
|
+
/**
|
|
939
|
+
* Bounded read-only re-plans after the apply (#1349). A provider can
|
|
940
|
+
* report a resource as still changing for a short while after a successful
|
|
941
|
+
* apply. Set, a post-deploy plan that is only `NOT_CONVERGED` waits
|
|
942
|
+
* `delayMillis` and re-plans, up to `attempts` more times, under the same
|
|
943
|
+
* lease. The apply never repeats, and every other check (the state read on
|
|
944
|
+
* both sides of each plan, retained identities, created resources, the
|
|
945
|
+
* lease) runs on every attempt and stops the deploy at once. Exhausted, the
|
|
946
|
+
* deploy is still `NOT_CONVERGED`. Omitted, there is no retry. `attempts`
|
|
947
|
+
* is 1 to 10 and `delayMillis` 0 to 60 000, and below an explicit
|
|
948
|
+
* `ownershipTtlMillis`. That bound is a floor: the lease is renewed after
|
|
949
|
+
* each dry-run, so the delay plus one re-plan must fit inside the lease;
|
|
950
|
+
* keep the delay well under it.
|
|
951
|
+
*/
|
|
952
|
+
readonly convergenceRetries?: {
|
|
953
|
+
readonly attempts: number;
|
|
954
|
+
readonly delayMillis: number;
|
|
955
|
+
};
|
|
986
956
|
}
|
|
987
957
|
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
988
958
|
/**
|
|
@@ -1000,7 +970,8 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K>
|
|
|
1000
970
|
* which owns its own redactor and its own file.
|
|
1001
971
|
*/
|
|
1002
972
|
type AlchemyLifecycleEntry = DistributiveOmit<ExecuteAlchemyEntryOptions, "args" | "onCaptured" | "stdio" | "maxBuffer" | "redact"> & {
|
|
1003
|
-
/** Explicit dotenv file for every child; omitted preserves Alchemy defaults. */
|
|
973
|
+
/** Explicit dotenv file for every child; omitted preserves Alchemy defaults. */
|
|
974
|
+
readonly envFile?: string;
|
|
1004
975
|
};
|
|
1005
976
|
interface RunAlchemyLifecycleOptions {
|
|
1006
977
|
readonly request: AlchemyLifecycleRequest;
|
|
@@ -1095,9 +1066,7 @@ interface AlchemyLifecycleResult {
|
|
|
1095
1066
|
* mutated, and after that is reported as `CHILD_DIAGNOSTICS_UNWRITABLE` once
|
|
1096
1067
|
* the operation has finished, never in place of its postconditions.
|
|
1097
1068
|
*/
|
|
1098
|
-
declare const runAlchemyLifecycle: (options: RunAlchemyLifecycleOptions) => Promise<AlchemyLifecycleResult>;
|
|
1099
|
-
//#endregion
|
|
1100
|
-
//#region src/alchemy/state-tree.d.ts
|
|
1069
|
+
export declare const runAlchemyLifecycle: (options: RunAlchemyLifecycleOptions) => Promise<AlchemyLifecycleResult>;
|
|
1101
1070
|
/**
|
|
1102
1071
|
* The subset of the state layer the record read goes through: the atomic
|
|
1103
1072
|
* stage view and the per-resource record. `@patronage/alchemy-d1-state`
|
|
@@ -1124,7 +1093,7 @@ interface StageFilter {
|
|
|
1124
1093
|
* empty result is the store reporting nothing, never a read this module
|
|
1125
1094
|
* could not make: a state layer that cannot be read fails instead.
|
|
1126
1095
|
*/
|
|
1127
|
-
declare const inventoryStages: (state: StateService, filter?: StageFilter) => Promise<readonly StageTarget[]>;
|
|
1096
|
+
export declare const inventoryStages: (state: StateService, filter?: StageFilter) => Promise<readonly StageTarget[]>;
|
|
1128
1097
|
/**
|
|
1129
1098
|
* The persisted-state document for one stage, as `parseStateSnapshot` reads
|
|
1130
1099
|
* it: `{ resources: [{ stack, stage, fqn, state }] }`, ordered by fqn.
|
|
@@ -1140,7 +1109,7 @@ declare const inventoryStages: (state: StateService, filter?: StageFilter) => Pr
|
|
|
1140
1109
|
* the store cannot read fails. `deleteStageRows` answers an absent stage the
|
|
1141
1110
|
* other way, because it addresses a path rather than a stage view.
|
|
1142
1111
|
*/
|
|
1143
|
-
declare const readStageSnapshot: (state: StageRecordStore, target: StageTarget) => Promise<string>;
|
|
1112
|
+
export declare const readStageSnapshot: (state: StageRecordStore, target: StageTarget) => Promise<string>;
|
|
1144
1113
|
/**
|
|
1145
1114
|
* Remove every row the state layer holds for one stage. Other stages of the
|
|
1146
1115
|
* same stack keep every row.
|
|
@@ -1149,9 +1118,7 @@ declare const readStageSnapshot: (state: StageRecordStore, target: StageTarget)
|
|
|
1149
1118
|
* reported as removed, so a caller never reads a mistyped stage as a stage
|
|
1150
1119
|
* that was already empty.
|
|
1151
1120
|
*/
|
|
1152
|
-
declare const deleteStageRows: (state: StateService, target: StageTarget) => Promise<void>;
|
|
1153
|
-
//#endregion
|
|
1154
|
-
//#region src/alchemy/index.d.ts
|
|
1121
|
+
export declare const deleteStageRows: (state: StateService, target: StageTarget) => Promise<void>;
|
|
1155
1122
|
/**
|
|
1156
1123
|
* The `@patronage/factory-ci/alchemy` subpath: the only place in this package
|
|
1157
1124
|
* where `alchemy` or `effect` may be imported (ADR 0031).
|
|
@@ -1169,6 +1136,5 @@ declare const deleteStageRows: (state: StateService, target: StageTarget) => Pro
|
|
|
1169
1136
|
* both.
|
|
1170
1137
|
*/
|
|
1171
1138
|
/** The specifier a consumer imports this surface by. */
|
|
1172
|
-
declare const ALCHEMY_SUBPATH = "@patronage/factory-ci/alchemy";
|
|
1173
|
-
|
|
1174
|
-
export { ALCHEMY_SUBPATH, type AlchemyLifecycleEntry, AlchemyLifecycleError, type AlchemyLifecycleFailureCode, type AlchemyLifecycleFailureFields, type AlchemyLifecycleOperation, type AlchemyLifecyclePhase, type AlchemyLifecyclePolicy, type AlchemyLifecycleRequest, type AlchemyLifecycleResult, type AssertDestroyLeftNothingOptions, type AssertRetainedIdentitiesOptions, type AssertUrlImpliesAuthOptions, type AuthBindingNameMatcher, type ChildDiagnostics, type CloudflareCredential, CloudflareCredentialUnavailableError, type CloudflareTokenKind, type CredentialPreflightOptions, type CredentialPreflightResult, type CredentialSource, type EvaluateStackInput, type EvaluatedBinding, type EvaluatedGraph, type EvaluatedResource, type FirstDeployAuthorization, type FirstDeployAuthorizationOptions, type FirstDeployPlanHashOptions, type FirstDeployPolicy, HOSTED_CLOUDFLARE_CREDENTIAL_NAMES, LIFECYCLE_FAILURE_MESSAGES, LOCAL_PREVIEW_STAGES, MINIMUM_REDACTABLE_SECRET_LENGTH, type MutationCertainty, PLAN_ACTIONS, PLAN_OUTPUT_ALCHEMY_VERSION, type PlanAction, type PlanEffects, PlanEffectsError, type PlanEffectsRejection, type PlanResourceEffect, type PlanTaskAction, type PlanTaskEffect, RetainedIdentityError, type RetainedIdentityMarker, type RetainedIdentitySection, type RetainedIdentityViolation, type RetainedIdentityViolationReason, type RunAlchemyLifecycleOptions, SECRET_REDACTION_PLACEHOLDER, type SecretNamePolicyOptions, type StackOutputOccupancy, type StackStageOwnership, type StageCleanupOutcome, type StageLease, type StageMatcher, type StagePolicy, StagePolicyError, type StagePolicyErrorCode, type StagePolicyTable, type StageSnapshotView, type StageStateReader, type StageStateStore, type StageStateTarget, type StageTarget, type StateSnapshot, type StateSnapshotResource, type StateSnapshotScope, type UrlImpliesAuthAllowance, UrlImpliesAuthError, type UrlImpliesAuthViolation, type UrlImpliesAuthViolationReason, anyStage, assertDestroyLeftNothing, assertRetainedIdentities, assertUrlImpliesAuth, credentialPreflight, deleteStageRows, evaluateStack, firstDeployAuthorization, firstDeployPlanHash, inventoryStages, isAlchemyLifecycleError, isLocalEmulationStage, localEmulationEnvironment, parsePlanEffects, parseStateSnapshot, readStageSnapshot, runAlchemyLifecycle, secretNamePolicy, stagePolicy };
|
|
1139
|
+
export declare const ALCHEMY_SUBPATH = "@patronage/factory-ci/alchemy";
|
|
1140
|
+
export type { AlchemyLifecycleEntry, AlchemyLifecycleFailureCode, AlchemyLifecycleFailureFields, AlchemyLifecycleOperation, AlchemyLifecyclePhase, AlchemyLifecyclePolicy, AlchemyLifecycleRequest, AlchemyLifecycleResult, AssertDestroyLeftNothingOptions, AssertRetainedIdentitiesOptions, AssertUrlImpliesAuthOptions, AuthBindingNameMatcher, ChildDiagnostics, CloudflareCredential, CloudflareTokenKind, CredentialPreflightOptions, CredentialPreflightResult, CredentialSource, EvaluateStackInput, EvaluatedBinding, EvaluatedGraph, EvaluatedResource, FirstDeployAuthorization, FirstDeployAuthorizationOptions, FirstDeployPlanHashOptions, FirstDeployPolicy, MutationCertainty, PlanAction, PlanEffects, PlanEffectsRejection, PlanResourceEffect, PlanTaskAction, PlanTaskEffect, RetainedIdentityMarker, RetainedIdentitySection, RetainedIdentityViolation, RetainedIdentityViolationReason, RunAlchemyLifecycleOptions, SecretNamePolicyOptions, StackOutputOccupancy, StackStageOwnership, StageCleanupOutcome, StageLease, StageMatcher, StagePolicy, StagePolicyErrorCode, StagePolicyTable, StageSnapshotView, StageStateReader, StageStateStore, StageStateTarget, StageTarget, StateSnapshot, StateSnapshotResource, StateSnapshotScope, UrlImpliesAuthAllowance, UrlImpliesAuthViolation, UrlImpliesAuthViolationReason };
|