deepline 0.3.344 → 0.3.346
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/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +240 -66
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +40 -18
- package/dist/cli/auth-5YTC2XH2.js +31 -0
- package/dist/cli/{auth-KHHPB2DO.mjs → auth-HTWHQNMY.mjs} +4 -4
- package/dist/cli/{billing-HAR4AJZT.js → billing-4DCHVGO5.js} +71 -71
- package/dist/cli/{billing-RLK734WE.mjs → billing-X56CVZWC.mjs} +4 -4
- package/dist/cli/{chunk-SJIF45BK.js → chunk-22GXXUTB.js} +4 -4
- package/dist/cli/{chunk-DRHVFFMJ.mjs → chunk-2GRMXCLZ.mjs} +1 -1
- package/dist/cli/{chunk-FHCBNR7M.js → chunk-2RJ7RMRM.js} +8 -8
- package/dist/cli/{chunk-2MSG6WCC.mjs → chunk-3GLIYDIF.mjs} +2 -2
- package/dist/cli/{chunk-VL5IYXS3.js → chunk-4Q572AVS.js} +6 -6
- package/dist/cli/{chunk-TYPYDSNY.js → chunk-5NNSJTJ3.js} +9 -9
- package/dist/cli/{chunk-475OQE7H.js → chunk-5QG2UAYH.js} +2 -2
- package/dist/cli/{chunk-QZMF7VDU.mjs → chunk-62TKYGY6.mjs} +3 -3
- package/dist/cli/{chunk-JXCEXXKW.js → chunk-EJ2NVO5K.js} +48 -48
- package/dist/cli/{chunk-BQYPKV4P.mjs → chunk-GCBLVWDQ.mjs} +6 -6
- package/dist/cli/{chunk-Y6PJVWDY.js → chunk-GGSLHWTB.js} +1 -1
- package/dist/cli/{chunk-23D4YCM6.mjs → chunk-KQCTQGUU.mjs} +1 -1
- package/dist/cli/{chunk-MQIHCQ5Z.js → chunk-L2R72RQJ.js} +8 -8
- package/dist/cli/{chunk-RN7NIZIL.mjs → chunk-MOVEHSNM.mjs} +1 -1
- package/dist/cli/{chunk-4DIFNYJZ.mjs → chunk-NVNHV73C.mjs} +2 -2
- package/dist/cli/{chunk-M5FYGL42.mjs → chunk-O4SXVVNQ.mjs} +1 -1
- package/dist/cli/{chunk-CIV43IXR.mjs → chunk-P4IKGWYF.mjs} +4 -4
- package/dist/cli/{chunk-ZUHK5OX3.js → chunk-SGBSQHXS.js} +45 -45
- package/dist/cli/{chunk-QO6T7ETF.js → chunk-T7EVEXHS.js} +15 -15
- package/dist/cli/{chunk-J5NN6XCF.mjs → chunk-VC7M2QR7.mjs} +1 -1
- package/dist/cli/{chunk-CMK6UNJA.mjs → chunk-WKZTHHJI.mjs} +5 -5
- package/dist/cli/{chunk-XRZUDK6O.mjs → chunk-XAM3XOUA.mjs} +2 -2
- package/dist/cli/{chunk-J5P35NOT.js → chunk-YEKAGC52.js} +60 -60
- package/dist/cli/{chunk-LELCMU5K.js → chunk-YUKZHAFW.js} +26 -26
- package/dist/cli/{chunk-UWV3BA43.js → chunk-ZEUFYRUR.js} +225 -225
- package/dist/cli/{chunk-GJYCHN2L.mjs → chunk-ZR4EHO62.mjs} +2 -2
- package/dist/cli/client-4RKYHB7Z.js +20 -0
- package/dist/cli/{client-JWDU663V.mjs → client-C2KUT452.mjs} +3 -3
- package/dist/cli/{csv-7AW5GZ4K.js → csv-3TAA2MTR.js} +12 -12
- package/dist/cli/{csv-CIAWYPZO.mjs → csv-SLACAH4F.mjs} +3 -3
- package/dist/cli/{db-UENUIWQN.js → db-BT6Q3FE6.js} +29 -29
- package/dist/cli/{db-SX73JJBH.mjs → db-IN4I6KJ5.mjs} +4 -4
- package/dist/cli/{describe-4SC5G2FG.mjs → describe-EDXTYMOF.mjs} +8 -8
- package/dist/cli/{describe-7OGZQAGF.js → describe-FJZXYKFH.js} +15 -15
- package/dist/cli/{executions-YB4IAUTW.mjs → executions-X36QA5NY.mjs} +4 -4
- package/dist/cli/{executions-UDXQNB34.js → executions-YYQC2TVR.js} +6 -6
- package/dist/cli/{feedback-5SGAGRAW.js → feedback-BS3S46O3.js} +7 -7
- package/dist/cli/{feedback-76QWZSW3.mjs → feedback-KTEPHZ4S.mjs} +3 -3
- package/dist/cli/{git-ESESPEVB.mjs → git-3ZVYB63W.mjs} +4 -4
- package/dist/cli/git-ZHAD5TJN.js +23 -0
- package/dist/cli/index.js +79 -79
- package/dist/cli/index.mjs +31 -31
- package/dist/cli/{legacy-noops-E74OIJCW.js → legacy-noops-V5R7ITER.js} +7 -7
- package/dist/cli/{legacy-noops-6F6QSRDB.mjs → legacy-noops-VVBJXM2K.mjs} +4 -4
- package/dist/cli/{monitors-4MIXICCR.js → monitors-J6XDE76B.js} +85 -85
- package/dist/cli/{monitors-USOHPXUY.mjs → monitors-KYTMBNUQ.mjs} +4 -4
- package/dist/cli/{org-DO3Q6L7S.js → org-MHF2NGDV.js} +60 -60
- package/dist/cli/{org-2RRIFNXJ.mjs → org-RGABGQKP.mjs} +4 -4
- package/dist/cli/{play-KAXYPLCQ.mjs → play-UII4SSA7.mjs} +7 -7
- package/dist/cli/play-ZWAH3U44.js +153 -0
- package/dist/cli/{providers-RCUITFFY.js → providers-3GDMD7T6.js} +7 -7
- package/dist/cli/{providers-FKHLPGQO.mjs → providers-LQOSKPUH.mjs} +4 -4
- package/dist/cli/{quickstart-CDBWA6IK.mjs → quickstart-GAMYLCLJ.mjs} +3 -3
- package/dist/cli/{quickstart-XGU4M4Z5.js → quickstart-R34Z7EMU.js} +5 -5
- package/dist/cli/{search-QA4DAJPS.mjs → search-AOOMDVF5.mjs} +5 -5
- package/dist/cli/search-FVB7ZNCO.js +26 -0
- package/dist/cli/{secrets-KYKXEHNR.js → secrets-T4XXIASK.js} +13 -13
- package/dist/cli/{secrets-6S2CDL2M.mjs → secrets-U7YGLUSX.mjs} +4 -4
- package/dist/cli/{sessions-PWAIUF7I.js → sessions-JQGKWKJS.js} +5 -5
- package/dist/cli/{sessions-WGLVMQYC.mjs → sessions-VPXR4DSZ.mjs} +4 -4
- package/dist/cli/{settings-FQ5CWYNQ.mjs → settings-LP55G43L.mjs} +7 -7
- package/dist/cli/{settings-CNWO5VFJ.js → settings-LXF45R7X.js} +74 -74
- package/dist/cli/{setup-RRT66ENS.mjs → setup-36QA4JI3.mjs} +6 -6
- package/dist/cli/{setup-ABIO2LJD.js → setup-MA2GLU4N.js} +41 -41
- package/dist/cli/skills-GUWC4FV7.js +28 -0
- package/dist/cli/{skills-3LY2RQE3.mjs → skills-HB6PARLZ.mjs} +4 -4
- package/dist/cli/{tools-TQMHPW3U.mjs → tools-E7K7R4AO.mjs} +6 -6
- package/dist/cli/tools-T5WIAD5Z.js +40 -0
- package/dist/cli/{update-6U4ASVZX.mjs → update-IT63P3NV.mjs} +6 -6
- package/dist/cli/update-QY6RY3A6.js +28 -0
- package/dist/cli/{workflow-GVXAFVXF.js → workflow-SJHASZ5C.js} +15 -15
- package/dist/cli/{workflow-XLE4N3W3.mjs → workflow-UO3PMX7R.mjs} +5 -5
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/dist/install-integrity.json +74 -74
- 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/package.json +1 -1
- package/dist/cli/auth-6ABMIWQQ.js +0 -31
- package/dist/cli/client-KETSZR46.js +0 -20
- package/dist/cli/git-4PRJV7B3.js +0 -23
- package/dist/cli/play-SHRBJAO4.js +0 -153
- package/dist/cli/search-ZHYH2BA3.js +0 -26
- package/dist/cli/skills-OBTT3OF7.js +0 -28
- package/dist/cli/tools-DMXHSMU2.js +0 -40
- package/dist/cli/update-4CK752WQ.js +0 -28
|
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
|
|
|
200
200
|
// getters keep their established compatibility behavior.
|
|
201
201
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
202
202
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
203
|
-
version: '0.3.
|
|
203
|
+
version: '0.3.346',
|
|
204
204
|
updateSummary:
|
|
205
205
|
'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
|
|
206
206
|
packageCapabilities: {
|
|
@@ -520,6 +520,68 @@ export type RuntimeSheetTiming = {
|
|
|
520
520
|
error?: string;
|
|
521
521
|
};
|
|
522
522
|
|
|
523
|
+
type RuntimeMapCompletionPhase =
|
|
524
|
+
| 'dbSessionAcquire'
|
|
525
|
+
| 'poolAcquire'
|
|
526
|
+
| 'transactionBegin'
|
|
527
|
+
| 'mapRowsUpdate'
|
|
528
|
+
| 'missingRowsInsert'
|
|
529
|
+
| 'failedRowsUpdate'
|
|
530
|
+
| 'transactionCommit'
|
|
531
|
+
| 'queryClient';
|
|
532
|
+
|
|
533
|
+
type RuntimeMapCompletionDiagnostics = Record<
|
|
534
|
+
`${RuntimeMapCompletionPhase}Ms` | `${RuntimeMapCompletionPhase}Failures`,
|
|
535
|
+
number
|
|
536
|
+
> & {
|
|
537
|
+
operationAttempts: number;
|
|
538
|
+
provisioningRetryAttempts: number;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
function createRuntimeMapCompletionDiagnostics(): RuntimeMapCompletionDiagnostics {
|
|
542
|
+
return {
|
|
543
|
+
dbSessionAcquireMs: 0,
|
|
544
|
+
dbSessionAcquireFailures: 0,
|
|
545
|
+
poolAcquireMs: 0,
|
|
546
|
+
poolAcquireFailures: 0,
|
|
547
|
+
transactionBeginMs: 0,
|
|
548
|
+
transactionBeginFailures: 0,
|
|
549
|
+
mapRowsUpdateMs: 0,
|
|
550
|
+
mapRowsUpdateFailures: 0,
|
|
551
|
+
missingRowsInsertMs: 0,
|
|
552
|
+
missingRowsInsertFailures: 0,
|
|
553
|
+
failedRowsUpdateMs: 0,
|
|
554
|
+
failedRowsUpdateFailures: 0,
|
|
555
|
+
transactionCommitMs: 0,
|
|
556
|
+
transactionCommitFailures: 0,
|
|
557
|
+
queryClientMs: 0,
|
|
558
|
+
queryClientFailures: 0,
|
|
559
|
+
operationAttempts: 0,
|
|
560
|
+
provisioningRetryAttempts: 0,
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
async function measureRuntimeSheetPhase<T>(
|
|
565
|
+
diagnostics: RuntimeMapCompletionDiagnostics | undefined,
|
|
566
|
+
phase: RuntimeMapCompletionPhase,
|
|
567
|
+
operation: () => Promise<T>,
|
|
568
|
+
): Promise<T> {
|
|
569
|
+
if (!diagnostics) return await operation();
|
|
570
|
+
const startedAt = Date.now();
|
|
571
|
+
let failed = false;
|
|
572
|
+
try {
|
|
573
|
+
return await operation();
|
|
574
|
+
} catch (error) {
|
|
575
|
+
failed = true;
|
|
576
|
+
throw error;
|
|
577
|
+
} finally {
|
|
578
|
+
const msKey = `${phase}Ms` as const;
|
|
579
|
+
const failuresKey = `${phase}Failures` as const;
|
|
580
|
+
diagnostics[msKey] += Date.now() - startedAt;
|
|
581
|
+
diagnostics[failuresKey] += Number(failed);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
523
585
|
export type RuntimeSheetAttemptHeartbeatResult = {
|
|
524
586
|
renewed: number;
|
|
525
587
|
renewedKeys: string[];
|
|
@@ -2314,6 +2376,7 @@ async function withRuntimePostgres<T>(
|
|
|
2314
2376
|
maxConnectAttempts?: number;
|
|
2315
2377
|
operationTimeoutMs?: number;
|
|
2316
2378
|
signal?: AbortSignal | null;
|
|
2379
|
+
completionDiagnostics?: RuntimeMapCompletionDiagnostics;
|
|
2317
2380
|
} = {},
|
|
2318
2381
|
): Promise<T> {
|
|
2319
2382
|
let client: RuntimePoolClient | null = null;
|
|
@@ -2336,24 +2399,35 @@ async function withRuntimePostgres<T>(
|
|
|
2336
2399
|
if (!cachePool) {
|
|
2337
2400
|
requestLocalPool = pool;
|
|
2338
2401
|
}
|
|
2339
|
-
client = await
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2402
|
+
client = await measureRuntimeSheetPhase(
|
|
2403
|
+
options.completionDiagnostics,
|
|
2404
|
+
'poolAcquire',
|
|
2405
|
+
() =>
|
|
2406
|
+
connectRuntimePostgresPool(
|
|
2407
|
+
pool,
|
|
2408
|
+
admission,
|
|
2409
|
+
lane,
|
|
2410
|
+
session.postgresUrl,
|
|
2411
|
+
options.signal,
|
|
2412
|
+
),
|
|
2345
2413
|
);
|
|
2346
2414
|
operationDeadlineAt =
|
|
2347
2415
|
options.operationTimeoutMs === undefined
|
|
2348
2416
|
? null
|
|
2349
2417
|
: Date.now() + Math.max(1, Math.floor(options.operationTimeoutMs));
|
|
2350
2418
|
if (session.executionRole) {
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2419
|
+
const roleClient = client;
|
|
2420
|
+
await measureRuntimeSheetPhase(
|
|
2421
|
+
options.completionDiagnostics,
|
|
2422
|
+
'transactionBegin',
|
|
2423
|
+
() =>
|
|
2424
|
+
awaitRuntimePostgresOperation({
|
|
2425
|
+
client: roleClient,
|
|
2426
|
+
deadlineAt: operationDeadlineAt,
|
|
2427
|
+
operation: roleClient.query('BEGIN'),
|
|
2428
|
+
signal: options.signal,
|
|
2429
|
+
}),
|
|
2430
|
+
);
|
|
2357
2431
|
roleTransactionStarted = true;
|
|
2358
2432
|
await awaitRuntimePostgresOperation({
|
|
2359
2433
|
client,
|
|
@@ -2419,12 +2493,18 @@ async function withRuntimePostgres<T>(
|
|
|
2419
2493
|
signal: options.signal,
|
|
2420
2494
|
});
|
|
2421
2495
|
if (roleTransactionStarted) {
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2496
|
+
const roleClient = client;
|
|
2497
|
+
await measureRuntimeSheetPhase(
|
|
2498
|
+
options.completionDiagnostics,
|
|
2499
|
+
'transactionCommit',
|
|
2500
|
+
() =>
|
|
2501
|
+
awaitRuntimePostgresOperation({
|
|
2502
|
+
client: roleClient,
|
|
2503
|
+
deadlineAt: operationDeadlineAt,
|
|
2504
|
+
operation: roleClient.query('COMMIT'),
|
|
2505
|
+
signal: options.signal,
|
|
2506
|
+
}),
|
|
2507
|
+
);
|
|
2428
2508
|
roleTransactionStarted = false;
|
|
2429
2509
|
}
|
|
2430
2510
|
return result;
|
|
@@ -2549,10 +2629,14 @@ async function withRuntimeSheetProvisioningRetry<T>(
|
|
|
2549
2629
|
sheetContract: PlaySheetContract;
|
|
2550
2630
|
session: RuntimePostgresSession;
|
|
2551
2631
|
timings?: RuntimeSheetTiming[];
|
|
2632
|
+
completionDiagnostics?: RuntimeMapCompletionDiagnostics;
|
|
2552
2633
|
},
|
|
2553
2634
|
operation: () => Promise<T>,
|
|
2554
2635
|
): Promise<T> {
|
|
2555
2636
|
const firstAttemptStartedAt = Date.now();
|
|
2637
|
+
if (input.completionDiagnostics) {
|
|
2638
|
+
input.completionDiagnostics.operationAttempts += 1;
|
|
2639
|
+
}
|
|
2556
2640
|
try {
|
|
2557
2641
|
const result = await operation();
|
|
2558
2642
|
input.timings?.push({
|
|
@@ -2610,6 +2694,10 @@ async function withRuntimeSheetProvisioningRetry<T>(
|
|
|
2610
2694
|
} else {
|
|
2611
2695
|
throw error;
|
|
2612
2696
|
}
|
|
2697
|
+
if (input.completionDiagnostics) {
|
|
2698
|
+
input.completionDiagnostics.provisioningRetryAttempts += 1;
|
|
2699
|
+
input.completionDiagnostics.operationAttempts += 1;
|
|
2700
|
+
}
|
|
2613
2701
|
const retryStartedAt = Date.now();
|
|
2614
2702
|
const result = await operation();
|
|
2615
2703
|
input.timings?.push({
|
|
@@ -2631,11 +2719,12 @@ async function withRuntimeSheetQueryClient<T>(
|
|
|
2631
2719
|
transactional: boolean;
|
|
2632
2720
|
statementTimeoutMs?: number;
|
|
2633
2721
|
timings?: RuntimeSheetTiming[];
|
|
2722
|
+
completionDiagnostics?: RuntimeMapCompletionDiagnostics;
|
|
2634
2723
|
},
|
|
2635
2724
|
operation: (client: RuntimeQueryClient) => Promise<T>,
|
|
2636
2725
|
): Promise<T> {
|
|
2637
|
-
const
|
|
2638
|
-
const
|
|
2726
|
+
const resultStartedAt = Date.now();
|
|
2727
|
+
const resultPromise = withRuntimeSheetProvisioningRetry(
|
|
2639
2728
|
context,
|
|
2640
2729
|
{ ...input, session },
|
|
2641
2730
|
async () => {
|
|
@@ -2661,7 +2750,13 @@ async function withRuntimeSheetQueryClient<T>(
|
|
|
2661
2750
|
const managesTransaction =
|
|
2662
2751
|
(input.transactional || input.statementTimeoutMs !== undefined) &&
|
|
2663
2752
|
!transaction.active;
|
|
2664
|
-
if (managesTransaction)
|
|
2753
|
+
if (managesTransaction) {
|
|
2754
|
+
await measureRuntimeSheetPhase(
|
|
2755
|
+
input.completionDiagnostics,
|
|
2756
|
+
'transactionBegin',
|
|
2757
|
+
() => client.query('BEGIN'),
|
|
2758
|
+
);
|
|
2759
|
+
}
|
|
2665
2760
|
try {
|
|
2666
2761
|
if (input.statementTimeoutMs !== undefined) {
|
|
2667
2762
|
await client.query(
|
|
@@ -2669,7 +2764,13 @@ async function withRuntimeSheetQueryClient<T>(
|
|
|
2669
2764
|
);
|
|
2670
2765
|
}
|
|
2671
2766
|
const result = await operation(client);
|
|
2672
|
-
if (managesTransaction)
|
|
2767
|
+
if (managesTransaction) {
|
|
2768
|
+
await measureRuntimeSheetPhase(
|
|
2769
|
+
input.completionDiagnostics,
|
|
2770
|
+
'transactionCommit',
|
|
2771
|
+
() => client.query('COMMIT'),
|
|
2772
|
+
);
|
|
2773
|
+
}
|
|
2673
2774
|
return result;
|
|
2674
2775
|
} catch (error) {
|
|
2675
2776
|
if (managesTransaction) {
|
|
@@ -2687,13 +2788,22 @@ async function withRuntimeSheetQueryClient<T>(
|
|
|
2687
2788
|
? undefined
|
|
2688
2789
|
: RUNTIME_SHEET_COMPLETION_SERVER_OPERATION_TIMEOUT_MS,
|
|
2689
2790
|
signal: context.abortSignal,
|
|
2791
|
+
completionDiagnostics: input.completionDiagnostics,
|
|
2690
2792
|
},
|
|
2691
2793
|
);
|
|
2692
2794
|
},
|
|
2693
2795
|
);
|
|
2796
|
+
if (input.completionDiagnostics) {
|
|
2797
|
+
return await measureRuntimeSheetPhase(
|
|
2798
|
+
input.completionDiagnostics,
|
|
2799
|
+
'queryClient',
|
|
2800
|
+
() => resultPromise,
|
|
2801
|
+
);
|
|
2802
|
+
}
|
|
2803
|
+
const result = await resultPromise;
|
|
2694
2804
|
input.timings?.push({
|
|
2695
2805
|
phase: 'query_client_total',
|
|
2696
|
-
ms: Date.now() -
|
|
2806
|
+
ms: Date.now() - resultStartedAt,
|
|
2697
2807
|
});
|
|
2698
2808
|
return result;
|
|
2699
2809
|
}
|
|
@@ -8686,24 +8796,62 @@ export async function completeRuntimeMapRows(
|
|
|
8686
8796
|
rows: input.rows.map((row) => row.data),
|
|
8687
8797
|
outputFields: input.outputFields,
|
|
8688
8798
|
});
|
|
8689
|
-
const
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8799
|
+
const completionDiagnostics = createRuntimeMapCompletionDiagnostics();
|
|
8800
|
+
const completionStartedAt = Date.now();
|
|
8801
|
+
let completionOutcome: 'succeeded' | 'failed' = 'failed';
|
|
8802
|
+
let uniqueRowCount = 0;
|
|
8803
|
+
let completedRowCount = 0;
|
|
8804
|
+
let failedRowCount = 0;
|
|
8805
|
+
let chunkCount = 0;
|
|
8806
|
+
let updatedRowCount = 0;
|
|
8807
|
+
let fencedRowCount = 0;
|
|
8808
|
+
const logCompletion = () => {
|
|
8809
|
+
console.info(
|
|
8810
|
+
'[runtime-sheet-map-completion]',
|
|
8811
|
+
JSON.stringify({
|
|
8812
|
+
event: 'finished',
|
|
8813
|
+
outcome: completionOutcome,
|
|
8814
|
+
inputRows: input.rows.length,
|
|
8815
|
+
uniqueRows: uniqueRowCount,
|
|
8816
|
+
completedRows: completedRowCount,
|
|
8817
|
+
failedRows: failedRowCount,
|
|
8818
|
+
chunks: chunkCount,
|
|
8819
|
+
updatedRows: updatedRowCount,
|
|
8820
|
+
fencedRows: fencedRowCount,
|
|
8821
|
+
...completionDiagnostics,
|
|
8822
|
+
totalMs: Date.now() - completionStartedAt,
|
|
8823
|
+
}),
|
|
8824
|
+
);
|
|
8825
|
+
};
|
|
8826
|
+
let session: RuntimePostgresSession;
|
|
8827
|
+
try {
|
|
8828
|
+
session = await measureRuntimeSheetPhase(
|
|
8829
|
+
completionDiagnostics,
|
|
8830
|
+
'dbSessionAcquire',
|
|
8831
|
+
async () =>
|
|
8832
|
+
requireRuntimePostgresSession(
|
|
8833
|
+
await getRuntimeDbSession(
|
|
8834
|
+
{
|
|
8835
|
+
...context,
|
|
8836
|
+
playName: context.playName,
|
|
8837
|
+
runId: context.runId ?? input.runId,
|
|
8838
|
+
},
|
|
8839
|
+
{
|
|
8840
|
+
tableNamespace: input.tableNamespace,
|
|
8841
|
+
logicalTable: 'sheet_rows',
|
|
8842
|
+
operations: ['rows.read', 'rows.upsert'],
|
|
8843
|
+
limits: {
|
|
8844
|
+
maxRows: runtimeDbSessionRowLimit(input.rows.length),
|
|
8845
|
+
},
|
|
8846
|
+
sheetContract,
|
|
8847
|
+
},
|
|
8848
|
+
),
|
|
8849
|
+
),
|
|
8850
|
+
);
|
|
8851
|
+
} catch (error) {
|
|
8852
|
+
logCompletion();
|
|
8853
|
+
throw error;
|
|
8854
|
+
}
|
|
8707
8855
|
|
|
8708
8856
|
// Dedupe by key. Last write wins on payload, status, and error.
|
|
8709
8857
|
const uniqueRows = new Map<string, RuntimeApiRowRecord>();
|
|
@@ -8718,7 +8866,10 @@ export async function completeRuntimeMapRows(
|
|
|
8718
8866
|
if (!resolvedKey) continue;
|
|
8719
8867
|
uniqueRows.set(resolvedKey, { ...row, key: resolvedKey });
|
|
8720
8868
|
}
|
|
8869
|
+
uniqueRowCount = uniqueRows.size;
|
|
8721
8870
|
if (uniqueRows.size === 0) {
|
|
8871
|
+
completionOutcome = 'succeeded';
|
|
8872
|
+
logCompletion();
|
|
8722
8873
|
return classifyRuntimeMapRowsWrite({
|
|
8723
8874
|
submittedKeys: [],
|
|
8724
8875
|
updated: 0,
|
|
@@ -8735,6 +8886,9 @@ export async function completeRuntimeMapRows(
|
|
|
8735
8886
|
});
|
|
8736
8887
|
const chunks = chunkValues(completedRows, DIRECT_POSTGRES_BATCH_SIZE);
|
|
8737
8888
|
const failedChunks = chunkValues(failedRows, DIRECT_POSTGRES_BATCH_SIZE);
|
|
8889
|
+
completedRowCount = completedRows.length;
|
|
8890
|
+
failedRowCount = failedRows.length;
|
|
8891
|
+
chunkCount = chunks.length + failedChunks.length;
|
|
8738
8892
|
const needsTransaction = true;
|
|
8739
8893
|
const outputFields = [...new Set(input.outputFields ?? [])];
|
|
8740
8894
|
const attemptId = input.attemptId?.trim() || null;
|
|
@@ -8752,7 +8906,7 @@ export async function completeRuntimeMapRows(
|
|
|
8752
8906
|
);
|
|
8753
8907
|
}
|
|
8754
8908
|
|
|
8755
|
-
return
|
|
8909
|
+
return withRuntimeSheetQueryClient(
|
|
8756
8910
|
context,
|
|
8757
8911
|
session,
|
|
8758
8912
|
{
|
|
@@ -8761,6 +8915,7 @@ export async function completeRuntimeMapRows(
|
|
|
8761
8915
|
sheetContract,
|
|
8762
8916
|
transactional: needsTransaction,
|
|
8763
8917
|
statementTimeoutMs: RUNTIME_SHEET_COMPLETION_STATEMENT_TIMEOUT_MS,
|
|
8918
|
+
completionDiagnostics,
|
|
8764
8919
|
},
|
|
8765
8920
|
async (client) => {
|
|
8766
8921
|
const completed =
|
|
@@ -8781,15 +8936,20 @@ export async function completeRuntimeMapRows(
|
|
|
8781
8936
|
),
|
|
8782
8937
|
outputFields,
|
|
8783
8938
|
};
|
|
8784
|
-
const updated = await
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
chunkInput,
|
|
8939
|
+
const updated = await measureRuntimeSheetPhase(
|
|
8940
|
+
completionDiagnostics,
|
|
8941
|
+
'mapRowsUpdate',
|
|
8942
|
+
() => completeRuntimeMapRowChunks(client, session, chunkInput),
|
|
8788
8943
|
);
|
|
8789
|
-
const inserted = await
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8944
|
+
const inserted = await measureRuntimeSheetPhase(
|
|
8945
|
+
completionDiagnostics,
|
|
8946
|
+
'missingRowsInsert',
|
|
8947
|
+
() =>
|
|
8948
|
+
insertMissingCompletedMapRowChunks(
|
|
8949
|
+
client,
|
|
8950
|
+
session,
|
|
8951
|
+
chunkInput,
|
|
8952
|
+
),
|
|
8793
8953
|
);
|
|
8794
8954
|
return {
|
|
8795
8955
|
updated: updated.updated + inserted.inserted,
|
|
@@ -8799,21 +8959,28 @@ export async function completeRuntimeMapRows(
|
|
|
8799
8959
|
: { updated: 0, fencedRows: [] };
|
|
8800
8960
|
const failed =
|
|
8801
8961
|
failedRows.length > 0
|
|
8802
|
-
? await
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8962
|
+
? await measureRuntimeSheetPhase(
|
|
8963
|
+
completionDiagnostics,
|
|
8964
|
+
'failedRowsUpdate',
|
|
8965
|
+
() =>
|
|
8966
|
+
failRuntimeMapRowChunks(client, session, {
|
|
8967
|
+
chunks: failedChunks,
|
|
8968
|
+
physicalColumnProjections: projections,
|
|
8969
|
+
forceTerminal: input.forceFailedRows === true,
|
|
8970
|
+
runId: input.runId,
|
|
8971
|
+
attemptId,
|
|
8972
|
+
attemptOwnerRunId,
|
|
8973
|
+
attemptExpiresAt,
|
|
8974
|
+
attemptSeq,
|
|
8975
|
+
writeVersion,
|
|
8976
|
+
normalizedPlayName: normalizePlayNameForSheet(
|
|
8977
|
+
session.playName,
|
|
8978
|
+
),
|
|
8979
|
+
normalizedTableNamespace: normalizeTableNamespace(
|
|
8980
|
+
input.tableNamespace,
|
|
8981
|
+
),
|
|
8982
|
+
}),
|
|
8983
|
+
)
|
|
8817
8984
|
: { updated: 0, fencedRows: [] };
|
|
8818
8985
|
return classifyRuntimeMapRowsWrite({
|
|
8819
8986
|
submittedKeys: uniqueRows.keys(),
|
|
@@ -8821,7 +8988,14 @@ export async function completeRuntimeMapRows(
|
|
|
8821
8988
|
fencedRows: [...completed.fencedRows, ...failed.fencedRows],
|
|
8822
8989
|
});
|
|
8823
8990
|
},
|
|
8824
|
-
)
|
|
8991
|
+
)
|
|
8992
|
+
.then((result) => {
|
|
8993
|
+
updatedRowCount = result.updated;
|
|
8994
|
+
fencedRowCount = result.fencedKeys.length;
|
|
8995
|
+
completionOutcome = 'succeeded';
|
|
8996
|
+
return result;
|
|
8997
|
+
})
|
|
8998
|
+
.finally(logCompletion);
|
|
8825
8999
|
}
|
|
8826
9000
|
|
|
8827
9001
|
/**
|
|
@@ -20173,6 +20173,18 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20173
20173
|
: undefined),
|
|
20174
20174
|
);
|
|
20175
20175
|
const tokenAuthority = input.tokenAuthority ?? 'local_mint';
|
|
20176
|
+
const reuseMarginMs =
|
|
20177
|
+
Math.max(
|
|
20178
|
+
1,
|
|
20179
|
+
Math.floor(
|
|
20180
|
+
input.runtimeApi?.requestTimeoutMs ??
|
|
20181
|
+
RUNTIME_CAPACITY_POLICY.receiptGateway.requestTimeoutMs,
|
|
20182
|
+
),
|
|
20183
|
+
) + RUNTIME_RELIABILITY_POLICY.schedulerDatabase.queryTimeoutMs;
|
|
20184
|
+
const ingressPrefixLimit = Math.min(
|
|
20185
|
+
RUN_LEDGER_PROJECTION_PREFIX_MAX_FACTS,
|
|
20186
|
+
remainingEvents ?? RUN_LEDGER_PROJECTION_PREFIX_MAX_FACTS,
|
|
20187
|
+
);
|
|
20176
20188
|
const leaseOwner =
|
|
20177
20189
|
input.leaseOwner?.trim() || `run-ledger-outbox-dispatch:${randomUUID()}`;
|
|
20178
20190
|
const needsLaunch =
|
|
@@ -20249,7 +20261,8 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20249
20261
|
const unclaimed: {
|
|
20250
20262
|
events: PostgresSchedulerOutboxEvent[];
|
|
20251
20263
|
launchJson: unknown;
|
|
20252
|
-
|
|
20264
|
+
ingressPrefixClaimed: boolean;
|
|
20265
|
+
} = { events: [], launchJson: undefined, ingressPrefixClaimed: false };
|
|
20253
20266
|
return unclaimed;
|
|
20254
20267
|
}
|
|
20255
20268
|
// A re-invocation with no named head claims again under the same owner,
|
|
@@ -20386,6 +20399,25 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20386
20399
|
FOR UPDATE OF runs SKIP LOCKED LIMIT 1
|
|
20387
20400
|
`));
|
|
20388
20401
|
const runId = selected.rows[0]?.run_id;
|
|
20402
|
+
let ingressPrefixClaimed = false;
|
|
20403
|
+
if (
|
|
20404
|
+
runId &&
|
|
20405
|
+
tokenAuthority === 'gateway' &&
|
|
20406
|
+
!input.searchOnly &&
|
|
20407
|
+
(input.limit ?? 1) === ingressPrefixLimit
|
|
20408
|
+
) {
|
|
20409
|
+
try {
|
|
20410
|
+
const launch = parseRunLedgerDispatchLaunch(
|
|
20411
|
+
selected.rows[0]?.dispatch_launch_json,
|
|
20412
|
+
);
|
|
20413
|
+
ingressPrefixClaimed =
|
|
20414
|
+
launch.runId === runId &&
|
|
20415
|
+
usableRunLedgerExecutorToken(launch, reuseMarginMs, options)
|
|
20416
|
+
?.runLedgerIngressPrefixBatching === true;
|
|
20417
|
+
} catch {
|
|
20418
|
+
// Malformed launches retain the existing post-claim failure policy.
|
|
20419
|
+
}
|
|
20420
|
+
}
|
|
20389
20421
|
const claimed = runId
|
|
20390
20422
|
? await readPendingPostgresSchedulerOutboxEvents(
|
|
20391
20423
|
client,
|
|
@@ -20397,6 +20429,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20397
20429
|
inTransaction: true,
|
|
20398
20430
|
restartTransactionOnMissingMarker: true,
|
|
20399
20431
|
searchOnly: input.searchOnly,
|
|
20432
|
+
allowIngressPrefix: ingressPrefixClaimed,
|
|
20400
20433
|
},
|
|
20401
20434
|
options,
|
|
20402
20435
|
)
|
|
@@ -20409,6 +20442,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20409
20442
|
return {
|
|
20410
20443
|
events: claimed,
|
|
20411
20444
|
launchJson: selected.rows[0]?.dispatch_launch_json,
|
|
20445
|
+
ingressPrefixClaimed,
|
|
20412
20446
|
};
|
|
20413
20447
|
} catch (error) {
|
|
20414
20448
|
await client.query('ROLLBACK');
|
|
@@ -20419,7 +20453,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20419
20453
|
? scope.nextClaimed.splice(0)
|
|
20420
20454
|
: null;
|
|
20421
20455
|
const claimed = preclaimed
|
|
20422
|
-
? { events: preclaimed, launchJson: null }
|
|
20456
|
+
? { events: preclaimed, launchJson: null, ingressPrefixClaimed: false }
|
|
20423
20457
|
: await withClient(async (client) => {
|
|
20424
20458
|
try {
|
|
20425
20459
|
return await claimEvents(client);
|
|
@@ -20661,14 +20695,6 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20661
20695
|
}
|
|
20662
20696
|
const needsRuntimeApi = ledgerEvents === null || ledgerEvents.length > 0;
|
|
20663
20697
|
let runtimeApi: WorkerRuntimeApiContext | null = null;
|
|
20664
|
-
const reuseMarginMs =
|
|
20665
|
-
Math.max(
|
|
20666
|
-
1,
|
|
20667
|
-
Math.floor(
|
|
20668
|
-
input.runtimeApi?.requestTimeoutMs ??
|
|
20669
|
-
RUNTIME_CAPACITY_POLICY.receiptGateway.requestTimeoutMs,
|
|
20670
|
-
),
|
|
20671
|
-
) + RUNTIME_RELIABILITY_POLICY.schedulerDatabase.queryTimeoutMs;
|
|
20672
20698
|
const cachedAuthority = authorityScope.authority;
|
|
20673
20699
|
const observeDispatchTokenResponse = (
|
|
20674
20700
|
observation: RunLedgerDispatchTokenObservation,
|
|
@@ -20787,11 +20813,10 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20787
20813
|
}
|
|
20788
20814
|
authorityReadyAtMs = Date.now();
|
|
20789
20815
|
}
|
|
20790
|
-
//
|
|
20791
|
-
//
|
|
20792
|
-
// before the first HTTP append, so an already-finished run need not pay one
|
|
20793
|
-
// authority/append/ACK round trip for every ingress predecessor.
|
|
20816
|
+
// A prefix-capable initial claim freezes even a singleton receipt. Only
|
|
20817
|
+
// widen when receiver support was not already used by that claim.
|
|
20794
20818
|
if (
|
|
20819
|
+
!claimed.ingressPrefixClaimed &&
|
|
20795
20820
|
runtimeApi?.runLedgerIngressPrefixBatching === true &&
|
|
20796
20821
|
events.length === 1 &&
|
|
20797
20822
|
first.eventType === RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runEvents
|
|
@@ -20820,10 +20845,7 @@ async function dispatchRunLedgerOutboxBatchWithScope(
|
|
|
20820
20845
|
runId: first.runId,
|
|
20821
20846
|
leaseOwner,
|
|
20822
20847
|
leaseSeconds: input.leaseSeconds ?? 120,
|
|
20823
|
-
limit:
|
|
20824
|
-
RUN_LEDGER_PROJECTION_PREFIX_MAX_FACTS,
|
|
20825
|
-
remainingEvents ?? RUN_LEDGER_PROJECTION_PREFIX_MAX_FACTS,
|
|
20826
|
-
),
|
|
20848
|
+
limit: ingressPrefixLimit,
|
|
20827
20849
|
allowIngressPrefix: true,
|
|
20828
20850
|
extendOwnedHead: first.eventId,
|
|
20829
20851
|
inTransaction: true,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkEJ2NVO5Kjs = require('./chunk-EJ2NVO5K.js');
|
|
13
|
+
require('./chunk-4Q572AVS.js');
|
|
14
|
+
require('./chunk-22GXXUTB.js');
|
|
15
|
+
require('./chunk-XNYIZMNQ.js');
|
|
16
|
+
require('./chunk-GGSLHWTB.js');
|
|
17
|
+
require('./chunk-7P5AA3SN.js');
|
|
18
|
+
require('./chunk-OG64RBAC.js');
|
|
19
|
+
require('./chunk-COGTRVWW.js');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkEJ2NVO5Kjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunkEJ2NVO5Kjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkEJ2NVO5Kjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkEJ2NVO5Kjs.handleRegister; exports.handleStatus = _chunkEJ2NVO5Kjs.handleStatus; exports.handleWait = _chunkEJ2NVO5Kjs.handleWait; exports.readPendingAuthClaim = _chunkEJ2NVO5Kjs.readPendingAuthClaim; exports.registerAuthCommands = _chunkEJ2NVO5Kjs.registerAuthCommands; exports.reportSetupCompleted = _chunkEJ2NVO5Kjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkEJ2NVO5Kjs.resolvePendingAuthClaimForResume;
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
registerAuthCommands,
|
|
10
10
|
reportSetupCompleted,
|
|
11
11
|
resolvePendingAuthClaimForResume
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-XAM3XOUA.mjs";
|
|
13
|
+
import "./chunk-2GRMXCLZ.mjs";
|
|
14
|
+
import "./chunk-VC7M2QR7.mjs";
|
|
15
15
|
import "./chunk-DLIRSHV6.mjs";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-MOVEHSNM.mjs";
|
|
17
17
|
import "./chunk-NXGCO4JB.mjs";
|
|
18
18
|
import "./chunk-WZYKRD7T.mjs";
|
|
19
19
|
import "./chunk-KRD6H754.mjs";
|