deepline 0.3.495 → 0.3.497
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client-core.ts +91 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +5 -19
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +79 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-control.ts +19 -3
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-gateway-drain.ts +110 -66
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +57 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +15 -0
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +28 -12
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +26 -6
- package/dist/bundling-sources/shared_libs/product-notifications/slack-payload.ts +4 -1
- package/dist/cli/auth-553ZBCPJ.js +43 -0
- package/dist/cli/{auth-B2YUNFQ6.mjs → auth-OAKBFUQD.mjs} +5 -5
- package/dist/cli/{billing-5TR7ZBZM.mjs → billing-AM6D2KN5.mjs} +7 -7
- package/dist/cli/{billing-2Q7TMNRE.js → billing-FUB6HQZ5.js} +80 -80
- package/dist/cli/{chunk-RBBOUPME.mjs → chunk-3DHPKENA.mjs} +1 -1
- package/dist/cli/{chunk-XR6RCBB3.mjs → chunk-3IVAGF4P.mjs} +10 -10
- package/dist/cli/{chunk-TUAEM76Y.js → chunk-3KG2FUU4.js} +108 -65
- package/dist/cli/{chunk-SC5GHGFD.mjs → chunk-4MR7LZXF.mjs} +2 -2
- package/dist/cli/{chunk-DFK5IJMT.mjs → chunk-5GXYXU45.mjs} +1 -1
- package/dist/cli/{chunk-H5L2Q2GI.mjs → chunk-5IBHSACU.mjs} +2 -2
- package/dist/cli/{chunk-CTFR52JC.js → chunk-6TA2H7CY.js} +26 -26
- package/dist/cli/{chunk-ZBQBH4IT.js → chunk-77IAUCTB.js} +3 -3
- package/dist/cli/{chunk-XAOLMEN5.js → chunk-7FFNSYMJ.js} +14 -14
- package/dist/cli/{chunk-XKYQR3QK.js → chunk-7RBIOOCQ.js} +3 -3
- package/dist/cli/{chunk-LQKZG5RN.js → chunk-A66Y2LCW.js} +53 -53
- package/dist/cli/{chunk-Z33PZUWG.js → chunk-B4Q3EBQX.js} +5 -5
- package/dist/cli/{chunk-T4PGA6UD.js → chunk-BBHGJE73.js} +1 -1
- package/dist/cli/{chunk-UDFO2MWA.js → chunk-BRUDMG56.js} +41 -41
- package/dist/cli/{chunk-DVQHG6AM.mjs → chunk-CS2AEAD6.mjs} +63 -11
- package/dist/cli/{chunk-Y2DUGUUU.js → chunk-DKSTMQ3F.js} +21 -21
- package/dist/cli/{chunk-PKV5CD3W.js → chunk-EQR5O2D2.js} +87 -35
- package/dist/cli/{chunk-L5ZXEYTQ.mjs → chunk-EWQ3KY5U.mjs} +6 -6
- package/dist/cli/{chunk-JRBQC6L4.mjs → chunk-FISH2MI2.mjs} +2 -2
- package/dist/cli/{chunk-PEIOQKTA.js → chunk-FVS5MJQ5.js} +3 -3
- package/dist/cli/{chunk-TSKVPEVZ.mjs → chunk-HRODQDTB.mjs} +46 -3
- package/dist/cli/{chunk-7YNZRALI.mjs → chunk-IURXJPGH.mjs} +3 -3
- package/dist/cli/{chunk-TCNILHMS.js → chunk-JDFYCHNV.js} +5 -5
- package/dist/cli/{chunk-TMO7W4P2.mjs → chunk-KFJV3BZX.mjs} +1 -1
- package/dist/cli/{chunk-S2QARJLX.mjs → chunk-KUX3HYJI.mjs} +1 -1
- package/dist/cli/{chunk-KG2FUYWB.mjs → chunk-LPCK5KK5.mjs} +3 -3
- package/dist/cli/{chunk-TFMV3NKL.mjs → chunk-M2WIEW2E.mjs} +1 -1
- package/dist/cli/{chunk-I66IWCY4.mjs → chunk-MBOAXLWC.mjs} +4 -4
- package/dist/cli/{chunk-CAWE3MS2.js → chunk-OEI6HXMK.js} +16 -16
- package/dist/cli/{chunk-UKGOZOTT.js → chunk-OWDK2PVH.js} +8 -8
- package/dist/cli/{chunk-7LLUJQM5.mjs → chunk-SJID5WMV.mjs} +4 -4
- package/dist/cli/{chunk-WVL5HGUG.js → chunk-SJM7MKOE.js} +2 -2
- package/dist/cli/{chunk-PHO53W67.js → chunk-SLS3HUVC.js} +4 -4
- package/dist/cli/{chunk-MG3WST3Z.mjs → chunk-TGAYN34A.mjs} +2 -2
- package/dist/cli/{chunk-SR6VS5PG.mjs → chunk-THD6KA67.mjs} +4 -4
- package/dist/cli/{chunk-OFBDI5S3.mjs → chunk-UETGYJYH.mjs} +2 -2
- package/dist/cli/{chunk-B3ROCZ5Y.js → chunk-UV7AT2D4.js} +2 -2
- package/dist/cli/{chunk-XX6PRYFI.js → chunk-V2EVSEUD.js} +16 -16
- package/dist/cli/{chunk-ZB6UYG5I.mjs → chunk-VMOVB2FN.mjs} +5 -5
- package/dist/cli/{chunk-UMFZQREB.js → chunk-WKCMARFR.js} +94 -94
- package/dist/cli/{chunk-ACVT5LPN.js → chunk-WXW7YJDO.js} +53 -53
- package/dist/cli/{chunk-FLJSK32S.mjs → chunk-WZ3A35ZD.mjs} +1 -1
- package/dist/cli/{chunk-MAMEKGLI.js → chunk-XLYJ7MJX.js} +7 -7
- package/dist/cli/{chunk-CKLJAQIV.mjs → chunk-XNLXHU6L.mjs} +5 -5
- package/dist/cli/{chunk-FC4JGTFC.mjs → chunk-XX7WLKOQ.mjs} +1 -1
- package/dist/cli/{chunk-HJ5LYO6U.mjs → chunk-YQ66NC4J.mjs} +2 -2
- package/dist/cli/{chunk-7OGADAAA.js → chunk-YUEFDOME.js} +6 -6
- package/dist/cli/{chunk-5OKQPDYJ.js → chunk-ZLYKN4AJ.js} +7 -7
- package/dist/cli/{csv-DZQ77T67.js → csv-PMBYKVUU.js} +13 -13
- package/dist/cli/{csv-5UQXKWLE.mjs → csv-U2GOFP3M.mjs} +4 -4
- package/dist/cli/{db-F62BVFTP.mjs → db-DKFOTZGZ.mjs} +7 -7
- package/dist/cli/{db-JIPLUHA6.js → db-GREVTMIR.js} +28 -28
- package/dist/cli/describe-BL5NNHV5.js +50 -0
- package/dist/cli/{describe-J7KYHONJ.mjs → describe-SWXA6L62.mjs} +18 -18
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/{executions-XQ4FNJ27.js → executions-2RRAESQK.js} +9 -9
- package/dist/cli/{executions-XB4F2KZD.mjs → executions-EBRFC5JR.mjs} +7 -7
- package/dist/cli/{feedback-5CR4CJ6W.mjs → feedback-4A57QLX2.mjs} +4 -4
- package/dist/cli/{feedback-Q6JRCMDV.js → feedback-N6ML7IRH.js} +8 -8
- package/dist/cli/{git-P5WBBUT3.mjs → git-6D2WQPOS.mjs} +5 -5
- package/dist/cli/git-7TSX5V57.js +25 -0
- package/dist/cli/index.js +137 -137
- package/dist/cli/index.mjs +40 -40
- package/dist/cli/{legacy-noops-H5JJVYZ2.mjs → legacy-noops-CL5QWXGH.mjs} +5 -5
- package/dist/cli/{legacy-noops-EJAB6III.js → legacy-noops-DXRJARNC.js} +8 -8
- package/dist/cli/{monitors-QPFAT2J5.mjs → monitors-SGMEGGJO.mjs} +190 -8
- package/dist/cli/{monitors-7DOGM7RO.js → monitors-XWKDVHYL.js} +318 -136
- package/dist/cli/{org-BH7ATDIJ.mjs → org-55BI5RQF.mjs} +7 -7
- package/dist/cli/{org-QOBB4IN3.js → org-QKQ57PDN.js} +73 -73
- package/dist/cli/{pages-PLTE54KM.js → pages-FOIR5UH4.js} +19 -19
- package/dist/cli/{pages-PJH2TXZQ.mjs → pages-LM4QACOM.mjs} +7 -7
- package/dist/cli/{play-ULTJ3LPA.mjs → play-7VA26O6E.mjs} +36 -61
- package/dist/cli/{play-XZAPTF3T.js → play-S44FXGD7.js} +634 -659
- package/dist/cli/{providers-6NUTRVE4.mjs → providers-QAVIR5E2.mjs} +7 -7
- package/dist/cli/{providers-SKXLW7M3.js → providers-RDSHID7C.js} +10 -10
- package/dist/cli/{quickstart-JFCIIGII.js → quickstart-EREQPM3G.js} +6 -6
- package/dist/cli/{quickstart-5HMJMXVT.mjs → quickstart-IL4HQYE4.mjs} +4 -4
- package/dist/cli/{run-2BJZPY4K.mjs → run-4XZNJR7N.mjs} +23 -23
- package/dist/cli/{run-BRAXLCBC.js → run-TBUUV5EG.js} +37 -37
- package/dist/cli/search-GCANFVVZ.js +32 -0
- package/dist/cli/{search-IDXSB2CV.mjs → search-SYT5UT5G.mjs} +8 -8
- package/dist/cli/{search-output-CJ4TNYF7.js → search-output-5F3EEQ34.js} +6 -6
- package/dist/cli/{search-output-AATMH4QG.mjs → search-output-Y3IKZ3TX.mjs} +4 -4
- package/dist/cli/{secrets-UQNEJSNG.mjs → secrets-AKAU2N3K.mjs} +7 -7
- package/dist/cli/{secrets-6SMKTBFT.js → secrets-PZWJ2ES5.js} +16 -16
- package/dist/cli/{sessions-W3KU4Q4X.js → sessions-UMHA7K23.js} +6 -6
- package/dist/cli/{sessions-MHTUVPSR.mjs → sessions-Z5C26IS7.mjs} +5 -5
- package/dist/cli/{settings-KNYJ6GXK.mjs → settings-S5BM3SVI.mjs} +12 -12
- package/dist/cli/{settings-BA52NEU5.js → settings-WGJYWTJZ.js} +79 -79
- package/dist/cli/{setup-D5HCJAVU.js → setup-6K6ERKOH.js} +49 -49
- package/dist/cli/{setup-TLTZ2YCO.mjs → setup-E4HRXP2X.mjs} +9 -9
- package/dist/cli/{skills-DPLM4EGS.mjs → skills-HIZA7YAN.mjs} +7 -7
- package/dist/cli/skills-J3GQHHHL.js +36 -0
- package/dist/cli/{tools-I4ZOJV23.mjs → tools-FS5S6BT7.mjs} +17 -17
- package/dist/cli/tools-RZYKMOUX.js +57 -0
- package/dist/cli/{update-VIFS7IK5.mjs → update-4CJPTG3L.mjs} +9 -9
- package/dist/cli/update-CATZW7GA.js +34 -0
- package/dist/cli/{workflow-7REPOHXM.js → workflow-TYSZ5JWS.js} +18 -18
- package/dist/cli/{workflow-TAQBNDV7.mjs → workflow-UMSXOIOS.mjs} +8 -8
- package/dist/{client-CKVH6tmp.d.ts → client-Cj3UqrCZ.d.ts} +1 -1
- package/dist/{client-BDT_LwuM.d.mts → client-DSCTVVRj.d.mts} +1 -1
- package/dist/{client-core-CEixe_C0.d.mts → client-core-B-8DTIN1.d.mts} +44 -3
- package/dist/{client-core-RS-d-vtY.d.ts → client-core-dI4KTuWS.d.ts} +44 -3
- package/dist/{compiler-manifest-CPEF48NM.d.mts → compiler-manifest-DlXDyndN.d.mts} +2 -0
- package/dist/{compiler-manifest-CPEF48NM.d.ts → compiler-manifest-DlXDyndN.d.ts} +2 -0
- package/dist/{errors-BWbPzqwo.d.mts → errors-BtriA2ld.d.mts} +1 -1
- package/dist/{errors-B-PJXveg.d.ts → errors-DmcLykM7.d.ts} +1 -1
- package/dist/{index-CvVxPpE8.d.ts → index--Jw-slHY.d.ts} +1 -1
- package/dist/{index-BJ8AA1F9.d.mts → index-DI0sR_fX.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +110 -110
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +2 -2
- package/dist/plays/run-request.mjs +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-GAOWVOK4.js +0 -43
- package/dist/cli/describe-BA4RAZ7J.js +0 -50
- package/dist/cli/git-EAO432S2.js +0 -25
- package/dist/cli/search-4MU2G6HV.js +0 -32
- package/dist/cli/skills-SVUWVXCE.js +0 -36
- package/dist/cli/tools-RJSP76HX.js +0 -57
- package/dist/cli/update-YT6JPIC6.js +0 -34
|
@@ -1297,6 +1297,31 @@ export type MonitorsListOptions = {
|
|
|
1297
1297
|
includeConsumers?: boolean;
|
|
1298
1298
|
};
|
|
1299
1299
|
|
|
1300
|
+
/** Options for `client.monitors.ledger(...)`. */
|
|
1301
|
+
export type MonitorsLedgerOptions = {
|
|
1302
|
+
/** Search name, key, subject, signal and deploy filters. */
|
|
1303
|
+
search?: string;
|
|
1304
|
+
/** Customer statuses to include; every status except `stopped` by default. */
|
|
1305
|
+
states?: string[];
|
|
1306
|
+
/** Signal keys, as the response's `signals[].key` lists them. */
|
|
1307
|
+
signals?: string[];
|
|
1308
|
+
/** A Play definition id, or `none` for monitors no Play listens to. */
|
|
1309
|
+
play?: string;
|
|
1310
|
+
/** `findings` orders by the most findings in `window`. */
|
|
1311
|
+
sort?: 'recent' | 'installed' | 'name' | 'findings';
|
|
1312
|
+
/** The span each row's findings count covers; `30d` by default. */
|
|
1313
|
+
window?: '1d' | '7d' | '30d' | '90d' | '1y';
|
|
1314
|
+
limit?: number | string;
|
|
1315
|
+
cursor?: string;
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
/** The Monitors list page: rows plus counts, options and failing Plays. */
|
|
1319
|
+
export type MonitorsLedgerResult = Record<string, unknown> & {
|
|
1320
|
+
monitors?: Array<Record<string, unknown>>;
|
|
1321
|
+
total?: number;
|
|
1322
|
+
next_cursor?: string | null;
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1300
1325
|
/**
|
|
1301
1326
|
* Server-owned monitor payload shapes returned by the deploy/check/get/mutation
|
|
1302
1327
|
* endpoints. Kept as open records because the render layer and the endpoints
|
|
@@ -1926,6 +1951,17 @@ export type MonitorsNamespace = {
|
|
|
1926
1951
|
list: (options?: MonitorsListOptions) => Promise<MonitorsListResult>;
|
|
1927
1952
|
/** Fetch one deployed monitor by public key with bounded current listener health. */
|
|
1928
1953
|
get: (key: string) => Promise<MonitorDetail>;
|
|
1954
|
+
/** The Monitors list: monitors with status, radar filters and the Plays
|
|
1955
|
+
* each triggers, plus status counts and failing Plays. */
|
|
1956
|
+
ledger: (options?: MonitorsLedgerOptions) => Promise<MonitorsLedgerResult>;
|
|
1957
|
+
/** One monitor as its Monitors page shows it, with every Play it triggers. */
|
|
1958
|
+
ledgerGet: (key: string) => Promise<Record<string, unknown>>;
|
|
1959
|
+
/** One page of a monitor's delivered findings, newest first, with each
|
|
1960
|
+
* Play's recorded run per finding. */
|
|
1961
|
+
ledgerFindings: (
|
|
1962
|
+
key: string,
|
|
1963
|
+
options?: { cursor?: string },
|
|
1964
|
+
) => Promise<Record<string, unknown>>;
|
|
1929
1965
|
/** Test a deployed monitor's callback envelope without side effects. */
|
|
1930
1966
|
test: (
|
|
1931
1967
|
key: string,
|
|
@@ -3017,6 +3053,10 @@ export class DeeplineClient {
|
|
|
3017
3053
|
? this.deployMonitor(definition, { dryRun: true })
|
|
3018
3054
|
: this.syncScalarMonitor(definition, options),
|
|
3019
3055
|
list: (options) => this.listMonitors(options),
|
|
3056
|
+
ledger: (options) => this.listMonitorLedger(options),
|
|
3057
|
+
ledgerGet: (key) => this.getMonitorLedgerEntry(key),
|
|
3058
|
+
ledgerFindings: (key, options) =>
|
|
3059
|
+
this.listMonitorLedgerFindings(key, options),
|
|
3020
3060
|
get: (key) => this.getMonitor(key),
|
|
3021
3061
|
test: (key, payload, options) =>
|
|
3022
3062
|
this.testMonitorWebhook(key, payload, options),
|
|
@@ -7222,6 +7262,51 @@ export class DeeplineClient {
|
|
|
7222
7262
|
);
|
|
7223
7263
|
}
|
|
7224
7264
|
|
|
7265
|
+
/** The Monitors list. Prefer `client.monitors.ledger(...)`. */
|
|
7266
|
+
async listMonitorLedger(
|
|
7267
|
+
options?: MonitorsLedgerOptions,
|
|
7268
|
+
): Promise<MonitorsLedgerResult> {
|
|
7269
|
+
const params = new URLSearchParams();
|
|
7270
|
+
if (options?.search) params.set('q', options.search);
|
|
7271
|
+
for (const state of options?.states ?? []) params.append('state', state);
|
|
7272
|
+
for (const signal of options?.signals ?? [])
|
|
7273
|
+
params.append('signal', signal);
|
|
7274
|
+
if (options?.play) params.set('play', options.play);
|
|
7275
|
+
if (options?.sort) params.set('sort', options.sort);
|
|
7276
|
+
if (options?.window) params.set('window', options.window);
|
|
7277
|
+
if (options?.limit !== undefined)
|
|
7278
|
+
params.set('limit', String(options.limit));
|
|
7279
|
+
if (options?.cursor) params.set('cursor', options.cursor);
|
|
7280
|
+
const query = params.toString();
|
|
7281
|
+
const suffix = query ? `?${query}` : '';
|
|
7282
|
+
return this.http.request<MonitorsLedgerResult>(
|
|
7283
|
+
`/api/v2/monitors/ledger${suffix}`,
|
|
7284
|
+
{ method: 'GET' },
|
|
7285
|
+
);
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7288
|
+
/** One Monitors list entry. Prefer `client.monitors.ledgerGet(...)`. */
|
|
7289
|
+
async getMonitorLedgerEntry(key: string): Promise<Record<string, unknown>> {
|
|
7290
|
+
return this.http.request<Record<string, unknown>>(
|
|
7291
|
+
`/api/v2/monitors/ledger/${encodeURIComponent(key)}`,
|
|
7292
|
+
{ method: 'GET' },
|
|
7293
|
+
);
|
|
7294
|
+
}
|
|
7295
|
+
|
|
7296
|
+
/** A monitor's recent findings. Prefer `client.monitors.ledgerFindings(...)`. */
|
|
7297
|
+
async listMonitorLedgerFindings(
|
|
7298
|
+
key: string,
|
|
7299
|
+
options?: { cursor?: string },
|
|
7300
|
+
): Promise<Record<string, unknown>> {
|
|
7301
|
+
const suffix = options?.cursor
|
|
7302
|
+
? `?cursor=${encodeURIComponent(options.cursor)}`
|
|
7303
|
+
: '';
|
|
7304
|
+
return this.http.request<Record<string, unknown>>(
|
|
7305
|
+
`/api/v2/monitors/ledger/${encodeURIComponent(key)}/findings${suffix}`,
|
|
7306
|
+
{ method: 'GET' },
|
|
7307
|
+
);
|
|
7308
|
+
}
|
|
7309
|
+
|
|
7225
7310
|
/** Fetch one deployed monitor by public key. Prefer `client.monitors.get(...)`. */
|
|
7226
7311
|
async getMonitor(key: string): Promise<MonitorDetail> {
|
|
7227
7312
|
return this.http.request<MonitorDetail>(
|
|
@@ -7707,7 +7792,12 @@ export class DeeplineClient {
|
|
|
7707
7792
|
const terminal: ReadonlySet<string> =
|
|
7708
7793
|
options?.until === 'deactivated'
|
|
7709
7794
|
? new Set(['deactivated', 'degraded', 'billing_suspended'])
|
|
7710
|
-
: new Set([
|
|
7795
|
+
: new Set([
|
|
7796
|
+
'converged',
|
|
7797
|
+
'degraded',
|
|
7798
|
+
'deactivated',
|
|
7799
|
+
'billing_suspended',
|
|
7800
|
+
]);
|
|
7711
7801
|
const startedAt = Date.now();
|
|
7712
7802
|
let latest = await this.getMonitorFleet(fleetId);
|
|
7713
7803
|
while (true) {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* passed in as explicit request fields.
|
|
17
17
|
*/
|
|
18
18
|
import { DeeplineError } from '../../../shared_libs/plays/tool-execution-error';
|
|
19
|
+
import { inputFieldsFromStaticCsvArgs } from '../../../shared_libs/plays/static-pipeline';
|
|
19
20
|
import { isTerminalPlayRunLifecycleStatus } from '../../../shared_libs/play-runtime/run-lifecycle-policy.js';
|
|
20
21
|
import {
|
|
21
22
|
buildCallerPlayWorkflowId,
|
|
@@ -683,20 +684,6 @@ function stringMetadata(
|
|
|
683
684
|
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
684
685
|
}
|
|
685
686
|
|
|
686
|
-
function inputFieldFromCsvArg(csvArg: unknown): string | null {
|
|
687
|
-
if (typeof csvArg !== 'string') return null;
|
|
688
|
-
// The static pipeline preserves the authored expression, not just the
|
|
689
|
-
// resolved source. A very common, valid form is
|
|
690
|
-
// `ctx.csv(input.csv ?? 'default.csv')`: when the caller supplies --csv, the
|
|
691
|
-
// input field still owns the staged file and must be rewritten to its logical
|
|
692
|
-
// path before the runner starts.
|
|
693
|
-
const match =
|
|
694
|
-
/^\(?\s*input\.([A-Za-z_$][\w$]*)\s*\)?(?:\s*\?\?[\s\S]+)?$/.exec(
|
|
695
|
-
csvArg.trim(),
|
|
696
|
-
);
|
|
697
|
-
return match?.[1] ?? null;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
687
|
/** The `csvInput` binding a `CsvInput<Row>` field compiles to. */
|
|
701
688
|
export function fileInputBindingsFromPlaySchema(
|
|
702
689
|
inputSchema: Record<string, unknown> | null | undefined,
|
|
@@ -710,7 +697,7 @@ export function fileInputBindingsFromPlaySchema(
|
|
|
710
697
|
];
|
|
711
698
|
}
|
|
712
699
|
|
|
713
|
-
/**
|
|
700
|
+
/** Every input field read by an authored `ctx.csv(input.x)` call. */
|
|
714
701
|
export function fileInputBindingsFromStaticPipeline(
|
|
715
702
|
staticPipeline: unknown,
|
|
716
703
|
): FileInputBinding[] {
|
|
@@ -721,10 +708,9 @@ export function fileInputBindingsFromStaticPipeline(
|
|
|
721
708
|
) {
|
|
722
709
|
return [];
|
|
723
710
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
);
|
|
727
|
-
return inputField ? [{ inputPath: inputField }] : [];
|
|
711
|
+
return inputFieldsFromStaticCsvArgs(
|
|
712
|
+
staticPipeline as Record<string, unknown>,
|
|
713
|
+
).map((inputPath) => ({ inputPath }));
|
|
728
714
|
}
|
|
729
715
|
|
|
730
716
|
/** Every file-input binding of a Play definition, in staging order. */
|
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.497',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -69,6 +69,85 @@ function isDirectCreditSuspension(input: {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* What a customer must fix for a billing-suspended monitor, from its public
|
|
74
|
+
* suspension reason. `payment_required` stays with credits: the dashboard has
|
|
75
|
+
* always told the customer to add credits for it, but it is never restored
|
|
76
|
+
* automatically (see `monitorRecoveryProjection`).
|
|
77
|
+
*/
|
|
78
|
+
export type MonitorPauseKind = 'credits' | 'cap' | 'billing';
|
|
79
|
+
|
|
80
|
+
export function monitorPauseKind(reason: string | undefined): MonitorPauseKind {
|
|
81
|
+
if (isMonitorCapSuspensionReason(reason)) return 'cap';
|
|
82
|
+
if (
|
|
83
|
+
isCreditExhaustionSuspensionReason(reason) ||
|
|
84
|
+
reason === POLICY_CREDIT_SUSPENSION_REASON ||
|
|
85
|
+
reason === 'payment_required'
|
|
86
|
+
) {
|
|
87
|
+
return 'credits';
|
|
88
|
+
}
|
|
89
|
+
return 'billing';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether a top-up or a cap change brings this suspended monitor back by
|
|
94
|
+
* itself, and if not, what is in the way. Customer copy promises an automatic
|
|
95
|
+
* resume only when `automatic` is true: it is the same selector credit and cap
|
|
96
|
+
* recovery run, so the promise and the behavior cannot drift apart.
|
|
97
|
+
*/
|
|
98
|
+
export type MonitorRecoveryProjection = {
|
|
99
|
+
automatic: boolean;
|
|
100
|
+
/** Set when the pause kind would normally recover but this row cannot yet. */
|
|
101
|
+
blocked_by: 'cleanup_pending' | 'customer_stop' | 'review' | null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export function monitorRecoveryProjection(input: {
|
|
105
|
+
fleetId?: string;
|
|
106
|
+
status: string;
|
|
107
|
+
desired?: 'active' | 'inactive';
|
|
108
|
+
deactivationReason?: string;
|
|
109
|
+
billingState: unknown;
|
|
110
|
+
providerBinding: unknown;
|
|
111
|
+
}): MonitorRecoveryProjection {
|
|
112
|
+
const billingState = parseStoredMonitorBillingState(input.billingState);
|
|
113
|
+
const reason = billingState.suspension_reason;
|
|
114
|
+
if (input.fleetId !== undefined) {
|
|
115
|
+
// Fleet members recover with their Fleet's lifecycle (KAR-43), which is
|
|
116
|
+
// selected from the Fleet's own suspension reason, not this row.
|
|
117
|
+
return {
|
|
118
|
+
automatic:
|
|
119
|
+
isCreditRestorableFleetSuspensionReason(reason) ||
|
|
120
|
+
isMonitorCapSuspensionReason(reason),
|
|
121
|
+
blocked_by: null,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (
|
|
125
|
+
isCreditRestorableDirectMonitorSuspension(input) ||
|
|
126
|
+
isCapRestorableDirectMonitorSuspension(input)
|
|
127
|
+
) {
|
|
128
|
+
return { automatic: true, blocked_by: null };
|
|
129
|
+
}
|
|
130
|
+
const kind = monitorPauseKind(reason);
|
|
131
|
+
const recoverableKind =
|
|
132
|
+
(kind === 'credits' && reason !== 'payment_required') || kind === 'cap';
|
|
133
|
+
if (!recoverableKind || billingState.state !== 'billing_suspended') {
|
|
134
|
+
return { automatic: false, blocked_by: null };
|
|
135
|
+
}
|
|
136
|
+
if (!hasConfirmedProviderMonitorUpstreamCleanup(input.providerBinding)) {
|
|
137
|
+
return { automatic: false, blocked_by: 'cleanup_pending' };
|
|
138
|
+
}
|
|
139
|
+
const policyProvenance =
|
|
140
|
+
input.deactivationReason === POLICY_CREDIT_SUSPENSION_REASON ||
|
|
141
|
+
input.deactivationReason === POLICY_CAP_SUSPENSION_REASON;
|
|
142
|
+
return {
|
|
143
|
+
automatic: false,
|
|
144
|
+
blocked_by:
|
|
145
|
+
input.desired === 'inactive' && !policyProvenance
|
|
146
|
+
? 'customer_stop'
|
|
147
|
+
: 'review',
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
72
151
|
/**
|
|
73
152
|
* A billing suspension is not itself proof that TamRadar accepted the delete.
|
|
74
153
|
* Keep this test beside the recovery selector so every automatic path rejects
|
|
@@ -472,6 +472,24 @@
|
|
|
472
472
|
"failureAlert": "github_workflow_run",
|
|
473
473
|
"domainReportRequired": true
|
|
474
474
|
},
|
|
475
|
+
{
|
|
476
|
+
"id": "github.release-train",
|
|
477
|
+
"name": "Release train",
|
|
478
|
+
"scheduler": "github_actions",
|
|
479
|
+
"cadence": "*/5 * * * *",
|
|
480
|
+
"timezone": "UTC",
|
|
481
|
+
"source": ".github/workflows/release-train.yml",
|
|
482
|
+
"locator": "schedule:",
|
|
483
|
+
"owner": "platform",
|
|
484
|
+
"criticality": "operational",
|
|
485
|
+
"purpose": "Recheck whether the latest main commit can start a release train after a cadence or capacity deferral.",
|
|
486
|
+
"successDefinition": "The starter is disabled, or it records a dispatch or deferral decision and GitHub accepts any selected train dispatch.",
|
|
487
|
+
"failureDefinition": "Git ref or train history lookup fails, the configured cadence is invalid, or GitHub rejects the selected dispatch.",
|
|
488
|
+
"startGraceMs": 600000,
|
|
489
|
+
"runTimeoutMs": 300000,
|
|
490
|
+
"failureAlert": "github_workflow_run",
|
|
491
|
+
"domainReportRequired": true
|
|
492
|
+
},
|
|
475
493
|
{
|
|
476
494
|
"id": "github.runtime-lifecycle",
|
|
477
495
|
"name": "On-Demand Runtime Lifecycle Load Check",
|
|
@@ -26,10 +26,24 @@ export type ScheduledWorkOrganizationTarget = {
|
|
|
26
26
|
readonly orgId: string;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
export type HistoricalSettlementManifest = {
|
|
30
|
+
readonly deployment: string;
|
|
31
|
+
readonly cutoffMs: number;
|
|
32
|
+
readonly liabilityShard: number;
|
|
33
|
+
readonly rows: readonly {
|
|
34
|
+
readonly workId: string;
|
|
35
|
+
readonly reservationId: string;
|
|
36
|
+
readonly version: number;
|
|
37
|
+
readonly expectedDebitMicros: number;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type ScheduledWorkPreviewMode = 'transactional' | 'read_only';
|
|
42
|
+
|
|
29
43
|
export type ScheduledWorkPreviewResult = {
|
|
30
44
|
readonly ok: boolean;
|
|
31
45
|
readonly dryRun: true;
|
|
32
|
-
readonly previewMode:
|
|
46
|
+
readonly previewMode: ScheduledWorkPreviewMode;
|
|
33
47
|
readonly state: 'unknown' | 'inProgress' | 'success' | 'failed' | 'canceled';
|
|
34
48
|
readonly processed: number;
|
|
35
49
|
readonly isDone: boolean;
|
|
@@ -46,6 +60,7 @@ export type ScheduledWorkControlContext = {
|
|
|
46
60
|
* lists in `orgScopedJobIds` accept it.
|
|
47
61
|
*/
|
|
48
62
|
readonly orgScope?: readonly string[];
|
|
63
|
+
readonly historicalSettlementManifest?: HistoricalSettlementManifest;
|
|
49
64
|
readonly requestedByUserId: string;
|
|
50
65
|
readonly requestedByEmail: string;
|
|
51
66
|
readonly reason: string;
|
|
@@ -68,6 +83,7 @@ export type ScheduledWorkControlConnector = {
|
|
|
68
83
|
/** Jobs whose run may be restricted to an organization allow-list. */
|
|
69
84
|
readonly orgScopedJobIds?: readonly string[];
|
|
70
85
|
readonly previewActions?: readonly ScheduledWorkControlAction[];
|
|
86
|
+
readonly previewMode?: ScheduledWorkPreviewMode;
|
|
71
87
|
preview?: (
|
|
72
88
|
context: ScheduledWorkControlContext,
|
|
73
89
|
action: ScheduledWorkControlAction,
|
|
@@ -98,7 +114,7 @@ export type ScheduledWorkControlCapability =
|
|
|
98
114
|
readonly connectorId: string;
|
|
99
115
|
readonly scheduler: string;
|
|
100
116
|
readonly targetKind?: 'organization';
|
|
101
|
-
readonly previewMode?:
|
|
117
|
+
readonly previewMode?: ScheduledWorkPreviewMode;
|
|
102
118
|
}
|
|
103
119
|
| {
|
|
104
120
|
readonly available: false;
|
|
@@ -219,7 +235,7 @@ export class ScheduledWorkControlRegistry {
|
|
|
219
235
|
scheduler: connector.scheduler,
|
|
220
236
|
...(connector.targetKind ? { targetKind: connector.targetKind } : {}),
|
|
221
237
|
...(connector.previewActions?.includes(action)
|
|
222
|
-
? { previewMode: 'transactional'
|
|
238
|
+
? { previewMode: connector.previewMode ?? 'transactional' }
|
|
223
239
|
: {}),
|
|
224
240
|
};
|
|
225
241
|
}
|
|
@@ -984,8 +984,14 @@ export class FlyMachinesClient {
|
|
|
984
984
|
async acquireMachineLease(
|
|
985
985
|
id: string,
|
|
986
986
|
options: { ttl: number; description: string },
|
|
987
|
+
leaseNonce?: string,
|
|
987
988
|
): Promise<string> {
|
|
988
|
-
const result = await this.request(
|
|
989
|
+
const result = await this.request(
|
|
990
|
+
'POST',
|
|
991
|
+
`/machines/${id}/lease`,
|
|
992
|
+
options,
|
|
993
|
+
leaseNonce,
|
|
994
|
+
);
|
|
989
995
|
const nonce =
|
|
990
996
|
result &&
|
|
991
997
|
typeof result === 'object' &&
|
|
@@ -155,6 +155,11 @@ export async function selectDrainedGatewaySourceMachines(input: {
|
|
|
155
155
|
return [...alreadyStopped, ...observed];
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// Continuation ownership is process-local; Fly owns expiry after a controller
|
|
159
|
+
// crash. Every pass refreshes the provider lease and re-reads source state.
|
|
160
|
+
const gatewayDrainLeaseNonces = new Map<string, string>();
|
|
161
|
+
const GATEWAY_DRAIN_LEASE_TTL_SECONDS = 120;
|
|
162
|
+
|
|
158
163
|
/** One bounded reconciliation pass. Nonzero work is normal and is retained
|
|
159
164
|
* for the next controller tick; metric/identity errors are intentionally loud
|
|
160
165
|
* so no release can quietly fall back to a timeout-based delete. */
|
|
@@ -166,89 +171,128 @@ export async function reconcileGatewaySourceDrain(input: {
|
|
|
166
171
|
inventory?: readonly FlyMachine[];
|
|
167
172
|
retryDelaysMs?: readonly number[];
|
|
168
173
|
sleep?: (delayMs: number) => Promise<void>;
|
|
174
|
+
leaseNonces?: Map<string, string>;
|
|
169
175
|
}): Promise<{ deletedMachineIds: string[]; pendingMachineIds: string[] }> {
|
|
170
176
|
const inventory = [
|
|
171
177
|
...(input.inventory ?? (await input.client.listMachines())),
|
|
172
178
|
];
|
|
173
179
|
const sourceIds = [...new Set(input.sourceMachineIds)];
|
|
174
180
|
const fetchImpl = input.fetchImpl ?? fetch;
|
|
175
|
-
const deletedMachineIds =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
const deletedMachineIds: string[] = [];
|
|
182
|
+
const leases = input.leaseNonces ?? gatewayDrainLeaseNonces;
|
|
183
|
+
const keyPrefix = `${input.app}/`;
|
|
184
|
+
for (const key of leases.keys()) {
|
|
185
|
+
if (
|
|
186
|
+
key.startsWith(keyPrefix) &&
|
|
187
|
+
!inventory.some((machine) => `${keyPrefix}${machine.id}` === key)
|
|
188
|
+
) {
|
|
189
|
+
leases.delete(key);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const machineId of sourceIds) {
|
|
193
|
+
if (!inventory.some((machine) => machine.id === machineId)) continue;
|
|
194
|
+
// Fly Proxy can restart a stopped source before deletion. Hold provider
|
|
195
|
+
// ownership across the fresh drain proof, stop, and deletion so autostart
|
|
196
|
+
// cannot race that sequence. Never carry a pre-lease emptiness proof.
|
|
197
|
+
const leaseKey = `${keyPrefix}${machineId}`;
|
|
198
|
+
let nonce = leases.get(leaseKey);
|
|
199
|
+
const refreshLease = async () => {
|
|
200
|
+
const prior = nonce;
|
|
201
|
+
try {
|
|
202
|
+
nonce = await input.client.acquireMachineLease(
|
|
203
|
+
machineId,
|
|
204
|
+
{
|
|
205
|
+
ttl: GATEWAY_DRAIN_LEASE_TTL_SECONDS,
|
|
206
|
+
description: 'Gateway source retirement',
|
|
207
|
+
},
|
|
208
|
+
prior,
|
|
209
|
+
);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
leases.delete(leaseKey);
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
leases.set(leaseKey, nonce);
|
|
215
|
+
if (prior && nonce !== prior) {
|
|
216
|
+
// Ownership lapsed. A restarted source needs a fresh state/work proof;
|
|
217
|
+
// this pass must not continue from observations made under the old lease.
|
|
218
|
+
leases.delete(leaseKey);
|
|
219
|
+
await input.client.releaseMachineLease(machineId, nonce);
|
|
220
|
+
throw new Error(
|
|
221
|
+
'Gateway drain lease changed; fresh source proof is required.',
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
await refreshLease();
|
|
226
|
+
let retainLease = false;
|
|
227
|
+
let providerConfirmedGone = false;
|
|
228
|
+
try {
|
|
229
|
+
const current = await input.client.getMachine(machineId);
|
|
230
|
+
if (current.cordoned !== true) {
|
|
231
|
+
throw new Error(
|
|
232
|
+
'Gateway drain source Machine became public before deletion.',
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
if (['stopping', 'destroying'].includes(current.state ?? '')) {
|
|
236
|
+
retainLease = true;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
const drained = await selectDrainedGatewaySourceMachines({
|
|
240
|
+
sourceMachineIds: [machineId],
|
|
241
|
+
inventory: [current],
|
|
242
|
+
readMetrics: () =>
|
|
243
|
+
readPrivateGatewayMetrics({
|
|
244
|
+
app: input.app,
|
|
245
|
+
machineId,
|
|
246
|
+
fetchImpl,
|
|
247
|
+
retryDelaysMs: input.retryDelaysMs,
|
|
248
|
+
sleep: input.sleep,
|
|
249
|
+
}),
|
|
185
250
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return !['stopped', 'suspended'].includes(machine?.state ?? '');
|
|
197
|
-
})
|
|
198
|
-
.map((machineId) =>
|
|
199
|
-
input.client.stopMachine(machineId, {
|
|
251
|
+
if (drained.length === 0) continue;
|
|
252
|
+
if (!['stopped', 'suspended'].includes(current.state ?? '')) {
|
|
253
|
+
// Refresh immediately before each effect. A provider request is bounded
|
|
254
|
+
// at 30 seconds, below this lease's 120 seconds; slow reads/retries cannot
|
|
255
|
+
// consume the fence needed by the following mutation.
|
|
256
|
+
await refreshLease();
|
|
257
|
+
retainLease = true;
|
|
258
|
+
await input.client.stopMachine(
|
|
259
|
+
machineId,
|
|
260
|
+
{
|
|
200
261
|
signal: 'SIGTERM',
|
|
201
262
|
timeout: '300s',
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const remaining = current.filter((machine) =>
|
|
209
|
-
deletedMachineIds.includes(machine.id ?? ''),
|
|
263
|
+
},
|
|
264
|
+
nonce,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
const stopped = (await input.client.listMachines()).find(
|
|
268
|
+
(machine) => machine.id === machineId,
|
|
210
269
|
);
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
['stopped', 'suspended'].includes(machine.state ?? ''),
|
|
214
|
-
)
|
|
215
|
-
) {
|
|
216
|
-
if (remaining.some((machine) => machine.cordoned !== true)) {
|
|
270
|
+
if (stopped) {
|
|
271
|
+
if (stopped.cordoned !== true) {
|
|
217
272
|
throw new Error(
|
|
218
273
|
'Gateway drain source Machine became public before deletion.',
|
|
219
274
|
);
|
|
220
275
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
276
|
+
// Stops and deletes are asynchronous. Resume from fresh provider truth
|
|
277
|
+
// next tick rather than blocking live capacity planning for ten minutes.
|
|
278
|
+
if (!['stopped', 'suspended'].includes(stopped.state ?? '')) continue;
|
|
279
|
+
await refreshLease();
|
|
280
|
+
retainLease = true;
|
|
281
|
+
await input.client.deleteMachine(machineId, false, nonce);
|
|
227
282
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
`Gateway drain sources did not stop within 600000 ms: ${remaining.map((machine) => `${machine.id}=${machine.state}`).join(', ')}.`,
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
await new Promise((resolve) => setTimeout(resolve, 5_000));
|
|
234
|
-
}
|
|
235
|
-
for (;;) {
|
|
236
|
-
const providerMachineIds = new Set(
|
|
237
|
-
(await input.client.listMachines())
|
|
238
|
-
.map((machine) => machine.id)
|
|
239
|
-
.filter((id): id is string => Boolean(id)),
|
|
283
|
+
providerConfirmedGone = !(await input.client.listMachines()).some(
|
|
284
|
+
(machine) => machine.id === machineId,
|
|
240
285
|
);
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
)
|
|
245
|
-
) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (Date.now() >= deadline) {
|
|
249
|
-
throw new Error('Gateway source deletion is not provider-confirmed.');
|
|
286
|
+
if (providerConfirmedGone) deletedMachineIds.push(machineId);
|
|
287
|
+
} finally {
|
|
288
|
+
if (providerConfirmedGone) {
|
|
289
|
+
leases.delete(leaseKey);
|
|
290
|
+
} else if (!retainLease && leases.get(leaseKey) === nonce) {
|
|
291
|
+
leases.delete(leaseKey);
|
|
292
|
+
await input.client.releaseMachineLease(machineId, nonce!);
|
|
250
293
|
}
|
|
251
|
-
|
|
294
|
+
// Keep the lease through asynchronous stopping/deletion and ambiguous
|
|
295
|
+
// mutation outcomes. The next tick refreshes it; a crash lets Fly expire it.
|
|
252
296
|
}
|
|
253
297
|
}
|
|
254
298
|
return {
|
package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts
CHANGED
|
@@ -53,6 +53,19 @@ export interface VercelDeploymentEventSummary {
|
|
|
53
53
|
workerBuildId: string | null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export type VercelPromotionTiming = {
|
|
57
|
+
requestedAt: number;
|
|
58
|
+
previousReleaseAt?: number;
|
|
59
|
+
train?: { runId: string; attempt: string; durationMs: number };
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export function vercelPromotionTimingKey(deploymentId: string): string {
|
|
63
|
+
if (!/^dpl_[a-zA-Z0-9]+$/.test(deploymentId)) {
|
|
64
|
+
throw new Error('Invalid Vercel deployment ID.');
|
|
65
|
+
}
|
|
66
|
+
return `production-releases/vercel-promotions/${deploymentId}.json`;
|
|
67
|
+
}
|
|
68
|
+
|
|
56
69
|
function readRecord(value: unknown): Record<string, unknown> | null {
|
|
57
70
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
|
58
71
|
return value as Record<string, unknown>;
|
|
@@ -261,6 +274,7 @@ export function buildVercelRollbackSlackText(
|
|
|
261
274
|
|
|
262
275
|
export function buildVercelDeploymentSlackText(
|
|
263
276
|
summary: VercelDeploymentEventSummary,
|
|
277
|
+
promotion?: { promotedAt: number; timing: VercelPromotionTiming },
|
|
264
278
|
): string {
|
|
265
279
|
const title =
|
|
266
280
|
summary.eventType === 'deployment.succeeded'
|
|
@@ -276,5 +290,48 @@ export function buildVercelDeploymentSlackText(
|
|
|
276
290
|
? `Aligned worker build: ${summary.workerBuildId}`
|
|
277
291
|
: null,
|
|
278
292
|
];
|
|
293
|
+
if (summary.eventType === 'deployment.promoted' && promotion) {
|
|
294
|
+
const { promotedAt, timing } = promotion;
|
|
295
|
+
const sinceRequest = promotedAt - timing.requestedAt;
|
|
296
|
+
// A later manual promotion must not pick up an abandoned CI intent.
|
|
297
|
+
if (
|
|
298
|
+
Number.isFinite(sinceRequest) &&
|
|
299
|
+
sinceRequest >= 0 &&
|
|
300
|
+
sinceRequest <= 600_000
|
|
301
|
+
) {
|
|
302
|
+
const sinceRelease = promotedAt - (timing.previousReleaseAt ?? NaN);
|
|
303
|
+
if (Number.isFinite(sinceRelease) && sinceRelease >= 0) {
|
|
304
|
+
lines.push(
|
|
305
|
+
`Since last successful Production release: ${formatDuration(sinceRelease)}`,
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
const train = timing.train;
|
|
309
|
+
if (
|
|
310
|
+
train &&
|
|
311
|
+
/^[1-9]\d*$/.test(train.runId) &&
|
|
312
|
+
/^[1-9]\d*$/.test(train.attempt) &&
|
|
313
|
+
Number.isFinite(train.durationMs) &&
|
|
314
|
+
train.durationMs >= 0
|
|
315
|
+
) {
|
|
316
|
+
const url = `https://github.com/getaero-io/deepline-api/actions/runs/${train.runId}/attempts/${train.attempt}`;
|
|
317
|
+
lines.push(
|
|
318
|
+
`CI train: ${formatDuration(train.durationMs)} · <${url}|View run>`,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
279
323
|
return lines.filter(Boolean).join('\n');
|
|
280
324
|
}
|
|
325
|
+
|
|
326
|
+
function formatDuration(durationMs: number): string {
|
|
327
|
+
const seconds = Math.floor(durationMs / 1000);
|
|
328
|
+
const hours = Math.floor(seconds / 3600);
|
|
329
|
+
const minutes = Math.floor((seconds % 3600) / 60);
|
|
330
|
+
return [
|
|
331
|
+
hours ? `${hours}h` : '',
|
|
332
|
+
minutes || hours ? `${minutes}m` : '',
|
|
333
|
+
`${seconds % 60}s`,
|
|
334
|
+
]
|
|
335
|
+
.filter(Boolean)
|
|
336
|
+
.join(' ');
|
|
337
|
+
}
|