deepline 0.3.178 → 0.3.180
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/observability/scheduled-job-errors.ts +11 -21
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +61 -12
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
|
@@ -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.180',
|
|
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: {
|
|
@@ -28,6 +28,7 @@ export type ScheduledJobFailure = {
|
|
|
28
28
|
attempt?: number | null;
|
|
29
29
|
occurredAt?: string;
|
|
30
30
|
test?: boolean;
|
|
31
|
+
conclusion?: string | null;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
export function sanitizeScheduledJobError(
|
|
@@ -69,28 +70,17 @@ export function sanitizeScheduledJobError(
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
export function formatScheduledJobFailure(input: ScheduledJobFailure): string {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"'''",
|
|
78
|
-
);
|
|
73
|
+
const compact = (value: unknown, size: number) =>
|
|
74
|
+
sanitizeScheduledJobError(value, size)
|
|
75
|
+
.replace(/[<>`*]/g, '')
|
|
76
|
+
.replaceAll('&', '&');
|
|
77
|
+
const status = input.conclusion?.toUpperCase() ?? 'FAIL';
|
|
79
78
|
return [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`Occurred: ${input.occurredAt ?? new Date().toISOString()}`,
|
|
86
|
-
input.runUrl ? `Diagnostics: ${input.runUrl}` : null,
|
|
87
|
-
'Error/log:',
|
|
88
|
-
'```',
|
|
89
|
-
errorLog,
|
|
90
|
-
'```',
|
|
91
|
-
]
|
|
92
|
-
.filter((line): line is string => Boolean(line))
|
|
93
|
-
.join('\n');
|
|
79
|
+
`${input.test ? '[TEST] ' : ''}${compact(input.jobName, 70)} · ${status} · ${compact(input.stage ?? 'stage unknown', 80)}`,
|
|
80
|
+
input.runUrl
|
|
81
|
+
? `<${input.runUrl}|Run / diagnostics>`
|
|
82
|
+
: compact(input.error, 160),
|
|
83
|
+
].join('\n');
|
|
94
84
|
}
|
|
95
85
|
|
|
96
86
|
function safeJson(value: unknown): string {
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
readPostgresSchedulerAbsurdTaskId,
|
|
37
37
|
readPostgresSchedulerResult,
|
|
38
38
|
recordPostgresSchedulerSignal,
|
|
39
|
+
type PostgresSchedulerQueryClient,
|
|
39
40
|
} from './postgres';
|
|
40
41
|
import {
|
|
41
42
|
createPlayRunAdmissionJob,
|
|
@@ -75,10 +76,55 @@ export type AbsurdSchedulerBackendOptions = AbsurdSchedulerOptions & {
|
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
const cancellationFlights = new Map<string, Promise<void>>();
|
|
79
|
+
const ABSURD_CANCEL_TASK_SAVEPOINT = 'deepline_cancel_absurd_task';
|
|
78
80
|
|
|
79
81
|
function quotePostgresIdentifier(identifier: string): string {
|
|
80
82
|
return `"${identifier.replaceAll('"', '""')}"`;
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
function isAbsurdTaskMissingError(
|
|
86
|
+
error: unknown,
|
|
87
|
+
input: { queue: string; taskId: string },
|
|
88
|
+
): boolean {
|
|
89
|
+
if (!error || typeof error !== 'object') return false;
|
|
90
|
+
const candidate = error as { code?: unknown; message?: unknown };
|
|
91
|
+
return (
|
|
92
|
+
candidate.code === 'P0001' &&
|
|
93
|
+
candidate.message ===
|
|
94
|
+
`Task "${input.taskId}" not found in queue "${input.queue}"`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function cancelAbsurdTaskIfPresent(
|
|
99
|
+
client: PostgresSchedulerQueryClient,
|
|
100
|
+
input: { queue: string; taskId: string; runId: string },
|
|
101
|
+
): Promise<boolean> {
|
|
102
|
+
await client.query(`SAVEPOINT ${ABSURD_CANCEL_TASK_SAVEPOINT}`);
|
|
103
|
+
try {
|
|
104
|
+
await client.query(`SELECT absurd.cancel_task($1, $2::uuid)`, [
|
|
105
|
+
input.queue,
|
|
106
|
+
input.taskId,
|
|
107
|
+
]);
|
|
108
|
+
await client.query(`RELEASE SAVEPOINT ${ABSURD_CANCEL_TASK_SAVEPOINT}`);
|
|
109
|
+
return true;
|
|
110
|
+
} catch (error) {
|
|
111
|
+
if (!isAbsurdTaskMissingError(error, input)) throw error;
|
|
112
|
+
|
|
113
|
+
// A PostgreSQL statement error aborts the transaction until we roll back
|
|
114
|
+
// to a savepoint. The engine's exact missing-task result proves there is
|
|
115
|
+
// no task left to claim, so restore the transaction and let the scheduler
|
|
116
|
+
// terminal write release the run's attempts, receipts, and billing state.
|
|
117
|
+
await client.query(`ROLLBACK TO SAVEPOINT ${ABSURD_CANCEL_TASK_SAVEPOINT}`);
|
|
118
|
+
await client.query(`RELEASE SAVEPOINT ${ABSURD_CANCEL_TASK_SAVEPOINT}`);
|
|
119
|
+
console.warn('[absurd-runtime.cancel] engine_task_missing', {
|
|
120
|
+
runId: input.runId,
|
|
121
|
+
taskId: input.taskId,
|
|
122
|
+
queue: input.queue,
|
|
123
|
+
});
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
82
128
|
function runCancellationSingleFlight(
|
|
83
129
|
key: string,
|
|
84
130
|
operation: () => Promise<void>,
|
|
@@ -186,24 +232,27 @@ function absurdRunHandle(input: {
|
|
|
186
232
|
effectiveOptions,
|
|
187
233
|
);
|
|
188
234
|
if (taskId) {
|
|
189
|
-
await client
|
|
190
|
-
cancellationQueue,
|
|
235
|
+
const engineTaskCancelled = await cancelAbsurdTaskIfPresent(client, {
|
|
236
|
+
queue: cancellationQueue,
|
|
191
237
|
taskId,
|
|
192
|
-
|
|
238
|
+
runId: input.runId,
|
|
239
|
+
});
|
|
193
240
|
// Older v4 Absurd functions do not materialize a manual cancellation
|
|
194
241
|
// deadline or reason. Stamp both in the adapter so existing queues
|
|
195
242
|
// participate in the same durable reconciliation lane without a
|
|
196
243
|
// schema cutover. The explicit marker keeps a user cancel distinct
|
|
197
244
|
// from a task cancelled by its configured max_delay sweep.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
245
|
+
if (engineTaskCancelled) {
|
|
246
|
+
await client.query(
|
|
247
|
+
`UPDATE absurd.${quotePostgresIdentifier(`t_${cancellationQueue}`)}
|
|
248
|
+
SET cancel_at = COALESCE(cancel_at, clock_timestamp()),
|
|
249
|
+
cancellation = COALESCE(cancellation, '{}'::jsonb)
|
|
250
|
+
|| jsonb_build_object('manual', true)
|
|
251
|
+
WHERE task_id = $1::uuid
|
|
252
|
+
AND state = 'cancelled'`,
|
|
253
|
+
[taskId],
|
|
254
|
+
);
|
|
255
|
+
}
|
|
207
256
|
}
|
|
208
257
|
const cancelled = await cancelPostgresSchedulerRun(
|
|
209
258
|
client,
|
package/dist/cli/index.js
CHANGED
|
@@ -3051,7 +3051,7 @@ var SDK_RELEASE = {
|
|
|
3051
3051
|
// getters keep their established compatibility behavior.
|
|
3052
3052
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3053
3053
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3054
|
-
version: "0.3.
|
|
3054
|
+
version: "0.3.180",
|
|
3055
3055
|
updateSummary: "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.",
|
|
3056
3056
|
packageCapabilities: {
|
|
3057
3057
|
updatePreferences: 1
|
package/dist/cli/index.mjs
CHANGED
|
@@ -3046,7 +3046,7 @@ var SDK_RELEASE = {
|
|
|
3046
3046
|
// getters keep their established compatibility behavior.
|
|
3047
3047
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3048
3048
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3049
|
-
version: "0.3.
|
|
3049
|
+
version: "0.3.180",
|
|
3050
3050
|
updateSummary: "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.",
|
|
3051
3051
|
packageCapabilities: {
|
|
3052
3052
|
updatePreferences: 1
|
package/dist/index.js
CHANGED
|
@@ -864,7 +864,7 @@ var SDK_RELEASE = {
|
|
|
864
864
|
// getters keep their established compatibility behavior.
|
|
865
865
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
866
866
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
867
|
-
version: "0.3.
|
|
867
|
+
version: "0.3.180",
|
|
868
868
|
updateSummary: "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.",
|
|
869
869
|
packageCapabilities: {
|
|
870
870
|
updatePreferences: 1
|
package/dist/index.mjs
CHANGED
|
@@ -768,7 +768,7 @@ var SDK_RELEASE = {
|
|
|
768
768
|
// getters keep their established compatibility behavior.
|
|
769
769
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
770
770
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
771
|
-
version: "0.3.
|
|
771
|
+
version: "0.3.180",
|
|
772
772
|
updateSummary: "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.",
|
|
773
773
|
packageCapabilities: {
|
|
774
774
|
updatePreferences: 1
|
package/dist/release.d.mts
CHANGED
|
@@ -149,7 +149,7 @@ type SdkRelease = {
|
|
|
149
149
|
supportPolicy: SdkSupportPolicy;
|
|
150
150
|
};
|
|
151
151
|
declare const SDK_RELEASE: {
|
|
152
|
-
readonly version: "0.3.
|
|
152
|
+
readonly version: "0.3.180";
|
|
153
153
|
readonly updateSummary: "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.";
|
|
154
154
|
readonly packageCapabilities: {
|
|
155
155
|
readonly updatePreferences: 1;
|
package/dist/release.d.ts
CHANGED
|
@@ -149,7 +149,7 @@ type SdkRelease = {
|
|
|
149
149
|
supportPolicy: SdkSupportPolicy;
|
|
150
150
|
};
|
|
151
151
|
declare const SDK_RELEASE: {
|
|
152
|
-
readonly version: "0.3.
|
|
152
|
+
readonly version: "0.3.180";
|
|
153
153
|
readonly updateSummary: "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.";
|
|
154
154
|
readonly packageCapabilities: {
|
|
155
155
|
readonly updatePreferences: 1;
|
package/dist/release.js
CHANGED
|
@@ -74,7 +74,7 @@ var SDK_RELEASE = {
|
|
|
74
74
|
// getters keep their established compatibility behavior.
|
|
75
75
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
76
76
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
77
|
-
version: "0.3.
|
|
77
|
+
version: "0.3.180",
|
|
78
78
|
updateSummary: "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.",
|
|
79
79
|
packageCapabilities: {
|
|
80
80
|
updatePreferences: 1
|
package/dist/release.mjs
CHANGED
|
@@ -48,7 +48,7 @@ var SDK_RELEASE = {
|
|
|
48
48
|
// getters keep their established compatibility behavior.
|
|
49
49
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
50
50
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
51
|
-
version: "0.3.
|
|
51
|
+
version: "0.3.180",
|
|
52
52
|
updateSummary: "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.",
|
|
53
53
|
packageCapabilities: {
|
|
54
54
|
updatePreferences: 1
|