@caelo-cms/provisioning 0.10.69 → 0.10.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/adopt-existing.d.ts +119 -0
  2. package/dist/adopt-existing.d.ts.map +1 -0
  3. package/dist/adopt-existing.js +118 -0
  4. package/dist/adopt-existing.js.map +1 -0
  5. package/dist/preview-plan.d.ts +7 -0
  6. package/dist/preview-plan.d.ts.map +1 -1
  7. package/dist/preview-plan.js +1 -0
  8. package/dist/preview-plan.js.map +1 -1
  9. package/dist/remote-mcp.d.ts +27 -8
  10. package/dist/remote-mcp.d.ts.map +1 -1
  11. package/dist/remote-mcp.js +88 -56
  12. package/dist/remote-mcp.js.map +1 -1
  13. package/dist/stack-contract.d.ts +53 -39
  14. package/dist/stack-contract.d.ts.map +1 -1
  15. package/dist/stack-contract.js +110 -0
  16. package/dist/stack-contract.js.map +1 -1
  17. package/dist/state-command.d.ts.map +1 -1
  18. package/dist/state-command.js +27 -1
  19. package/dist/state-command.js.map +1 -1
  20. package/dist/state-migrate.d.ts +7 -0
  21. package/dist/state-migrate.d.ts.map +1 -1
  22. package/dist/state-migrate.js +18 -1
  23. package/dist/state-migrate.js.map +1 -1
  24. package/dist/state-pulumi.d.ts +7 -0
  25. package/dist/state-pulumi.d.ts.map +1 -1
  26. package/dist/state-pulumi.js +11 -0
  27. package/dist/state-pulumi.js.map +1 -1
  28. package/dist/upgrade/converge.d.ts.map +1 -1
  29. package/dist/upgrade/converge.js +4 -2
  30. package/dist/upgrade/converge.js.map +1 -1
  31. package/dist/wizards/gcp-pulumi.d.ts +28 -5
  32. package/dist/wizards/gcp-pulumi.d.ts.map +1 -1
  33. package/dist/wizards/gcp-pulumi.js +70 -8
  34. package/dist/wizards/gcp-pulumi.js.map +1 -1
  35. package/dist/wizards/gcp.d.ts.map +1 -1
  36. package/dist/wizards/gcp.js +100 -46
  37. package/dist/wizards/gcp.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/__tests__/fixtures/viu-one-plan-state-migrate.txt +98 -0
  40. package/src/adopt-existing.test.ts +397 -0
  41. package/src/adopt-existing.ts +228 -0
  42. package/src/preview-plan.ts +8 -0
  43. package/src/remote-mcp-stack-config.test.ts +195 -0
  44. package/src/remote-mcp.test.ts +99 -16
  45. package/src/remote-mcp.ts +104 -58
  46. package/src/stack-contract-parity.test.ts +28 -3
  47. package/src/stack-contract.ts +107 -6
  48. package/src/state-command.ts +38 -1
  49. package/src/state-migrate.test.ts +38 -0
  50. package/src/state-migrate.ts +24 -1
  51. package/src/state-pulumi.ts +21 -0
  52. package/src/upgrade/converge.ts +4 -2
  53. package/src/wizards/gcp-pulumi.ts +105 -9
  54. package/src/wizards/gcp.ts +126 -55
  55. package/stacks/gcp/index.ts +13 -2
  56. package/stacks/gcp-firebase/index.ts +20 -6
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Adopt cloud resources the stack declares but its Pulumi state lacks
3
+ * (#1079), before the installer's `pulumi up`.
4
+ *
5
+ * `cms-provision upgrade` converges an install through gcloud and never runs
6
+ * Pulumi (stack-converge.ts), so it creates some resources the stack also
7
+ * declares — the gateway's service account (runtime-secrets.ts), the MCP
8
+ * service account (mcp-iap.ts) — without them entering the state. The next
9
+ * installer run then plans to CREATE them, and `state migrate` refuses an
10
+ * install whose preview plans anything. So, after the preview and before
11
+ * the review:
12
+ *
13
+ * 1. {@link adoptionCandidates}: the planned creates of a kind in
14
+ * {@link ADOPTABLE_KINDS} whose inputs name the cloud resource. Only
15
+ * planned steps are looked at, so nothing the stack does not declare is
16
+ * ever adopted; every other kind is left to Pulumi.
17
+ * 2. {@link existingCandidates}: a gcloud describe per candidate. Exists →
18
+ * adopt; NOT_FOUND → a plain create; anything else stops the run (we
19
+ * can't tell, and guessing either way is wrong).
20
+ * 3. `pulumi import` of the existing ones into the stack, under the
21
+ * stack's explicit GCP provider (wizards/gcp-pulumi.ts). State only: the
22
+ * cloud resources are not touched.
23
+ * 4. A second preview: what the review shows and `up` applies. An adopted
24
+ * resource that is still planned as a create stops the run.
25
+ *
26
+ * Why only service accounts ({@link ADOPTABLE_KINDS}). A kind is adopted
27
+ * when the stack declares it AND the CLI also creates it through gcloud, and
28
+ * its name is unique in the project. Checked per kind against both stacks:
29
+ *
30
+ * - Secret Manager secrets: the stack declares only `postgres-password` and
31
+ * `secret-kek`, which the CLI never creates; the secrets the CLI makes
32
+ * (stack-contract.ts CLI_GENERATED_SECRETS) the stack only references by
33
+ * id. Adopting a secret without its value resource would also make `up`
34
+ * add a version with a freshly generated value — a new KEK.
35
+ * - Buckets, Cloud Run jobs, custom roles: the stack's buckets are made by
36
+ * Pulumi alone; the CLI's own (ops, audit results, the upgrader, converge,
37
+ * audit and operator-access jobs, their custom roles) are not declared.
38
+ * - The admin's Cloud Run domain mapping: owned by `admin-domain enable`
39
+ * (admin-domain.ts), the stack's copy stays off; Pulumi, running as the
40
+ * provisioner, could not manage it.
41
+ * - IAM member resources (`*IamMember`, `IAMMember`): non-authoritative.
42
+ * Their create is a read-modify-write that merges the member into the
43
+ * policy and succeeds when it is there already, so a planned create of
44
+ * one is an adoption already.
45
+ * - Cloud SQL users: the CLI's are IAM users named after service accounts,
46
+ * the stack's are the built-in `admin_role` / `public_role`.
47
+ */
48
+ import type { GcloudRunner } from "./gcloud-retry.js";
49
+ import type { PlannedStep } from "./preview-plan.js";
50
+ /** The cloud identity of a resource a planned create would make. */
51
+ export interface AdoptionTarget {
52
+ /** How the operator knows it, e.g. the service account's email. */
53
+ readonly display: string;
54
+ /** gcloud args that succeed exactly when it exists. */
55
+ readonly describeArgs: readonly string[];
56
+ /** The id `pulumi import` takes for the kind. */
57
+ readonly importId: string;
58
+ }
59
+ /** A resource kind the installer adopts when it exists already. */
60
+ export interface AdoptableKind {
61
+ /** What it is, for messages (`service account`). */
62
+ readonly label: string;
63
+ /**
64
+ * The resource a create with these inputs would make, or null when the
65
+ * inputs don't pin it down (then the create is left to Pulumi).
66
+ */
67
+ target(inputs: Readonly<Record<string, unknown>>, projectId: string): AdoptionTarget | null;
68
+ }
69
+ /** Kinds adopted before `up`, by Pulumi type token. See the file comment for the rest. */
70
+ export declare const ADOPTABLE_KINDS: Readonly<Record<string, AdoptableKind>>;
71
+ /** A planned create the installer may adopt instead. */
72
+ export interface AdoptionCandidate extends AdoptionTarget {
73
+ readonly step: PlannedStep;
74
+ readonly label: string;
75
+ }
76
+ /** Thrown when adoption cannot finish; nothing was applied. */
77
+ export declare class AdoptionError extends Error {
78
+ readonly name = "AdoptionError";
79
+ }
80
+ /** The planned creates of an adoptable kind, with what each would create. */
81
+ export declare function adoptionCandidates(steps: readonly PlannedStep[], projectId: string): AdoptionCandidate[];
82
+ /**
83
+ * The candidates that exist in the project.
84
+ *
85
+ * @throws AdoptionError when a describe fails for another reason than NOT_FOUND
86
+ */
87
+ export declare function existingCandidates(candidates: readonly AdoptionCandidate[], run: GcloudRunner): Promise<AdoptionCandidate[]>;
88
+ /** What adoption needs from Pulumi and gcloud; fakes in tests. */
89
+ export interface AdoptionDeps {
90
+ readonly projectId: string;
91
+ readonly gcloud: GcloudRunner;
92
+ /** A fresh preview of the stack. */
93
+ preview(): Promise<readonly PlannedStep[]>;
94
+ /** `pulumi import` the candidates into the stack (state only). */
95
+ importResources(candidates: readonly AdoptionCandidate[]): Promise<void>;
96
+ }
97
+ /** The plan to review after adoption, and what was adopted into it. */
98
+ export interface AdoptionResult {
99
+ readonly adopted: readonly AdoptionCandidate[];
100
+ readonly steps: readonly PlannedStep[];
101
+ }
102
+ /**
103
+ * The line of a failed Pulumi call that says what went wrong. The
104
+ * Automation API's error starts with `code: 255` and carries the CLI's
105
+ * stderr below; its first `error:` line is the reason.
106
+ */
107
+ export declare function pulumiErrorReason(e: unknown): string;
108
+ /**
109
+ * Adopt the planned creates of `steps` that exist in the project already,
110
+ * and return the plan after it. With nothing to adopt, `steps` comes back
111
+ * unchanged and nothing else runs.
112
+ *
113
+ * @throws AdoptionError when a probe or the import fails, or a re-plan still
114
+ * creates an adopted resource; `up` must not run then
115
+ */
116
+ export declare function adoptExistingResources(steps: readonly PlannedStep[], deps: AdoptionDeps): Promise<AdoptionResult>;
117
+ /** The adopted resources as lines for the review, or none. */
118
+ export declare function formatAdopted(adopted: readonly AdoptionCandidate[]): string[];
119
+ //# sourceMappingURL=adopt-existing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adopt-existing.d.ts","sourceRoot":"","sources":["../src/adopt-existing.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC;CAC7F;AAED,0FAA0F;AAC1F,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CA6BnE,CAAC;AAEF,wDAAwD;AACxD,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CA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type token. See the file comment for the rest. */
3
+ export const ADOPTABLE_KINDS = {
4
+ "gcp:serviceaccount/account:Account": {
5
+ label: "service account",
6
+ target(inputs, projectId) {
7
+ // GCP's account-id format; also keeps out the engine's placeholder
8
+ // for a value only known after apply.
9
+ const accountId = inputs.accountId;
10
+ if (typeof accountId !== "string" || !/^[a-z][a-z0-9-]{4,28}[a-z0-9]$/.test(accountId)) {
11
+ return null;
12
+ }
13
+ // Unset means the provider's project, which is the install's
14
+ // (assertStackProject). Another project is never adopted.
15
+ const project = inputs.project ?? projectId;
16
+ if (project !== projectId)
17
+ return null;
18
+ const email = `${accountId}@${projectId}.iam.gserviceaccount.com`;
19
+ return {
20
+ display: email,
21
+ describeArgs: [
22
+ "iam",
23
+ "service-accounts",
24
+ "describe",
25
+ email,
26
+ `--project=${projectId}`,
27
+ "--format=value(email)",
28
+ ],
29
+ importId: `projects/${projectId}/serviceAccounts/${email}`,
30
+ };
31
+ },
32
+ },
33
+ };
34
+ /** Thrown when adoption cannot finish; nothing was applied. */
35
+ export class AdoptionError extends Error {
36
+ name = "AdoptionError";
37
+ }
38
+ /** The planned creates of an adoptable kind, with what each would create. */
39
+ export function adoptionCandidates(steps, projectId) {
40
+ const out = [];
41
+ for (const step of steps) {
42
+ if (step.op !== "create")
43
+ continue;
44
+ const kind = ADOPTABLE_KINDS[step.type];
45
+ if (!kind || !step.inputs)
46
+ continue;
47
+ const target = kind.target(step.inputs, projectId);
48
+ if (target)
49
+ out.push({ ...target, step, label: kind.label });
50
+ }
51
+ return out;
52
+ }
53
+ const NOT_FOUND = /NOT_FOUND|not found|does not exist/i;
54
+ /**
55
+ * The candidates that exist in the project.
56
+ *
57
+ * @throws AdoptionError when a describe fails for another reason than NOT_FOUND
58
+ */
59
+ export async function existingCandidates(candidates, run) {
60
+ const existing = [];
61
+ for (const c of candidates) {
62
+ const r = await run([...c.describeArgs]);
63
+ if (r.ok)
64
+ existing.push(c);
65
+ else if (!NOT_FOUND.test(r.stderr)) {
66
+ throw new AdoptionError(`could not tell whether the ${c.label} ${c.display} exists (gcloud: ${r.stderr.trim()}). Nothing was imported or applied. Check that gcloud is signed in as the Owner (gcloud auth login) and re-run the installer.`);
67
+ }
68
+ }
69
+ return existing;
70
+ }
71
+ /**
72
+ * The line of a failed Pulumi call that says what went wrong. The
73
+ * Automation API's error starts with `code: 255` and carries the CLI's
74
+ * stderr below; its first `error:` line is the reason.
75
+ */
76
+ export function pulumiErrorReason(e) {
77
+ const lines = (e instanceof Error ? e.message : String(e))
78
+ .split("\n")
79
+ .map((l) => l.trim().replace(/^stderr:\s*/, ""))
80
+ .filter((l) => l !== "");
81
+ return lines.find((l) => /^error:/i.test(l)) ?? lines[0] ?? "no output";
82
+ }
83
+ /**
84
+ * Adopt the planned creates of `steps` that exist in the project already,
85
+ * and return the plan after it. With nothing to adopt, `steps` comes back
86
+ * unchanged and nothing else runs.
87
+ *
88
+ * @throws AdoptionError when a probe or the import fails, or a re-plan still
89
+ * creates an adopted resource; `up` must not run then
90
+ */
91
+ export async function adoptExistingResources(steps, deps) {
92
+ const existing = await existingCandidates(adoptionCandidates(steps, deps.projectId), deps.gcloud);
93
+ if (existing.length === 0)
94
+ return { adopted: [], steps };
95
+ const names = existing.map((c) => `${c.label} ${c.display}`).join(", ");
96
+ try {
97
+ await deps.importResources(existing);
98
+ }
99
+ catch (e) {
100
+ throw new AdoptionError(`could not adopt ${names} (already in the project) into the stack: pulumi import says "${pulumiErrorReason(e)}". Nothing was applied. Re-run the installer: what was adopted stays adopted. If it fails the same way, report it with this message.`);
101
+ }
102
+ const after = await deps.preview();
103
+ const stillCreated = after.filter((s) => s.op === "create" && existing.some((c) => c.step.urn === s.urn));
104
+ if (stillCreated.length > 0) {
105
+ throw new AdoptionError(`imported ${names}, but the next preview still creates ${stillCreated.map((s) => s.name).join(", ")}. Nothing was applied. Report this with the message; re-running the installer does not fix it.`);
106
+ }
107
+ return { adopted: existing, steps: after };
108
+ }
109
+ /** The adopted resources as lines for the review, or none. */
110
+ export function formatAdopted(adopted) {
111
+ if (adopted.length === 0)
112
+ return [];
113
+ return [
114
+ `Adopted (${adopted.length}) — already in the project, now in the stack instead of created again:`,
115
+ ...adopted.map((c) => ` ${c.label} ${c.display} (${c.step.name})`),
116
+ ];
117
+ }
118
+ //# sourceMappingURL=adopt-existing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adopt-existing.js","sourceRoot":"","sources":["../src/adopt-existing.ts"],"names":[],"mappings":"AAAA,mCAAmC;AA0EnC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,eAAe,GAA4C;IACtE,oCAAoC,EAAE;QACpC,KAAK,EAAE,iBAAiB;QACxB,MAAM,CAAC,MAAM,EAAE,SAAS;YACtB,mEAAmE;YACnE,sCAAsC;YACtC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;YACnC,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,gCAAgC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBACvF,OAAO,IAAI,CAAC;YACd,CAAC;YACD,6DAA6D;YAC7D,0DAA0D;YAC1D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC;YAC5C,IAAI,OAAO,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;YACvC,MAAM,KAAK,GAAG,GAAG,SAAS,IAAI,SAAS,0BAA0B,CAAC;YAClE,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE;oBACZ,KAAK;oBACL,kBAAkB;oBAClB,UAAU;oBACV,KAAK;oBACL,aAAa,SAAS,EAAE;oBACxB,uBAAuB;iBACxB;gBACD,QAAQ,EAAE,YAAY,SAAS,oBAAoB,KAAK,EAAE;aAC3D,CAAC;QACJ,CAAC;KACF;CACF,CAAC;AAQF,+DAA+D;AAC/D,MAAM,OAAO,aAAc,SAAQ,KAAK;IACpB,IAAI,GAAG,eAAe,CAAC;CAC1C;AAED,6EAA6E;AAC7E,MAAM,UAA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B,mBAAmB,KAAK,iEAAiE,iBAAiB,CAAC,CAAC,CAAC,sIAAsI,CACpP,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACnC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAC/B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CACvE,CAAC;IACF,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,aAAa,CACrB,YAAY,KAAK,wCAAwC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,gGAAgG,CACpM,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,OAAqC;IACjE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,OAAO;QACL,YAAY,OAAO,CAAC,MAAM,wEAAwE;QAClG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;KACpE,CAAC;AACJ,CAAC"}
@@ -13,6 +13,13 @@ export interface PlannedStep {
13
13
  readonly diffs: readonly string[];
14
14
  /** Properties that force the replace (replace steps only). */
15
15
  readonly replaceReasons: readonly string[];
16
+ /**
17
+ * The inputs the program declares, for create steps only (#1079: they name
18
+ * the cloud resource a create would make, e.g. a service account's
19
+ * `accountId`, so adopt-existing.ts can tell whether it exists already).
20
+ * Secret values arrive masked by the engine. Never written to a plan file.
21
+ */
22
+ readonly inputs?: Readonly<Record<string, unknown>>;
16
23
  }
17
24
  /** What a data-bearing resource holds, or null for any other type. */
18
25
  export declare function dataBearingKind(type: string): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"preview-plan.d.ts","sourceRoot":"","sources":["../src/preview-plan.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAU,MAAM,2BAA2B,CAAC;AAErE,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9E,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,8DAA8D;IAC9D,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAkCD,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE3D;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAEpD;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAEzE;AAOD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,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IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE;AAC3D,yEAAyE;GACvE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEhC;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,IAAI,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;CAAE,GACtC,QAAQ,CAKV"}
@@ -81,6 +81,7 @@ export function collectPreviewSteps() {
81
81
  urn: m.urn,
82
82
  diffs: [...(m.diffs ?? [])],
83
83
  replaceReasons: op === "replace" ? [...(m.keys ?? [])] : [],
84
+ ...(op === "create" && m.new?.inputs ? { inputs: { ...m.new.inputs } } : {}),
84
85
  });
