gencow 0.1.280 → 0.1.282

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.
@@ -0,0 +1,224 @@
1
+ // Pure parsing, validation and rendering helpers for `gencow credits` / `gencow usage`.
2
+ // The Platform `usage.byUser` payload is the only data source; unknown fields are ignored so
3
+ // additive server changes never break the CLI, and the account user id is never carried forward.
4
+
5
+ import { BOLD, CYAN, DIM, RESET } from "./output.mjs";
6
+
7
+ const MONTH_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/u;
8
+ const SAFE_TEXT_PATTERN = /^[A-Za-z0-9 _.:/@()\-]{1,200}$/u;
9
+ const SAFE_CODE_PATTERN = /^[A-Z][A-Z0-9_]{2,80}$/u;
10
+ const SAFE_CORRELATION_PATTERN = /^[A-Za-z0-9_-]{8,128}$/u;
11
+
12
+ const isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
13
+ const num = (value) => (typeof value === "number" && Number.isFinite(value) ? value : null);
14
+ const text = (value) => (typeof value === "string" && value.length > 0 ? value : null);
15
+
16
+ export function parseUsageMonth(value, now = new Date()) {
17
+ if (value === undefined) return { ok: true, month: undefined };
18
+ if (typeof value !== "string" || !MONTH_PATTERN.test(value)) {
19
+ return { ok: false, message: "Invalid --month. Use the YYYY-MM format, for example 2026-10." };
20
+ }
21
+ const current = `${now.getUTCFullYear()}-${String(now.getUTCMonth() + 1).padStart(2, "0")}`;
22
+ if (value > current) {
23
+ return { ok: false, message: `Invalid --month. ${value} is in the future (latest allowed: ${current}).` };
24
+ }
25
+ return { ok: true, month: value };
26
+ }
27
+
28
+ function readCredits(value) {
29
+ if (!isRecord(value)) return null;
30
+ const total = num(value.total);
31
+ const used = num(value.used);
32
+ const remaining = num(value.remaining);
33
+ return total === null || used === null || remaining === null ? null : { total, used, remaining };
34
+ }
35
+
36
+ function readServiceCredits(value) {
37
+ if (!isRecord(value)) return null;
38
+ const balance = num(value.balance);
39
+ if (balance === null) return null;
40
+ return {
41
+ balance,
42
+ periodUsed: num(value.periodUsed) ?? 0,
43
+ spendCapEnabled: value.spendCapEnabled === true,
44
+ spendCapAmount: num(value.spendCapAmount),
45
+ };
46
+ }
47
+
48
+ export function parseUsagePayload(value) {
49
+ if (!isRecord(value)) return null;
50
+ const plan = text(value.planDisplayName) ?? text(value.plan);
51
+ const platformCredits = readCredits(value.credits);
52
+ const serviceCredits = readServiceCredits(value.serviceCredits);
53
+ if (!plan || !platformCredits || !serviceCredits) return null;
54
+
55
+ const period = isRecord(value.period)
56
+ ? { start: text(value.period.start), end: text(value.period.end) }
57
+ : { start: null, end: null };
58
+ const spendCap = isRecord(value.spendCap)
59
+ ? { enabled: value.spendCap.enabled === true, amount: num(value.spendCap.amount) }
60
+ : { enabled: false, amount: null };
61
+ const serviceUsage = (Array.isArray(value.serviceUsageBreakdown) ? value.serviceUsageBreakdown : [])
62
+ .filter(isRecord)
63
+ .map((row) => ({
64
+ service: text(row.serviceType) ?? "unknown",
65
+ provider: text(row.provider),
66
+ unit: text(row.unitLabel),
67
+ quantity: num(row.unitQuantity) ?? 0,
68
+ credits: num(row.chargedCredits) ?? 0,
69
+ }));
70
+ const apps = (Array.isArray(value.apps) ? value.apps : [])
71
+ .filter((row) => isRecord(row) && text(row.appId))
72
+ .map((row) => ({
73
+ name: row.appId,
74
+ status: text(row.status) ?? "unknown",
75
+ platformCreditsUsed: num(row.creditsUsed) ?? 0,
76
+ serviceCreditsUsed: num(row.serviceCreditsUsed) ?? 0,
77
+ }));
78
+ const measurement = isRecord(value.measurement)
79
+ ? { status: text(value.measurement.status) ?? "unknown", lastUpdatedAt: text(value.measurement.lastUpdatedAt) }
80
+ : { status: "unknown", lastUpdatedAt: null };
81
+
82
+ return { plan, period, platformCredits, serviceCredits, spendCap, serviceUsage, apps, measurement };
83
+ }
84
+
85
+ export function toCreditsJson(summary) {
86
+ return {
87
+ plan: summary.plan,
88
+ period: summary.period,
89
+ platformCredits: summary.platformCredits,
90
+ serviceCredits: {
91
+ balance: summary.serviceCredits.balance,
92
+ periodUsed: summary.serviceCredits.periodUsed,
93
+ spendCapEnabled: summary.serviceCredits.spendCapEnabled,
94
+ spendCapAmount: summary.serviceCredits.spendCapAmount,
95
+ },
96
+ spendCap: summary.spendCap,
97
+ };
98
+ }
99
+
100
+ export function toUsageJson(summary, appFilter) {
101
+ return {
102
+ ...toCreditsJson(summary),
103
+ serviceUsage: summary.serviceUsage,
104
+ apps: filterApps(summary.apps, appFilter),
105
+ measurement: summary.measurement,
106
+ };
107
+ }
108
+
109
+ export function filterApps(apps, appFilter) {
110
+ return appFilter ? apps.filter((app) => app.name === appFilter) : apps;
111
+ }
112
+
113
+ export const formatNumber = (value) =>
114
+ value.toLocaleString("en-US", { maximumFractionDigits: 2 });
115
+
116
+ function formatDate(iso) {
117
+ return iso ? iso.slice(0, 10) : "—";
118
+ }
119
+
120
+ export function formatCreditsLines(summary) {
121
+ const { serviceCredits, platformCredits, spendCap, period } = summary;
122
+ const lines = [
123
+ "",
124
+ `${BOLD}${CYAN}Credits${RESET} ${DIM}plan: ${summary.plan}${RESET}`,
125
+ ` Service credits (AI / media) ${BOLD}${formatNumber(serviceCredits.balance)}${RESET} remaining`,
126
+ ` Platform credits ${BOLD}${formatNumber(platformCredits.remaining)}${RESET} remaining ${DIM}of ${formatNumber(platformCredits.total)}${RESET}`,
127
+ ` ${DIM}Period ${formatDate(period.start)} → ${formatDate(period.end)} · used this period: service ${formatNumber(serviceCredits.periodUsed)}, platform ${formatNumber(platformCredits.used)}${RESET}`,
128
+ ];
129
+ if (serviceCredits.spendCapEnabled) {
130
+ lines.push(` ${DIM}Service spend cap: ${serviceCredits.spendCapAmount === null ? "on" : formatNumber(serviceCredits.spendCapAmount)}${RESET}`);
131
+ }
132
+ if (spendCap.enabled) {
133
+ lines.push(` ${DIM}Platform spend cap: ${spendCap.amount === null ? "on" : formatNumber(spendCap.amount)}${RESET}`);
134
+ }
135
+ lines.push("");
136
+ return lines;
137
+ }
138
+
139
+ export function formatUsageLines(summary, appFilter) {
140
+ const apps = filterApps(summary.apps, appFilter);
141
+ const lines = formatCreditsLines(summary);
142
+ lines.push(`${BOLD}${CYAN}Usage by app${RESET}`);
143
+ if (apps.length === 0) {
144
+ lines.push(` ${DIM}No apps.${RESET}`);
145
+ } else {
146
+ lines.push(` ${"APP".padEnd(24)} ${"STATUS".padEnd(10)} ${"PLATFORM".padStart(10)} ${"SERVICE".padStart(10)}`);
147
+ for (const app of apps) {
148
+ lines.push(
149
+ ` ${app.name.padEnd(24)} ${app.status.padEnd(10)} ${formatNumber(app.platformCreditsUsed).padStart(10)} ${formatNumber(app.serviceCreditsUsed).padStart(10)}`,
150
+ );
151
+ }
152
+ }
153
+ if (!appFilter && summary.serviceUsage.length > 0) {
154
+ lines.push("", `${BOLD}${CYAN}Service usage${RESET}`);
155
+ for (const row of summary.serviceUsage) {
156
+ const via = row.provider ? ` (${row.provider})` : "";
157
+ const unit = row.unit ? ` ${row.unit}` : "";
158
+ lines.push(` ${(row.service + via).padEnd(28)} ${formatNumber(row.quantity)}${unit} → ${formatNumber(row.credits)} credits`);
159
+ }
160
+ }
161
+ if (summary.measurement.status !== "ready" && summary.measurement.status !== "unknown") {
162
+ lines.push("", ` ${DIM}Measurement status: ${summary.measurement.status} — recent usage may not be fully reflected yet.${RESET}`);
163
+ }
164
+ lines.push("");
165
+ return lines;
166
+ }
167
+
168
+ function safeText(value) {
169
+ return typeof value === "string" && SAFE_TEXT_PATTERN.test(value) ? value : null;
170
+ }
171
+
172
+ /**
173
+ * Render a failed Platform response using only the typed, public diagnostic fields.
174
+ * Unknown shapes fall back to a status-derived, non-support-escalating message.
175
+ */
176
+ export function formatUsageFailure(response, body, { command }) {
177
+ const status = response?.status;
178
+ const typed = isRecord(body) && SAFE_CODE_PATTERN.test(String(body.code ?? ""));
179
+ const lines = [];
180
+ if (typed) {
181
+ lines.push(safeText(body.error) ?? `gencow ${command} could not complete.`);
182
+ lines.push(`Code: ${body.code}`);
183
+ if (safeText(body.stage)) lines.push(`Stage: ${body.stage}`);
184
+ if (body.stateChanged === false) lines.push("State: nothing was changed.");
185
+ if (typeof body.retryable === "boolean") lines.push(`Retryable: ${body.retryable ? "yes" : "no"}`);
186
+ if (safeText(body.nextAction)) lines.push(`Next: ${body.nextAction}`);
187
+ } else if (status === 401) {
188
+ lines.push("You are not signed in, or your session has expired.");
189
+ lines.push("Code: CLI_AUTH_REQUIRED", "State: nothing was changed.", "Retryable: no", "Next: gencow login");
190
+ } else if (status === 503) {
191
+ lines.push("The Gencow Platform is temporarily unavailable.");
192
+ lines.push("Code: CLI_PLATFORM_UNAVAILABLE", "State: nothing was changed.", "Retryable: yes");
193
+ lines.push(`Next: wait a moment, then run gencow ${command} again.`);
194
+ } else {
195
+ lines.push(`gencow ${command} failed (HTTP ${Number.isInteger(status) ? status : "unknown"}).`);
196
+ lines.push("Code: CLI_PLATFORM_REQUEST_FAILED", "State: nothing was changed.");
197
+ lines.push(`Next: run gencow ${command} again; if it keeps failing, run gencow doctor and include the correlation ID below.`);
198
+ }
199
+ const correlation = response?.headers?.get?.("x-correlation-id") ?? response?.headers?.get?.("x-request-id");
200
+ if (typeof correlation === "string" && SAFE_CORRELATION_PATTERN.test(correlation)) {
201
+ lines.push(`Correlation: ${correlation}`);
202
+ }
203
+ return lines.join("\n");
204
+ }
205
+
206
+ export function formatUnreachable({ command }) {
207
+ return [
208
+ "Could not reach the Gencow Platform.",
209
+ "Code: CLI_PLATFORM_UNREACHABLE",
210
+ "State: nothing was changed.",
211
+ "Retryable: yes",
212
+ `Next: check your network connection, then run gencow ${command} again.`,
213
+ ].join("\n");
214
+ }
215
+
216
+ export function formatInvalidResponse({ command }) {
217
+ return [
218
+ `The Platform returned data gencow ${command} does not understand.`,
219
+ "Code: CLI_USAGE_RESPONSE_INVALID",
220
+ "State: nothing was changed (read-only command).",
221
+ "Retryable: yes",
222
+ "Next: update the CLI with npx gencow@latest, then retry.",
223
+ ].join("\n");
224
+ }
@@ -1,5 +1,6 @@
1
1
  import { appNotFoundDiagnostic } from "./app-response-contract.mjs";