85
86
  },
86
87
  steps: () => [...byUrn.values()],
@@ -1 +1 @@
1
- {"version":3,"file":"preview-plan.js","sourceRoot":"","sources":["../src/preview-plan.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAoBjC;;;;GAIG;AACH,MAAM,OAAO,GAAiD;IAC5D,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,oBAAoB,EAAE,SAAS;CAChC,CAAC;AAEF;;;;GAIG;AACH,MAAM,YAAY,GAAqC;IACrD,2CAA2C,EAAE,oCAAoC;IACjF,2BAA2B,EAAE,oBAAoB;IACjD,2BAA2B,EAAE,uDAAuD;IACpF,iCAAiC,EAAE,uBAAuB;IAC1D,+CAA+C,EAAE,6BAA6B;IAC9E,8BAA8B,EAAE,kBAAkB;IAClD,sCAAsC,EAAE,uBAAuB;IAC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AAE;YACpB,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;gBAC7B,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1D,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACtE,CAAC,IAAI,CAAC,IAAI,CAAC,CACb;QACD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AAWD;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,KAA6B,EAC7B,IAAuC;IAEvC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAClE,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACzD,CAAC"}
@@ -51,23 +51,42 @@ export declare function resolveRemoteMcpIdentity(target: RemoteMcpTarget, deps?:
51
51
  readonly orgDomainError?: string;
52
52
  }>>;
53
53
  /**
54
- * Bring both services' {@link RemoteMcpIdentity} env vars to `identity`
55
- * with one `gcloud run services update` per service that differs (a new
56
- * revision only then). Vars already right are left alone.
54
+ * #1082 — the deployed install remote MCP is resolved on: the Pulumi-suffixed
55
+ * admin and gateway Cloud Run services found by prefix. Read-only.
57
56
  */
58
- export declare function applyRemoteMcpIdentityEnv(target: RemoteMcpTarget, identity: RemoteMcpIdentity, deps?: {
57
+ export declare function findRemoteMcpTarget(base: Omit<RemoteMcpTarget, "services">, deps?: {
59
58
  run?: GcloudRunner;
60
59
  }): Promise<RemoteMcpResult<{
61
- readonly changes: Record<CloudRunSlug, EnvChange[]>;
60
+ readonly target: RemoteMcpTarget;
62
61
  }>>;
63
- /** {@link resolveRemoteMcpIdentity} then {@link applyRemoteMcpIdentityEnv}. */
64
- export declare function ensureRemoteMcpIdentityEnv(target: RemoteMcpTarget, deps?: {
62
+ /**
63
+ * #1082 — the identity the installer writes into the stack config before
64
+ * `up` (stack-contract.ts REMOTE_MCP_IDENTITY_CONFIG), so the stack declares
65
+ * the vars the services carry and `up` keeps them.
66
+ *
67
+ * {@link resolveRemoteMcpIdentity}, except for the organisation domain when
68
+ * it cannot be read: then the admin's live `CAELO_GOOGLE_ORG_DOMAIN` is
69
+ * carried over (an earlier run as an account with the Organization Viewer
70
+ * role set it). The stack would otherwise remove it, where a gcloud roll
71
+ * leaves it as it is. `orgDomainError` still says why it was not read.
72
+ */
73
+ export declare function resolveStackRemoteMcpIdentity(target: RemoteMcpTarget, deps?: {
65
74
  run?: GcloudRunner;
66
75
  }): Promise<RemoteMcpResult<{
67
76
  readonly identity: RemoteMcpIdentity;
68
- readonly changes: Record<CloudRunSlug, EnvChange[]>;
69
77
  readonly orgDomainError?: string;
70
78
  }>>;
79
+ /**
80
+ * #1082 — what each service's identity env lacks against `identity`
81
+ * (read-only). The stack owns these vars now; this is the installer's check
82
+ * that the `up` it just ran put them in place. An empty list per service is
83
+ * the expected answer.
84
+ */
85
+ export declare function checkRemoteMcpIdentityEnv(target: RemoteMcpTarget, identity: RemoteMcpIdentity, deps?: {
86
+ run?: GcloudRunner;
87
+ }): Promise<RemoteMcpResult<{
88
+ readonly drift: Record<CloudRunSlug, EnvChange[]>;
89
+ }>>;
71
90
  /** A path rule / matcher / URL map as the Compute API returns them (the parts used here). */
72
91
  interface UrlMapPathRule {
73
92
  readonly paths: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"remote-mcp.d.ts","sourceRoot":"","sources":["../src/remote-mcp.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EAGvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,SAAS,EAAmC,MAAM,qBAAqB,CAAC;AAEtF,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3D;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IACzB,CAAC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,CAAC,GAC3B;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAsBnD;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE;IAAE,GAAG,CAAC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AC5E,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAC,EAC1E,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAAO,GACzF,OAAO,CAAC,eAAe,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC,CAcvD"}
@@ -2,13 +2,15 @@
2
2
  /**
3
3
  * #806 — the CLI's part of remote MCP on a Google IAP install (`gcp`,
4
4
  * `gcp-firebase`), run as the operator's (or the provisioner's) gcloud
5
- * identity by the wizard after `pulumi up` and by `cms-provision upgrade`
6
- * after the roll. Every step is idempotent.
5
+ * identity by the wizard around `pulumi up`, by `state migrate`'s preview
6
+ * and by `cms-provision upgrade` around the roll. Every step is idempotent.
7
7
  *
8
- * - {@link ensureRemoteMcpIdentityEnv}: the env vars that name generated
9
- * identities ({@link RemoteMcpIdentity} — why the stacks cannot declare
10
- * them is in stack-contract.ts), applied with `gcloud run services
11
- * update` only where they differ.
8
+ * - {@link resolveStackRemoteMcpIdentity}: the env vars that name
9
+ * generated identities ({@link RemoteMcpIdentity}), resolved from the
10
+ * live install for the stack config the installer writes before `up`
11
+ * (#1082: the stack is their one owner — stack-contract.ts says why
12
+ * they cannot be plain resource inputs), and
13
+ * {@link checkRemoteMcpIdentityEnv}, the read-only check after it.
12
14
  * - {@link ensureRemoteMcpEdge} (`gcp` only): the load balancer's part for
13
15
  * installs whose URL map / Cloud Armor policy predate it — the
14
16
  * `/.well-known/oauth-*` path rules (the stack ignores `pathRules` after
@@ -31,8 +33,9 @@ import { GCP_PUBLIC_BASE_PATHS } from "@caelo-cms/shared";
31
33
  import { gcloud as defaultGcloud } from "./gcloud.js";
32
34
  import { gcpNamePrefix } from "./gcp-names.js";
33
35
  import { isMcpArmorRule, MCP_ARMOR_RULE, mcpArmorRuleFlags, } from "./remote-mcp-edge.js";
34
- import { remoteMcpIdentity, remoteMcpIdentityEnv, } from "./stack-contract.js";
36
+ import { REMOTE_MCP_ENV, remoteMcpIdentity, remoteMcpIdentityEnv, } from "./stack-contract.js";
35
37
  import { liveContainerEnv, planEnvUpdate } from "./stack-converge.js";
38
+ import { lookupFailure, resolveGcpResourceName } from "./upgrade/gcp-lookup.js";
36
39
  /** Parse gcloud JSON output; null (never a throw) when it is not JSON. */
37
40
  function parseJson(stdout) {
38
41
  try {
@@ -181,67 +184,96 @@ async function resolveServiceIdentity(target, deps = {}) {
181
184
  }),
182
185
  };
183
186
  }
187
+ /** `gcloud run services describe --format=json` of one service, or why it failed. */
188
+ async function describeService(target, service, run) {
189
+ const describe = await run([
190
+ "run",
191
+ "services",
192
+ "describe",
193
+ service,
194
+ `--region=${target.region}`,
195
+ `--project=${target.projectId}`,
196
+ "--format=json",
197
+ ]);
198
+ if (!describe.ok)
199
+ return { ok: false, error: `describe ${service}: ${describe.stderr.trim()}` };
200
+ if (parseJson(describe.stdout) === null) {
201
+ return { ok: false, error: `describe ${service}: output is not JSON` };
202
+ }
203
+ return { ok: true, json: describe.stdout };
204
+ }
184
205
  /**
185
- * Bring both services' {@link RemoteMcpIdentity} env vars to `identity`
186
- * with one `gcloud run services update` per service that differs (a new
187
- * revision only then). Vars already right are left alone.
206
+ * #1082 — the deployed install remote MCP is resolved on: the Pulumi-suffixed
207
+ * admin and gateway Cloud Run services found by prefix. Read-only.
188
208
  */
189
- export async function applyRemoteMcpIdentityEnv(target, identity, deps = {}) {
209
+ export async function findRemoteMcpTarget(base, deps = {}) {
190
210
  const run = deps.run ?? defaultGcloud;
191
- const desired = remoteMcpIdentityEnv(identity);
192
- const changes = { admin: [], gateway: [] };
211
+ const services = {};
193
212
  for (const slug of ["admin", "gateway"]) {
194
- const service = target.services[slug];
195
- const describe = await run([
196
- "run",
197
- "services",
198
- "describe",
199
- service,
200
- `--region=${target.region}`,
201
- `--project=${target.projectId}`,
202
- "--format=json",
203
- ]);
204
- if (!describe.ok)
205
- return { ok: false, error: `describe ${service}: ${describe.stderr.trim()}` };
206
- if (parseJson(describe.stdout) === null) {
207
- return { ok: false, error: `describe ${service}: output is not JSON` };
213
+ const prefix = `${gcpNamePrefix(base.env)}-${slug}`;
214
+ const lookup = await resolveGcpResourceName(run, "run-service", prefix, base.projectId, base.region);
215
+ if (lookup.status !== "found") {
216
+ return {
217
+ ok: false,
218
+ error: lookupFailure(lookup, `${prefix}* Cloud Run service`, "operator"),
219
+ };
208
220
  }
209
- const plan = planEnvUpdate(liveContainerEnv(describe.stdout), desired[slug]);
210
- if (!plan.ok)
211
- return { ok: false, error: `${slug}: ${plan.error}` };
212
- if (plan.flags.length === 0)
213
- continue;
214
- const update = await run([
215
- "run",
216
- "services",
217
- "update",
218
- service,
219
- `--region=${target.region}`,
220
- `--project=${target.projectId}`,
221
- ...plan.flags,
222
- "--quiet",
223
- ]);
224
- if (!update.ok)
225
- return { ok: false, error: `update ${service}: ${update.stderr.trim()}` };
226
- changes[slug] = plan.changes;
221
+ services[slug] = lookup.name;
227
222
  }
228
- return { ok: true, changes };
223
+ return {
224
+ ok: true,
225
+ target: { ...base, services: services },
226
+ };
229
227
  }
230
- /** {@link resolveRemoteMcpIdentity} then {@link applyRemoteMcpIdentityEnv}. */
231
- export async function ensureRemoteMcpIdentityEnv(target, deps = {}) {
232
- const resolved = await resolveRemoteMcpIdentity(target, deps);
233
- if (!resolved.ok)
228
+ /**
229
+ * #1082 — the identity the installer writes into the stack config before
230
+ * `up` (stack-contract.ts REMOTE_MCP_IDENTITY_CONFIG), so the stack declares
231
+ * the vars the services carry and `up` keeps them.
232
+ *
233
+ * {@link resolveRemoteMcpIdentity}, except for the organisation domain when
234
+ * it cannot be read: then the admin's live `CAELO_GOOGLE_ORG_DOMAIN` is
235
+ * carried over (an earlier run as an account with the Organization Viewer
236
+ * role set it). The stack would otherwise remove it, where a gcloud roll
237
+ * leaves it as it is. `orgDomainError` still says why it was not read.
238
+ */
239
+ export async function resolveStackRemoteMcpIdentity(target, deps = {}) {
240
+ const run = deps.run ?? defaultGcloud;
241
+ const resolved = await resolveRemoteMcpIdentity(target, { run });
242
+ if (!resolved.ok || !resolved.orgDomainError)
234
243
  return resolved;
235
- const applied = await applyRemoteMcpIdentityEnv(target, resolved.identity, deps);
236
- if (!applied.ok)
237
- return applied;
244
+ const admin = await describeService(target, target.services.admin, run);
245
+ if (!admin.ok)
246
+ return admin;
247
+ const live = liveContainerEnv(admin.json).get(REMOTE_MCP_ENV.googleOrgDomain);
238
248
  return {
239
249
  ok: true,
240
- identity: resolved.identity,
241
- changes: applied.changes,
242
- ...(resolved.orgDomainError ? { orgDomainError: resolved.orgDomainError } : {}),
250
+ identity: live?.kind === "value"
251
+ ? { ...resolved.identity, googleOrgDomain: live.value }
252
+ : resolved.identity,
253
+ orgDomainError: resolved.orgDomainError,
243
254
  };
244
255
  }
256
+ /**
257
+ * #1082 — what each service's identity env lacks against `identity`
258
+ * (read-only). The stack owns these vars now; this is the installer's check
259
+ * that the `up` it just ran put them in place. An empty list per service is
260
+ * the expected answer.
261
+ */
262
+ export async function checkRemoteMcpIdentityEnv(target, identity, deps = {}) {
263
+ const run = deps.run ?? defaultGcloud;
264
+ const desired = remoteMcpIdentityEnv(identity);
265
+ const drift = { admin: [], gateway: [] };
266
+ for (const slug of ["admin", "gateway"]) {
267
+ const described = await describeService(target, target.services[slug], run);
268
+ if (!described.ok)
269
+ return described;
270
+ const plan = planEnvUpdate(liveContainerEnv(described.json), desired[slug]);
271
+ if (!plan.ok)
272
+ return { ok: false, error: `${slug}: ${plan.error}` };
273
+ drift[slug] = plan.changes;
274
+ }
275
+ return { ok: true, drift };
276
+ }
245
277
  /**
246
278
  * The URL map with every {@link GCP_PUBLIC_BASE_PATHS} entry routed like
247
279
  * `/api/*` (to the gateway). Only the rule that carries `/api/*` changes;