2
2
  import { describeProdTargetFailure, resolveProdAppTarget } from "./cloud-targets.mjs";
3
+ import { responseHeaderCorrelationId, SAFE_CORRELATION_ID } from "./http-correlation-id.mjs";
3
4
  import { readJsonObjectResponse } from "./http-response-json.mjs";
4
5
  import { authCauseNextAction, safeAuthCauseCode } from "./release-auth-cause.mjs";
5
6
 
@@ -12,14 +13,19 @@ const PUBLIC_LOOKUP_ERROR_CODES = new Set([
12
13
  "APP_RELEASE_ENVIRONMENT_INVALID",
13
14
  "APP_RELEASE_POLICY_READ_UNAVAILABLE",
14
15
  ]);
15
- const SAFE_CORRELATION_ID = /^[A-Za-z0-9_-]{8,128}$/u;
16
+ const UNTYPED_STAGE = "deploy target lookup";
16
17
 
17
18
  function publicLookupFailure(response, body, creds) {
18
- const code = PUBLIC_LOOKUP_ERROR_CODES.has(body?.code)
19
+ const typed = PUBLIC_LOOKUP_ERROR_CODES.has(body?.code);
20
+ const code = typed
19
21
  ? body.code
20
22
  : response.status === 401
21
23
  ? "APP_RELEASE_AUTH_REQUIRED"
22
24
  : "APP_DEPLOY_TARGET_LOOKUP_FAILED";
25
+ // A 5xx without a public code (empty, HTML or unknown-code body) may come from the edge or a proxy, so it is
26
+ // untyped. Its Stage and state lines are rendered; the header ID is used only here, so typed output is unchanged.
27
+ const untyped = !typed && response.status >= 500;
28
+ const bodyRetryable = typeof body?.retryable === "boolean" ? body.retryable : undefined;
23
29
  const causeCode =
24
30
  code === "APP_RELEASE_AUTH_REQUIRED" && body?.stage === "auth" ? safeAuthCauseCode(body.causeCode) : null;
25
31
  // Only a fixed env name is kept, so the next action can tell the user to replace or unset it.
@@ -28,20 +34,63 @@ function publicLookupFailure(response, body, creds) {
28
34
  (creds.credentialEnvName === "GENCOW_TOKEN" || creds.credentialEnvName === "GENCOW_DEPLOY_TOKEN")
29
35
  ? creds.credentialEnvName
30
36
  : null;
37
+ const correlationId =
38
+ typeof body?.correlationId === "string" && SAFE_CORRELATION_ID.test(body.correlationId)
39
+ ? body.correlationId
40
+ : untyped
41
+ ? responseHeaderCorrelationId(response)
42
+ : undefined;
31
43
  return {
32
44
  kind: "error",
33
45
  code,
34
46
  status: response.status,
35
- retryable: typeof body?.retryable === "boolean" ? body.retryable : response.status >= 500,
36
- ...(typeof body?.correlationId === "string" && SAFE_CORRELATION_ID.test(body.correlationId)
37
- ? { correlationId: body.correlationId }
38
- : {}),
47
+ retryable: bodyRetryable ?? response.status >= 500,
48
+ // The CLI estimates retryability when the Platform states none.
49
+ ...(bodyRetryable === undefined && untyped ? { retryableEstimated: true } : {}),
50
+ ...(correlationId ? { correlationId } : {}),
39
51
  ...(causeCode ? { causeCode } : {}),
40
52
  ...(causeCode && credentialEnvName ? { credentialEnvName } : {}),
53
+ ...(untyped ? { untyped: true } : {}),
41
54
  };
42
55
  }
43
56
 
44
- function formatLookupFailure(failure, target) {
57
+ // Lookup failure without a typed Platform error: an untyped 5xx, or no HTTP response at all (network error).
58
+ // Serving is stated only for this lookup: a GET changes nothing, so the incumbent serving state is unchanged by it.
59
+ function formatUntypedLookupFailure(failure, target, retryCommand) {
60
+ const lines = [
61
+ `${failure.code}: Could not verify the configured ${target} app. No replacement app was created and gencow.json was unchanged.`,
62
+ `Stage: ${UNTYPED_STAGE}`,
63
+ ];
64
+ if (failure.transportError) lines.push("Response: none received (network error)");
65
+ else lines.push(`HTTP status: ${failure.status}`);
66
+ lines.push(
67
+ failure.retryableEstimated
68
+ ? "Retry: rerun the same command (the Platform did not say whether a retry is safe)"
69
+ : `Retryable: ${failure.retryable ? "yes" : "no"}`,
70
+ );
71
+ lines.push(`Changed: ${DEPLOY_CHANGED_TEXT}`);
72
+ lines.push("Incumbent serving: PRESERVED (this lookup did not change it)");
73
+ lines.push(`Correlation ID: ${failure.correlationId ?? "none returned"}`);
74
+ const reportTail =
75
+ `add the failure time (UTC)${failure.correlationId ? " and the Correlation ID above" : ""} to the GitHub issue.`;
76
+ if (failure.transportError) {
77
+ lines.push(
78
+ "Action: check the network connection, then wait for Platform release capability to recover and retry.",
79
+ );
80
+ } else if (failure.retryable === false) {
81
+ // The Platform stated the failure is not retryable: no rerun instruction, only a report.
82
+ lines.push(`Action: do not retry this command. Report it: ${reportTail}`);
83
+ } else {
84
+ lines.push(`Rerun: ${retryCommand ?? "the same deploy command"}`);
85
+ lines.push(
86
+ `Action: wait 5-10 seconds, then rerun the same command once. If it fails again, ${reportTail}`,
87
+ );
88
+ }
89
+ return lines.join("\n");
90
+ }
91
+
92
+ function formatLookupFailure(failure, target, retryCommand = null) {
93
+ if (failure?.untyped) return formatUntypedLookupFailure(failure, target, retryCommand);
45
94
  const code = failure?.kind === "error" ? failure.code : "APP_DEPLOY_TARGET_LOOKUP_FAILED";
46
95
  const lines = [
47
96
  `${code}: Could not verify the configured ${target} app. No replacement app was created and gencow.json was unchanged.`,
@@ -198,6 +247,8 @@ export async function lookupOwnedApp({ creds, appId, environment, platformFetchI
198
247
  kind: "error",
199
248
  code: "APP_RELEASE_CAPABILITY_UNAVAILABLE",
200
249
  retryable: true,
250
+ untyped: true,
251
+ transportError: true,
201
252
  };
202
253
  }
203
254
  }
@@ -210,6 +261,7 @@ export async function resolveDeployAppId({
210
261
  platformFetchImpl,
211
262
  allowMissingAppReplacement,
212
263
  explicitApp = false,
264
+ retryCommand = null,
213
265
  infoImpl,
214
266
  errorImpl,
215
267
  exitImpl,
@@ -218,7 +270,7 @@ export async function resolveDeployAppId({
218
270
  const lookup = await lookupOwnedApp({ creds, appId, environment, platformFetchImpl });
219
271
  if (lookup === "found" || lookup === "unsupported") return appId;
220
272
  if (lookup?.kind === "error" || lookup === "error") {
221
- errorImpl(formatLookupFailure(lookup, `"${appId}"`));
273
+ errorImpl(formatLookupFailure(lookup, `"${appId}"`, retryCommand));
222
274
  exitImpl(1);
223
275
  return false;
224
276
  }
@@ -245,6 +297,7 @@ export async function reconcileProductionAppTarget({
245
297
  platformFetchImpl,
246
298
  createCloudAppIfNeeded,
247
299
  explicitApp = false,
300
+ retryCommand = null,
248
301
  infoImpl,
249
302
  errorImpl,
250
303
  exitImpl,
@@ -256,7 +309,7 @@ export async function reconcileProductionAppTarget({
256
309
  }
257
310
 
258
311
  const failLookup = (failure, target) => {
259
- errorImpl(formatLookupFailure(failure, target));
312
+ errorImpl(formatLookupFailure(failure, target, retryCommand));
260
313
  exitImpl(1);
261
314
  return null;
262
315
  };
@@ -12,6 +12,7 @@ import { readJsonValueResponse } from "./http-response-json.mjs";
12
12
  import { renderDeployFailureDiagnosticLines } from "./deploy-failure-diagnostic.mjs";
13
13
  import { formatAppLogDiagnosis } from "./deploy-logs-diagnostic.mjs";
14
14
  import { formatDeploymentOperationPhase } from "./deployment-operation-poll.mjs";
15
+ import { handleDeployReleaseSubcommand } from "./release-history-command.mjs";
15
16
 
16
17
  export function renderDeployHelp() {
17
18
  log(`\n${BOLD}${CYAN}gencow deploy${RESET} — Deploy backend or fullstack app to cloud\n`);
@@ -23,6 +24,8 @@ export function renderDeployHelp() {
23
24
  log(` ${DIM}--prod${RESET} Deploy to production (Startup/Enterprise)`);
24
25
  log(` ${DIM}--region <slug>${RESET} First production app placement region`);
25
26
  log(` ${DIM}--rollback${RESET} Rollback to previous deployment`);
27
+ log(` ${DIM}history${RESET} List retained releases (deploy history [--prod] [--json])`);
28
+ log(` ${DIM}rollback <version>${RESET} Restore a static release (deploy rollback v2 [--prod] [--yes])`);
26
29
  log(` ${DIM}--force, -f${RESET} Skip optional dependency scan`);
27
30
  log(` ${DIM}--resume <request-id>${RESET} Resume an exact interrupted deploy`);
28
31
  log(` ${DIM}--app, -a${RESET} Target specific app\n`);
@@ -168,6 +171,7 @@ export async function handleDeployReadonlySubcommand(params) {
168
171
  infoImpl = info,
169
172
  logImpl = log,
170
173
  } = params;
174
+ if (await handleDeployReleaseSubcommand(params)) return true;
171
175
  const knownSubcmds = new Set(["logs", "status"]);
172
176
  if (deployArgs.length === 0 || !knownSubcmds.has(deployArgs[0])) {
173
177
  return false;
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, writeFileSync } from "fs";
2
2
 
3
3
  import { CONFIRMATION_MODE, resolveConfirmationMode } from "./confirm-gate.mjs";
4
4
  import { confirmFirstProductionDeploy } from "./deploy-first-prod-confirm.mjs";
5
- import { reconcileProductionAppTarget } from "./deploy-app-target.mjs";
5
+ import { prodRetryCommandLine, reconcileProductionAppTarget } from "./deploy-app-target.mjs";
6
6
  import { readJsonObjectResponse } from "./http-response-json.mjs";
7
7
  import { BOLD, DIM, GREEN, RED, RESET, error, info, log, success } from "./output.mjs";
8
8
  import { prodCreateFailureMessage } from "./prod-create-failure.mjs";
@@ -52,6 +52,7 @@ export async function ensureProductionDeployTarget({
52
52
  platformFetchImpl,
53
53
  createCloudAppIfNeeded,
54
54
  explicitApp,
55
+ retryCommand: prodRetryCommandLine({ command: "deploy", args: deployArgs ?? [] }),
55
56
  infoImpl,
56
57
  errorImpl,
57
58
  exitImpl,
@@ -0,0 +1,13 @@
1
+ // Correlation ID shape accepted from Platform bodies and headers. Anything else is dropped, never echoed.
2
+ export const SAFE_CORRELATION_ID = /^[A-Za-z0-9_-]{8,128}$/u;
3
+
4
+ // Header names checked, in order, when the JSON body carries no correlation ID.
5
+ const SAFE_CORRELATION_HEADERS = ["x-gencow-correlation-id", "x-correlation-id", "x-request-id"];
6
+
7
+ export function responseHeaderCorrelationId(response) {
8
+ for (const name of SAFE_CORRELATION_HEADERS) {
9
+ const value = response?.headers?.get?.(name);
10
+ if (typeof value === "string" && SAFE_CORRELATION_ID.test(value)) return value;
11
+ }
12
+ return undefined;
13
+ }
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { unlink } from "node:fs/promises";
3
3
 
4
+ import { responseHeaderCorrelationId } from "./http-correlation-id.mjs";
4
5
  import { safeAuthCauseCode } from "./release-auth-cause.mjs";
5
6
  import { platformFetch } from "./platform-client.mjs";
6
7
  import { createReleaseSourcePackage } from "./release-source-package.mjs";
@@ -66,17 +67,6 @@ function safePlatformOrigin(value) {
66
67
  }
67
68
  }
68
69
 
69
- // Header names checked, in order, when the JSON body carries no correlation ID.
70
- const SAFE_CORRELATION_HEADERS = ["x-gencow-correlation-id", "x-correlation-id", "x-request-id"];
71
-
72
- function responseHeaderCorrelationId(response) {
73
- for (const name of SAFE_CORRELATION_HEADERS) {
74
- const value = response?.headers?.get?.(name);
75
- if (typeof value === "string" && SAFE_CORRELATION_ID.test(value)) return value;
76
- }
77
- return undefined;
78
- }
79
-
80
70
  // `context.stage` is set only where the request is known to happen before any serving
81
71
  // change, so an untyped 5xx there can be reported as "incumbent serving preserved".
82
72
  function throwResponseError(response, fallback, body, creds = {}, context = {}) {