@kici-dev/orchestrator 0.2.0 → 0.4.0
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/cli/api-client.d.ts +22 -0
- package/dist/cli.js +615 -469
- package/dist/cluster/cluster-settings-reader.d.ts +1 -1
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/types.d.ts +2 -0
- package/dist/config.d.ts +3 -0
- package/dist/db/migrations/108_unroutable_fast_fail.d.ts +4 -0
- package/dist/db/types.d.ts +20 -0
- package/dist/index.js +50 -13
- package/dist/metrics/prometheus.d.ts +1 -0
- package/dist/queue/bootstrap.d.ts +5 -0
- package/dist/queue/cleanup.d.ts +8 -6
- package/dist/queue/job-queue.d.ts +47 -0
- package/dist/queue/scheduled-job.d.ts +1 -0
- package/dist/queue/terminalize-unroutable.d.ts +53 -0
- package/dist/queue/unroutable-probe.d.ts +52 -0
- package/dist/reporting/run-aggregator.d.ts +18 -1
- package/dist/secrets/pg-secret-store.d.ts +20 -2
- package/dist/server.js +1044 -717
- package/dist/standalone.js +1127 -804
- package/installer-image-digests.json +3 -3
- package/package.json +4 -4
- package/sbom.spdx.json +52 -52
package/dist/cli.js
CHANGED
|
@@ -7,10 +7,10 @@ import * as fs$1 from "node:fs";
|
|
|
7
7
|
import fs, { chmodSync, closeSync, constants, createReadStream, createWriteStream, existsSync, mkdirSync, mkdtempSync, openSync, promises, readFileSync, realpathSync, rmSync, statSync, unwatchFile, watchFile, writeFileSync } from "node:fs";
|
|
8
8
|
import { Command, Option } from "commander";
|
|
9
9
|
import { AgentPlatform, BaseColdStore, ChunkLru, addLogsToArchive, chunkObjectKey, clearDispatchQueueDirect, computeChunkId, computeMigrationsHash, createContextTemplateDirect, createDb, createDbRole, createLogger, createPool, createReadOnlyDbUser, createS3Client, decodeChunk, decrypt, deleteContextDirect, deriveKey, diagnoseExitCode, dropAndCreateDatabase, emitKiciEventDirect, encodeKeySegment, encrypt, ensureDatabase, formatBytes, formatUptime, isSchemaCurrent, kiciMkdtemp, listCheckRunTrackingDirect, listContextsDirect, listExecutionRunsDirect, listQueueDirect, listRegistrationsDirect, maskDatabaseUrl, parseDatabaseUrl, parseManifest, prunePeerCredentialsDirect, purgeContextsDirect, purgeScopedSecretsDirect, purgeSecretBackendsDirect, purgeStaleExecutionDirect, purgeStaleSourcesDirect, registerWorkflowManualDirect, resetRaftStateDirect, seedContextBindingDirect, seedContextDirect, setContextPolicyDirect, setContextSecretDirect, sha256, showContextDirect, showExecutionRunDirect, showQueueEntryDirect, showRegistrationDirect, splitAgentPlatform, storeMigrationContentHash, tablePrefix, toErrorMessage } from "@kici-dev/shared";
|
|
10
|
+
import { AccessLogSource, DEFAULT_APPROVAL_EXPIRY_HOURS, ExecutionJobStatus, KICI_AGENT_ENV_PREFIX, KNOWN_ROLES, OrchestratorMode, PLATFORM_CONNECTED_MODES, PRIVILEGED_ROOT_LABEL, ScalerBackendType, ScalerEventType, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, WS_MAX_PAYLOAD_BYTES, accessLogWarmSqlCase, agentLabelOf, assertValidSecretKey, attestationVerifyStatusSchema, flattenActor, getAccessLogColdDays, getSecretAuditLogColdDays, matcherSatisfiedBy, minAccessLogWarmDays, minSecretAuditLogWarmDays, parseHostPropertyAssignments, scalerAgentLabels, scalerPlatformSchema, secretAuditLogWarmSqlCase, shouldRecordAccess, shouldRecordSecretResolve } from "@kici-dev/engine";
|
|
10
11
|
import crypto$1, { createDecipheriv, createHash, createHmac, createPublicKey, generateKeyPairSync, hkdfSync, randomBytes, randomUUID } from "node:crypto";
|
|
11
12
|
import { createInterface } from "node:readline";
|
|
12
13
|
import { sql } from "kysely";
|
|
13
|
-
import { AccessLogSource, DEFAULT_APPROVAL_EXPIRY_HOURS, KICI_AGENT_ENV_PREFIX, KNOWN_ROLES, OrchestratorMode, PLATFORM_CONNECTED_MODES, PRIVILEGED_ROOT_LABEL, ScalerBackendType, ScalerEventType, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, WS_MAX_PAYLOAD_BYTES, accessLogWarmSqlCase, agentLabelOf, attestationVerifyStatusSchema, flattenActor, getAccessLogColdDays, getSecretAuditLogColdDays, matcherSatisfiedBy, minAccessLogWarmDays, minSecretAuditLogWarmDays, parseHostPropertyAssignments, scalerAgentLabels, scalerPlatformSchema, secretAuditLogWarmSqlCase, shouldRecordAccess, shouldRecordSecretResolve } from "@kici-dev/engine";
|
|
14
14
|
import { access, chmod, constants as constants$1, copyFile, link, mkdir, open, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
15
15
|
import { parse, stringify } from "yaml";
|
|
16
16
|
import { z } from "zod";
|
|
@@ -70,6 +70,46 @@ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
|
70
70
|
* All methods are thin wrappers around fetch() that handle JSON serialization,
|
|
71
71
|
* error formatting, and URL construction.
|
|
72
72
|
*/
|
|
73
|
+
/**
|
|
74
|
+
* `fetch` rejects with a bare `TypeError: fetch failed` when it cannot reach the
|
|
75
|
+
* host — it names neither the address dialled nor the knob that sets it. Printed
|
|
76
|
+
* through the CLI's `Error: ${message}` handler that becomes `Error: fetch
|
|
77
|
+
* failed`, which reads like a fault in the subcommand rather than a misaddressed
|
|
78
|
+
* client, and sends the operator debugging the wrong thing.
|
|
79
|
+
*
|
|
80
|
+
* The trap is sharpened by two details of this CLI. The base URL comes from
|
|
81
|
+
* `KICI_ADMIN_URL`, not the `KICI_ORCHESTRATOR_URL` an operator is likelier to
|
|
82
|
+
* have exported; and subcommands accepting `--database-url` fall back to direct
|
|
83
|
+
* DB access, so on a host with `KICI_DATABASE_URL` set they keep working while
|
|
84
|
+
* the HTTP-only ones fail — making it look like specific subcommands are broken.
|
|
85
|
+
*
|
|
86
|
+
* So: name the address, name the variable, and name the near-miss.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Best-effort one-line detail from a rejected `fetch`. Returns '' when nothing
|
|
90
|
+
* useful is available, so the caller can omit the parenthetical rather than
|
|
91
|
+
* print an empty one.
|
|
92
|
+
*/
|
|
93
|
+
function firstCauseMessage(err) {
|
|
94
|
+
if (!(err instanceof Error)) return "";
|
|
95
|
+
const cause = err.cause;
|
|
96
|
+
if (!(cause instanceof Error)) return "";
|
|
97
|
+
if (cause.message) return cause.message;
|
|
98
|
+
const nested = cause.errors;
|
|
99
|
+
if (Array.isArray(nested)) {
|
|
100
|
+
for (const e of nested) if (e instanceof Error && e.message) return e.message;
|
|
101
|
+
}
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
async function fetchAdminApi(url, init, baseUrl) {
|
|
105
|
+
try {
|
|
106
|
+
return await fetch(url, init);
|
|
107
|
+
} catch (err) {
|
|
108
|
+
const detail = firstCauseMessage(err);
|
|
109
|
+
const cause = detail ? ` (${detail})` : "";
|
|
110
|
+
throw new Error(`cannot reach the orchestrator admin API at ${baseUrl}${cause}. Set KICI_ADMIN_URL to the orchestrator's HTTP address, or pass --base-url where the subcommand accepts it. Note KICI_ORCHESTRATOR_URL is NOT read by this CLI; if other subcommands appear to work, they are using the --database-url / KICI_DATABASE_URL direct-DB path rather than HTTP.`, { cause: err });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
73
113
|
var AdminApiClient = class {
|
|
74
114
|
baseUrl;
|
|
75
115
|
token;
|
|
@@ -81,16 +121,14 @@ var AdminApiClient = class {
|
|
|
81
121
|
* Make an authenticated HTTP request to the admin API.
|
|
82
122
|
*/
|
|
83
123
|
async request(method, path, body) {
|
|
84
|
-
const
|
|
85
|
-
const headers = {
|
|
86
|
-
Authorization: `Bearer ${this.token}`,
|
|
87
|
-
"Content-Type": "application/json"
|
|
88
|
-
};
|
|
89
|
-
const res = await fetch(url, {
|
|
124
|
+
const res = await fetchAdminApi(`${this.baseUrl}${path}`, {
|
|
90
125
|
method,
|
|
91
|
-
headers
|
|
126
|
+
headers: {
|
|
127
|
+
Authorization: `Bearer ${this.token}`,
|
|
128
|
+
"Content-Type": "application/json"
|
|
129
|
+
},
|
|
92
130
|
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
93
|
-
});
|
|
131
|
+
}, this.baseUrl);
|
|
94
132
|
if (!res.ok) {
|
|
95
133
|
const text = await res.text();
|
|
96
134
|
let errorBody;
|
|
@@ -138,11 +176,10 @@ var AdminApiClient = class {
|
|
|
138
176
|
* Public GET request returning raw response text.
|
|
139
177
|
*/
|
|
140
178
|
async getText(path) {
|
|
141
|
-
const
|
|
142
|
-
const res = await fetch(url, {
|
|
179
|
+
const res = await fetchAdminApi(`${this.baseUrl}${path}`, {
|
|
143
180
|
method: "GET",
|
|
144
181
|
headers: { Authorization: `Bearer ${this.token}` }
|
|
145
|
-
});
|
|
182
|
+
}, this.baseUrl);
|
|
146
183
|
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
|
|
147
184
|
return res.text();
|
|
148
185
|
}
|
|
@@ -155,14 +192,14 @@ var AdminApiClient = class {
|
|
|
155
192
|
* response is an octet-stream, so it is read as bytes rather than parsed JSON.
|
|
156
193
|
*/
|
|
157
194
|
async downloadFleetBundle(body, outPath) {
|
|
158
|
-
const res = await
|
|
195
|
+
const res = await fetchAdminApi(`${this.baseUrl}/admin/fleet-bundle`, {
|
|
159
196
|
method: "POST",
|
|
160
197
|
headers: {
|
|
161
198
|
Authorization: `Bearer ${this.token}`,
|
|
162
199
|
"Content-Type": "application/json"
|
|
163
200
|
},
|
|
164
201
|
body: JSON.stringify(body)
|
|
165
|
-
});
|
|
202
|
+
}, this.baseUrl);
|
|
166
203
|
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
|
|
167
204
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
168
205
|
fs$1.writeFileSync(outPath, buf);
|
|
@@ -746,17 +783,36 @@ var PgSecretStore = class PgSecretStore {
|
|
|
746
783
|
}
|
|
747
784
|
return result;
|
|
748
785
|
}
|
|
749
|
-
/**
|
|
750
|
-
* Set (create or update) a secret in a scope.
|
|
751
|
-
* Encrypts the value with AAD = "orgId:scope:key".
|
|
752
|
-
*/
|
|
753
786
|
/** Check if a scope is internal/operational (always allowed regardless of toggle). */
|
|
754
787
|
isInternalScope(scope) {
|
|
755
788
|
const colonIdx = scope.indexOf(":");
|
|
756
789
|
const path = colonIdx >= 0 ? scope.slice(colonIdx + 1) : scope;
|
|
757
790
|
return path.startsWith("__source__/") || path.startsWith("__webhook__/");
|
|
758
791
|
}
|
|
792
|
+
/**
|
|
793
|
+
* Set (create or update) a secret in a scope.
|
|
794
|
+
* Encrypts the value with AAD = "orgId:scope:key".
|
|
795
|
+
*
|
|
796
|
+
* Rejects a key outside `[A-Za-z0-9._-]` before doing anything else. The AAD
|
|
797
|
+
* is a plain concatenation, so a `:` in the key would let two distinct
|
|
798
|
+
* locations render one AAD (scope 'b' + key 'c:d' equals scope 'b:c' + key
|
|
799
|
+
* 'd') and a ciphertext written at one would authenticate at the other. The
|
|
800
|
+
* check sits ahead of the customerSecretsEnabled gate so internal scopes get
|
|
801
|
+
* no exemption — the binding has to hold for every writer.
|
|
802
|
+
*
|
|
803
|
+
* Callers pass a bare scope path, so the AAD's middle field is colon-free
|
|
804
|
+
* too: the admin route and the dashboard handler both run the scope
|
|
805
|
+
* validator immediately before calling in, and `source-store` builds its
|
|
806
|
+
* scope from a uuid. That precondition is what makes the whole triple
|
|
807
|
+
* recoverable, and it is the caller's to keep — this method does not
|
|
808
|
+
* re-check it.
|
|
809
|
+
*
|
|
810
|
+
* Write-path only: getSecrets, listKeys, deleteSecret, deleteScope,
|
|
811
|
+
* renameScope, getAllSecrets and createScope stay unvalidated, which is what
|
|
812
|
+
* keeps a key stored before this rule readable and deletable.
|
|
813
|
+
*/
|
|
759
814
|
async setSecret(orgId, scope, key, value) {
|
|
815
|
+
assertValidSecretKey(key);
|
|
760
816
|
if (!this.customerSecretsEnabled && !this.isInternalScope(scope)) throw new Error("PG customer secrets are disabled. Use an external secret backend or enable pgCustomerSecrets in config.");
|
|
761
817
|
const aad = `${orgId}:${scope}:${key}`;
|
|
762
818
|
const encrypted = encrypt(value, this.masterKey, this.keyVersion, aad);
|
|
@@ -1454,6 +1510,7 @@ function registerSecretCommands(program, getClient) {
|
|
|
1454
1510
|
}
|
|
1455
1511
|
const dbUrl = resolveDirectDbUrl$10(opts.databaseUrl);
|
|
1456
1512
|
if (dbUrl) {
|
|
1513
|
+
assertValidSecretKey(key);
|
|
1457
1514
|
await setContextSecretDirect(dbUrl, {
|
|
1458
1515
|
orgId,
|
|
1459
1516
|
context: scope,
|
|
@@ -1971,6 +2028,7 @@ var init_schema = __esmMin((() => {
|
|
|
1971
2028
|
rosterTtlMs: z.coerce.number().default(18e5),
|
|
1972
2029
|
queueMaxDepth: z.coerce.number().default(1e3),
|
|
1973
2030
|
queueTimeoutMs: z.coerce.number().default(36e5),
|
|
2031
|
+
unroutableGraceMs: z.coerce.number().default(12e4),
|
|
1974
2032
|
/**
|
|
1975
2033
|
* Operator-facing backpressure warning threshold. See `configSchema` in
|
|
1976
2034
|
* `packages/orchestrator/src/config.ts` for the user-facing prose.
|
|
@@ -2454,8 +2512,8 @@ server:
|
|
|
2454
2512
|
//#endregion
|
|
2455
2513
|
//#region src/db/migrations/001_initial.ts
|
|
2456
2514
|
var _001_initial_exports = /* @__PURE__ */ __exportAll({
|
|
2457
|
-
down: () => down$
|
|
2458
|
-
up: () => up$
|
|
2515
|
+
down: () => down$107,
|
|
2516
|
+
up: () => up$107
|
|
2459
2517
|
});
|
|
2460
2518
|
/**
|
|
2461
2519
|
* Squashed initial migration -- creates the complete Orchestrator database schema.
|
|
@@ -3147,7 +3205,7 @@ const DDL_STATEMENTS = [
|
|
|
3147
3205
|
`ALTER TABLE ONLY public.held_runs
|
|
3148
3206
|
ADD CONSTRAINT held_runs_environment_id_fkey FOREIGN KEY (environment_id) REFERENCES public.environments(id);`
|
|
3149
3207
|
];
|
|
3150
|
-
async function up$
|
|
3208
|
+
async function up$107(db) {
|
|
3151
3209
|
for (const stmt of DDL_STATEMENTS) await sql.raw(stmt).execute(db);
|
|
3152
3210
|
await sql`
|
|
3153
3211
|
INSERT INTO cluster_meta (key, value)
|
|
@@ -3169,7 +3227,7 @@ async function up$106(db) {
|
|
|
3169
3227
|
* Rollback drops everything created above. Uses CASCADE on table drops to cut
|
|
3170
3228
|
* through the FK graph without relying on exact topological order.
|
|
3171
3229
|
*/
|
|
3172
|
-
async function down$
|
|
3230
|
+
async function down$107(db) {
|
|
3173
3231
|
for (const [trig, tbl] of [["source_secrets_change_trigger", "scoped_secrets"], ["sources_change_trigger", "sources"]]) await sql.raw(`DROP TRIGGER IF EXISTS ${trig} ON public.${tbl}`).execute(db);
|
|
3174
3232
|
for (const table of [
|
|
3175
3233
|
"workflow_registrations",
|
|
@@ -3216,8 +3274,8 @@ async function down$106(db) {
|
|
|
3216
3274
|
//#endregion
|
|
3217
3275
|
//#region src/db/migrations/002_config_versions_key_version.ts
|
|
3218
3276
|
var _002_config_versions_key_version_exports = /* @__PURE__ */ __exportAll({
|
|
3219
|
-
down: () => down$
|
|
3220
|
-
up: () => up$
|
|
3277
|
+
down: () => down$106,
|
|
3278
|
+
up: () => up$106
|
|
3221
3279
|
});
|
|
3222
3280
|
/**
|
|
3223
3281
|
* Add key_version column to config_versions so that sensitive-field encryption
|
|
@@ -3231,13 +3289,13 @@ var _002_config_versions_key_version_exports = /* @__PURE__ */ __exportAll({
|
|
|
3231
3289
|
* No index is needed: rotation does a full-table scan; reads are by
|
|
3232
3290
|
* `version` primary key and never filter on `key_version`.
|
|
3233
3291
|
*/
|
|
3234
|
-
async function up$
|
|
3292
|
+
async function up$106(db) {
|
|
3235
3293
|
await sql`
|
|
3236
3294
|
ALTER TABLE public.config_versions
|
|
3237
3295
|
ADD COLUMN key_version integer NOT NULL DEFAULT 1
|
|
3238
3296
|
`.execute(db);
|
|
3239
3297
|
}
|
|
3240
|
-
async function down$
|
|
3298
|
+
async function down$106(db) {
|
|
3241
3299
|
await sql`
|
|
3242
3300
|
ALTER TABLE public.config_versions
|
|
3243
3301
|
DROP COLUMN key_version
|
|
@@ -3246,8 +3304,8 @@ async function down$105(db) {
|
|
|
3246
3304
|
//#endregion
|
|
3247
3305
|
//#region src/db/migrations/003_access_log.ts
|
|
3248
3306
|
var _003_access_log_exports = /* @__PURE__ */ __exportAll({
|
|
3249
|
-
down: () => down$
|
|
3250
|
-
up: () => up$
|
|
3307
|
+
down: () => down$105,
|
|
3308
|
+
up: () => up$105
|
|
3251
3309
|
});
|
|
3252
3310
|
/**
|
|
3253
3311
|
* Access log: one row per read or orchestrator-admin mutation attributable
|
|
@@ -3271,7 +3329,7 @@ var _003_access_log_exports = /* @__PURE__ */ __exportAll({
|
|
|
3271
3329
|
* Retention is TTL-based via expires_at; packages/orchestrator/src/queue/
|
|
3272
3330
|
* cleanup.ts picks up the prune pass.
|
|
3273
3331
|
*/
|
|
3274
|
-
async function up$
|
|
3332
|
+
async function up$105(db) {
|
|
3275
3333
|
await sql`
|
|
3276
3334
|
CREATE TABLE public.access_log (
|
|
3277
3335
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
@@ -3309,28 +3367,28 @@ async function up$104(db) {
|
|
|
3309
3367
|
ON public.access_log (actor_type, actor_id, created_at DESC)
|
|
3310
3368
|
`.execute(db);
|
|
3311
3369
|
}
|
|
3312
|
-
async function down$
|
|
3370
|
+
async function down$105(db) {
|
|
3313
3371
|
await sql`DROP TABLE IF EXISTS public.access_log`.execute(db);
|
|
3314
3372
|
}
|
|
3315
3373
|
//#endregion
|
|
3316
3374
|
//#region src/db/migrations/004_rename_bundle_to_source.ts
|
|
3317
3375
|
var _004_rename_bundle_to_source_exports = /* @__PURE__ */ __exportAll({
|
|
3318
|
-
down: () => down$
|
|
3319
|
-
up: () => up$
|
|
3376
|
+
down: () => down$104,
|
|
3377
|
+
up: () => up$104
|
|
3320
3378
|
});
|
|
3321
|
-
async function up$
|
|
3379
|
+
async function up$104(db) {
|
|
3322
3380
|
await db.schema.alterTable("dispatch_queue").renameColumn("bundle_url", "source_tar_url").execute();
|
|
3323
3381
|
await db.schema.alterTable("dispatch_queue").renameColumn("bundle_hash", "source_tar_hash").execute();
|
|
3324
3382
|
}
|
|
3325
|
-
async function down$
|
|
3383
|
+
async function down$104(db) {
|
|
3326
3384
|
await db.schema.alterTable("dispatch_queue").renameColumn("source_tar_url", "bundle_url").execute();
|
|
3327
3385
|
await db.schema.alterTable("dispatch_queue").renameColumn("source_tar_hash", "bundle_hash").execute();
|
|
3328
3386
|
}
|
|
3329
3387
|
//#endregion
|
|
3330
3388
|
//#region src/db/migrations/005_cold_store_chunk_counter.ts
|
|
3331
3389
|
var _005_cold_store_chunk_counter_exports = /* @__PURE__ */ __exportAll({
|
|
3332
|
-
down: () => down$
|
|
3333
|
-
up: () => up$
|
|
3390
|
+
down: () => down$103,
|
|
3391
|
+
up: () => up$103
|
|
3334
3392
|
});
|
|
3335
3393
|
/**
|
|
3336
3394
|
* Cold-store chunk counter table.
|
|
@@ -3347,7 +3405,7 @@ var _005_cold_store_chunk_counter_exports = /* @__PURE__ */ __exportAll({
|
|
|
3347
3405
|
*
|
|
3348
3406
|
* sections 5 and 8.
|
|
3349
3407
|
*/
|
|
3350
|
-
async function up$
|
|
3408
|
+
async function up$103(db) {
|
|
3351
3409
|
await sql`
|
|
3352
3410
|
CREATE TABLE public.cold_store_chunk_counts (
|
|
3353
3411
|
db TEXT NOT NULL,
|
|
@@ -3365,14 +3423,14 @@ async function up$102(db) {
|
|
|
3365
3423
|
ON public.cold_store_chunk_counts (db, table_name)
|
|
3366
3424
|
`.execute(db);
|
|
3367
3425
|
}
|
|
3368
|
-
async function down$
|
|
3426
|
+
async function down$103(db) {
|
|
3369
3427
|
await sql`DROP TABLE IF EXISTS public.cold_store_chunk_counts`.execute(db);
|
|
3370
3428
|
}
|
|
3371
3429
|
//#endregion
|
|
3372
3430
|
//#region src/db/migrations/006_runs_jobs_steps_archived_at.ts
|
|
3373
3431
|
var _006_runs_jobs_steps_archived_at_exports = /* @__PURE__ */ __exportAll({
|
|
3374
|
-
down: () => down$
|
|
3375
|
-
up: () => up$
|
|
3432
|
+
down: () => down$102,
|
|
3433
|
+
up: () => up$102
|
|
3376
3434
|
});
|
|
3377
3435
|
/**
|
|
3378
3436
|
* `execution_runs` / `execution_jobs` / `execution_steps` cold-store
|
|
@@ -3408,7 +3466,7 @@ var _006_runs_jobs_steps_archived_at_exports = /* @__PURE__ */ __exportAll({
|
|
|
3408
3466
|
* - `idx_execution_jobs_routing_key_created (routing_key, created_at)`
|
|
3409
3467
|
* - `idx_execution_steps_routing_key_created (routing_key, created_at)`
|
|
3410
3468
|
*/
|
|
3411
|
-
async function up$
|
|
3469
|
+
async function up$102(db) {
|
|
3412
3470
|
await sql`
|
|
3413
3471
|
ALTER TABLE public.execution_runs
|
|
3414
3472
|
ADD COLUMN archived_at TIMESTAMPTZ NULL,
|
|
@@ -3453,7 +3511,7 @@ async function up$101(db) {
|
|
|
3453
3511
|
ON public.execution_steps (routing_key, created_at)
|
|
3454
3512
|
`.execute(db);
|
|
3455
3513
|
}
|
|
3456
|
-
async function down$
|
|
3514
|
+
async function down$102(db) {
|
|
3457
3515
|
await sql`DROP INDEX IF EXISTS public.idx_execution_steps_routing_key_created`.execute(db);
|
|
3458
3516
|
await sql`
|
|
3459
3517
|
ALTER TABLE public.execution_steps
|
|
@@ -3478,8 +3536,8 @@ async function down$101(db) {
|
|
|
3478
3536
|
//#endregion
|
|
3479
3537
|
//#region src/db/migrations/007_audit_logs_archived_at.ts
|
|
3480
3538
|
var _007_audit_logs_archived_at_exports = /* @__PURE__ */ __exportAll({
|
|
3481
|
-
down: () => down$
|
|
3482
|
-
up: () => up$
|
|
3539
|
+
down: () => down$101,
|
|
3540
|
+
up: () => up$101
|
|
3483
3541
|
});
|
|
3484
3542
|
/**
|
|
3485
3543
|
* `secret_audit_log` and `access_log` cold-store schema additions, plus
|
|
@@ -3519,7 +3577,7 @@ var _007_audit_logs_archived_at_exports = /* @__PURE__ */ __exportAll({
|
|
|
3519
3577
|
* `down()` would not have meaningful retention bounds. Acceptable for
|
|
3520
3578
|
* staging.
|
|
3521
3579
|
*/
|
|
3522
|
-
async function up$
|
|
3580
|
+
async function up$101(db) {
|
|
3523
3581
|
await sql`
|
|
3524
3582
|
ALTER TABLE public.secret_audit_log
|
|
3525
3583
|
ADD COLUMN archived_at TIMESTAMPTZ NULL,
|
|
@@ -3540,7 +3598,7 @@ async function up$100(db) {
|
|
|
3540
3598
|
DROP COLUMN IF EXISTS expires_at
|
|
3541
3599
|
`.execute(db);
|
|
3542
3600
|
}
|
|
3543
|
-
async function down$
|
|
3601
|
+
async function down$101(db) {
|
|
3544
3602
|
await sql`
|
|
3545
3603
|
ALTER TABLE public.access_log
|
|
3546
3604
|
ADD COLUMN expires_at TIMESTAMPTZ NOT NULL DEFAULT (now() + INTERVAL '90 days')
|
|
@@ -3568,8 +3626,8 @@ async function down$100(db) {
|
|
|
3568
3626
|
//#endregion
|
|
3569
3627
|
//#region src/db/migrations/008_event_log_archived_at.ts
|
|
3570
3628
|
var _008_event_log_archived_at_exports = /* @__PURE__ */ __exportAll({
|
|
3571
|
-
down: () => down$
|
|
3572
|
-
up: () => up$
|
|
3629
|
+
down: () => down$100,
|
|
3630
|
+
up: () => up$100
|
|
3573
3631
|
});
|
|
3574
3632
|
/**
|
|
3575
3633
|
* `event_log` cold-store schema additions plus removal of the
|
|
@@ -3607,7 +3665,7 @@ var _008_event_log_archived_at_exports = /* @__PURE__ */ __exportAll({
|
|
|
3607
3665
|
* — best effort; rows inserted between `up()` and a hypothetical
|
|
3608
3666
|
* `down()` would not have meaningful retention bounds.
|
|
3609
3667
|
*/
|
|
3610
|
-
async function up$
|
|
3668
|
+
async function up$100(db) {
|
|
3611
3669
|
await sql`
|
|
3612
3670
|
ALTER TABLE public.event_log
|
|
3613
3671
|
ADD COLUMN archived_at TIMESTAMPTZ NULL,
|
|
@@ -3623,7 +3681,7 @@ async function up$99(db) {
|
|
|
3623
3681
|
DROP COLUMN IF EXISTS expires_at
|
|
3624
3682
|
`.execute(db);
|
|
3625
3683
|
}
|
|
3626
|
-
async function down$
|
|
3684
|
+
async function down$100(db) {
|
|
3627
3685
|
await sql`
|
|
3628
3686
|
ALTER TABLE public.event_log
|
|
3629
3687
|
ADD COLUMN expires_at TIMESTAMPTZ NOT NULL DEFAULT (now() + INTERVAL '30 days')
|
|
@@ -3642,8 +3700,8 @@ async function down$99(db) {
|
|
|
3642
3700
|
//#endregion
|
|
3643
3701
|
//#region src/db/migrations/009_access_log_trigram.ts
|
|
3644
3702
|
var _009_access_log_trigram_exports = /* @__PURE__ */ __exportAll({
|
|
3645
|
-
down: () => down$
|
|
3646
|
-
up: () => up$
|
|
3703
|
+
down: () => down$99,
|
|
3704
|
+
up: () => up$99
|
|
3647
3705
|
});
|
|
3648
3706
|
/**
|
|
3649
3707
|
* Trigram (pg_trgm) index on access_log.error_message for the federated
|
|
@@ -3656,7 +3714,7 @@ var _009_access_log_trigram_exports = /* @__PURE__ */ __exportAll({
|
|
|
3656
3714
|
* EXISTS` are both safe to re-run. No CONCURRENTLY because Kysely runs
|
|
3657
3715
|
* migrations inside a transaction; the lock is brief on a sampled table.
|
|
3658
3716
|
*/
|
|
3659
|
-
async function up$
|
|
3717
|
+
async function up$99(db) {
|
|
3660
3718
|
await sql`CREATE EXTENSION IF NOT EXISTS pg_trgm`.execute(db);
|
|
3661
3719
|
await sql`
|
|
3662
3720
|
CREATE INDEX IF NOT EXISTS access_log_error_message_trgm_idx
|
|
@@ -3665,14 +3723,14 @@ async function up$98(db) {
|
|
|
3665
3723
|
WHERE error_message IS NOT NULL
|
|
3666
3724
|
`.execute(db);
|
|
3667
3725
|
}
|
|
3668
|
-
async function down$
|
|
3726
|
+
async function down$99(db) {
|
|
3669
3727
|
await sql`DROP INDEX IF EXISTS public.access_log_error_message_trgm_idx`.execute(db);
|
|
3670
3728
|
}
|
|
3671
3729
|
//#endregion
|
|
3672
3730
|
//#region src/db/migrations/010_cold_store_chunks.ts
|
|
3673
3731
|
var _010_cold_store_chunks_exports = /* @__PURE__ */ __exportAll({
|
|
3674
|
-
down: () => down$
|
|
3675
|
-
up: () => up$
|
|
3732
|
+
down: () => down$98,
|
|
3733
|
+
up: () => up$98
|
|
3676
3734
|
});
|
|
3677
3735
|
/**
|
|
3678
3736
|
* Cold-store chunk index — Phase 2 (cold-store purge).
|
|
@@ -3704,7 +3762,7 @@ var _010_cold_store_chunks_exports = /* @__PURE__ */ __exportAll({
|
|
|
3704
3762
|
* forever. Adapters that don't opt into per-bucket archival via
|
|
3705
3763
|
* `coldTtlDays` don't insert here either.
|
|
3706
3764
|
*/
|
|
3707
|
-
async function up$
|
|
3765
|
+
async function up$98(db) {
|
|
3708
3766
|
await sql`
|
|
3709
3767
|
CREATE TABLE public.cold_store_chunks (
|
|
3710
3768
|
db TEXT NOT NULL,
|
|
@@ -3731,14 +3789,14 @@ async function up$97(db) {
|
|
|
3731
3789
|
ON public.cold_store_chunks (db, table_name, tenant_id, archived_at DESC)
|
|
3732
3790
|
`.execute(db);
|
|
3733
3791
|
}
|
|
3734
|
-
async function down$
|
|
3792
|
+
async function down$98(db) {
|
|
3735
3793
|
await sql`DROP TABLE IF EXISTS public.cold_store_chunks`.execute(db);
|
|
3736
3794
|
}
|
|
3737
3795
|
//#endregion
|
|
3738
3796
|
//#region src/db/migrations/011_drop_source_secrets_notify.ts
|
|
3739
3797
|
var _011_drop_source_secrets_notify_exports = /* @__PURE__ */ __exportAll({
|
|
3740
|
-
down: () => down$
|
|
3741
|
-
up: () => up$
|
|
3798
|
+
down: () => down$97,
|
|
3799
|
+
up: () => up$97
|
|
3742
3800
|
});
|
|
3743
3801
|
/**
|
|
3744
3802
|
* Drop the `source_secrets_change_trigger` and the
|
|
@@ -3757,11 +3815,11 @@ var _011_drop_source_secrets_notify_exports = /* @__PURE__ */ __exportAll({
|
|
|
3757
3815
|
* in `001_initial.ts`. They wake up no consumer until the `WebhookSecretManager`
|
|
3758
3816
|
* is restored, so this migration is safe to roll back.
|
|
3759
3817
|
*/
|
|
3760
|
-
async function up$
|
|
3818
|
+
async function up$97(db) {
|
|
3761
3819
|
await sql`DROP TRIGGER IF EXISTS source_secrets_change_trigger ON public.scoped_secrets`.execute(db);
|
|
3762
3820
|
await sql`DROP FUNCTION IF EXISTS public.notify_source_secrets_change() CASCADE`.execute(db);
|
|
3763
3821
|
}
|
|
3764
|
-
async function down$
|
|
3822
|
+
async function down$97(db) {
|
|
3765
3823
|
await sql`
|
|
3766
3824
|
CREATE OR REPLACE FUNCTION public.notify_source_secrets_change() RETURNS trigger
|
|
3767
3825
|
LANGUAGE plpgsql
|
|
@@ -3800,8 +3858,8 @@ async function down$96(db) {
|
|
|
3800
3858
|
//#endregion
|
|
3801
3859
|
//#region src/db/migrations/012_peer_credentials_active_uniq.ts
|
|
3802
3860
|
var _012_peer_credentials_active_uniq_exports = /* @__PURE__ */ __exportAll({
|
|
3803
|
-
down: () => down$
|
|
3804
|
-
up: () => up$
|
|
3861
|
+
down: () => down$96,
|
|
3862
|
+
up: () => up$96
|
|
3805
3863
|
});
|
|
3806
3864
|
/**
|
|
3807
3865
|
* Add a partial unique index on `peer_credentials (instance_id) WHERE
|
|
@@ -3827,7 +3885,7 @@ var _012_peer_credentials_active_uniq_exports = /* @__PURE__ */ __exportAll({
|
|
|
3827
3885
|
* `down()` only drops the index; it does NOT undo the dedupe (there's no
|
|
3828
3886
|
* safe way to recreate revoked rows, and the dedupe is monotonic).
|
|
3829
3887
|
*/
|
|
3830
|
-
async function up$
|
|
3888
|
+
async function up$96(db) {
|
|
3831
3889
|
await sql`
|
|
3832
3890
|
UPDATE public.peer_credentials
|
|
3833
3891
|
SET revoked_at = NOW()
|
|
@@ -3845,14 +3903,14 @@ async function up$95(db) {
|
|
|
3845
3903
|
WHERE revoked_at IS NULL
|
|
3846
3904
|
`.execute(db);
|
|
3847
3905
|
}
|
|
3848
|
-
async function down$
|
|
3906
|
+
async function down$96(db) {
|
|
3849
3907
|
await sql`DROP INDEX IF EXISTS public.peer_credentials_active_uniq`.execute(db);
|
|
3850
3908
|
}
|
|
3851
3909
|
//#endregion
|
|
3852
3910
|
//#region src/db/migrations/013_execution_log_bytes.ts
|
|
3853
3911
|
var _013_execution_log_bytes_exports = /* @__PURE__ */ __exportAll({
|
|
3854
|
-
down: () => down$
|
|
3855
|
-
up: () => up$
|
|
3912
|
+
down: () => down$95,
|
|
3913
|
+
up: () => up$95
|
|
3856
3914
|
});
|
|
3857
3915
|
/**
|
|
3858
3916
|
* Add `log_bytes BIGINT NOT NULL DEFAULT 0` columns to `execution_runs` and
|
|
@@ -3871,7 +3929,7 @@ var _013_execution_log_bytes_exports = /* @__PURE__ */ __exportAll({
|
|
|
3871
3929
|
*
|
|
3872
3930
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`).
|
|
3873
3931
|
*/
|
|
3874
|
-
async function up$
|
|
3932
|
+
async function up$95(db) {
|
|
3875
3933
|
await sql`
|
|
3876
3934
|
ALTER TABLE public.execution_runs
|
|
3877
3935
|
ADD COLUMN IF NOT EXISTS log_bytes BIGINT NOT NULL DEFAULT 0
|
|
@@ -3881,15 +3939,15 @@ async function up$94(db) {
|
|
|
3881
3939
|
ADD COLUMN IF NOT EXISTS log_bytes BIGINT NOT NULL DEFAULT 0
|
|
3882
3940
|
`.execute(db);
|
|
3883
3941
|
}
|
|
3884
|
-
async function down$
|
|
3942
|
+
async function down$95(db) {
|
|
3885
3943
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS log_bytes`.execute(db);
|
|
3886
3944
|
await sql`ALTER TABLE public.execution_jobs DROP COLUMN IF EXISTS log_bytes`.execute(db);
|
|
3887
3945
|
}
|
|
3888
3946
|
//#endregion
|
|
3889
3947
|
//#region src/db/migrations/014_kici_events_lease_retry.ts
|
|
3890
3948
|
var _014_kici_events_lease_retry_exports = /* @__PURE__ */ __exportAll({
|
|
3891
|
-
down: () => down$
|
|
3892
|
-
up: () => up$
|
|
3949
|
+
down: () => down$94,
|
|
3950
|
+
up: () => up$94
|
|
3893
3951
|
});
|
|
3894
3952
|
/**
|
|
3895
3953
|
* Add lease + retry + DLQ columns to `kici_events` so the EventRouter can
|
|
@@ -3923,7 +3981,7 @@ var _014_kici_events_lease_retry_exports = /* @__PURE__ */ __exportAll({
|
|
|
3923
3981
|
*
|
|
3924
3982
|
* Idempotent (`ADD COLUMN IF NOT EXISTS` + `CREATE INDEX IF NOT EXISTS`).
|
|
3925
3983
|
*/
|
|
3926
|
-
async function up$
|
|
3984
|
+
async function up$94(db) {
|
|
3927
3985
|
await sql`
|
|
3928
3986
|
ALTER TABLE public.kici_events
|
|
3929
3987
|
ADD COLUMN IF NOT EXISTS claimed_at TIMESTAMPTZ,
|
|
@@ -3954,7 +4012,7 @@ async function up$93(db) {
|
|
|
3954
4012
|
WHERE dlq_at IS NOT NULL
|
|
3955
4013
|
`.execute(db);
|
|
3956
4014
|
}
|
|
3957
|
-
async function down$
|
|
4015
|
+
async function down$94(db) {
|
|
3958
4016
|
await sql`DROP INDEX IF EXISTS public.idx_kici_events_dlq`.execute(db);
|
|
3959
4017
|
await sql`DROP INDEX IF EXISTS public.idx_kici_events_lease_expired`.execute(db);
|
|
3960
4018
|
await sql`DROP INDEX IF EXISTS public.idx_kici_events_retry_due`.execute(db);
|
|
@@ -3972,8 +4030,8 @@ async function down$93(db) {
|
|
|
3972
4030
|
//#endregion
|
|
3973
4031
|
//#region src/db/migrations/015_org_settings_customer_scoped.ts
|
|
3974
4032
|
var _015_org_settings_customer_scoped_exports = /* @__PURE__ */ __exportAll({
|
|
3975
|
-
down: () => down$
|
|
3976
|
-
up: () => up$
|
|
4033
|
+
down: () => down$93,
|
|
4034
|
+
up: () => up$93
|
|
3977
4035
|
});
|
|
3978
4036
|
/**
|
|
3979
4037
|
* Org-scope `org_settings` and qualify each glob entry by source.
|
|
@@ -4001,7 +4059,7 @@ var _015_org_settings_customer_scoped_exports = /* @__PURE__ */ __exportAll({
|
|
|
4001
4059
|
* Idempotent: a re-run on an already-migrated DB sees `customer_id` exists
|
|
4002
4060
|
* and the list columns are already jsonb, so it is a no-op.
|
|
4003
4061
|
*/
|
|
4004
|
-
async function up$
|
|
4062
|
+
async function up$93(db) {
|
|
4005
4063
|
if ((await sql`
|
|
4006
4064
|
SELECT EXISTS (
|
|
4007
4065
|
SELECT 1 FROM information_schema.columns
|
|
@@ -4126,7 +4184,7 @@ async function up$92(db) {
|
|
|
4126
4184
|
await sql`DROP TABLE _org_settings_merged`.execute(db);
|
|
4127
4185
|
await sql`DROP TABLE _org_settings_stage`.execute(db);
|
|
4128
4186
|
}
|
|
4129
|
-
async function down$
|
|
4187
|
+
async function down$93(db) {
|
|
4130
4188
|
if (!(await sql`
|
|
4131
4189
|
SELECT EXISTS (
|
|
4132
4190
|
SELECT 1 FROM information_schema.columns
|
|
@@ -4151,8 +4209,8 @@ async function down$92(db) {
|
|
|
4151
4209
|
//#endregion
|
|
4152
4210
|
//#region src/db/migrations/016_org_settings_allow_http_npm.ts
|
|
4153
4211
|
var _016_org_settings_allow_http_npm_exports = /* @__PURE__ */ __exportAll({
|
|
4154
|
-
down: () => down$
|
|
4155
|
-
up: () => up$
|
|
4212
|
+
down: () => down$92,
|
|
4213
|
+
up: () => up$92
|
|
4156
4214
|
});
|
|
4157
4215
|
/**
|
|
4158
4216
|
* Add `org_settings.allow_http_npm_registries boolean NOT NULL DEFAULT false`.
|
|
@@ -4165,7 +4223,7 @@ var _016_org_settings_allow_http_npm_exports = /* @__PURE__ */ __exportAll({
|
|
|
4165
4223
|
*
|
|
4166
4224
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
4167
4225
|
*/
|
|
4168
|
-
async function up$
|
|
4226
|
+
async function up$92(db) {
|
|
4169
4227
|
if ((await sql`
|
|
4170
4228
|
SELECT EXISTS (
|
|
4171
4229
|
SELECT 1 FROM information_schema.columns
|
|
@@ -4179,7 +4237,7 @@ async function up$91(db) {
|
|
|
4179
4237
|
ADD COLUMN allow_http_npm_registries boolean NOT NULL DEFAULT false
|
|
4180
4238
|
`.execute(db);
|
|
4181
4239
|
}
|
|
4182
|
-
async function down$
|
|
4240
|
+
async function down$92(db) {
|
|
4183
4241
|
await sql`
|
|
4184
4242
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS allow_http_npm_registries
|
|
4185
4243
|
`.execute(db);
|
|
@@ -4187,8 +4245,8 @@ async function down$91(db) {
|
|
|
4187
4245
|
//#endregion
|
|
4188
4246
|
//#region src/db/migrations/017_org_id_widen.ts
|
|
4189
4247
|
var _017_org_id_widen_exports = /* @__PURE__ */ __exportAll({
|
|
4190
|
-
down: () => down$
|
|
4191
|
-
up: () => up$
|
|
4248
|
+
down: () => down$91,
|
|
4249
|
+
up: () => up$91
|
|
4192
4250
|
});
|
|
4193
4251
|
/**
|
|
4194
4252
|
* Widen every orchestrator-side `org_id varchar(12)` column to
|
|
@@ -4228,17 +4286,17 @@ const ORG_ID_TABLES$1 = [
|
|
|
4228
4286
|
"held_runs",
|
|
4229
4287
|
"scoped_secrets"
|
|
4230
4288
|
];
|
|
4231
|
-
async function up$
|
|
4289
|
+
async function up$91(db) {
|
|
4232
4290
|
for (const table of ORG_ID_TABLES$1) await sql.raw(`ALTER TABLE public.${table} ALTER COLUMN org_id TYPE varchar(16)`).execute(db);
|
|
4233
4291
|
}
|
|
4234
|
-
async function down$
|
|
4292
|
+
async function down$91(db) {
|
|
4235
4293
|
for (const table of ORG_ID_TABLES$1) await sql.raw(`ALTER TABLE public.${table} ALTER COLUMN org_id TYPE varchar(12)`).execute(db);
|
|
4236
4294
|
}
|
|
4237
4295
|
//#endregion
|
|
4238
4296
|
//#region src/db/migrations/018_org_id_prefix_backfill.ts
|
|
4239
4297
|
var _018_org_id_prefix_backfill_exports = /* @__PURE__ */ __exportAll({
|
|
4240
|
-
down: () => down$
|
|
4241
|
-
up: () => up$
|
|
4298
|
+
down: () => down$90,
|
|
4299
|
+
up: () => up$90
|
|
4242
4300
|
});
|
|
4243
4301
|
/**
|
|
4244
4302
|
* Prefix every orchestrator-side tenant string with `org_` to align
|
|
@@ -4283,19 +4341,19 @@ const CUSTOMER_ID_TABLES = [
|
|
|
4283
4341
|
"workflow_registrations",
|
|
4284
4342
|
"org_settings"
|
|
4285
4343
|
];
|
|
4286
|
-
async function up$
|
|
4344
|
+
async function up$90(db) {
|
|
4287
4345
|
for (const table of ORG_ID_TABLES) await sql.raw(`UPDATE public.${table} SET org_id = 'org_' || org_id WHERE org_id <> 'kici-admin' AND org_id NOT LIKE 'org\\_%' ESCAPE '\\'`).execute(db);
|
|
4288
4346
|
for (const table of CUSTOMER_ID_TABLES) await sql.raw(`UPDATE public.${table} SET customer_id = 'org_' || customer_id WHERE customer_id <> 'kici-admin' AND customer_id NOT LIKE 'org\\_%' ESCAPE '\\'`).execute(db);
|
|
4289
4347
|
}
|
|
4290
|
-
async function down$
|
|
4348
|
+
async function down$90(db) {
|
|
4291
4349
|
for (const table of CUSTOMER_ID_TABLES) await sql.raw(`UPDATE public.${table} SET customer_id = substring(customer_id from 5) WHERE customer_id LIKE 'org\\_%' ESCAPE '\\'`).execute(db);
|
|
4292
4350
|
for (const table of ORG_ID_TABLES) await sql.raw(`UPDATE public.${table} SET org_id = substring(org_id from 5) WHERE org_id LIKE 'org\\_%' ESCAPE '\\'`).execute(db);
|
|
4293
4351
|
}
|
|
4294
4352
|
//#endregion
|
|
4295
4353
|
//#region src/db/migrations/019_generic_sources_change_notify.ts
|
|
4296
4354
|
var _019_generic_sources_change_notify_exports = /* @__PURE__ */ __exportAll({
|
|
4297
|
-
down: () => down$
|
|
4298
|
-
up: () => up$
|
|
4355
|
+
down: () => down$89,
|
|
4356
|
+
up: () => up$89
|
|
4299
4357
|
});
|
|
4300
4358
|
/**
|
|
4301
4359
|
* Add a Postgres trigger on `generic_webhook_sources` that emits
|
|
@@ -4318,7 +4376,7 @@ var _019_generic_sources_change_notify_exports = /* @__PURE__ */ __exportAll({
|
|
|
4318
4376
|
* (`notify_sources_change()` + `sources_change_trigger`, defined in
|
|
4319
4377
|
* `001_initial.ts`).
|
|
4320
4378
|
*/
|
|
4321
|
-
async function up$
|
|
4379
|
+
async function up$89(db) {
|
|
4322
4380
|
await sql`
|
|
4323
4381
|
CREATE FUNCTION public.notify_generic_sources_change() RETURNS trigger
|
|
4324
4382
|
LANGUAGE plpgsql
|
|
@@ -4339,15 +4397,15 @@ async function up$88(db) {
|
|
|
4339
4397
|
FOR EACH ROW EXECUTE FUNCTION public.notify_generic_sources_change()
|
|
4340
4398
|
`.execute(db);
|
|
4341
4399
|
}
|
|
4342
|
-
async function down$
|
|
4400
|
+
async function down$89(db) {
|
|
4343
4401
|
await sql`DROP TRIGGER IF EXISTS generic_sources_change_trigger ON public.generic_webhook_sources`.execute(db);
|
|
4344
4402
|
await sql`DROP FUNCTION IF EXISTS public.notify_generic_sources_change()`.execute(db);
|
|
4345
4403
|
}
|
|
4346
4404
|
//#endregion
|
|
4347
4405
|
//#region src/db/migrations/020_org_settings_dashboard_write_policy.ts
|
|
4348
4406
|
var _020_org_settings_dashboard_write_policy_exports = /* @__PURE__ */ __exportAll({
|
|
4349
|
-
down: () => down$
|
|
4350
|
-
up: () => up$
|
|
4407
|
+
down: () => down$88,
|
|
4408
|
+
up: () => up$88
|
|
4351
4409
|
});
|
|
4352
4410
|
/**
|
|
4353
4411
|
* Add `org_settings.dashboard_write_policy jsonb NOT NULL DEFAULT '{}'`.
|
|
@@ -4362,7 +4420,7 @@ var _020_org_settings_dashboard_write_policy_exports = /* @__PURE__ */ __exportA
|
|
|
4362
4420
|
*
|
|
4363
4421
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
4364
4422
|
*/
|
|
4365
|
-
async function up$
|
|
4423
|
+
async function up$88(db) {
|
|
4366
4424
|
if ((await sql`
|
|
4367
4425
|
SELECT EXISTS (
|
|
4368
4426
|
SELECT 1 FROM information_schema.columns
|
|
@@ -4376,7 +4434,7 @@ async function up$87(db) {
|
|
|
4376
4434
|
ADD COLUMN dashboard_write_policy jsonb NOT NULL DEFAULT '{}'::jsonb
|
|
4377
4435
|
`.execute(db);
|
|
4378
4436
|
}
|
|
4379
|
-
async function down$
|
|
4437
|
+
async function down$88(db) {
|
|
4380
4438
|
await sql`
|
|
4381
4439
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS dashboard_write_policy
|
|
4382
4440
|
`.execute(db);
|
|
@@ -4384,8 +4442,8 @@ async function down$87(db) {
|
|
|
4384
4442
|
//#endregion
|
|
4385
4443
|
//#region src/db/migrations/021_check_run_tracking.ts
|
|
4386
4444
|
var _021_check_run_tracking_exports = /* @__PURE__ */ __exportAll({
|
|
4387
|
-
down: () => down$
|
|
4388
|
-
up: () => up$
|
|
4445
|
+
down: () => down$87,
|
|
4446
|
+
up: () => up$87
|
|
4389
4447
|
});
|
|
4390
4448
|
/**
|
|
4391
4449
|
* Add `check_run_tracking` table for HA-safe check-run state persistence.
|
|
@@ -4409,7 +4467,7 @@ var _021_check_run_tracking_exports = /* @__PURE__ */ __exportAll({
|
|
|
4409
4467
|
*
|
|
4410
4468
|
* Idempotent: a re-run on a DB that already has the table is a no-op.
|
|
4411
4469
|
*/
|
|
4412
|
-
async function up$
|
|
4470
|
+
async function up$87(db) {
|
|
4413
4471
|
if ((await sql`
|
|
4414
4472
|
SELECT EXISTS (
|
|
4415
4473
|
SELECT 1 FROM information_schema.tables
|
|
@@ -4440,14 +4498,14 @@ async function up$86(db) {
|
|
|
4440
4498
|
WHERE run_id IS NOT NULL
|
|
4441
4499
|
`.execute(db);
|
|
4442
4500
|
}
|
|
4443
|
-
async function down$
|
|
4501
|
+
async function down$87(db) {
|
|
4444
4502
|
await sql`DROP TABLE IF EXISTS public.check_run_tracking`.execute(db);
|
|
4445
4503
|
}
|
|
4446
4504
|
//#endregion
|
|
4447
4505
|
//#region src/db/migrations/022_scaler_manager_state.ts
|
|
4448
4506
|
var _022_scaler_manager_state_exports = /* @__PURE__ */ __exportAll({
|
|
4449
|
-
down: () => down$
|
|
4450
|
-
up: () => up$
|
|
4507
|
+
down: () => down$86,
|
|
4508
|
+
up: () => up$86
|
|
4451
4509
|
});
|
|
4452
4510
|
/**
|
|
4453
4511
|
* Add three tables persisting `ScalerManager` per-coord state:
|
|
@@ -4474,7 +4532,7 @@ var _022_scaler_manager_state_exports = /* @__PURE__ */ __exportAll({
|
|
|
4474
4532
|
* Idempotent: a re-run on a DB that already has any of these tables
|
|
4475
4533
|
* leaves the existing one alone.
|
|
4476
4534
|
*/
|
|
4477
|
-
async function up$
|
|
4535
|
+
async function up$86(db) {
|
|
4478
4536
|
const tableExists = async (name) => {
|
|
4479
4537
|
return (await sql`
|
|
4480
4538
|
SELECT EXISTS (
|
|
@@ -4524,7 +4582,7 @@ async function up$85(db) {
|
|
|
4524
4582
|
`.execute(db);
|
|
4525
4583
|
}
|
|
4526
4584
|
}
|
|
4527
|
-
async function down$
|
|
4585
|
+
async function down$86(db) {
|
|
4528
4586
|
await sql`DROP TABLE IF EXISTS public.scaler_reservations`.execute(db);
|
|
4529
4587
|
await sql`DROP TABLE IF EXISTS public.scaler_agent_jobs`.execute(db);
|
|
4530
4588
|
await sql`DROP TABLE IF EXISTS public.scaler_spawning_agents`.execute(db);
|
|
@@ -4532,8 +4590,8 @@ async function down$85(db) {
|
|
|
4532
4590
|
//#endregion
|
|
4533
4591
|
//#region src/db/migrations/023_dispatch_queue_recovery_deadline.ts
|
|
4534
4592
|
var _023_dispatch_queue_recovery_deadline_exports = /* @__PURE__ */ __exportAll({
|
|
4535
|
-
down: () => down$
|
|
4536
|
-
up: () => up$
|
|
4593
|
+
down: () => down$85,
|
|
4594
|
+
up: () => up$85
|
|
4537
4595
|
});
|
|
4538
4596
|
/**
|
|
4539
4597
|
* Add `dispatch_queue.recovery_deadline TIMESTAMPTZ` and
|
|
@@ -4557,7 +4615,7 @@ var _023_dispatch_queue_recovery_deadline_exports = /* @__PURE__ */ __exportAll(
|
|
|
4557
4615
|
* Idempotent: re-running on a DB that already has either column is a
|
|
4558
4616
|
* no-op.
|
|
4559
4617
|
*/
|
|
4560
|
-
async function up$
|
|
4618
|
+
async function up$85(db) {
|
|
4561
4619
|
const colExists = async (name) => {
|
|
4562
4620
|
return (await sql`
|
|
4563
4621
|
SELECT EXISTS (
|
|
@@ -4582,7 +4640,7 @@ async function up$84(db) {
|
|
|
4582
4640
|
WHERE recovery_deadline IS NOT NULL
|
|
4583
4641
|
`.execute(db);
|
|
4584
4642
|
}
|
|
4585
|
-
async function down$
|
|
4643
|
+
async function down$85(db) {
|
|
4586
4644
|
await sql`DROP INDEX IF EXISTS public.idx_dispatch_queue_recovery_deadline`.execute(db);
|
|
4587
4645
|
await sql`
|
|
4588
4646
|
ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS recovery_agent_id
|
|
@@ -4594,8 +4652,8 @@ async function down$84(db) {
|
|
|
4594
4652
|
//#endregion
|
|
4595
4653
|
//#region src/db/migrations/024_dispatch_queue_provisioning_error.ts
|
|
4596
4654
|
var _024_dispatch_queue_provisioning_error_exports = /* @__PURE__ */ __exportAll({
|
|
4597
|
-
down: () => down$
|
|
4598
|
-
up: () => up$
|
|
4655
|
+
down: () => down$84,
|
|
4656
|
+
up: () => up$84
|
|
4599
4657
|
});
|
|
4600
4658
|
/**
|
|
4601
4659
|
* Add `dispatch_queue.last_provisioning_error TEXT` recording the most
|
|
@@ -4611,7 +4669,7 @@ var _024_dispatch_queue_provisioning_error_exports = /* @__PURE__ */ __exportAll
|
|
|
4611
4669
|
*
|
|
4612
4670
|
* Idempotent: re-running on a DB that already has the column is a no-op.
|
|
4613
4671
|
*/
|
|
4614
|
-
async function up$
|
|
4672
|
+
async function up$84(db) {
|
|
4615
4673
|
const colExists = async (name) => {
|
|
4616
4674
|
return (await sql`
|
|
4617
4675
|
SELECT EXISTS (
|
|
@@ -4627,7 +4685,7 @@ async function up$83(db) {
|
|
|
4627
4685
|
ADD COLUMN last_provisioning_error TEXT
|
|
4628
4686
|
`.execute(db);
|
|
4629
4687
|
}
|
|
4630
|
-
async function down$
|
|
4688
|
+
async function down$84(db) {
|
|
4631
4689
|
await sql`
|
|
4632
4690
|
ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS last_provisioning_error
|
|
4633
4691
|
`.execute(db);
|
|
@@ -4635,8 +4693,8 @@ async function down$83(db) {
|
|
|
4635
4693
|
//#endregion
|
|
4636
4694
|
//#region src/db/migrations/025_init_failure.ts
|
|
4637
4695
|
var _025_init_failure_exports = /* @__PURE__ */ __exportAll({
|
|
4638
|
-
down: () => down$
|
|
4639
|
-
up: () => up$
|
|
4696
|
+
down: () => down$83,
|
|
4697
|
+
up: () => up$83
|
|
4640
4698
|
});
|
|
4641
4699
|
/**
|
|
4642
4700
|
* Add `init_failure jsonb` columns to `execution_runs` and `execution_jobs`.
|
|
@@ -4650,7 +4708,7 @@ var _025_init_failure_exports = /* @__PURE__ */ __exportAll({
|
|
|
4650
4708
|
* Idempotent: re-running on a DB that already has either column is a no-op
|
|
4651
4709
|
* for that column.
|
|
4652
4710
|
*/
|
|
4653
|
-
async function up$
|
|
4711
|
+
async function up$83(db) {
|
|
4654
4712
|
const colExists = async (table, name) => {
|
|
4655
4713
|
return (await sql`
|
|
4656
4714
|
SELECT EXISTS (
|
|
@@ -4670,7 +4728,7 @@ async function up$82(db) {
|
|
|
4670
4728
|
ADD COLUMN init_failure JSONB DEFAULT NULL
|
|
4671
4729
|
`.execute(db);
|
|
4672
4730
|
}
|
|
4673
|
-
async function down$
|
|
4731
|
+
async function down$83(db) {
|
|
4674
4732
|
await sql`
|
|
4675
4733
|
ALTER TABLE public.execution_jobs DROP COLUMN IF EXISTS init_failure
|
|
4676
4734
|
`.execute(db);
|
|
@@ -4681,8 +4739,8 @@ async function down$82(db) {
|
|
|
4681
4739
|
//#endregion
|
|
4682
4740
|
//#region src/db/migrations/026_event_log_lockfile_corrupt.ts
|
|
4683
4741
|
var _026_event_log_lockfile_corrupt_exports = /* @__PURE__ */ __exportAll({
|
|
4684
|
-
down: () => down$
|
|
4685
|
-
up: () => up$
|
|
4742
|
+
down: () => down$82,
|
|
4743
|
+
up: () => up$82
|
|
4686
4744
|
});
|
|
4687
4745
|
/**
|
|
4688
4746
|
* Extend the event_log.status CHECK constraint with 'lockfile_corrupt' so the
|
|
@@ -4691,7 +4749,7 @@ var _026_event_log_lockfile_corrupt_exports = /* @__PURE__ */ __exportAll({
|
|
|
4691
4749
|
*
|
|
4692
4750
|
* Idempotent: the DROP ... IF EXISTS / re-ADD pair re-runs cleanly.
|
|
4693
4751
|
*/
|
|
4694
|
-
async function up$
|
|
4752
|
+
async function up$82(db) {
|
|
4695
4753
|
await sql`ALTER TABLE event_log DROP CONSTRAINT IF EXISTS event_log_status_check`.execute(db);
|
|
4696
4754
|
await sql`
|
|
4697
4755
|
ALTER TABLE event_log ADD CONSTRAINT event_log_status_check
|
|
@@ -4701,7 +4759,7 @@ async function up$81(db) {
|
|
|
4701
4759
|
])))
|
|
4702
4760
|
`.execute(db);
|
|
4703
4761
|
}
|
|
4704
|
-
async function down$
|
|
4762
|
+
async function down$82(db) {
|
|
4705
4763
|
await sql`ALTER TABLE event_log DROP CONSTRAINT IF EXISTS event_log_status_check`.execute(db);
|
|
4706
4764
|
await sql`
|
|
4707
4765
|
ALTER TABLE event_log ADD CONSTRAINT event_log_status_check
|
|
@@ -4714,8 +4772,8 @@ async function down$81(db) {
|
|
|
4714
4772
|
//#endregion
|
|
4715
4773
|
//#region src/db/migrations/027_workflow_timeout.ts
|
|
4716
4774
|
var _027_workflow_timeout_exports = /* @__PURE__ */ __exportAll({
|
|
4717
|
-
down: () => down$
|
|
4718
|
-
up: () => up$
|
|
4775
|
+
down: () => down$81,
|
|
4776
|
+
up: () => up$81
|
|
4719
4777
|
});
|
|
4720
4778
|
/**
|
|
4721
4779
|
* Add `workflow_timeout_ms integer` to `execution_runs`.
|
|
@@ -4733,13 +4791,13 @@ var _027_workflow_timeout_exports = /* @__PURE__ */ __exportAll({
|
|
|
4733
4791
|
*
|
|
4734
4792
|
* Idempotent: re-running on a DB that already has the column is a no-op.
|
|
4735
4793
|
*/
|
|
4736
|
-
async function up$
|
|
4794
|
+
async function up$81(db) {
|
|
4737
4795
|
await sql`
|
|
4738
4796
|
ALTER TABLE public.execution_runs
|
|
4739
4797
|
ADD COLUMN IF NOT EXISTS workflow_timeout_ms INTEGER DEFAULT NULL
|
|
4740
4798
|
`.execute(db);
|
|
4741
4799
|
}
|
|
4742
|
-
async function down$
|
|
4800
|
+
async function down$81(db) {
|
|
4743
4801
|
await sql`
|
|
4744
4802
|
ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS workflow_timeout_ms
|
|
4745
4803
|
`.execute(db);
|
|
@@ -4747,8 +4805,8 @@ async function down$80(db) {
|
|
|
4747
4805
|
//#endregion
|
|
4748
4806
|
//#region src/db/migrations/028_org_settings_user_cache.ts
|
|
4749
4807
|
var _028_org_settings_user_cache_exports = /* @__PURE__ */ __exportAll({
|
|
4750
|
-
down: () => down$
|
|
4751
|
-
up: () => up$
|
|
4808
|
+
down: () => down$80,
|
|
4809
|
+
up: () => up$80
|
|
4752
4810
|
});
|
|
4753
4811
|
/**
|
|
4754
4812
|
* Add `org_settings.user_cache_quota_bytes bigint` and
|
|
@@ -4767,7 +4825,7 @@ var _028_org_settings_user_cache_exports = /* @__PURE__ */ __exportAll({
|
|
|
4767
4825
|
*
|
|
4768
4826
|
* Idempotent: a re-run on a DB that already has either column skips it.
|
|
4769
4827
|
*/
|
|
4770
|
-
async function columnExists$
|
|
4828
|
+
async function columnExists$6(db, column) {
|
|
4771
4829
|
return (await sql`
|
|
4772
4830
|
SELECT EXISTS (
|
|
4773
4831
|
SELECT 1 FROM information_schema.columns
|
|
@@ -4777,17 +4835,17 @@ async function columnExists$5(db, column) {
|
|
|
4777
4835
|
) AS exists
|
|
4778
4836
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
4779
4837
|
}
|
|
4780
|
-
async function up$
|
|
4781
|
-
if (!await columnExists$
|
|
4838
|
+
async function up$80(db) {
|
|
4839
|
+
if (!await columnExists$6(db, "user_cache_quota_bytes")) await sql`
|
|
4782
4840
|
ALTER TABLE public.org_settings
|
|
4783
4841
|
ADD COLUMN user_cache_quota_bytes bigint
|
|
4784
4842
|
`.execute(db);
|
|
4785
|
-
if (!await columnExists$
|
|
4843
|
+
if (!await columnExists$6(db, "user_cache_ttl_ms")) await sql`
|
|
4786
4844
|
ALTER TABLE public.org_settings
|
|
4787
4845
|
ADD COLUMN user_cache_ttl_ms bigint
|
|
4788
4846
|
`.execute(db);
|
|
4789
4847
|
}
|
|
4790
|
-
async function down$
|
|
4848
|
+
async function down$80(db) {
|
|
4791
4849
|
await sql`
|
|
4792
4850
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS user_cache_quota_bytes
|
|
4793
4851
|
`.execute(db);
|
|
@@ -4798,8 +4856,8 @@ async function down$79(db) {
|
|
|
4798
4856
|
//#endregion
|
|
4799
4857
|
//#region src/db/migrations/029_dispatch_queue_attempts.ts
|
|
4800
4858
|
var _029_dispatch_queue_attempts_exports = /* @__PURE__ */ __exportAll({
|
|
4801
|
-
down: () => down$
|
|
4802
|
-
up: () => up$
|
|
4859
|
+
down: () => down$79,
|
|
4860
|
+
up: () => up$79
|
|
4803
4861
|
});
|
|
4804
4862
|
/**
|
|
4805
4863
|
* Add `dispatch_queue.dispatch_attempts INT NOT NULL DEFAULT 0`.
|
|
@@ -4813,7 +4871,7 @@ var _029_dispatch_queue_attempts_exports = /* @__PURE__ */ __exportAll({
|
|
|
4813
4871
|
*
|
|
4814
4872
|
* Idempotent: re-running on a DB that already has the column is a no-op.
|
|
4815
4873
|
*/
|
|
4816
|
-
async function up$
|
|
4874
|
+
async function up$79(db) {
|
|
4817
4875
|
if (!((await sql`
|
|
4818
4876
|
SELECT EXISTS (
|
|
4819
4877
|
SELECT 1 FROM information_schema.columns
|
|
@@ -4826,7 +4884,7 @@ async function up$78(db) {
|
|
|
4826
4884
|
ADD COLUMN dispatch_attempts INT NOT NULL DEFAULT 0
|
|
4827
4885
|
`.execute(db);
|
|
4828
4886
|
}
|
|
4829
|
-
async function down$
|
|
4887
|
+
async function down$79(db) {
|
|
4830
4888
|
await sql`
|
|
4831
4889
|
ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS dispatch_attempts
|
|
4832
4890
|
`.execute(db);
|
|
@@ -4834,8 +4892,8 @@ async function down$78(db) {
|
|
|
4834
4892
|
//#endregion
|
|
4835
4893
|
//#region src/db/migrations/030_held_runs_env_set_null.ts
|
|
4836
4894
|
var _030_held_runs_env_set_null_exports = /* @__PURE__ */ __exportAll({
|
|
4837
|
-
down: () => down$
|
|
4838
|
-
up: () => up$
|
|
4895
|
+
down: () => down$78,
|
|
4896
|
+
up: () => up$78
|
|
4839
4897
|
});
|
|
4840
4898
|
/**
|
|
4841
4899
|
* held_runs.environment_id becomes nullable with ON DELETE SET NULL so
|
|
@@ -4846,14 +4904,14 @@ var _030_held_runs_env_set_null_exports = /* @__PURE__ */ __exportAll({
|
|
|
4846
4904
|
* Idempotent: dropping the NOT NULL and the constraint are both no-ops on a
|
|
4847
4905
|
* re-run, and the constraint is re-created with the SET NULL action.
|
|
4848
4906
|
*/
|
|
4849
|
-
async function up$
|
|
4907
|
+
async function up$78(db) {
|
|
4850
4908
|
await sql`ALTER TABLE public.held_runs ALTER COLUMN environment_id DROP NOT NULL`.execute(db);
|
|
4851
4909
|
await sql`ALTER TABLE public.held_runs DROP CONSTRAINT IF EXISTS held_runs_environment_id_fkey`.execute(db);
|
|
4852
4910
|
await sql`ALTER TABLE public.held_runs
|
|
4853
4911
|
ADD CONSTRAINT held_runs_environment_id_fkey
|
|
4854
4912
|
FOREIGN KEY (environment_id) REFERENCES public.environments(id) ON DELETE SET NULL`.execute(db);
|
|
4855
4913
|
}
|
|
4856
|
-
async function down$
|
|
4914
|
+
async function down$78(db) {
|
|
4857
4915
|
await sql`ALTER TABLE public.held_runs DROP CONSTRAINT IF EXISTS held_runs_environment_id_fkey`.execute(db);
|
|
4858
4916
|
await sql`ALTER TABLE public.held_runs
|
|
4859
4917
|
ADD CONSTRAINT held_runs_environment_id_fkey
|
|
@@ -4863,8 +4921,8 @@ async function down$77(db) {
|
|
|
4863
4921
|
//#endregion
|
|
4864
4922
|
//#region src/db/migrations/031_dispatch_queue_ack_deadline.ts
|
|
4865
4923
|
var _031_dispatch_queue_ack_deadline_exports = /* @__PURE__ */ __exportAll({
|
|
4866
|
-
down: () => down$
|
|
4867
|
-
up: () => up$
|
|
4924
|
+
down: () => down$77,
|
|
4925
|
+
up: () => up$77
|
|
4868
4926
|
});
|
|
4869
4927
|
/**
|
|
4870
4928
|
* Add `dispatch_queue.ack_deadline TIMESTAMPTZ` and
|
|
@@ -4881,7 +4939,7 @@ var _031_dispatch_queue_ack_deadline_exports = /* @__PURE__ */ __exportAll({
|
|
|
4881
4939
|
*
|
|
4882
4940
|
* Idempotent: re-running on a DB that already has either column is a no-op.
|
|
4883
4941
|
*/
|
|
4884
|
-
async function up$
|
|
4942
|
+
async function up$77(db) {
|
|
4885
4943
|
const colExists = async (name) => {
|
|
4886
4944
|
return (await sql`
|
|
4887
4945
|
SELECT EXISTS (
|
|
@@ -4906,7 +4964,7 @@ async function up$76(db) {
|
|
|
4906
4964
|
WHERE ack_deadline IS NOT NULL
|
|
4907
4965
|
`.execute(db);
|
|
4908
4966
|
}
|
|
4909
|
-
async function down$
|
|
4967
|
+
async function down$77(db) {
|
|
4910
4968
|
await sql`DROP INDEX IF EXISTS public.idx_dispatch_queue_ack_deadline`.execute(db);
|
|
4911
4969
|
await sql`ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS ack_agent_id`.execute(db);
|
|
4912
4970
|
await sql`ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS ack_deadline`.execute(db);
|
|
@@ -4914,8 +4972,8 @@ async function down$76(db) {
|
|
|
4914
4972
|
//#endregion
|
|
4915
4973
|
//#region src/db/migrations/032_org_settings_dispatch_ack_timeout.ts
|
|
4916
4974
|
var _032_org_settings_dispatch_ack_timeout_exports = /* @__PURE__ */ __exportAll({
|
|
4917
|
-
down: () => down$
|
|
4918
|
-
up: () => up$
|
|
4975
|
+
down: () => down$76,
|
|
4976
|
+
up: () => up$76
|
|
4919
4977
|
});
|
|
4920
4978
|
/**
|
|
4921
4979
|
* Add `org_settings.dispatch_ack_timeout_ms BIGINT` (nullable).
|
|
@@ -4927,7 +4985,7 @@ var _032_org_settings_dispatch_ack_timeout_exports = /* @__PURE__ */ __exportAll
|
|
|
4927
4985
|
*
|
|
4928
4986
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
4929
4987
|
*/
|
|
4930
|
-
async function up$
|
|
4988
|
+
async function up$76(db) {
|
|
4931
4989
|
if ((await sql`
|
|
4932
4990
|
SELECT EXISTS (
|
|
4933
4991
|
SELECT 1 FROM information_schema.columns
|
|
@@ -4941,7 +4999,7 @@ async function up$75(db) {
|
|
|
4941
4999
|
ADD COLUMN dispatch_ack_timeout_ms BIGINT
|
|
4942
5000
|
`.execute(db);
|
|
4943
5001
|
}
|
|
4944
|
-
async function down$
|
|
5002
|
+
async function down$76(db) {
|
|
4945
5003
|
await sql`
|
|
4946
5004
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS dispatch_ack_timeout_ms
|
|
4947
5005
|
`.execute(db);
|
|
@@ -4949,8 +5007,8 @@ async function down$75(db) {
|
|
|
4949
5007
|
//#endregion
|
|
4950
5008
|
//#region src/db/migrations/033_org_settings_approval.ts
|
|
4951
5009
|
var _033_org_settings_approval_exports = /* @__PURE__ */ __exportAll({
|
|
4952
|
-
down: () => down$
|
|
4953
|
-
up: () => up$
|
|
5010
|
+
down: () => down$75,
|
|
5011
|
+
up: () => up$75
|
|
4954
5012
|
});
|
|
4955
5013
|
/**
|
|
4956
5014
|
* Add the two approval-policy columns to `org_settings`:
|
|
@@ -4967,7 +5025,7 @@ var _033_org_settings_approval_exports = /* @__PURE__ */ __exportAll({
|
|
|
4967
5025
|
* and the orchestrator admin route. Idempotent: a re-run on a DB that already
|
|
4968
5026
|
* has the columns is a no-op (each column is guarded independently).
|
|
4969
5027
|
*/
|
|
4970
|
-
async function up$
|
|
5028
|
+
async function up$75(db) {
|
|
4971
5029
|
const colExists = async (column) => {
|
|
4972
5030
|
return (await sql`
|
|
4973
5031
|
SELECT EXISTS (
|
|
@@ -4987,7 +5045,7 @@ async function up$74(db) {
|
|
|
4987
5045
|
ADD COLUMN allow_self_approval BOOLEAN NOT NULL DEFAULT true
|
|
4988
5046
|
`.execute(db);
|
|
4989
5047
|
}
|
|
4990
|
-
async function down$
|
|
5048
|
+
async function down$75(db) {
|
|
4991
5049
|
await sql`
|
|
4992
5050
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS approval_expiry_seconds
|
|
4993
5051
|
`.execute(db);
|
|
@@ -4998,8 +5056,8 @@ async function down$74(db) {
|
|
|
4998
5056
|
//#endregion
|
|
4999
5057
|
//#region src/db/migrations/034_held_runs_generalize.ts
|
|
5000
5058
|
var _034_held_runs_generalize_exports = /* @__PURE__ */ __exportAll({
|
|
5001
|
-
down: () => down$
|
|
5002
|
-
up: () => up$
|
|
5059
|
+
down: () => down$74,
|
|
5060
|
+
up: () => up$74
|
|
5003
5061
|
});
|
|
5004
5062
|
/**
|
|
5005
5063
|
* Generalize `held_runs` from an environment-only hold into the unified
|
|
@@ -5021,7 +5079,7 @@ var _034_held_runs_generalize_exports = /* @__PURE__ */ __exportAll({
|
|
|
5021
5079
|
* New `held_run_approvals` table: one row per approver decision, FK to
|
|
5022
5080
|
* `held_runs.id` (uuid) with ON DELETE CASCADE.
|
|
5023
5081
|
*/
|
|
5024
|
-
async function up$
|
|
5082
|
+
async function up$74(db) {
|
|
5025
5083
|
const colExists = async (column) => {
|
|
5026
5084
|
return (await sql`
|
|
5027
5085
|
SELECT EXISTS (
|
|
@@ -5054,7 +5112,7 @@ async function up$73(db) {
|
|
|
5054
5112
|
ON public.held_run_approvals USING btree (held_run_id)
|
|
5055
5113
|
`.execute(db);
|
|
5056
5114
|
}
|
|
5057
|
-
async function down$
|
|
5115
|
+
async function down$74(db) {
|
|
5058
5116
|
await sql`DROP TABLE IF EXISTS public.held_run_approvals`.execute(db);
|
|
5059
5117
|
await sql`ALTER TABLE public.held_runs DROP COLUMN IF EXISTS approval_requirement`.execute(db);
|
|
5060
5118
|
await sql`ALTER TABLE public.held_runs DROP COLUMN IF EXISTS trigger_source`.execute(db);
|
|
@@ -5064,8 +5122,8 @@ async function down$73(db) {
|
|
|
5064
5122
|
//#endregion
|
|
5065
5123
|
//#region src/db/migrations/035_pending_workflow_contexts.ts
|
|
5066
5124
|
var _035_pending_workflow_contexts_exports = /* @__PURE__ */ __exportAll({
|
|
5067
|
-
down: () => down$
|
|
5068
|
-
up: () => up$
|
|
5125
|
+
down: () => down$73,
|
|
5126
|
+
up: () => up$73
|
|
5069
5127
|
});
|
|
5070
5128
|
/**
|
|
5071
5129
|
* Pending workflow dispatch context — backs resume of a workflow whose install
|
|
@@ -5074,7 +5132,7 @@ var _035_pending_workflow_contexts_exports = /* @__PURE__ */ __exportAll({
|
|
|
5074
5132
|
* wait-timer expiry, concurrency slot free). The row is deleted once the resume
|
|
5075
5133
|
* dispatch has been kicked off.
|
|
5076
5134
|
*/
|
|
5077
|
-
async function up$
|
|
5135
|
+
async function up$73(db) {
|
|
5078
5136
|
await sql`
|
|
5079
5137
|
CREATE TABLE IF NOT EXISTS public.pending_workflow_contexts (
|
|
5080
5138
|
run_id text PRIMARY KEY,
|
|
@@ -5084,14 +5142,14 @@ async function up$72(db) {
|
|
|
5084
5142
|
)
|
|
5085
5143
|
`.execute(db);
|
|
5086
5144
|
}
|
|
5087
|
-
async function down$
|
|
5145
|
+
async function down$73(db) {
|
|
5088
5146
|
await sql`DROP TABLE IF EXISTS public.pending_workflow_contexts`.execute(db);
|
|
5089
5147
|
}
|
|
5090
5148
|
//#endregion
|
|
5091
5149
|
//#region src/db/migrations/036_attestations.ts
|
|
5092
5150
|
var _036_attestations_exports = /* @__PURE__ */ __exportAll({
|
|
5093
|
-
down: () => down$
|
|
5094
|
-
up: () => up$
|
|
5151
|
+
down: () => down$72,
|
|
5152
|
+
up: () => up$72
|
|
5095
5153
|
});
|
|
5096
5154
|
/**
|
|
5097
5155
|
* Add the `attestations` table for build-provenance bundles.
|
|
@@ -5104,7 +5162,7 @@ var _036_attestations_exports = /* @__PURE__ */ __exportAll({
|
|
|
5104
5162
|
*
|
|
5105
5163
|
* Idempotent: a re-run on a DB that already has the table is a no-op.
|
|
5106
5164
|
*/
|
|
5107
|
-
async function up$
|
|
5165
|
+
async function up$72(db) {
|
|
5108
5166
|
if ((await sql`
|
|
5109
5167
|
SELECT EXISTS (
|
|
5110
5168
|
SELECT 1 FROM information_schema.tables
|
|
@@ -5130,14 +5188,14 @@ async function up$71(db) {
|
|
|
5130
5188
|
ON public.attestations (run_id, job_id)
|
|
5131
5189
|
`.execute(db);
|
|
5132
5190
|
}
|
|
5133
|
-
async function down$
|
|
5191
|
+
async function down$72(db) {
|
|
5134
5192
|
await sql`DROP TABLE IF EXISTS public.attestations`.execute(db);
|
|
5135
5193
|
}
|
|
5136
5194
|
//#endregion
|
|
5137
5195
|
//#region src/db/migrations/037_generic_sources_provider_type_local.ts
|
|
5138
5196
|
var _037_generic_sources_provider_type_local_exports = /* @__PURE__ */ __exportAll({
|
|
5139
|
-
down: () => down$
|
|
5140
|
-
up: () => up$
|
|
5197
|
+
down: () => down$71,
|
|
5198
|
+
up: () => up$71
|
|
5141
5199
|
});
|
|
5142
5200
|
/**
|
|
5143
5201
|
* Replace the `generic_webhook_sources.provider_type` CHECK constraint so it
|
|
@@ -5154,7 +5212,7 @@ var _037_generic_sources_provider_type_local_exports = /* @__PURE__ */ __exportA
|
|
|
5154
5212
|
* Idempotent: the constraint is dropped IF EXISTS and recreated; the data
|
|
5155
5213
|
* backfill is a plain UPDATE that is a no-op once no `'internal'` rows remain.
|
|
5156
5214
|
*/
|
|
5157
|
-
async function up$
|
|
5215
|
+
async function up$71(db) {
|
|
5158
5216
|
await sql`
|
|
5159
5217
|
ALTER TABLE public.generic_webhook_sources
|
|
5160
5218
|
DROP CONSTRAINT IF EXISTS generic_webhook_sources_provider_type_check
|
|
@@ -5170,7 +5228,7 @@ async function up$70(db) {
|
|
|
5170
5228
|
CHECK (provider_type = ANY (ARRAY['generic'::text, 'local'::text]))
|
|
5171
5229
|
`.execute(db);
|
|
5172
5230
|
}
|
|
5173
|
-
async function down$
|
|
5231
|
+
async function down$71(db) {
|
|
5174
5232
|
await sql`
|
|
5175
5233
|
ALTER TABLE public.generic_webhook_sources
|
|
5176
5234
|
DROP CONSTRAINT IF EXISTS generic_webhook_sources_provider_type_check
|
|
@@ -5189,8 +5247,8 @@ async function down$70(db) {
|
|
|
5189
5247
|
//#endregion
|
|
5190
5248
|
//#region src/db/migrations/038_remote_sources.ts
|
|
5191
5249
|
var _038_remote_sources_exports = /* @__PURE__ */ __exportAll({
|
|
5192
|
-
down: () => down$
|
|
5193
|
-
up: () => up$
|
|
5250
|
+
down: () => down$70,
|
|
5251
|
+
up: () => up$70
|
|
5194
5252
|
});
|
|
5195
5253
|
/**
|
|
5196
5254
|
* `remote_sources` anchors a Platform-relayed `kici run remote` to its real
|
|
@@ -5202,7 +5260,7 @@ var _038_remote_sources_exports = /* @__PURE__ */ __exportAll({
|
|
|
5202
5260
|
*
|
|
5203
5261
|
* Idempotent: a re-run on a DB that already has the table is a no-op.
|
|
5204
5262
|
*/
|
|
5205
|
-
async function up$
|
|
5263
|
+
async function up$70(db) {
|
|
5206
5264
|
if ((await sql`
|
|
5207
5265
|
SELECT EXISTS (
|
|
5208
5266
|
SELECT 1 FROM information_schema.tables
|
|
@@ -5221,14 +5279,14 @@ async function up$69(db) {
|
|
|
5221
5279
|
)
|
|
5222
5280
|
`.execute(db);
|
|
5223
5281
|
}
|
|
5224
|
-
async function down$
|
|
5282
|
+
async function down$70(db) {
|
|
5225
5283
|
await sql`DROP TABLE IF EXISTS public.remote_sources`.execute(db);
|
|
5226
5284
|
}
|
|
5227
5285
|
//#endregion
|
|
5228
5286
|
//#region src/db/migrations/039_host_roster.ts
|
|
5229
5287
|
var _039_host_roster_exports = /* @__PURE__ */ __exportAll({
|
|
5230
|
-
down: () => down$
|
|
5231
|
-
up: () => up$
|
|
5288
|
+
down: () => down$69,
|
|
5289
|
+
up: () => up$69
|
|
5232
5290
|
});
|
|
5233
5291
|
/**
|
|
5234
5292
|
* `host_roster` is KiCI's declared inventory: one durable row per agent the
|
|
@@ -5245,7 +5303,7 @@ var _039_host_roster_exports = /* @__PURE__ */ __exportAll({
|
|
|
5245
5303
|
*
|
|
5246
5304
|
* Idempotent: a re-run on a DB that already has the table is a no-op.
|
|
5247
5305
|
*/
|
|
5248
|
-
async function up$
|
|
5306
|
+
async function up$69(db) {
|
|
5249
5307
|
if ((await sql`
|
|
5250
5308
|
SELECT EXISTS (
|
|
5251
5309
|
SELECT 1 FROM information_schema.tables
|
|
@@ -5275,14 +5333,14 @@ async function up$68(db) {
|
|
|
5275
5333
|
await sql`CREATE INDEX idx_host_roster_reap
|
|
5276
5334
|
ON public.host_roster (lifecycle_class, last_seen)`.execute(db);
|
|
5277
5335
|
}
|
|
5278
|
-
async function down$
|
|
5336
|
+
async function down$69(db) {
|
|
5279
5337
|
await sql`DROP TABLE IF EXISTS public.host_roster`.execute(db);
|
|
5280
5338
|
}
|
|
5281
5339
|
//#endregion
|
|
5282
5340
|
//#region src/db/migrations/040_runsonall_pin.ts
|
|
5283
5341
|
var _040_runsonall_pin_exports = /* @__PURE__ */ __exportAll({
|
|
5284
|
-
down: () => down$
|
|
5285
|
-
up: () => up$
|
|
5342
|
+
down: () => down$68,
|
|
5343
|
+
up: () => up$68
|
|
5286
5344
|
});
|
|
5287
5345
|
/**
|
|
5288
5346
|
* Add the `runsOnAll` host fan-out columns:
|
|
@@ -5309,7 +5367,7 @@ async function colExists$12(db, table, name) {
|
|
|
5309
5367
|
) AS exists
|
|
5310
5368
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5311
5369
|
}
|
|
5312
|
-
async function up$
|
|
5370
|
+
async function up$68(db) {
|
|
5313
5371
|
if (!await colExists$12(db, "dispatch_queue", "pinned_agent_id")) await sql`ALTER TABLE public.dispatch_queue ADD COLUMN pinned_agent_id TEXT`.execute(db);
|
|
5314
5372
|
if (!await colExists$12(db, "execution_jobs", "base_job_name")) await sql`ALTER TABLE public.execution_jobs ADD COLUMN base_job_name TEXT`.execute(db);
|
|
5315
5373
|
if (!await colExists$12(db, "execution_jobs", "variant_kind")) await sql`ALTER TABLE public.execution_jobs ADD COLUMN variant_kind TEXT`.execute(db);
|
|
@@ -5320,7 +5378,7 @@ async function up$67(db) {
|
|
|
5320
5378
|
WHERE pinned_agent_id IS NOT NULL
|
|
5321
5379
|
`.execute(db);
|
|
5322
5380
|
}
|
|
5323
|
-
async function down$
|
|
5381
|
+
async function down$68(db) {
|
|
5324
5382
|
await sql`DROP INDEX IF EXISTS public.idx_dispatch_queue_pinned_agent`.execute(db);
|
|
5325
5383
|
await sql`ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS pinned_agent_id`.execute(db);
|
|
5326
5384
|
await sql`ALTER TABLE public.execution_jobs DROP COLUMN IF EXISTS variant_label`.execute(db);
|
|
@@ -5330,8 +5388,8 @@ async function down$67(db) {
|
|
|
5330
5388
|
//#endregion
|
|
5331
5389
|
//#region src/db/migrations/041_wave_gated.ts
|
|
5332
5390
|
var _041_wave_gated_exports = /* @__PURE__ */ __exportAll({
|
|
5333
|
-
down: () => down$
|
|
5334
|
-
up: () => up$
|
|
5391
|
+
down: () => down$67,
|
|
5392
|
+
up: () => up$67
|
|
5335
5393
|
});
|
|
5336
5394
|
/**
|
|
5337
5395
|
* Add the rolling fan-out wave-gate columns:
|
|
@@ -5361,7 +5419,7 @@ async function colExists$11(db, table, name) {
|
|
|
5361
5419
|
) AS exists
|
|
5362
5420
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5363
5421
|
}
|
|
5364
|
-
async function up$
|
|
5422
|
+
async function up$67(db) {
|
|
5365
5423
|
if (!await colExists$11(db, "execution_jobs", "wave_gated")) await sql`ALTER TABLE public.execution_jobs ADD COLUMN wave_gated boolean NOT NULL DEFAULT false`.execute(db);
|
|
5366
5424
|
if (!await colExists$11(db, "execution_jobs", "wave_max_parallel")) await sql`ALTER TABLE public.execution_jobs ADD COLUMN wave_max_parallel integer`.execute(db);
|
|
5367
5425
|
if (!await colExists$11(db, "execution_jobs", "wave_fail_fast")) await sql`ALTER TABLE public.execution_jobs ADD COLUMN wave_fail_fast boolean`.execute(db);
|
|
@@ -5370,7 +5428,7 @@ async function up$66(db) {
|
|
|
5370
5428
|
ON public.execution_jobs (run_id, base_job_name, wave_gated)
|
|
5371
5429
|
`.execute(db);
|
|
5372
5430
|
}
|
|
5373
|
-
async function down$
|
|
5431
|
+
async function down$67(db) {
|
|
5374
5432
|
await sql`DROP INDEX IF EXISTS public.idx_execution_jobs_wave`.execute(db);
|
|
5375
5433
|
await sql`ALTER TABLE public.execution_jobs DROP COLUMN IF EXISTS wave_fail_fast`.execute(db);
|
|
5376
5434
|
await sql`ALTER TABLE public.execution_jobs DROP COLUMN IF EXISTS wave_max_parallel`.execute(db);
|
|
@@ -5379,8 +5437,8 @@ async function down$66(db) {
|
|
|
5379
5437
|
//#endregion
|
|
5380
5438
|
//#region src/db/migrations/042_dispatch_queue_patterns.ts
|
|
5381
5439
|
var _042_dispatch_queue_patterns_exports = /* @__PURE__ */ __exportAll({
|
|
5382
|
-
down: () => down$
|
|
5383
|
-
up: () => up$
|
|
5440
|
+
down: () => down$66,
|
|
5441
|
+
up: () => up$66
|
|
5384
5442
|
});
|
|
5385
5443
|
/**
|
|
5386
5444
|
* Add pattern columns to dispatch_queue. Exact labels stay in runs_on_labels /
|
|
@@ -5406,19 +5464,19 @@ async function colExists$10(db, table, name) {
|
|
|
5406
5464
|
) AS exists
|
|
5407
5465
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5408
5466
|
}
|
|
5409
|
-
async function up$
|
|
5467
|
+
async function up$66(db) {
|
|
5410
5468
|
if (!await colExists$10(db, "dispatch_queue", "runs_on_patterns")) await sql`ALTER TABLE public.dispatch_queue ADD COLUMN runs_on_patterns jsonb NOT NULL DEFAULT '[]'::jsonb`.execute(db);
|
|
5411
5469
|
if (!await colExists$10(db, "dispatch_queue", "exclude_patterns")) await sql`ALTER TABLE public.dispatch_queue ADD COLUMN exclude_patterns jsonb NOT NULL DEFAULT '[]'::jsonb`.execute(db);
|
|
5412
5470
|
}
|
|
5413
|
-
async function down$
|
|
5471
|
+
async function down$66(db) {
|
|
5414
5472
|
await sql`ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS exclude_patterns`.execute(db);
|
|
5415
5473
|
await sql`ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS runs_on_patterns`.execute(db);
|
|
5416
5474
|
}
|
|
5417
5475
|
//#endregion
|
|
5418
5476
|
//#region src/db/migrations/043_rerouted_to_peer.ts
|
|
5419
5477
|
var _043_rerouted_to_peer_exports = /* @__PURE__ */ __exportAll({
|
|
5420
|
-
down: () => down$
|
|
5421
|
-
up: () => up$
|
|
5478
|
+
down: () => down$65,
|
|
5479
|
+
up: () => up$65
|
|
5422
5480
|
});
|
|
5423
5481
|
/**
|
|
5424
5482
|
* Add a nullable `rerouted_to_peer text` marker to execution_jobs. Non-null
|
|
@@ -5439,17 +5497,17 @@ async function colExists$9(db, table, name) {
|
|
|
5439
5497
|
) AS exists
|
|
5440
5498
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5441
5499
|
}
|
|
5442
|
-
async function up$
|
|
5500
|
+
async function up$65(db) {
|
|
5443
5501
|
if (!await colExists$9(db, "execution_jobs", "rerouted_to_peer")) await sql`ALTER TABLE public.execution_jobs ADD COLUMN rerouted_to_peer text`.execute(db);
|
|
5444
5502
|
}
|
|
5445
|
-
async function down$
|
|
5503
|
+
async function down$65(db) {
|
|
5446
5504
|
await sql`ALTER TABLE public.execution_jobs DROP COLUMN IF EXISTS rerouted_to_peer`.execute(db);
|
|
5447
5505
|
}
|
|
5448
5506
|
//#endregion
|
|
5449
5507
|
//#region src/db/migrations/044_check_mode.ts
|
|
5450
5508
|
var _044_check_mode_exports = /* @__PURE__ */ __exportAll({
|
|
5451
|
-
down: () => down$
|
|
5452
|
-
up: () => up$
|
|
5509
|
+
down: () => down$64,
|
|
5510
|
+
up: () => up$64
|
|
5453
5511
|
});
|
|
5454
5512
|
/**
|
|
5455
5513
|
* Add idempotent check-mode columns:
|
|
@@ -5476,13 +5534,13 @@ async function colExists$8(db, table, name) {
|
|
|
5476
5534
|
) AS exists
|
|
5477
5535
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5478
5536
|
}
|
|
5479
|
-
async function up$
|
|
5537
|
+
async function up$64(db) {
|
|
5480
5538
|
if (!await colExists$8(db, "execution_runs", "check_mode")) await sql`ALTER TABLE public.execution_runs ADD COLUMN check_mode text`.execute(db);
|
|
5481
5539
|
if (!await colExists$8(db, "execution_steps", "check_outcome")) await sql`ALTER TABLE public.execution_steps ADD COLUMN check_outcome text`.execute(db);
|
|
5482
5540
|
if (!await colExists$8(db, "execution_steps", "drift_summary")) await sql`ALTER TABLE public.execution_steps ADD COLUMN drift_summary text`.execute(db);
|
|
5483
5541
|
if (!await colExists$8(db, "execution_steps", "drift")) await sql`ALTER TABLE public.execution_steps ADD COLUMN drift jsonb`.execute(db);
|
|
5484
5542
|
}
|
|
5485
|
-
async function down$
|
|
5543
|
+
async function down$64(db) {
|
|
5486
5544
|
await sql`ALTER TABLE public.execution_steps DROP COLUMN IF EXISTS drift`.execute(db);
|
|
5487
5545
|
await sql`ALTER TABLE public.execution_steps DROP COLUMN IF EXISTS drift_summary`.execute(db);
|
|
5488
5546
|
await sql`ALTER TABLE public.execution_steps DROP COLUMN IF EXISTS check_outcome`.execute(db);
|
|
@@ -5491,8 +5549,8 @@ async function down$63(db) {
|
|
|
5491
5549
|
//#endregion
|
|
5492
5550
|
//#region src/db/migrations/045_host_properties.ts
|
|
5493
5551
|
var _045_host_properties_exports = /* @__PURE__ */ __exportAll({
|
|
5494
|
-
down: () => down$
|
|
5495
|
-
up: () => up$
|
|
5552
|
+
down: () => down$63,
|
|
5553
|
+
up: () => up$63
|
|
5496
5554
|
});
|
|
5497
5555
|
/**
|
|
5498
5556
|
* Add the typed host-vars dimension to the host roster:
|
|
@@ -5506,18 +5564,18 @@ var _045_host_properties_exports = /* @__PURE__ */ __exportAll({
|
|
|
5506
5564
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`): re-running on a DB that already has
|
|
5507
5565
|
* the column is a no-op. Staging data is preserved (additive column).
|
|
5508
5566
|
*/
|
|
5509
|
-
async function up$
|
|
5567
|
+
async function up$63(db) {
|
|
5510
5568
|
await sql`ALTER TABLE public.host_roster
|
|
5511
5569
|
ADD COLUMN IF NOT EXISTS host_properties jsonb NOT NULL DEFAULT '{}'::jsonb`.execute(db);
|
|
5512
5570
|
}
|
|
5513
|
-
async function down$
|
|
5571
|
+
async function down$63(db) {
|
|
5514
5572
|
await sql`ALTER TABLE public.host_roster DROP COLUMN IF EXISTS host_properties`.execute(db);
|
|
5515
5573
|
}
|
|
5516
5574
|
//#endregion
|
|
5517
5575
|
//#region src/db/migrations/046_join_token_consumed_by_instance.ts
|
|
5518
5576
|
var _046_join_token_consumed_by_instance_exports = /* @__PURE__ */ __exportAll({
|
|
5519
|
-
down: () => down$
|
|
5520
|
-
up: () => up$
|
|
5577
|
+
down: () => down$62,
|
|
5578
|
+
up: () => up$62
|
|
5521
5579
|
});
|
|
5522
5580
|
/**
|
|
5523
5581
|
* Record the joining peer's instanceId at first consumption of a join token:
|
|
@@ -5532,18 +5590,18 @@ var _046_join_token_consumed_by_instance_exports = /* @__PURE__ */ __exportAll({
|
|
|
5532
5590
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`): re-running on a DB that already has
|
|
5533
5591
|
* the column is a no-op. Staging data is preserved (additive nullable column).
|
|
5534
5592
|
*/
|
|
5535
|
-
async function up$
|
|
5593
|
+
async function up$62(db) {
|
|
5536
5594
|
await sql`ALTER TABLE public.join_tokens
|
|
5537
5595
|
ADD COLUMN IF NOT EXISTS consumed_by_instance text`.execute(db);
|
|
5538
5596
|
}
|
|
5539
|
-
async function down$
|
|
5597
|
+
async function down$62(db) {
|
|
5540
5598
|
await sql`ALTER TABLE public.join_tokens DROP COLUMN IF EXISTS consumed_by_instance`.execute(db);
|
|
5541
5599
|
}
|
|
5542
5600
|
//#endregion
|
|
5543
5601
|
//#region src/db/migrations/047_needs_run_on.ts
|
|
5544
5602
|
var _047_needs_run_on_exports = /* @__PURE__ */ __exportAll({
|
|
5545
|
-
down: () => down$
|
|
5546
|
-
up: () => up$
|
|
5603
|
+
down: () => down$61,
|
|
5604
|
+
up: () => up$61
|
|
5547
5605
|
});
|
|
5548
5606
|
/**
|
|
5549
5607
|
* Migrate `execution_job_needs` from the binary `if_failed` policy to a
|
|
@@ -5579,7 +5637,7 @@ async function colExists$7(db, table, name) {
|
|
|
5579
5637
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5580
5638
|
}
|
|
5581
5639
|
const SUCCESS_ONLY_DEFAULT = `'${SUCCESS_ONLY_JSON}'`;
|
|
5582
|
-
async function up$
|
|
5640
|
+
async function up$61(db) {
|
|
5583
5641
|
if (!await colExists$7(db, "execution_job_needs", "run_on")) await sql`
|
|
5584
5642
|
ALTER TABLE public.execution_job_needs
|
|
5585
5643
|
ADD COLUMN run_on text NOT NULL DEFAULT ${sql.raw(SUCCESS_ONLY_DEFAULT)}
|
|
@@ -5598,7 +5656,7 @@ async function up$60(db) {
|
|
|
5598
5656
|
await sql`ALTER TABLE public.execution_job_needs DROP COLUMN if_failed`.execute(db);
|
|
5599
5657
|
}
|
|
5600
5658
|
}
|
|
5601
|
-
async function down$
|
|
5659
|
+
async function down$61(db) {
|
|
5602
5660
|
if (!await colExists$7(db, "execution_job_needs", "if_failed")) await sql`
|
|
5603
5661
|
ALTER TABLE public.execution_job_needs
|
|
5604
5662
|
ADD COLUMN if_failed text NOT NULL DEFAULT 'skip'
|
|
@@ -5614,8 +5672,8 @@ async function down$60(db) {
|
|
|
5614
5672
|
//#endregion
|
|
5615
5673
|
//#region src/db/migrations/048_host_reboot_pending.ts
|
|
5616
5674
|
var _048_host_reboot_pending_exports = /* @__PURE__ */ __exportAll({
|
|
5617
|
-
down: () => down$
|
|
5618
|
-
up: () => up$
|
|
5675
|
+
down: () => down$60,
|
|
5676
|
+
up: () => up$60
|
|
5619
5677
|
});
|
|
5620
5678
|
/**
|
|
5621
5679
|
* Add `host_roster.reboot_pending_until timestamptz NULL` — the persisted
|
|
@@ -5632,18 +5690,18 @@ var _048_host_reboot_pending_exports = /* @__PURE__ */ __exportAll({
|
|
|
5632
5690
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
|
|
5633
5691
|
* preserved.
|
|
5634
5692
|
*/
|
|
5635
|
-
async function up$
|
|
5693
|
+
async function up$60(db) {
|
|
5636
5694
|
await sql`ALTER TABLE public.host_roster
|
|
5637
5695
|
ADD COLUMN IF NOT EXISTS reboot_pending_until timestamptz`.execute(db);
|
|
5638
5696
|
}
|
|
5639
|
-
async function down$
|
|
5697
|
+
async function down$60(db) {
|
|
5640
5698
|
await sql`ALTER TABLE public.host_roster DROP COLUMN IF EXISTS reboot_pending_until`.execute(db);
|
|
5641
5699
|
}
|
|
5642
5700
|
//#endregion
|
|
5643
5701
|
//#region src/db/migrations/049_held_runs_payload.ts
|
|
5644
5702
|
var _049_held_runs_payload_exports = /* @__PURE__ */ __exportAll({
|
|
5645
|
-
down: () => down$
|
|
5646
|
-
up: () => up$
|
|
5703
|
+
down: () => down$59,
|
|
5704
|
+
up: () => up$59
|
|
5647
5705
|
});
|
|
5648
5706
|
/**
|
|
5649
5707
|
* Add `held_runs.payload jsonb NULL` — the drift payload captured when a
|
|
@@ -5655,18 +5713,18 @@ var _049_held_runs_payload_exports = /* @__PURE__ */ __exportAll({
|
|
|
5655
5713
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
|
|
5656
5714
|
* preserved.
|
|
5657
5715
|
*/
|
|
5658
|
-
async function up$
|
|
5716
|
+
async function up$59(db) {
|
|
5659
5717
|
await sql`ALTER TABLE public.held_runs
|
|
5660
5718
|
ADD COLUMN IF NOT EXISTS payload jsonb`.execute(db);
|
|
5661
5719
|
}
|
|
5662
|
-
async function down$
|
|
5720
|
+
async function down$59(db) {
|
|
5663
5721
|
await sql`ALTER TABLE public.held_runs DROP COLUMN IF EXISTS payload`.execute(db);
|
|
5664
5722
|
}
|
|
5665
5723
|
//#endregion
|
|
5666
5724
|
//#region src/db/migrations/050_sources_slug.ts
|
|
5667
5725
|
var _050_sources_slug_exports = /* @__PURE__ */ __exportAll({
|
|
5668
|
-
down: () => down$
|
|
5669
|
-
up: () => up$
|
|
5726
|
+
down: () => down$58,
|
|
5727
|
+
up: () => up$58
|
|
5670
5728
|
});
|
|
5671
5729
|
/**
|
|
5672
5730
|
* Add `sources.slug TEXT NULL` — the GitHub App slug (the URL-safe identifier
|
|
@@ -5681,18 +5739,18 @@ var _050_sources_slug_exports = /* @__PURE__ */ __exportAll({
|
|
|
5681
5739
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
|
|
5682
5740
|
* preserved.
|
|
5683
5741
|
*/
|
|
5684
|
-
async function up$
|
|
5742
|
+
async function up$58(db) {
|
|
5685
5743
|
await sql`ALTER TABLE public.sources
|
|
5686
5744
|
ADD COLUMN IF NOT EXISTS slug text`.execute(db);
|
|
5687
5745
|
}
|
|
5688
|
-
async function down$
|
|
5746
|
+
async function down$58(db) {
|
|
5689
5747
|
await sql`ALTER TABLE public.sources DROP COLUMN IF EXISTS slug`.execute(db);
|
|
5690
5748
|
}
|
|
5691
5749
|
//#endregion
|
|
5692
5750
|
//#region src/db/migrations/051_binding_host_pattern.ts
|
|
5693
5751
|
var _051_binding_host_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
5694
|
-
down: () => down$
|
|
5695
|
-
up: () => up$
|
|
5752
|
+
down: () => down$57,
|
|
5753
|
+
up: () => up$57
|
|
5696
5754
|
});
|
|
5697
5755
|
/**
|
|
5698
5756
|
* Add a per-host dimension to environment secret bindings:
|
|
@@ -5708,7 +5766,7 @@ var _051_binding_host_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
|
5708
5766
|
* Idempotent: re-running on a DB that already has the column / index is a no-op.
|
|
5709
5767
|
* Additive — staging data is preserved.
|
|
5710
5768
|
*/
|
|
5711
|
-
async function up$
|
|
5769
|
+
async function up$57(db) {
|
|
5712
5770
|
await sql`ALTER TABLE public.environment_bindings
|
|
5713
5771
|
ADD COLUMN IF NOT EXISTS host_pattern text NOT NULL DEFAULT '**'`.execute(db);
|
|
5714
5772
|
await sql`ALTER TABLE public.environment_bindings
|
|
@@ -5716,7 +5774,7 @@ async function up$56(db) {
|
|
|
5716
5774
|
await sql`CREATE UNIQUE INDEX IF NOT EXISTS environment_bindings_env_scope_host_uniq
|
|
5717
5775
|
ON public.environment_bindings (environment_id, scope_pattern, host_pattern)`.execute(db);
|
|
5718
5776
|
}
|
|
5719
|
-
async function down$
|
|
5777
|
+
async function down$57(db) {
|
|
5720
5778
|
await sql`DROP INDEX IF EXISTS public.environment_bindings_env_scope_host_uniq`.execute(db);
|
|
5721
5779
|
await sql`ALTER TABLE public.environment_bindings
|
|
5722
5780
|
DROP COLUMN IF EXISTS host_pattern`.execute(db);
|
|
@@ -5726,8 +5784,8 @@ async function down$56(db) {
|
|
|
5726
5784
|
//#endregion
|
|
5727
5785
|
//#region src/db/migrations/052_host_reach_metadata.ts
|
|
5728
5786
|
var _052_host_reach_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
5729
|
-
down: () => down$
|
|
5730
|
-
up: () => up$
|
|
5787
|
+
down: () => down$56,
|
|
5788
|
+
up: () => up$56
|
|
5731
5789
|
});
|
|
5732
5790
|
/**
|
|
5733
5791
|
* Add pre-agent reach metadata to the host roster so a declared host (no agent
|
|
@@ -5744,14 +5802,14 @@ var _052_host_reach_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
|
5744
5802
|
* behaves exactly as before. Idempotent (`ADD COLUMN IF NOT EXISTS`); additive,
|
|
5745
5803
|
* so staging data is preserved.
|
|
5746
5804
|
*/
|
|
5747
|
-
async function up$
|
|
5805
|
+
async function up$56(db) {
|
|
5748
5806
|
await sql`ALTER TABLE public.host_roster
|
|
5749
5807
|
ADD COLUMN IF NOT EXISTS address text,
|
|
5750
5808
|
ADD COLUMN IF NOT EXISTS ssh_user text,
|
|
5751
5809
|
ADD COLUMN IF NOT EXISTS ssh_port integer,
|
|
5752
5810
|
ADD COLUMN IF NOT EXISTS ssh_key_secret text`.execute(db);
|
|
5753
5811
|
}
|
|
5754
|
-
async function down$
|
|
5812
|
+
async function down$56(db) {
|
|
5755
5813
|
await sql`ALTER TABLE public.host_roster
|
|
5756
5814
|
DROP COLUMN IF EXISTS address,
|
|
5757
5815
|
DROP COLUMN IF EXISTS ssh_user,
|
|
@@ -5761,8 +5819,8 @@ async function down$55(db) {
|
|
|
5761
5819
|
//#endregion
|
|
5762
5820
|
//#region src/db/migrations/053_agent_token_single_use.ts
|
|
5763
5821
|
var _053_agent_token_single_use_exports = /* @__PURE__ */ __exportAll({
|
|
5764
|
-
down: () => down$
|
|
5765
|
-
up: () => up$
|
|
5822
|
+
down: () => down$55,
|
|
5823
|
+
up: () => up$55
|
|
5766
5824
|
});
|
|
5767
5825
|
/**
|
|
5768
5826
|
* Add a single-use marker to agent tokens for the bootstrap (init-runner)
|
|
@@ -5777,19 +5835,19 @@ var _053_agent_token_single_use_exports = /* @__PURE__ */ __exportAll({
|
|
|
5777
5835
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
|
|
5778
5836
|
* preserved.
|
|
5779
5837
|
*/
|
|
5780
|
-
async function up$
|
|
5838
|
+
async function up$55(db) {
|
|
5781
5839
|
await sql`ALTER TABLE public.agent_tokens
|
|
5782
5840
|
ADD COLUMN IF NOT EXISTS consumed_at timestamptz`.execute(db);
|
|
5783
5841
|
}
|
|
5784
|
-
async function down$
|
|
5842
|
+
async function down$55(db) {
|
|
5785
5843
|
await sql`ALTER TABLE public.agent_tokens
|
|
5786
5844
|
DROP COLUMN IF EXISTS consumed_at`.execute(db);
|
|
5787
5845
|
}
|
|
5788
5846
|
//#endregion
|
|
5789
5847
|
//#region src/db/migrations/054_local_working_tree.ts
|
|
5790
5848
|
var _054_local_working_tree_exports = /* @__PURE__ */ __exportAll({
|
|
5791
|
-
down: () => down$
|
|
5792
|
-
up: () => up$
|
|
5849
|
+
down: () => down$54,
|
|
5850
|
+
up: () => up$54
|
|
5793
5851
|
});
|
|
5794
5852
|
/**
|
|
5795
5853
|
* Mark runs that executed an uploaded local working tree (`kici run remote`):
|
|
@@ -5802,19 +5860,19 @@ var _054_local_working_tree_exports = /* @__PURE__ */ __exportAll({
|
|
|
5802
5860
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive with a default, so staging
|
|
5803
5861
|
* data is preserved.
|
|
5804
5862
|
*/
|
|
5805
|
-
async function up$
|
|
5863
|
+
async function up$54(db) {
|
|
5806
5864
|
await sql`ALTER TABLE public.execution_runs
|
|
5807
5865
|
ADD COLUMN IF NOT EXISTS local_working_tree boolean NOT NULL DEFAULT false`.execute(db);
|
|
5808
5866
|
}
|
|
5809
|
-
async function down$
|
|
5867
|
+
async function down$54(db) {
|
|
5810
5868
|
await sql`ALTER TABLE public.execution_runs
|
|
5811
5869
|
DROP COLUMN IF EXISTS local_working_tree`.execute(db);
|
|
5812
5870
|
}
|
|
5813
5871
|
//#endregion
|
|
5814
5872
|
//#region src/db/migrations/055_agent_token_mandatory_labels.ts
|
|
5815
5873
|
var _055_agent_token_mandatory_labels_exports = /* @__PURE__ */ __exportAll({
|
|
5816
|
-
down: () => down$
|
|
5817
|
-
up: () => up$
|
|
5874
|
+
down: () => down$53,
|
|
5875
|
+
up: () => up$53
|
|
5818
5876
|
});
|
|
5819
5877
|
/**
|
|
5820
5878
|
* Add a token-bound mandatory-label taint to agent tokens:
|
|
@@ -5830,19 +5888,19 @@ var _055_agent_token_mandatory_labels_exports = /* @__PURE__ */ __exportAll({
|
|
|
5830
5888
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
|
|
5831
5889
|
* preserved.
|
|
5832
5890
|
*/
|
|
5833
|
-
async function up$
|
|
5891
|
+
async function up$53(db) {
|
|
5834
5892
|
await sql`ALTER TABLE public.agent_tokens
|
|
5835
5893
|
ADD COLUMN IF NOT EXISTS mandatory_labels text`.execute(db);
|
|
5836
5894
|
}
|
|
5837
|
-
async function down$
|
|
5895
|
+
async function down$53(db) {
|
|
5838
5896
|
await sql`ALTER TABLE public.agent_tokens
|
|
5839
5897
|
DROP COLUMN IF EXISTS mandatory_labels`.execute(db);
|
|
5840
5898
|
}
|
|
5841
5899
|
//#endregion
|
|
5842
5900
|
//#region src/db/migrations/056_execution_jobs_environments.ts
|
|
5843
5901
|
var _056_execution_jobs_environments_exports = /* @__PURE__ */ __exportAll({
|
|
5844
|
-
down: () => down$
|
|
5845
|
-
up: () => up$
|
|
5902
|
+
down: () => down$52,
|
|
5903
|
+
up: () => up$52
|
|
5846
5904
|
});
|
|
5847
5905
|
/**
|
|
5848
5906
|
* Add a per-job bound deployment-environment list to `execution_jobs`:
|
|
@@ -5857,19 +5915,19 @@ var _056_execution_jobs_environments_exports = /* @__PURE__ */ __exportAll({
|
|
|
5857
5915
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
|
|
5858
5916
|
* preserved.
|
|
5859
5917
|
*/
|
|
5860
|
-
async function up$
|
|
5918
|
+
async function up$52(db) {
|
|
5861
5919
|
await sql`ALTER TABLE public.execution_jobs
|
|
5862
5920
|
ADD COLUMN IF NOT EXISTS environments text`.execute(db);
|
|
5863
5921
|
}
|
|
5864
|
-
async function down$
|
|
5922
|
+
async function down$52(db) {
|
|
5865
5923
|
await sql`ALTER TABLE public.execution_jobs
|
|
5866
5924
|
DROP COLUMN IF EXISTS environments`.execute(db);
|
|
5867
5925
|
}
|
|
5868
5926
|
//#endregion
|
|
5869
5927
|
//#region src/db/migrations/057_step_concurrency.ts
|
|
5870
5928
|
var _057_step_concurrency_exports = /* @__PURE__ */ __exportAll({
|
|
5871
|
-
down: () => down$
|
|
5872
|
-
up: () => up$
|
|
5929
|
+
down: () => down$51,
|
|
5930
|
+
up: () => up$51
|
|
5873
5931
|
});
|
|
5874
5932
|
/**
|
|
5875
5933
|
* Add parallel step-group concurrency columns to `execution_steps`:
|
|
@@ -5892,19 +5950,19 @@ async function colExists$6(db, table, name) {
|
|
|
5892
5950
|
) AS exists
|
|
5893
5951
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5894
5952
|
}
|
|
5895
|
-
async function up$
|
|
5953
|
+
async function up$51(db) {
|
|
5896
5954
|
if (!await colExists$6(db, "execution_steps", "concurrency_kind")) await sql`ALTER TABLE public.execution_steps ADD COLUMN concurrency_kind text`.execute(db);
|
|
5897
5955
|
if (!await colExists$6(db, "execution_steps", "group_id")) await sql`ALTER TABLE public.execution_steps ADD COLUMN group_id text`.execute(db);
|
|
5898
5956
|
}
|
|
5899
|
-
async function down$
|
|
5957
|
+
async function down$51(db) {
|
|
5900
5958
|
await sql`ALTER TABLE public.execution_steps DROP COLUMN IF EXISTS group_id`.execute(db);
|
|
5901
5959
|
await sql`ALTER TABLE public.execution_steps DROP COLUMN IF EXISTS concurrency_kind`.execute(db);
|
|
5902
5960
|
}
|
|
5903
5961
|
//#endregion
|
|
5904
5962
|
//#region src/db/migrations/058_access_log_agent_label.ts
|
|
5905
5963
|
var _058_access_log_agent_label_exports = /* @__PURE__ */ __exportAll({
|
|
5906
|
-
down: () => down$
|
|
5907
|
-
up: () => up$
|
|
5964
|
+
down: () => down$50,
|
|
5965
|
+
up: () => up$50
|
|
5908
5966
|
});
|
|
5909
5967
|
/**
|
|
5910
5968
|
* Add `access_log.agent_label text` — the human-set name of the agent that
|
|
@@ -5924,17 +5982,17 @@ async function colExists$5(db, table, name) {
|
|
|
5924
5982
|
) AS exists
|
|
5925
5983
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5926
5984
|
}
|
|
5927
|
-
async function up$
|
|
5985
|
+
async function up$50(db) {
|
|
5928
5986
|
if (!await colExists$5(db, "access_log", "agent_label")) await sql`ALTER TABLE public.access_log ADD COLUMN agent_label text`.execute(db);
|
|
5929
5987
|
}
|
|
5930
|
-
async function down$
|
|
5988
|
+
async function down$50(db) {
|
|
5931
5989
|
await sql`ALTER TABLE public.access_log DROP COLUMN IF EXISTS agent_label`.execute(db);
|
|
5932
5990
|
}
|
|
5933
5991
|
//#endregion
|
|
5934
5992
|
//#region src/db/migrations/059_attestation_verdict.ts
|
|
5935
5993
|
var _059_attestation_verdict_exports = /* @__PURE__ */ __exportAll({
|
|
5936
|
-
down: () => down$
|
|
5937
|
-
up: () => up$
|
|
5994
|
+
down: () => down$49,
|
|
5995
|
+
up: () => up$49
|
|
5938
5996
|
});
|
|
5939
5997
|
/**
|
|
5940
5998
|
* Add server-side verification verdict columns to `attestations`, plus the
|
|
@@ -5961,7 +6019,7 @@ async function colExists$4(db, table, name) {
|
|
|
5961
6019
|
) AS exists
|
|
5962
6020
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
5963
6021
|
}
|
|
5964
|
-
async function up$
|
|
6022
|
+
async function up$49(db) {
|
|
5965
6023
|
if (await colExists$4(db, "attestations", "verify_status")) return;
|
|
5966
6024
|
await sql`
|
|
5967
6025
|
ALTER TABLE public.attestations
|
|
@@ -5974,7 +6032,7 @@ async function up$48(db) {
|
|
|
5974
6032
|
await sql`CREATE INDEX idx_attestations_verify_status ON public.attestations (verify_status)`.execute(db);
|
|
5975
6033
|
await sql`CREATE INDEX idx_attestations_created_at ON public.attestations (created_at)`.execute(db);
|
|
5976
6034
|
}
|
|
5977
|
-
async function down$
|
|
6035
|
+
async function down$49(db) {
|
|
5978
6036
|
await sql`DROP INDEX IF EXISTS idx_attestations_created_at`.execute(db);
|
|
5979
6037
|
await sql`DROP INDEX IF EXISTS idx_attestations_verify_status`.execute(db);
|
|
5980
6038
|
await sql`DROP INDEX IF EXISTS idx_attestations_subject_name`.execute(db);
|
|
@@ -5989,8 +6047,8 @@ async function down$48(db) {
|
|
|
5989
6047
|
//#endregion
|
|
5990
6048
|
//#region src/db/migrations/060_run_trigger_actor.ts
|
|
5991
6049
|
var _060_run_trigger_actor_exports = /* @__PURE__ */ __exportAll({
|
|
5992
|
-
down: () => down$
|
|
5993
|
-
up: () => up$
|
|
6050
|
+
down: () => down$48,
|
|
6051
|
+
up: () => up$48
|
|
5994
6052
|
});
|
|
5995
6053
|
/**
|
|
5996
6054
|
* Add the triggering-actor columns to `execution_runs`:
|
|
@@ -6018,12 +6076,12 @@ async function colExists$3(db, table, name) {
|
|
|
6018
6076
|
) AS exists
|
|
6019
6077
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
6020
6078
|
}
|
|
6021
|
-
async function up$
|
|
6079
|
+
async function up$48(db) {
|
|
6022
6080
|
if (!await colExists$3(db, "execution_runs", "trigger_actor_provider")) await sql`ALTER TABLE public.execution_runs ADD COLUMN trigger_actor_provider text`.execute(db);
|
|
6023
6081
|
if (!await colExists$3(db, "execution_runs", "trigger_actor_username")) await sql`ALTER TABLE public.execution_runs ADD COLUMN trigger_actor_username text`.execute(db);
|
|
6024
6082
|
if (!await colExists$3(db, "execution_runs", "trigger_actor_user_id")) await sql`ALTER TABLE public.execution_runs ADD COLUMN trigger_actor_user_id text`.execute(db);
|
|
6025
6083
|
}
|
|
6026
|
-
async function down$
|
|
6084
|
+
async function down$48(db) {
|
|
6027
6085
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS trigger_actor_provider`.execute(db);
|
|
6028
6086
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS trigger_actor_username`.execute(db);
|
|
6029
6087
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS trigger_actor_user_id`.execute(db);
|
|
@@ -6031,8 +6089,8 @@ async function down$47(db) {
|
|
|
6031
6089
|
//#endregion
|
|
6032
6090
|
//#region src/db/migrations/061_execution_runs_environment_id.ts
|
|
6033
6091
|
var _061_execution_runs_environment_id_exports = /* @__PURE__ */ __exportAll({
|
|
6034
|
-
down: () => down$
|
|
6035
|
-
up: () => up$
|
|
6092
|
+
down: () => down$47,
|
|
6093
|
+
up: () => up$47
|
|
6036
6094
|
});
|
|
6037
6095
|
/**
|
|
6038
6096
|
* Add `environment_id` to `execution_runs` so environment run-history can be
|
|
@@ -6068,7 +6126,7 @@ async function colExists$2(db, table, name) {
|
|
|
6068
6126
|
) AS exists
|
|
6069
6127
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
6070
6128
|
}
|
|
6071
|
-
async function up$
|
|
6129
|
+
async function up$47(db) {
|
|
6072
6130
|
if (!await colExists$2(db, "execution_runs", "environment_id")) await sql`
|
|
6073
6131
|
ALTER TABLE public.execution_runs
|
|
6074
6132
|
ADD COLUMN environment_id uuid
|
|
@@ -6090,15 +6148,15 @@ async function up$46(db) {
|
|
|
6090
6148
|
WHERE e2.type = 'fixed' AND e2.name = er.environment) = 1
|
|
6091
6149
|
`.execute(db);
|
|
6092
6150
|
}
|
|
6093
|
-
async function down$
|
|
6151
|
+
async function down$47(db) {
|
|
6094
6152
|
await sql`DROP INDEX IF EXISTS idx_execution_runs_environment_id`.execute(db);
|
|
6095
6153
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS environment_id`.execute(db);
|
|
6096
6154
|
}
|
|
6097
6155
|
//#endregion
|
|
6098
6156
|
//#region src/db/migrations/062_execution_runs_agent_label.ts
|
|
6099
6157
|
var _062_execution_runs_agent_label_exports = /* @__PURE__ */ __exportAll({
|
|
6100
|
-
down: () => down$
|
|
6101
|
-
up: () => up$
|
|
6158
|
+
down: () => down$46,
|
|
6159
|
+
up: () => up$46
|
|
6102
6160
|
});
|
|
6103
6161
|
/**
|
|
6104
6162
|
* Add the agent-provenance columns to `execution_runs`:
|
|
@@ -6123,19 +6181,19 @@ async function colExists$1(db, table, name) {
|
|
|
6123
6181
|
) AS exists
|
|
6124
6182
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
6125
6183
|
}
|
|
6126
|
-
async function up$
|
|
6184
|
+
async function up$46(db) {
|
|
6127
6185
|
if (!await colExists$1(db, "execution_runs", "triggered_by_agent_label")) await sql`ALTER TABLE public.execution_runs ADD COLUMN triggered_by_agent_label text`.execute(db);
|
|
6128
6186
|
if (!await colExists$1(db, "execution_runs", "cancelled_by_agent_label")) await sql`ALTER TABLE public.execution_runs ADD COLUMN cancelled_by_agent_label text`.execute(db);
|
|
6129
6187
|
}
|
|
6130
|
-
async function down$
|
|
6188
|
+
async function down$46(db) {
|
|
6131
6189
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS triggered_by_agent_label`.execute(db);
|
|
6132
6190
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS cancelled_by_agent_label`.execute(db);
|
|
6133
6191
|
}
|
|
6134
6192
|
//#endregion
|
|
6135
6193
|
//#region src/db/migrations/063_access_log_agent_label_index.ts
|
|
6136
6194
|
var _063_access_log_agent_label_index_exports = /* @__PURE__ */ __exportAll({
|
|
6137
|
-
down: () => down$
|
|
6138
|
-
up: () => up$
|
|
6195
|
+
down: () => down$45,
|
|
6196
|
+
up: () => up$45
|
|
6139
6197
|
});
|
|
6140
6198
|
/**
|
|
6141
6199
|
* Index `access_log.agent_label` (column added by migration 058) so the
|
|
@@ -6143,17 +6201,17 @@ var _063_access_log_agent_label_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
6143
6201
|
* the dashboard "agent name" filter) does an indexed exact-match lookup
|
|
6144
6202
|
* instead of a scan. Idempotent.
|
|
6145
6203
|
*/
|
|
6146
|
-
async function up$
|
|
6204
|
+
async function up$45(db) {
|
|
6147
6205
|
await sql`CREATE INDEX IF NOT EXISTS access_log_agent_label_idx ON public.access_log (agent_label)`.execute(db);
|
|
6148
6206
|
}
|
|
6149
|
-
async function down$
|
|
6207
|
+
async function down$45(db) {
|
|
6150
6208
|
await sql`DROP INDEX IF EXISTS access_log_agent_label_idx`.execute(db);
|
|
6151
6209
|
}
|
|
6152
6210
|
//#endregion
|
|
6153
6211
|
//#region src/db/migrations/064_execution_jobs_skipped_environments.ts
|
|
6154
6212
|
var _064_execution_jobs_skipped_environments_exports = /* @__PURE__ */ __exportAll({
|
|
6155
|
-
down: () => down$
|
|
6156
|
-
up: () => up$
|
|
6213
|
+
down: () => down$44,
|
|
6214
|
+
up: () => up$44
|
|
6157
6215
|
});
|
|
6158
6216
|
/**
|
|
6159
6217
|
* Add the test-run skipped-environment columns to `execution_jobs`:
|
|
@@ -6168,13 +6226,13 @@ var _064_execution_jobs_skipped_environments_exports = /* @__PURE__ */ __exportA
|
|
|
6168
6226
|
* Idempotent (`ADD COLUMN IF NOT EXISTS`); additive, so staging data is
|
|
6169
6227
|
* preserved.
|
|
6170
6228
|
*/
|
|
6171
|
-
async function up$
|
|
6229
|
+
async function up$44(db) {
|
|
6172
6230
|
await sql`ALTER TABLE public.execution_jobs
|
|
6173
6231
|
ADD COLUMN IF NOT EXISTS skipped_environments text`.execute(db);
|
|
6174
6232
|
await sql`ALTER TABLE public.execution_jobs
|
|
6175
6233
|
ADD COLUMN IF NOT EXISTS env_warning text`.execute(db);
|
|
6176
6234
|
}
|
|
6177
|
-
async function down$
|
|
6235
|
+
async function down$44(db) {
|
|
6178
6236
|
await sql`ALTER TABLE public.execution_jobs
|
|
6179
6237
|
DROP COLUMN IF EXISTS skipped_environments`.execute(db);
|
|
6180
6238
|
await sql`ALTER TABLE public.execution_jobs
|
|
@@ -6183,8 +6241,8 @@ async function down$43(db) {
|
|
|
6183
6241
|
//#endregion
|
|
6184
6242
|
//#region src/db/migrations/065_pending_attestations.ts
|
|
6185
6243
|
var _065_pending_attestations_exports = /* @__PURE__ */ __exportAll({
|
|
6186
|
-
down: () => down$
|
|
6187
|
-
up: () => up$
|
|
6244
|
+
down: () => down$43,
|
|
6245
|
+
up: () => up$43
|
|
6188
6246
|
});
|
|
6189
6247
|
/**
|
|
6190
6248
|
* Add the `pending_attestations` deferred-attestation outbox and an idempotency
|
|
@@ -6204,7 +6262,7 @@ var _065_pending_attestations_exports = /* @__PURE__ */ __exportAll({
|
|
|
6204
6262
|
*
|
|
6205
6263
|
* Idempotent: guarded on table existence.
|
|
6206
6264
|
*/
|
|
6207
|
-
async function up$
|
|
6265
|
+
async function up$43(db) {
|
|
6208
6266
|
if ((await sql`
|
|
6209
6267
|
SELECT EXISTS (
|
|
6210
6268
|
SELECT 1 FROM information_schema.tables
|
|
@@ -6243,15 +6301,15 @@ async function up$42(db) {
|
|
|
6243
6301
|
ON public.attestations (run_id, job_id, subject_digest)
|
|
6244
6302
|
`.execute(db);
|
|
6245
6303
|
}
|
|
6246
|
-
async function down$
|
|
6304
|
+
async function down$43(db) {
|
|
6247
6305
|
await sql`DROP INDEX IF EXISTS uq_attestations_run_job_subject`.execute(db);
|
|
6248
6306
|
await sql`DROP TABLE IF EXISTS public.pending_attestations`.execute(db);
|
|
6249
6307
|
}
|
|
6250
6308
|
//#endregion
|
|
6251
6309
|
//#region src/db/migrations/066_pending_attestations_rejected.ts
|
|
6252
6310
|
var _066_pending_attestations_rejected_exports = /* @__PURE__ */ __exportAll({
|
|
6253
|
-
down: () => down$
|
|
6254
|
-
up: () => up$
|
|
6311
|
+
down: () => down$42,
|
|
6312
|
+
up: () => up$42
|
|
6255
6313
|
});
|
|
6256
6314
|
/**
|
|
6257
6315
|
* Add `rejected_at` to `pending_attestations`: the terminal-rejection marker for
|
|
@@ -6262,21 +6320,21 @@ var _066_pending_attestations_rejected_exports = /* @__PURE__ */ __exportAll({
|
|
|
6262
6320
|
*
|
|
6263
6321
|
* Idempotent: guarded on column existence.
|
|
6264
6322
|
*/
|
|
6265
|
-
async function up$
|
|
6266
|
-
if (await columnExists$
|
|
6323
|
+
async function up$42(db) {
|
|
6324
|
+
if (await columnExists$5(db, "pending_attestations", "rejected_at")) return;
|
|
6267
6325
|
await sql`
|
|
6268
6326
|
ALTER TABLE public.pending_attestations
|
|
6269
6327
|
ADD COLUMN rejected_at TIMESTAMPTZ
|
|
6270
6328
|
`.execute(db);
|
|
6271
6329
|
}
|
|
6272
|
-
async function down$
|
|
6273
|
-
if (!await columnExists$
|
|
6330
|
+
async function down$42(db) {
|
|
6331
|
+
if (!await columnExists$5(db, "pending_attestations", "rejected_at")) return;
|
|
6274
6332
|
await sql`
|
|
6275
6333
|
ALTER TABLE public.pending_attestations
|
|
6276
6334
|
DROP COLUMN rejected_at
|
|
6277
6335
|
`.execute(db);
|
|
6278
6336
|
}
|
|
6279
|
-
async function columnExists$
|
|
6337
|
+
async function columnExists$5(db, table, column) {
|
|
6280
6338
|
return (await sql`
|
|
6281
6339
|
SELECT EXISTS (
|
|
6282
6340
|
SELECT 1 FROM information_schema.columns
|
|
@@ -6287,8 +6345,8 @@ async function columnExists$4(db, table, column) {
|
|
|
6287
6345
|
//#endregion
|
|
6288
6346
|
//#region src/db/migrations/067_environments_to_contexts.ts
|
|
6289
6347
|
var _067_environments_to_contexts_exports = /* @__PURE__ */ __exportAll({
|
|
6290
|
-
down: () => down$
|
|
6291
|
-
up: () => up$
|
|
6348
|
+
down: () => down$41,
|
|
6349
|
+
up: () => up$41
|
|
6292
6350
|
});
|
|
6293
6351
|
/**
|
|
6294
6352
|
* Rename the named-policy object from "environment" to "context" across the
|
|
@@ -6322,7 +6380,7 @@ var _067_environments_to_contexts_exports = /* @__PURE__ */ __exportAll({
|
|
|
6322
6380
|
* columns automatically (Postgres references them by identity, not name), so
|
|
6323
6381
|
* only the one hand-named index above needs an explicit rename.
|
|
6324
6382
|
*/
|
|
6325
|
-
async function up$
|
|
6383
|
+
async function up$41(db) {
|
|
6326
6384
|
await sql`ALTER TABLE public.environments RENAME TO contexts`.execute(db);
|
|
6327
6385
|
await sql`ALTER TABLE public.environment_bindings RENAME TO context_bindings`.execute(db);
|
|
6328
6386
|
await sql`ALTER TABLE public.environment_variables RENAME TO context_variables`.execute(db);
|
|
@@ -6341,7 +6399,7 @@ async function up$40(db) {
|
|
|
6341
6399
|
await sql`ALTER TABLE public.held_runs ALTER COLUMN queue_type SET DEFAULT 'context'`.execute(db);
|
|
6342
6400
|
await sql`ALTER TABLE public.held_runs ALTER COLUMN trigger_source SET DEFAULT 'context'`.execute(db);
|
|
6343
6401
|
}
|
|
6344
|
-
async function down$
|
|
6402
|
+
async function down$41(db) {
|
|
6345
6403
|
await sql`ALTER TABLE public.held_runs ALTER COLUMN trigger_source SET DEFAULT 'environment'`.execute(db);
|
|
6346
6404
|
await sql`ALTER TABLE public.held_runs ALTER COLUMN queue_type SET DEFAULT 'environment'`.execute(db);
|
|
6347
6405
|
await sql`UPDATE public.held_runs SET trigger_source = 'environment' WHERE trigger_source = 'context'`.execute(db);
|
|
@@ -6363,8 +6421,8 @@ async function down$40(db) {
|
|
|
6363
6421
|
//#endregion
|
|
6364
6422
|
//#region src/db/migrations/068_request_idempotency.ts
|
|
6365
6423
|
var _068_request_idempotency_exports = /* @__PURE__ */ __exportAll({
|
|
6366
|
-
down: () => down$
|
|
6367
|
-
up: () => up$
|
|
6424
|
+
down: () => down$40,
|
|
6425
|
+
up: () => up$40
|
|
6368
6426
|
});
|
|
6369
6427
|
/**
|
|
6370
6428
|
* Add the `request_idempotency` claim table: a `request_id`-keyed record that
|
|
@@ -6379,12 +6437,12 @@ var _068_request_idempotency_exports = /* @__PURE__ */ __exportAll({
|
|
|
6379
6437
|
*
|
|
6380
6438
|
* Idempotent: guarded on table existence.
|
|
6381
6439
|
*/
|
|
6382
|
-
async function up$
|
|
6440
|
+
async function up$40(db) {
|
|
6383
6441
|
if (await tableExists$3(db, "request_idempotency")) return;
|
|
6384
6442
|
await db.schema.createTable("request_idempotency").addColumn("request_id", "text", (c) => c.primaryKey()).addColumn("new_run_id", "text", (c) => c.notNull()).addColumn("created_at", "timestamptz", (c) => c.notNull().defaultTo(sql`now()`)).execute();
|
|
6385
6443
|
await db.schema.createIndex("idx_request_idempotency_created_at").on("request_idempotency").column("created_at").execute();
|
|
6386
6444
|
}
|
|
6387
|
-
async function down$
|
|
6445
|
+
async function down$40(db) {
|
|
6388
6446
|
await db.schema.dropTable("request_idempotency").ifExists().execute();
|
|
6389
6447
|
}
|
|
6390
6448
|
async function tableExists$3(db, table) {
|
|
@@ -6398,8 +6456,8 @@ async function tableExists$3(db, table) {
|
|
|
6398
6456
|
//#endregion
|
|
6399
6457
|
//#region src/db/migrations/069_reroute_tunables.ts
|
|
6400
6458
|
var _069_reroute_tunables_exports = /* @__PURE__ */ __exportAll({
|
|
6401
|
-
down: () => down$
|
|
6402
|
-
up: () => up$
|
|
6459
|
+
down: () => down$39,
|
|
6460
|
+
up: () => up$39
|
|
6403
6461
|
});
|
|
6404
6462
|
/**
|
|
6405
6463
|
* Add the three reroute-tunable columns to `org_settings` (all nullable):
|
|
@@ -6418,12 +6476,12 @@ var _069_reroute_tunables_exports = /* @__PURE__ */ __exportAll({
|
|
|
6418
6476
|
* Idempotent: each column add is guarded on column existence, so a re-run on a
|
|
6419
6477
|
* DB that already has a column is a no-op for that column.
|
|
6420
6478
|
*/
|
|
6421
|
-
async function up$
|
|
6479
|
+
async function up$39(db) {
|
|
6422
6480
|
await addColumnIfMissing(db, "reroute_spawn_window_ms", "BIGINT");
|
|
6423
6481
|
await addColumnIfMissing(db, "reroute_ack_timeout_ms", "BIGINT");
|
|
6424
6482
|
await addColumnIfMissing(db, "reroute_max_hops", "INTEGER");
|
|
6425
6483
|
}
|
|
6426
|
-
async function down$
|
|
6484
|
+
async function down$39(db) {
|
|
6427
6485
|
await sql`ALTER TABLE public.org_settings DROP COLUMN IF EXISTS reroute_spawn_window_ms`.execute(db);
|
|
6428
6486
|
await sql`ALTER TABLE public.org_settings DROP COLUMN IF EXISTS reroute_ack_timeout_ms`.execute(db);
|
|
6429
6487
|
await sql`ALTER TABLE public.org_settings DROP COLUMN IF EXISTS reroute_max_hops`.execute(db);
|
|
@@ -6442,8 +6500,8 @@ async function addColumnIfMissing(db, column, type) {
|
|
|
6442
6500
|
//#endregion
|
|
6443
6501
|
//#region src/db/migrations/070_execution_runs_failure_class.ts
|
|
6444
6502
|
var _070_execution_runs_failure_class_exports = /* @__PURE__ */ __exportAll({
|
|
6445
|
-
down: () => down$
|
|
6446
|
-
up: () => up$
|
|
6503
|
+
down: () => down$38,
|
|
6504
|
+
up: () => up$38
|
|
6447
6505
|
});
|
|
6448
6506
|
/**
|
|
6449
6507
|
* Add `execution_runs.failure_class` — the reason a terminal run failed
|
|
@@ -6464,17 +6522,17 @@ async function colExists(db, table, name) {
|
|
|
6464
6522
|
) AS exists
|
|
6465
6523
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
6466
6524
|
}
|
|
6467
|
-
async function up$
|
|
6525
|
+
async function up$38(db) {
|
|
6468
6526
|
if (!await colExists(db, "execution_runs", "failure_class")) await sql`ALTER TABLE public.execution_runs ADD COLUMN failure_class text`.execute(db);
|
|
6469
6527
|
}
|
|
6470
|
-
async function down$
|
|
6528
|
+
async function down$38(db) {
|
|
6471
6529
|
await sql`ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS failure_class`.execute(db);
|
|
6472
6530
|
}
|
|
6473
6531
|
//#endregion
|
|
6474
6532
|
//#region src/db/migrations/071_batch_accumulation.ts
|
|
6475
6533
|
var _071_batch_accumulation_exports = /* @__PURE__ */ __exportAll({
|
|
6476
|
-
down: () => down$
|
|
6477
|
-
up: () => up$
|
|
6534
|
+
down: () => down$37,
|
|
6535
|
+
up: () => up$37
|
|
6478
6536
|
});
|
|
6479
6537
|
/**
|
|
6480
6538
|
* Add the batch-accumulation tables that back the `workflows_failed_batch`
|
|
@@ -6498,7 +6556,7 @@ var _071_batch_accumulation_exports = /* @__PURE__ */ __exportAll({
|
|
|
6498
6556
|
*
|
|
6499
6557
|
* Idempotent: guarded on table existence.
|
|
6500
6558
|
*/
|
|
6501
|
-
async function up$
|
|
6559
|
+
async function up$37(db) {
|
|
6502
6560
|
if ((await sql`
|
|
6503
6561
|
SELECT EXISTS (
|
|
6504
6562
|
SELECT 1 FROM information_schema.tables
|
|
@@ -6543,15 +6601,15 @@ async function up$36(db) {
|
|
|
6543
6601
|
ON public.batch_accumulation_items (window_id)
|
|
6544
6602
|
`.execute(db);
|
|
6545
6603
|
}
|
|
6546
|
-
async function down$
|
|
6604
|
+
async function down$37(db) {
|
|
6547
6605
|
await sql`DROP TABLE IF EXISTS public.batch_accumulation_items`.execute(db);
|
|
6548
6606
|
await sql`DROP TABLE IF EXISTS public.batch_accumulation_windows`.execute(db);
|
|
6549
6607
|
}
|
|
6550
6608
|
//#endregion
|
|
6551
6609
|
//#region src/db/migrations/072_dispatch_queue_run_id_index.ts
|
|
6552
6610
|
var _072_dispatch_queue_run_id_index_exports = /* @__PURE__ */ __exportAll({
|
|
6553
|
-
down: () => down$
|
|
6554
|
-
up: () => up$
|
|
6611
|
+
down: () => down$36,
|
|
6612
|
+
up: () => up$36
|
|
6555
6613
|
});
|
|
6556
6614
|
/**
|
|
6557
6615
|
* Add `idx_dispatch_queue_run_id` on `dispatch_queue (run_id)`.
|
|
@@ -6564,20 +6622,20 @@ var _072_dispatch_queue_run_id_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
6564
6622
|
*
|
|
6565
6623
|
* Idempotent: `IF NOT EXISTS` makes a re-run a no-op.
|
|
6566
6624
|
*/
|
|
6567
|
-
async function up$
|
|
6625
|
+
async function up$36(db) {
|
|
6568
6626
|
await sql`
|
|
6569
6627
|
CREATE INDEX IF NOT EXISTS idx_dispatch_queue_run_id
|
|
6570
6628
|
ON public.dispatch_queue (run_id)
|
|
6571
6629
|
`.execute(db);
|
|
6572
6630
|
}
|
|
6573
|
-
async function down$
|
|
6631
|
+
async function down$36(db) {
|
|
6574
6632
|
await sql`DROP INDEX IF EXISTS public.idx_dispatch_queue_run_id`.execute(db);
|
|
6575
6633
|
}
|
|
6576
6634
|
//#endregion
|
|
6577
6635
|
//#region src/db/migrations/073_org_settings_ingest_concurrency.ts
|
|
6578
6636
|
var _073_org_settings_ingest_concurrency_exports = /* @__PURE__ */ __exportAll({
|
|
6579
|
-
down: () => down$
|
|
6580
|
-
up: () => up$
|
|
6637
|
+
down: () => down$35,
|
|
6638
|
+
up: () => up$35
|
|
6581
6639
|
});
|
|
6582
6640
|
/**
|
|
6583
6641
|
* Add `org_settings.ingest_max_concurrency BIGINT` (nullable).
|
|
@@ -6588,7 +6646,7 @@ var _073_org_settings_ingest_concurrency_exports = /* @__PURE__ */ __exportAll({
|
|
|
6588
6646
|
*
|
|
6589
6647
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
6590
6648
|
*/
|
|
6591
|
-
async function up$
|
|
6649
|
+
async function up$35(db) {
|
|
6592
6650
|
if ((await sql`
|
|
6593
6651
|
SELECT EXISTS (
|
|
6594
6652
|
SELECT 1 FROM information_schema.columns
|
|
@@ -6602,7 +6660,7 @@ async function up$34(db) {
|
|
|
6602
6660
|
ADD COLUMN ingest_max_concurrency BIGINT
|
|
6603
6661
|
`.execute(db);
|
|
6604
6662
|
}
|
|
6605
|
-
async function down$
|
|
6663
|
+
async function down$35(db) {
|
|
6606
6664
|
await sql`
|
|
6607
6665
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS ingest_max_concurrency
|
|
6608
6666
|
`.execute(db);
|
|
@@ -6610,8 +6668,8 @@ async function down$34(db) {
|
|
|
6610
6668
|
//#endregion
|
|
6611
6669
|
//#region src/db/migrations/074_normalize_zero_concurrency_limit.ts
|
|
6612
6670
|
var _074_normalize_zero_concurrency_limit_exports = /* @__PURE__ */ __exportAll({
|
|
6613
|
-
down: () => down$
|
|
6614
|
-
up: () => up$
|
|
6671
|
+
down: () => down$34,
|
|
6672
|
+
up: () => up$34
|
|
6615
6673
|
});
|
|
6616
6674
|
/**
|
|
6617
6675
|
* Normalize degenerate context concurrency limits. A `concurrency_limit` of 0
|
|
@@ -6622,15 +6680,15 @@ var _074_normalize_zero_concurrency_limit_exports = /* @__PURE__ */ __exportAll(
|
|
|
6622
6680
|
* Idempotent; down() is a no-op (a normalized 0 cannot — and should not — be
|
|
6623
6681
|
* restored).
|
|
6624
6682
|
*/
|
|
6625
|
-
async function up$
|
|
6683
|
+
async function up$34(db) {
|
|
6626
6684
|
await sql`UPDATE public.contexts SET concurrency_limit = NULL WHERE concurrency_limit <= 0`.execute(db);
|
|
6627
6685
|
}
|
|
6628
|
-
async function down$
|
|
6686
|
+
async function down$34(_db) {}
|
|
6629
6687
|
//#endregion
|
|
6630
6688
|
//#region src/db/migrations/075_ingest_overflow_buffer.ts
|
|
6631
6689
|
var _075_ingest_overflow_buffer_exports = /* @__PURE__ */ __exportAll({
|
|
6632
|
-
down: () => down$
|
|
6633
|
-
up: () => up$
|
|
6690
|
+
down: () => down$33,
|
|
6691
|
+
up: () => up$33
|
|
6634
6692
|
});
|
|
6635
6693
|
/**
|
|
6636
6694
|
* Durable overflow buffer for shed webhook-ingest deliveries.
|
|
@@ -6644,7 +6702,7 @@ var _075_ingest_overflow_buffer_exports = /* @__PURE__ */ __exportAll({
|
|
|
6644
6702
|
*
|
|
6645
6703
|
* Idempotent: a re-run on a DB that already has the table is a no-op.
|
|
6646
6704
|
*/
|
|
6647
|
-
async function up$
|
|
6705
|
+
async function up$33(db) {
|
|
6648
6706
|
if ((await sql`
|
|
6649
6707
|
SELECT EXISTS (
|
|
6650
6708
|
SELECT 1 FROM information_schema.tables
|
|
@@ -6677,14 +6735,14 @@ async function up$32(db) {
|
|
|
6677
6735
|
ON public.ingest_overflow_buffer (delivery_id)
|
|
6678
6736
|
`.execute(db);
|
|
6679
6737
|
}
|
|
6680
|
-
async function down$
|
|
6738
|
+
async function down$33(db) {
|
|
6681
6739
|
await sql`DROP TABLE IF EXISTS public.ingest_overflow_buffer`.execute(db);
|
|
6682
6740
|
}
|
|
6683
6741
|
//#endregion
|
|
6684
6742
|
//#region src/db/migrations/076_artifacts.ts
|
|
6685
6743
|
var _076_artifacts_exports = /* @__PURE__ */ __exportAll({
|
|
6686
|
-
down: () => down$
|
|
6687
|
-
up: () => up$
|
|
6744
|
+
down: () => down$32,
|
|
6745
|
+
up: () => up$32
|
|
6688
6746
|
});
|
|
6689
6747
|
/**
|
|
6690
6748
|
* Add the `artifacts` table for user-facing build artifacts and the per-org
|
|
@@ -6701,7 +6759,7 @@ var _076_artifacts_exports = /* @__PURE__ */ __exportAll({
|
|
|
6701
6759
|
*
|
|
6702
6760
|
* Idempotent: a re-run on a DB that already has the table / columns is a no-op.
|
|
6703
6761
|
*/
|
|
6704
|
-
async function up$
|
|
6762
|
+
async function up$32(db) {
|
|
6705
6763
|
if (!(await sql`
|
|
6706
6764
|
SELECT EXISTS (
|
|
6707
6765
|
SELECT 1 FROM information_schema.tables
|
|
@@ -6737,7 +6795,7 @@ async function up$31(db) {
|
|
|
6737
6795
|
ADD COLUMN IF NOT EXISTS artifact_ttl_ms BIGINT
|
|
6738
6796
|
`.execute(db);
|
|
6739
6797
|
}
|
|
6740
|
-
async function down$
|
|
6798
|
+
async function down$32(db) {
|
|
6741
6799
|
await sql`DROP TABLE IF EXISTS public.artifacts`.execute(db);
|
|
6742
6800
|
await sql`
|
|
6743
6801
|
ALTER TABLE public.org_settings
|
|
@@ -6748,8 +6806,8 @@ async function down$31(db) {
|
|
|
6748
6806
|
//#endregion
|
|
6749
6807
|
//#region src/db/migrations/077_backup_runs.ts
|
|
6750
6808
|
var _077_backup_runs_exports = /* @__PURE__ */ __exportAll({
|
|
6751
|
-
down: () => down$
|
|
6752
|
-
up: () => up$
|
|
6809
|
+
down: () => down$31,
|
|
6810
|
+
up: () => up$31
|
|
6753
6811
|
});
|
|
6754
6812
|
/**
|
|
6755
6813
|
* Add the `backup_runs` table: one row per successful `kici-admin db backup`,
|
|
@@ -6760,12 +6818,12 @@ var _077_backup_runs_exports = /* @__PURE__ */ __exportAll({
|
|
|
6760
6818
|
*
|
|
6761
6819
|
* Idempotent: guarded on table existence.
|
|
6762
6820
|
*/
|
|
6763
|
-
async function up$
|
|
6821
|
+
async function up$31(db) {
|
|
6764
6822
|
if (await tableExists$2(db, "backup_runs")) return;
|
|
6765
6823
|
await db.schema.createTable("backup_runs").addColumn("id", "bigserial", (c) => c.primaryKey()).addColumn("created_at", "timestamptz", (c) => c.notNull().defaultTo(sql`now()`)).addColumn("dump_path", "text", (c) => c.notNull()).addColumn("byte_size", "bigint", (c) => c.notNull()).addColumn("secret_key_version", "integer").addColumn("pg_server_version", "text", (c) => c.notNull()).addColumn("migrations_hash", "text", (c) => c.notNull()).addColumn("hostname", "text", (c) => c.notNull()).execute();
|
|
6766
6824
|
await db.schema.createIndex("idx_backup_runs_created_at").on("backup_runs").column("created_at").execute();
|
|
6767
6825
|
}
|
|
6768
|
-
async function down$
|
|
6826
|
+
async function down$31(db) {
|
|
6769
6827
|
await db.schema.dropTable("backup_runs").ifExists().execute();
|
|
6770
6828
|
}
|
|
6771
6829
|
async function tableExists$2(db, table) {
|
|
@@ -6779,8 +6837,8 @@ async function tableExists$2(db, table) {
|
|
|
6779
6837
|
//#endregion
|
|
6780
6838
|
//#region src/db/migrations/078_org_settings_backup_staleness.ts
|
|
6781
6839
|
var _078_org_settings_backup_staleness_exports = /* @__PURE__ */ __exportAll({
|
|
6782
|
-
down: () => down$
|
|
6783
|
-
up: () => up$
|
|
6840
|
+
down: () => down$30,
|
|
6841
|
+
up: () => up$30
|
|
6784
6842
|
});
|
|
6785
6843
|
/**
|
|
6786
6844
|
* Add the nullable `org_settings.backup_staleness_warn_hours INTEGER` column:
|
|
@@ -6790,7 +6848,7 @@ var _078_org_settings_backup_staleness_exports = /* @__PURE__ */ __exportAll({
|
|
|
6790
6848
|
*
|
|
6791
6849
|
* Idempotent: guarded on column existence.
|
|
6792
6850
|
*/
|
|
6793
|
-
async function up$
|
|
6851
|
+
async function up$30(db) {
|
|
6794
6852
|
if ((await sql`
|
|
6795
6853
|
SELECT EXISTS (
|
|
6796
6854
|
SELECT 1 FROM information_schema.columns
|
|
@@ -6804,7 +6862,7 @@ async function up$29(db) {
|
|
|
6804
6862
|
ADD COLUMN backup_staleness_warn_hours INTEGER
|
|
6805
6863
|
`.execute(db);
|
|
6806
6864
|
}
|
|
6807
|
-
async function down$
|
|
6865
|
+
async function down$30(db) {
|
|
6808
6866
|
await sql`
|
|
6809
6867
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS backup_staleness_warn_hours
|
|
6810
6868
|
`.execute(db);
|
|
@@ -6812,8 +6870,8 @@ async function down$29(db) {
|
|
|
6812
6870
|
//#endregion
|
|
6813
6871
|
//#region src/db/migrations/079_org_settings_scaler_spawn_timeout.ts
|
|
6814
6872
|
var _079_org_settings_scaler_spawn_timeout_exports = /* @__PURE__ */ __exportAll({
|
|
6815
|
-
down: () => down$
|
|
6816
|
-
up: () => up$
|
|
6873
|
+
down: () => down$29,
|
|
6874
|
+
up: () => up$29
|
|
6817
6875
|
});
|
|
6818
6876
|
/**
|
|
6819
6877
|
* Add `org_settings.scaler_spawn_timeout_ms BIGINT` (nullable).
|
|
@@ -6825,7 +6883,7 @@ var _079_org_settings_scaler_spawn_timeout_exports = /* @__PURE__ */ __exportAll
|
|
|
6825
6883
|
*
|
|
6826
6884
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
6827
6885
|
*/
|
|
6828
|
-
async function up$
|
|
6886
|
+
async function up$29(db) {
|
|
6829
6887
|
if ((await sql`
|
|
6830
6888
|
SELECT EXISTS (
|
|
6831
6889
|
SELECT 1 FROM information_schema.columns
|
|
@@ -6839,7 +6897,7 @@ async function up$28(db) {
|
|
|
6839
6897
|
ADD COLUMN scaler_spawn_timeout_ms BIGINT
|
|
6840
6898
|
`.execute(db);
|
|
6841
6899
|
}
|
|
6842
|
-
async function down$
|
|
6900
|
+
async function down$29(db) {
|
|
6843
6901
|
await sql`
|
|
6844
6902
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS scaler_spawn_timeout_ms
|
|
6845
6903
|
`.execute(db);
|
|
@@ -6847,8 +6905,8 @@ async function down$28(db) {
|
|
|
6847
6905
|
//#endregion
|
|
6848
6906
|
//#region src/db/migrations/080_cluster_settings.ts
|
|
6849
6907
|
var _080_cluster_settings_exports = /* @__PURE__ */ __exportAll({
|
|
6850
|
-
down: () => down$
|
|
6851
|
-
up: () => up$
|
|
6908
|
+
down: () => down$28,
|
|
6909
|
+
up: () => up$28
|
|
6852
6910
|
});
|
|
6853
6911
|
/**
|
|
6854
6912
|
* Create `cluster_settings`: a single-row (id='default') table of fleet-wide
|
|
@@ -6863,7 +6921,7 @@ var _080_cluster_settings_exports = /* @__PURE__ */ __exportAll({
|
|
|
6863
6921
|
*
|
|
6864
6922
|
* Idempotent: a re-run on a DB that already has the table is a no-op.
|
|
6865
6923
|
*/
|
|
6866
|
-
async function up$
|
|
6924
|
+
async function up$28(db) {
|
|
6867
6925
|
if ((await sql`
|
|
6868
6926
|
SELECT EXISTS (
|
|
6869
6927
|
SELECT 1 FROM information_schema.tables
|
|
@@ -6887,14 +6945,14 @@ async function up$27(db) {
|
|
|
6887
6945
|
)
|
|
6888
6946
|
`.execute(db);
|
|
6889
6947
|
}
|
|
6890
|
-
async function down$
|
|
6948
|
+
async function down$28(db) {
|
|
6891
6949
|
await sql`DROP TABLE IF EXISTS public.cluster_settings`.execute(db);
|
|
6892
6950
|
}
|
|
6893
6951
|
//#endregion
|
|
6894
6952
|
//#region src/db/migrations/081_org_settings_queue_timeout.ts
|
|
6895
6953
|
var _081_org_settings_queue_timeout_exports = /* @__PURE__ */ __exportAll({
|
|
6896
|
-
down: () => down$
|
|
6897
|
-
up: () => up$
|
|
6954
|
+
down: () => down$27,
|
|
6955
|
+
up: () => up$27
|
|
6898
6956
|
});
|
|
6899
6957
|
/**
|
|
6900
6958
|
* Add `org_settings.queue_timeout_ms BIGINT` (nullable).
|
|
@@ -6911,7 +6969,7 @@ var _081_org_settings_queue_timeout_exports = /* @__PURE__ */ __exportAll({
|
|
|
6911
6969
|
*
|
|
6912
6970
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
6913
6971
|
*/
|
|
6914
|
-
async function up$
|
|
6972
|
+
async function up$27(db) {
|
|
6915
6973
|
if ((await sql`
|
|
6916
6974
|
SELECT EXISTS (
|
|
6917
6975
|
SELECT 1 FROM information_schema.columns
|
|
@@ -6925,7 +6983,7 @@ async function up$26(db) {
|
|
|
6925
6983
|
ADD COLUMN queue_timeout_ms BIGINT
|
|
6926
6984
|
`.execute(db);
|
|
6927
6985
|
}
|
|
6928
|
-
async function down$
|
|
6986
|
+
async function down$27(db) {
|
|
6929
6987
|
await sql`
|
|
6930
6988
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS queue_timeout_ms
|
|
6931
6989
|
`.execute(db);
|
|
@@ -6933,8 +6991,8 @@ async function down$26(db) {
|
|
|
6933
6991
|
//#endregion
|
|
6934
6992
|
//#region src/db/migrations/082_host_s3_reachable.ts
|
|
6935
6993
|
var _082_host_s3_reachable_exports = /* @__PURE__ */ __exportAll({
|
|
6936
|
-
down: () => down$
|
|
6937
|
-
up: () => up$
|
|
6994
|
+
down: () => down$26,
|
|
6995
|
+
up: () => up$26
|
|
6938
6996
|
});
|
|
6939
6997
|
/**
|
|
6940
6998
|
* Add `host_roster.s3_reachable BOOLEAN` (nullable).
|
|
@@ -6948,7 +7006,7 @@ var _082_host_s3_reachable_exports = /* @__PURE__ */ __exportAll({
|
|
|
6948
7006
|
*
|
|
6949
7007
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
6950
7008
|
*/
|
|
6951
|
-
async function up$
|
|
7009
|
+
async function up$26(db) {
|
|
6952
7010
|
if ((await sql`
|
|
6953
7011
|
SELECT EXISTS (
|
|
6954
7012
|
SELECT 1 FROM information_schema.columns
|
|
@@ -6962,7 +7020,7 @@ async function up$25(db) {
|
|
|
6962
7020
|
ADD COLUMN s3_reachable BOOLEAN
|
|
6963
7021
|
`.execute(db);
|
|
6964
7022
|
}
|
|
6965
|
-
async function down$
|
|
7023
|
+
async function down$26(db) {
|
|
6966
7024
|
await sql`
|
|
6967
7025
|
ALTER TABLE public.host_roster DROP COLUMN IF EXISTS s3_reachable
|
|
6968
7026
|
`.execute(db);
|
|
@@ -6970,8 +7028,8 @@ async function down$25(db) {
|
|
|
6970
7028
|
//#endregion
|
|
6971
7029
|
//#region src/db/migrations/083_org_settings_artifact_caps.ts
|
|
6972
7030
|
var _083_org_settings_artifact_caps_exports = /* @__PURE__ */ __exportAll({
|
|
6973
|
-
down: () => down$
|
|
6974
|
-
up: () => up$
|
|
7031
|
+
down: () => down$25,
|
|
7032
|
+
up: () => up$25
|
|
6975
7033
|
});
|
|
6976
7034
|
/**
|
|
6977
7035
|
* Add `org_settings.artifact_max_bytes` + `artifact_max_per_run` (both nullable
|
|
@@ -6987,7 +7045,7 @@ var _083_org_settings_artifact_caps_exports = /* @__PURE__ */ __exportAll({
|
|
|
6987
7045
|
* Idempotent: guarded on column existence; a re-run on a DB that already has a
|
|
6988
7046
|
* column is a no-op.
|
|
6989
7047
|
*/
|
|
6990
|
-
async function up$
|
|
7048
|
+
async function up$25(db) {
|
|
6991
7049
|
for (const col of ["artifact_max_bytes", "artifact_max_per_run"]) {
|
|
6992
7050
|
if ((await sql`
|
|
6993
7051
|
SELECT EXISTS (
|
|
@@ -7000,15 +7058,15 @@ async function up$24(db) {
|
|
|
7000
7058
|
await sql`ALTER TABLE public.org_settings ADD COLUMN ${sql.ref(col)} BIGINT`.execute(db);
|
|
7001
7059
|
}
|
|
7002
7060
|
}
|
|
7003
|
-
async function down$
|
|
7061
|
+
async function down$25(db) {
|
|
7004
7062
|
await sql`ALTER TABLE public.org_settings DROP COLUMN IF EXISTS artifact_max_bytes`.execute(db);
|
|
7005
7063
|
await sql`ALTER TABLE public.org_settings DROP COLUMN IF EXISTS artifact_max_per_run`.execute(db);
|
|
7006
7064
|
}
|
|
7007
7065
|
//#endregion
|
|
7008
7066
|
//#region src/db/migrations/084_orchestrator_signing_keys.ts
|
|
7009
7067
|
var _084_orchestrator_signing_keys_exports = /* @__PURE__ */ __exportAll({
|
|
7010
|
-
down: () => down$
|
|
7011
|
-
up: () => up$
|
|
7068
|
+
down: () => down$24,
|
|
7069
|
+
up: () => up$24
|
|
7012
7070
|
});
|
|
7013
7071
|
/**
|
|
7014
7072
|
* Add the `orchestrator_signing_keys` table: the cluster-scoped, long-lived
|
|
@@ -7026,12 +7084,12 @@ var _084_orchestrator_signing_keys_exports = /* @__PURE__ */ __exportAll({
|
|
|
7026
7084
|
*
|
|
7027
7085
|
* Idempotent: guarded on table existence.
|
|
7028
7086
|
*/
|
|
7029
|
-
async function up$
|
|
7087
|
+
async function up$24(db) {
|
|
7030
7088
|
if (await tableExists$1(db, "orchestrator_signing_keys")) return;
|
|
7031
7089
|
await db.schema.createTable("orchestrator_signing_keys").addColumn("kid", "text", (c) => c.primaryKey()).addColumn("public_jwk", "jsonb", (c) => c.notNull()).addColumn("encrypted_private_jwk", "text").addColumn("key_version", "integer", (c) => c.notNull().defaultTo(1)).addColumn("alg", "text", (c) => c.notNull()).addColumn("signer_kind", "text", (c) => c.notNull()).addColumn("key_ref", "text").addColumn("status", "text", (c) => c.notNull().defaultTo("active")).addColumn("revocation_reason", "text").addColumn("created_at", "timestamptz", (c) => c.notNull().defaultTo(sql`now()`)).addColumn("activated_at", "timestamptz").addColumn("retired_at", "timestamptz").addColumn("revoked_at", "timestamptz").execute();
|
|
7032
7090
|
await db.schema.createIndex("idx_orch_signing_keys_status").on("orchestrator_signing_keys").column("status").execute();
|
|
7033
7091
|
}
|
|
7034
|
-
async function down$
|
|
7092
|
+
async function down$24(db) {
|
|
7035
7093
|
await db.schema.dropTable("orchestrator_signing_keys").ifExists().execute();
|
|
7036
7094
|
}
|
|
7037
7095
|
async function tableExists$1(db, table) {
|
|
@@ -7045,8 +7103,8 @@ async function tableExists$1(db, table) {
|
|
|
7045
7103
|
//#endregion
|
|
7046
7104
|
//#region src/db/migrations/085_cluster_settings_reroute_flap_grace_ms.ts
|
|
7047
7105
|
var _085_cluster_settings_reroute_flap_grace_ms_exports = /* @__PURE__ */ __exportAll({
|
|
7048
|
-
down: () => down$
|
|
7049
|
-
up: () => up$
|
|
7106
|
+
down: () => down$23,
|
|
7107
|
+
up: () => up$23
|
|
7050
7108
|
});
|
|
7051
7109
|
/**
|
|
7052
7110
|
* Add `cluster_settings.reroute_flap_grace_ms` (nullable BIGINT).
|
|
@@ -7056,7 +7114,7 @@ var _085_cluster_settings_reroute_flap_grace_ms_exports = /* @__PURE__ */ __expo
|
|
|
7056
7114
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7057
7115
|
* the column is a no-op.
|
|
7058
7116
|
*/
|
|
7059
|
-
async function up$
|
|
7117
|
+
async function up$23(db) {
|
|
7060
7118
|
if ((await sql`
|
|
7061
7119
|
SELECT EXISTS (
|
|
7062
7120
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7067,14 +7125,14 @@ async function up$22(db) {
|
|
|
7067
7125
|
`.execute(db)).rows[0]?.exists) return;
|
|
7068
7126
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN reroute_flap_grace_ms BIGINT`.execute(db);
|
|
7069
7127
|
}
|
|
7070
|
-
async function down$
|
|
7128
|
+
async function down$23(db) {
|
|
7071
7129
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS reroute_flap_grace_ms`.execute(db);
|
|
7072
7130
|
}
|
|
7073
7131
|
//#endregion
|
|
7074
7132
|
//#region src/db/migrations/086_cluster_settings_max_fanout_hosts.ts
|
|
7075
7133
|
var _086_cluster_settings_max_fanout_hosts_exports = /* @__PURE__ */ __exportAll({
|
|
7076
|
-
down: () => down$
|
|
7077
|
-
up: () => up$
|
|
7134
|
+
down: () => down$22,
|
|
7135
|
+
up: () => up$22
|
|
7078
7136
|
});
|
|
7079
7137
|
/**
|
|
7080
7138
|
* Add `cluster_settings.max_fanout_hosts` (nullable INTEGER).
|
|
@@ -7084,7 +7142,7 @@ var _086_cluster_settings_max_fanout_hosts_exports = /* @__PURE__ */ __exportAll
|
|
|
7084
7142
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7085
7143
|
* the column is a no-op.
|
|
7086
7144
|
*/
|
|
7087
|
-
async function up$
|
|
7145
|
+
async function up$22(db) {
|
|
7088
7146
|
if ((await sql`
|
|
7089
7147
|
SELECT EXISTS (
|
|
7090
7148
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7095,14 +7153,14 @@ async function up$21(db) {
|
|
|
7095
7153
|
`.execute(db)).rows[0]?.exists) return;
|
|
7096
7154
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN max_fanout_hosts INTEGER`.execute(db);
|
|
7097
7155
|
}
|
|
7098
|
-
async function down$
|
|
7156
|
+
async function down$22(db) {
|
|
7099
7157
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS max_fanout_hosts`.execute(db);
|
|
7100
7158
|
}
|
|
7101
7159
|
//#endregion
|
|
7102
7160
|
//#region src/db/migrations/087_cluster_settings_event_router_rate_limit.ts
|
|
7103
7161
|
var _087_cluster_settings_event_router_rate_limit_exports = /* @__PURE__ */ __exportAll({
|
|
7104
|
-
down: () => down$
|
|
7105
|
-
up: () => up$
|
|
7162
|
+
down: () => down$21,
|
|
7163
|
+
up: () => up$21
|
|
7106
7164
|
});
|
|
7107
7165
|
/**
|
|
7108
7166
|
* Add `cluster_settings.event_router_rate_limit_per_workflow_per_minute` (nullable INTEGER).
|
|
@@ -7112,7 +7170,7 @@ var _087_cluster_settings_event_router_rate_limit_exports = /* @__PURE__ */ __ex
|
|
|
7112
7170
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7113
7171
|
* the column is a no-op.
|
|
7114
7172
|
*/
|
|
7115
|
-
async function up$
|
|
7173
|
+
async function up$21(db) {
|
|
7116
7174
|
if ((await sql`
|
|
7117
7175
|
SELECT EXISTS (
|
|
7118
7176
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7123,14 +7181,14 @@ async function up$20(db) {
|
|
|
7123
7181
|
`.execute(db)).rows[0]?.exists) return;
|
|
7124
7182
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN event_router_rate_limit_per_workflow_per_minute INTEGER`.execute(db);
|
|
7125
7183
|
}
|
|
7126
|
-
async function down$
|
|
7184
|
+
async function down$21(db) {
|
|
7127
7185
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS event_router_rate_limit_per_workflow_per_minute`.execute(db);
|
|
7128
7186
|
}
|
|
7129
7187
|
//#endregion
|
|
7130
7188
|
//#region src/db/migrations/088_cluster_settings_cache_max_tarball_bytes.ts
|
|
7131
7189
|
var _088_cluster_settings_cache_max_tarball_bytes_exports = /* @__PURE__ */ __exportAll({
|
|
7132
|
-
down: () => down$
|
|
7133
|
-
up: () => up$
|
|
7190
|
+
down: () => down$20,
|
|
7191
|
+
up: () => up$20
|
|
7134
7192
|
});
|
|
7135
7193
|
/**
|
|
7136
7194
|
* Add `cluster_settings.cache_max_tarball_bytes` (nullable BIGINT).
|
|
@@ -7140,7 +7198,7 @@ var _088_cluster_settings_cache_max_tarball_bytes_exports = /* @__PURE__ */ __ex
|
|
|
7140
7198
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7141
7199
|
* the column is a no-op.
|
|
7142
7200
|
*/
|
|
7143
|
-
async function up$
|
|
7201
|
+
async function up$20(db) {
|
|
7144
7202
|
if ((await sql`
|
|
7145
7203
|
SELECT EXISTS (
|
|
7146
7204
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7151,14 +7209,14 @@ async function up$19(db) {
|
|
|
7151
7209
|
`.execute(db)).rows[0]?.exists) return;
|
|
7152
7210
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN cache_max_tarball_bytes BIGINT`.execute(db);
|
|
7153
7211
|
}
|
|
7154
|
-
async function down$
|
|
7212
|
+
async function down$20(db) {
|
|
7155
7213
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS cache_max_tarball_bytes`.execute(db);
|
|
7156
7214
|
}
|
|
7157
7215
|
//#endregion
|
|
7158
7216
|
//#region src/db/migrations/089_cluster_settings_cache_ttl_days.ts
|
|
7159
7217
|
var _089_cluster_settings_cache_ttl_days_exports = /* @__PURE__ */ __exportAll({
|
|
7160
|
-
down: () => down$
|
|
7161
|
-
up: () => up$
|
|
7218
|
+
down: () => down$19,
|
|
7219
|
+
up: () => up$19
|
|
7162
7220
|
});
|
|
7163
7221
|
/**
|
|
7164
7222
|
* Add `cluster_settings.cache_ttl_days` (nullable INTEGER).
|
|
@@ -7168,7 +7226,7 @@ var _089_cluster_settings_cache_ttl_days_exports = /* @__PURE__ */ __exportAll({
|
|
|
7168
7226
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7169
7227
|
* the column is a no-op.
|
|
7170
7228
|
*/
|
|
7171
|
-
async function up$
|
|
7229
|
+
async function up$19(db) {
|
|
7172
7230
|
if ((await sql`
|
|
7173
7231
|
SELECT EXISTS (
|
|
7174
7232
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7179,14 +7237,14 @@ async function up$18(db) {
|
|
|
7179
7237
|
`.execute(db)).rows[0]?.exists) return;
|
|
7180
7238
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN cache_ttl_days INTEGER`.execute(db);
|
|
7181
7239
|
}
|
|
7182
|
-
async function down$
|
|
7240
|
+
async function down$19(db) {
|
|
7183
7241
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS cache_ttl_days`.execute(db);
|
|
7184
7242
|
}
|
|
7185
7243
|
//#endregion
|
|
7186
7244
|
//#region src/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.ts
|
|
7187
7245
|
var _090_cluster_settings_concurrency_wait_timeout_ms_exports = /* @__PURE__ */ __exportAll({
|
|
7188
|
-
down: () => down$
|
|
7189
|
-
up: () => up$
|
|
7246
|
+
down: () => down$18,
|
|
7247
|
+
up: () => up$18
|
|
7190
7248
|
});
|
|
7191
7249
|
/**
|
|
7192
7250
|
* Add `cluster_settings.concurrency_wait_timeout_ms` (nullable BIGINT).
|
|
@@ -7196,7 +7254,7 @@ var _090_cluster_settings_concurrency_wait_timeout_ms_exports = /* @__PURE__ */
|
|
|
7196
7254
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7197
7255
|
* the column is a no-op.
|
|
7198
7256
|
*/
|
|
7199
|
-
async function up$
|
|
7257
|
+
async function up$18(db) {
|
|
7200
7258
|
if ((await sql`
|
|
7201
7259
|
SELECT EXISTS (
|
|
7202
7260
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7207,14 +7265,14 @@ async function up$17(db) {
|
|
|
7207
7265
|
`.execute(db)).rows[0]?.exists) return;
|
|
7208
7266
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN concurrency_wait_timeout_ms BIGINT`.execute(db);
|
|
7209
7267
|
}
|
|
7210
|
-
async function down$
|
|
7268
|
+
async function down$18(db) {
|
|
7211
7269
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS concurrency_wait_timeout_ms`.execute(db);
|
|
7212
7270
|
}
|
|
7213
7271
|
//#endregion
|
|
7214
7272
|
//#region src/db/migrations/091_cluster_settings_agent_token_ttl_ms.ts
|
|
7215
7273
|
var _091_cluster_settings_agent_token_ttl_ms_exports = /* @__PURE__ */ __exportAll({
|
|
7216
|
-
down: () => down$
|
|
7217
|
-
up: () => up$
|
|
7274
|
+
down: () => down$17,
|
|
7275
|
+
up: () => up$17
|
|
7218
7276
|
});
|
|
7219
7277
|
/**
|
|
7220
7278
|
* Add `cluster_settings.agent_token_ttl_ms` (nullable BIGINT).
|
|
@@ -7224,7 +7282,7 @@ var _091_cluster_settings_agent_token_ttl_ms_exports = /* @__PURE__ */ __exportA
|
|
|
7224
7282
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7225
7283
|
* the column is a no-op.
|
|
7226
7284
|
*/
|
|
7227
|
-
async function up$
|
|
7285
|
+
async function up$17(db) {
|
|
7228
7286
|
if ((await sql`
|
|
7229
7287
|
SELECT EXISTS (
|
|
7230
7288
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7235,14 +7293,14 @@ async function up$16(db) {
|
|
|
7235
7293
|
`.execute(db)).rows[0]?.exists) return;
|
|
7236
7294
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN agent_token_ttl_ms BIGINT`.execute(db);
|
|
7237
7295
|
}
|
|
7238
|
-
async function down$
|
|
7296
|
+
async function down$17(db) {
|
|
7239
7297
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS agent_token_ttl_ms`.execute(db);
|
|
7240
7298
|
}
|
|
7241
7299
|
//#endregion
|
|
7242
7300
|
//#region src/db/migrations/092_cluster_settings_version.ts
|
|
7243
7301
|
var _092_cluster_settings_version_exports = /* @__PURE__ */ __exportAll({
|
|
7244
|
-
down: () => down$
|
|
7245
|
-
up: () => up$
|
|
7302
|
+
down: () => down$16,
|
|
7303
|
+
up: () => up$16
|
|
7246
7304
|
});
|
|
7247
7305
|
/**
|
|
7248
7306
|
* Add `cluster_settings.version` (monotonic BIGINT, bumped on each settings
|
|
@@ -7256,7 +7314,7 @@ var _092_cluster_settings_version_exports = /* @__PURE__ */ __exportAll({
|
|
|
7256
7314
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7257
7315
|
* the column is a no-op.
|
|
7258
7316
|
*/
|
|
7259
|
-
async function up$
|
|
7317
|
+
async function up$16(db) {
|
|
7260
7318
|
if ((await sql`
|
|
7261
7319
|
SELECT EXISTS (
|
|
7262
7320
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7267,14 +7325,14 @@ async function up$15(db) {
|
|
|
7267
7325
|
`.execute(db)).rows[0]?.exists) return;
|
|
7268
7326
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN version BIGINT NOT NULL DEFAULT 0`.execute(db);
|
|
7269
7327
|
}
|
|
7270
|
-
async function down$
|
|
7328
|
+
async function down$16(db) {
|
|
7271
7329
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS version`.execute(db);
|
|
7272
7330
|
}
|
|
7273
7331
|
//#endregion
|
|
7274
7332
|
//#region src/db/migrations/093_org_settings_sandbox_allowlist.ts
|
|
7275
7333
|
var _093_org_settings_sandbox_allowlist_exports = /* @__PURE__ */ __exportAll({
|
|
7276
|
-
down: () => down$
|
|
7277
|
-
up: () => up$
|
|
7334
|
+
down: () => down$15,
|
|
7335
|
+
up: () => up$15
|
|
7278
7336
|
});
|
|
7279
7337
|
/**
|
|
7280
7338
|
* Add the per-org container-sandbox escape-hatch allow-list to `org_settings`:
|
|
@@ -7292,7 +7350,7 @@ var _093_org_settings_sandbox_allowlist_exports = /* @__PURE__ */ __exportAll({
|
|
|
7292
7350
|
*
|
|
7293
7351
|
* Idempotent: a re-run on a DB that already has a column skips that column.
|
|
7294
7352
|
*/
|
|
7295
|
-
async function columnExists$
|
|
7353
|
+
async function columnExists$4(db, column) {
|
|
7296
7354
|
return (await sql`
|
|
7297
7355
|
SELECT EXISTS (
|
|
7298
7356
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7302,17 +7360,17 @@ async function columnExists$3(db, column) {
|
|
|
7302
7360
|
) AS exists
|
|
7303
7361
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
7304
7362
|
}
|
|
7305
|
-
async function up$
|
|
7306
|
-
if (!await columnExists$
|
|
7363
|
+
async function up$15(db) {
|
|
7364
|
+
if (!await columnExists$4(db, "sandbox_allowed_capabilities")) await sql`
|
|
7307
7365
|
ALTER TABLE public.org_settings
|
|
7308
7366
|
ADD COLUMN sandbox_allowed_capabilities TEXT[]
|
|
7309
7367
|
`.execute(db);
|
|
7310
|
-
if (!await columnExists$
|
|
7368
|
+
if (!await columnExists$4(db, "sandbox_allow_host_network")) await sql`
|
|
7311
7369
|
ALTER TABLE public.org_settings
|
|
7312
7370
|
ADD COLUMN sandbox_allow_host_network BOOLEAN
|
|
7313
7371
|
`.execute(db);
|
|
7314
7372
|
}
|
|
7315
|
-
async function down$
|
|
7373
|
+
async function down$15(db) {
|
|
7316
7374
|
await sql`
|
|
7317
7375
|
ALTER TABLE public.org_settings DROP COLUMN IF EXISTS sandbox_allowed_capabilities
|
|
7318
7376
|
`.execute(db);
|
|
@@ -7323,8 +7381,8 @@ async function down$14(db) {
|
|
|
7323
7381
|
//#endregion
|
|
7324
7382
|
//#region src/db/migrations/094_dashboard_encryption_keys.ts
|
|
7325
7383
|
var _094_dashboard_encryption_keys_exports = /* @__PURE__ */ __exportAll({
|
|
7326
|
-
down: () => down$
|
|
7327
|
-
up: () => up$
|
|
7384
|
+
down: () => down$14,
|
|
7385
|
+
up: () => up$14
|
|
7328
7386
|
});
|
|
7329
7387
|
/**
|
|
7330
7388
|
* Add the `dashboard_encryption_keys` table: the cluster-scoped, long-lived
|
|
@@ -7343,12 +7401,12 @@ var _094_dashboard_encryption_keys_exports = /* @__PURE__ */ __exportAll({
|
|
|
7343
7401
|
*
|
|
7344
7402
|
* Idempotent: guarded on table existence.
|
|
7345
7403
|
*/
|
|
7346
|
-
async function up$
|
|
7404
|
+
async function up$14(db) {
|
|
7347
7405
|
if (await tableExists(db, "dashboard_encryption_keys")) return;
|
|
7348
7406
|
await db.schema.createTable("dashboard_encryption_keys").addColumn("kid", "text", (c) => c.primaryKey()).addColumn("public_jwk", "jsonb", (c) => c.notNull()).addColumn("encrypted_private_key", "text", (c) => c.notNull()).addColumn("status", "text", (c) => c.notNull().defaultTo("active")).addColumn("revocation_reason", "text").addColumn("created_at", "timestamptz", (c) => c.notNull().defaultTo(sql`now()`)).addColumn("activated_at", "timestamptz").addColumn("revoked_at", "timestamptz").execute();
|
|
7349
7407
|
await db.schema.createIndex("idx_dashboard_encryption_keys_status").on("dashboard_encryption_keys").column("status").execute();
|
|
7350
7408
|
}
|
|
7351
|
-
async function down$
|
|
7409
|
+
async function down$14(db) {
|
|
7352
7410
|
await db.schema.dropTable("dashboard_encryption_keys").ifExists().execute();
|
|
7353
7411
|
}
|
|
7354
7412
|
async function tableExists(db, table) {
|
|
@@ -7362,8 +7420,8 @@ async function tableExists(db, table) {
|
|
|
7362
7420
|
//#endregion
|
|
7363
7421
|
//#region src/db/migrations/095_dashboard_write_policy_tristate.ts
|
|
7364
7422
|
var _095_dashboard_write_policy_tristate_exports = /* @__PURE__ */ __exportAll({
|
|
7365
|
-
down: () => down$
|
|
7366
|
-
up: () => up$
|
|
7423
|
+
down: () => down$13,
|
|
7424
|
+
up: () => up$13
|
|
7367
7425
|
});
|
|
7368
7426
|
/**
|
|
7369
7427
|
* Migrate stored `org_settings.dashboard_write_policy` JSONB from the legacy
|
|
@@ -7381,7 +7439,7 @@ var _095_dashboard_write_policy_tristate_exports = /* @__PURE__ */ __exportAll({
|
|
|
7381
7439
|
* Pure SQL rewrite: for each row, rebuild the object keeping only non-`true`
|
|
7382
7440
|
* entries and mapping `false` → `'disabled'`, leaving existing string values.
|
|
7383
7441
|
*/
|
|
7384
|
-
async function up$
|
|
7442
|
+
async function up$13(db) {
|
|
7385
7443
|
await sql`
|
|
7386
7444
|
UPDATE org_settings
|
|
7387
7445
|
SET dashboard_write_policy = COALESCE(
|
|
@@ -7408,12 +7466,12 @@ async function up$12(db) {
|
|
|
7408
7466
|
)
|
|
7409
7467
|
`.execute(db);
|
|
7410
7468
|
}
|
|
7411
|
-
async function down$
|
|
7469
|
+
async function down$13() {}
|
|
7412
7470
|
//#endregion
|
|
7413
7471
|
//#region src/db/migrations/096_multi_schedule_cron_last_fired.ts
|
|
7414
7472
|
var _096_multi_schedule_cron_last_fired_exports = /* @__PURE__ */ __exportAll({
|
|
7415
|
-
down: () => down$
|
|
7416
|
-
up: () => up$
|
|
7473
|
+
down: () => down$12,
|
|
7474
|
+
up: () => up$12
|
|
7417
7475
|
});
|
|
7418
7476
|
/**
|
|
7419
7477
|
* Track cron last-fired per (registration, schedule) instead of per
|
|
@@ -7428,7 +7486,7 @@ var _096_multi_schedule_cron_last_fired_exports = /* @__PURE__ */ __exportAll({
|
|
|
7428
7486
|
*
|
|
7429
7487
|
* Idempotent: re-running on an already-migrated DB skips each step.
|
|
7430
7488
|
*/
|
|
7431
|
-
async function columnExists$
|
|
7489
|
+
async function columnExists$3(db, column) {
|
|
7432
7490
|
return (await sql`
|
|
7433
7491
|
SELECT EXISTS (
|
|
7434
7492
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7448,8 +7506,8 @@ async function primaryKeyColumns(db) {
|
|
|
7448
7506
|
ORDER BY a.attnum
|
|
7449
7507
|
`.execute(db)).rows.map((row) => row.attname);
|
|
7450
7508
|
}
|
|
7451
|
-
async function up$
|
|
7452
|
-
if (!await columnExists$
|
|
7509
|
+
async function up$12(db) {
|
|
7510
|
+
if (!await columnExists$3(db, "schedule_key")) await sql`ALTER TABLE public.cron_last_fired ADD COLUMN schedule_key text`.execute(db);
|
|
7453
7511
|
await sql`
|
|
7454
7512
|
UPDATE public.cron_last_fired clf
|
|
7455
7513
|
SET schedule_key = k.key
|
|
@@ -7475,7 +7533,7 @@ async function up$11(db) {
|
|
|
7475
7533
|
`.execute(db);
|
|
7476
7534
|
}
|
|
7477
7535
|
}
|
|
7478
|
-
async function down$
|
|
7536
|
+
async function down$12(db) {
|
|
7479
7537
|
await sql`
|
|
7480
7538
|
DELETE FROM public.cron_last_fired a
|
|
7481
7539
|
USING public.cron_last_fired b
|
|
@@ -7487,13 +7545,13 @@ async function down$11(db) {
|
|
|
7487
7545
|
ALTER TABLE public.cron_last_fired
|
|
7488
7546
|
ADD CONSTRAINT cron_last_fired_pkey PRIMARY KEY (registration_id)
|
|
7489
7547
|
`.execute(db);
|
|
7490
|
-
if (await columnExists$
|
|
7548
|
+
if (await columnExists$3(db, "schedule_key")) await sql`ALTER TABLE public.cron_last_fired DROP COLUMN schedule_key`.execute(db);
|
|
7491
7549
|
}
|
|
7492
7550
|
//#endregion
|
|
7493
7551
|
//#region src/db/migrations/097_execution_runs_pr_number.ts
|
|
7494
7552
|
var _097_execution_runs_pr_number_exports = /* @__PURE__ */ __exportAll({
|
|
7495
|
-
down: () => down$
|
|
7496
|
-
up: () => up$
|
|
7553
|
+
down: () => down$11,
|
|
7554
|
+
up: () => up$11
|
|
7497
7555
|
});
|
|
7498
7556
|
/**
|
|
7499
7557
|
* Add `pr_number INTEGER NULL` to `execution_runs`.
|
|
@@ -7506,7 +7564,7 @@ var _097_execution_runs_pr_number_exports = /* @__PURE__ */ __exportAll({
|
|
|
7506
7564
|
*
|
|
7507
7565
|
* Idempotent: a re-run on a DB that already has the column is a no-op.
|
|
7508
7566
|
*/
|
|
7509
|
-
async function columnExists$
|
|
7567
|
+
async function columnExists$2(db, column) {
|
|
7510
7568
|
return (await sql`
|
|
7511
7569
|
SELECT EXISTS (
|
|
7512
7570
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7516,13 +7574,13 @@ async function columnExists$1(db, column) {
|
|
|
7516
7574
|
) AS exists
|
|
7517
7575
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
7518
7576
|
}
|
|
7519
|
-
async function up$
|
|
7520
|
-
if (!await columnExists$
|
|
7577
|
+
async function up$11(db) {
|
|
7578
|
+
if (!await columnExists$2(db, "pr_number")) await sql`
|
|
7521
7579
|
ALTER TABLE public.execution_runs
|
|
7522
7580
|
ADD COLUMN pr_number INTEGER
|
|
7523
7581
|
`.execute(db);
|
|
7524
7582
|
}
|
|
7525
|
-
async function down$
|
|
7583
|
+
async function down$11(db) {
|
|
7526
7584
|
await sql`
|
|
7527
7585
|
ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS pr_number
|
|
7528
7586
|
`.execute(db);
|
|
@@ -7530,8 +7588,8 @@ async function down$10(db) {
|
|
|
7530
7588
|
//#endregion
|
|
7531
7589
|
//#region src/db/migrations/098_execution_runs_customer_id.ts
|
|
7532
7590
|
var _098_execution_runs_customer_id_exports = /* @__PURE__ */ __exportAll({
|
|
7533
|
-
down: () => down$
|
|
7534
|
-
up: () => up$
|
|
7591
|
+
down: () => down$10,
|
|
7592
|
+
up: () => up$10
|
|
7535
7593
|
});
|
|
7536
7594
|
/**
|
|
7537
7595
|
* Denormalize the owning org onto `execution_runs` so the concurrency-gate
|
|
@@ -7549,7 +7607,7 @@ var _098_execution_runs_customer_id_exports = /* @__PURE__ */ __exportAll({
|
|
|
7549
7607
|
*
|
|
7550
7608
|
* Idempotent: re-running skips the column when it already exists.
|
|
7551
7609
|
*/
|
|
7552
|
-
async function columnExists(db, column) {
|
|
7610
|
+
async function columnExists$1(db, column) {
|
|
7553
7611
|
return (await sql`
|
|
7554
7612
|
SELECT EXISTS (
|
|
7555
7613
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7559,8 +7617,8 @@ async function columnExists(db, column) {
|
|
|
7559
7617
|
) AS exists
|
|
7560
7618
|
`.execute(db)).rows[0]?.exists ?? false;
|
|
7561
7619
|
}
|
|
7562
|
-
async function up$
|
|
7563
|
-
if (!await columnExists(db, "customer_id")) {
|
|
7620
|
+
async function up$10(db) {
|
|
7621
|
+
if (!await columnExists$1(db, "customer_id")) {
|
|
7564
7622
|
await sql`
|
|
7565
7623
|
ALTER TABLE public.execution_runs
|
|
7566
7624
|
ADD COLUMN customer_id TEXT NOT NULL DEFAULT '__default__'
|
|
@@ -7583,7 +7641,7 @@ async function up$9(db) {
|
|
|
7583
7641
|
ON public.execution_runs (customer_id, context)
|
|
7584
7642
|
`.execute(db);
|
|
7585
7643
|
}
|
|
7586
|
-
async function down$
|
|
7644
|
+
async function down$10(db) {
|
|
7587
7645
|
await sql`DROP INDEX IF EXISTS execution_runs_customer_id_context_idx`.execute(db);
|
|
7588
7646
|
await sql`
|
|
7589
7647
|
ALTER TABLE public.execution_runs DROP COLUMN IF EXISTS customer_id
|
|
@@ -7592,8 +7650,8 @@ async function down$9(db) {
|
|
|
7592
7650
|
//#endregion
|
|
7593
7651
|
//#region src/db/migrations/099_cluster_settings_dashboard_verified_issuer.ts
|
|
7594
7652
|
var _099_cluster_settings_dashboard_verified_issuer_exports = /* @__PURE__ */ __exportAll({
|
|
7595
|
-
down: () => down$
|
|
7596
|
-
up: () => up$
|
|
7653
|
+
down: () => down$9,
|
|
7654
|
+
up: () => up$9
|
|
7597
7655
|
});
|
|
7598
7656
|
/**
|
|
7599
7657
|
* Add `cluster_settings.dashboard_verified_issuer` (nullable text).
|
|
@@ -7612,7 +7670,7 @@ var _099_cluster_settings_dashboard_verified_issuer_exports = /* @__PURE__ */ __
|
|
|
7612
7670
|
* Idempotent: guarded on column existence; a re-run on a DB that already has the
|
|
7613
7671
|
* column is a no-op.
|
|
7614
7672
|
*/
|
|
7615
|
-
async function up$
|
|
7673
|
+
async function up$9(db) {
|
|
7616
7674
|
if ((await sql`
|
|
7617
7675
|
SELECT EXISTS (
|
|
7618
7676
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7623,14 +7681,14 @@ async function up$8(db) {
|
|
|
7623
7681
|
`.execute(db)).rows[0]?.exists) return;
|
|
7624
7682
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN dashboard_verified_issuer TEXT`.execute(db);
|
|
7625
7683
|
}
|
|
7626
|
-
async function down$
|
|
7684
|
+
async function down$9(db) {
|
|
7627
7685
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS dashboard_verified_issuer`.execute(db);
|
|
7628
7686
|
}
|
|
7629
7687
|
//#endregion
|
|
7630
7688
|
//#region src/db/migrations/100_held_runs_hold_type_vocabulary.ts
|
|
7631
7689
|
var _100_held_runs_hold_type_vocabulary_exports = /* @__PURE__ */ __exportAll({
|
|
7632
|
-
down: () => down$
|
|
7633
|
-
up: () => up$
|
|
7690
|
+
down: () => down$8,
|
|
7691
|
+
up: () => up$8
|
|
7634
7692
|
});
|
|
7635
7693
|
/**
|
|
7636
7694
|
* Realign `held_runs.hold_type` onto the engine's `HoldType` vocabulary.
|
|
@@ -7649,7 +7707,7 @@ var _100_held_runs_hold_type_vocabulary_exports = /* @__PURE__ */ __exportAll({
|
|
|
7649
7707
|
*
|
|
7650
7708
|
* Idempotent: a second run matches no rows.
|
|
7651
7709
|
*/
|
|
7652
|
-
async function up$
|
|
7710
|
+
async function up$8(db) {
|
|
7653
7711
|
await sql`UPDATE public.held_runs SET hold_type = 'reviewer' WHERE hold_type = 'approval'`.execute(db);
|
|
7654
7712
|
await sql`UPDATE public.held_runs SET hold_type = 'timer' WHERE hold_type = 'wait_timer'`.execute(db);
|
|
7655
7713
|
}
|
|
@@ -7663,15 +7721,15 @@ async function up$7(db) {
|
|
|
7663
7721
|
* `wait_timer` alone, so leaving those rows spelled `timer` would strand them
|
|
7664
7722
|
* in the expire-and-fail path.
|
|
7665
7723
|
*/
|
|
7666
|
-
async function down$
|
|
7724
|
+
async function down$8(db) {
|
|
7667
7725
|
await sql`UPDATE public.held_runs SET hold_type = 'approval' WHERE hold_type = 'reviewer'`.execute(db);
|
|
7668
7726
|
await sql`UPDATE public.held_runs SET hold_type = 'wait_timer' WHERE hold_type = 'timer'`.execute(db);
|
|
7669
7727
|
}
|
|
7670
7728
|
//#endregion
|
|
7671
7729
|
//#region src/db/migrations/101_contexts_hold_expiry_drop_default.ts
|
|
7672
7730
|
var _101_contexts_hold_expiry_drop_default_exports = /* @__PURE__ */ __exportAll({
|
|
7673
|
-
down: () => down$
|
|
7674
|
-
up: () => up$
|
|
7731
|
+
down: () => down$7,
|
|
7732
|
+
up: () => up$7
|
|
7675
7733
|
});
|
|
7676
7734
|
/**
|
|
7677
7735
|
* Give the context hold expiry a single default, and retire the stored zeroes.
|
|
@@ -7692,7 +7750,7 @@ var _101_contexts_hold_expiry_drop_default_exports = /* @__PURE__ */ __exportAll
|
|
|
7692
7750
|
* Idempotent: dropping an absent default is a no-op and the UPDATE matches no
|
|
7693
7751
|
* rows on a second run.
|
|
7694
7752
|
*/
|
|
7695
|
-
async function up$
|
|
7753
|
+
async function up$7(db) {
|
|
7696
7754
|
await sql`ALTER TABLE public.contexts ALTER COLUMN hold_expiry_seconds DROP DEFAULT`.execute(db);
|
|
7697
7755
|
await sql`UPDATE public.contexts SET hold_expiry_seconds = NULL WHERE hold_expiry_seconds = 0`.execute(db);
|
|
7698
7756
|
}
|
|
@@ -7704,14 +7762,14 @@ async function up$6(db) {
|
|
|
7704
7762
|
* back to `0` would resume cancelling every hold on its context — so a
|
|
7705
7763
|
* rollback keeps them on the fallback rather than re-breaking them.
|
|
7706
7764
|
*/
|
|
7707
|
-
async function down$
|
|
7765
|
+
async function down$7(db) {
|
|
7708
7766
|
await sql`ALTER TABLE public.contexts ALTER COLUMN hold_expiry_seconds SET DEFAULT 86400`.execute(db);
|
|
7709
7767
|
}
|
|
7710
7768
|
//#endregion
|
|
7711
7769
|
//#region src/db/migrations/102_dispatch_queue_agent_id.ts
|
|
7712
7770
|
var _102_dispatch_queue_agent_id_exports = /* @__PURE__ */ __exportAll({
|
|
7713
|
-
down: () => down$
|
|
7714
|
-
up: () => up$
|
|
7771
|
+
down: () => down$6,
|
|
7772
|
+
up: () => up$6
|
|
7715
7773
|
});
|
|
7716
7774
|
/**
|
|
7717
7775
|
* Add `dispatch_queue.agent_id` (nullable text).
|
|
@@ -7729,7 +7787,7 @@ var _102_dispatch_queue_agent_id_exports = /* @__PURE__ */ __exportAll({
|
|
|
7729
7787
|
* Idempotent: guarded on column existence; a re-run on a DB that already has the
|
|
7730
7788
|
* column is a no-op.
|
|
7731
7789
|
*/
|
|
7732
|
-
async function up$
|
|
7790
|
+
async function up$6(db) {
|
|
7733
7791
|
if ((await sql`
|
|
7734
7792
|
SELECT EXISTS (
|
|
7735
7793
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7740,14 +7798,14 @@ async function up$5(db) {
|
|
|
7740
7798
|
`.execute(db)).rows[0]?.exists) return;
|
|
7741
7799
|
await sql`ALTER TABLE public.dispatch_queue ADD COLUMN agent_id TEXT`.execute(db);
|
|
7742
7800
|
}
|
|
7743
|
-
async function down$
|
|
7801
|
+
async function down$6(db) {
|
|
7744
7802
|
await sql`ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS agent_id`.execute(db);
|
|
7745
7803
|
}
|
|
7746
7804
|
//#endregion
|
|
7747
7805
|
//#region src/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.ts
|
|
7748
7806
|
var _103_cluster_settings_ownership_db_check_timeout_ms_exports = /* @__PURE__ */ __exportAll({
|
|
7749
|
-
down: () => down$
|
|
7750
|
-
up: () => up$
|
|
7807
|
+
down: () => down$5,
|
|
7808
|
+
up: () => up$5
|
|
7751
7809
|
});
|
|
7752
7810
|
/**
|
|
7753
7811
|
* Add `cluster_settings.ownership_db_check_timeout_ms` (nullable bigint).
|
|
@@ -7765,7 +7823,7 @@ var _103_cluster_settings_ownership_db_check_timeout_ms_exports = /* @__PURE__ *
|
|
|
7765
7823
|
* Idempotent: guarded on column existence; a re-run on a DB that already has the
|
|
7766
7824
|
* column is a no-op.
|
|
7767
7825
|
*/
|
|
7768
|
-
async function up$
|
|
7826
|
+
async function up$5(db) {
|
|
7769
7827
|
if ((await sql`
|
|
7770
7828
|
SELECT EXISTS (
|
|
7771
7829
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7776,14 +7834,14 @@ async function up$4(db) {
|
|
|
7776
7834
|
`.execute(db)).rows[0]?.exists) return;
|
|
7777
7835
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN ownership_db_check_timeout_ms BIGINT`.execute(db);
|
|
7778
7836
|
}
|
|
7779
|
-
async function down$
|
|
7837
|
+
async function down$5(db) {
|
|
7780
7838
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS ownership_db_check_timeout_ms`.execute(db);
|
|
7781
7839
|
}
|
|
7782
7840
|
//#endregion
|
|
7783
7841
|
//#region src/db/migrations/104_check_run_terminal_sent.ts
|
|
7784
7842
|
var _104_check_run_terminal_sent_exports = /* @__PURE__ */ __exportAll({
|
|
7785
|
-
down: () => down$
|
|
7786
|
-
up: () => up$
|
|
7843
|
+
down: () => down$4,
|
|
7844
|
+
up: () => up$4
|
|
7787
7845
|
});
|
|
7788
7846
|
/**
|
|
7789
7847
|
* Add `check_run_tracking.terminal_sent_at` (nullable timestamptz).
|
|
@@ -7803,7 +7861,7 @@ var _104_check_run_terminal_sent_exports = /* @__PURE__ */ __exportAll({
|
|
|
7803
7861
|
* Idempotent: guarded on column existence; a re-run on a DB that already has
|
|
7804
7862
|
* the column is a no-op.
|
|
7805
7863
|
*/
|
|
7806
|
-
async function up$
|
|
7864
|
+
async function up$4(db) {
|
|
7807
7865
|
if ((await sql`
|
|
7808
7866
|
SELECT EXISTS (
|
|
7809
7867
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7814,14 +7872,14 @@ async function up$3(db) {
|
|
|
7814
7872
|
`.execute(db)).rows[0]?.exists) return;
|
|
7815
7873
|
await sql`ALTER TABLE public.check_run_tracking ADD COLUMN terminal_sent_at TIMESTAMPTZ`.execute(db);
|
|
7816
7874
|
}
|
|
7817
|
-
async function down$
|
|
7875
|
+
async function down$4(db) {
|
|
7818
7876
|
await sql`ALTER TABLE public.check_run_tracking DROP COLUMN IF EXISTS terminal_sent_at`.execute(db);
|
|
7819
7877
|
}
|
|
7820
7878
|
//#endregion
|
|
7821
7879
|
//#region src/db/migrations/105_org_trust_policy.ts
|
|
7822
7880
|
var _105_org_trust_policy_exports = /* @__PURE__ */ __exportAll({
|
|
7823
|
-
down: () => down$
|
|
7824
|
-
up: () => up$
|
|
7881
|
+
down: () => down$3,
|
|
7882
|
+
up: () => up$3
|
|
7825
7883
|
});
|
|
7826
7884
|
/**
|
|
7827
7885
|
* Create `org_trust_policy` — the orchestrator's cache of the Platform-owned org
|
|
@@ -7838,7 +7896,7 @@ var _105_org_trust_policy_exports = /* @__PURE__ */ __exportAll({
|
|
|
7838
7896
|
*
|
|
7839
7897
|
* Idempotent: guarded by IF NOT EXISTS, so a re-run is a no-op.
|
|
7840
7898
|
*/
|
|
7841
|
-
async function up$
|
|
7899
|
+
async function up$3(db) {
|
|
7842
7900
|
await sql`
|
|
7843
7901
|
CREATE TABLE IF NOT EXISTS public.org_trust_policy (
|
|
7844
7902
|
customer_id TEXT PRIMARY KEY,
|
|
@@ -7851,14 +7909,14 @@ async function up$2(db) {
|
|
|
7851
7909
|
)
|
|
7852
7910
|
`.execute(db);
|
|
7853
7911
|
}
|
|
7854
|
-
async function down$
|
|
7912
|
+
async function down$3(db) {
|
|
7855
7913
|
await sql`DROP TABLE IF EXISTS public.org_trust_policy`.execute(db);
|
|
7856
7914
|
}
|
|
7857
7915
|
//#endregion
|
|
7858
7916
|
//#region src/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.ts
|
|
7859
7917
|
var _106_cluster_settings_check_run_tracking_ttl_days_exports = /* @__PURE__ */ __exportAll({
|
|
7860
|
-
down: () => down$
|
|
7861
|
-
up: () => up$
|
|
7918
|
+
down: () => down$2,
|
|
7919
|
+
up: () => up$2
|
|
7862
7920
|
});
|
|
7863
7921
|
/**
|
|
7864
7922
|
* Add `cluster_settings.check_run_tracking_ttl_days` (nullable integer).
|
|
@@ -7874,7 +7932,7 @@ var _106_cluster_settings_check_run_tracking_ttl_days_exports = /* @__PURE__ */
|
|
|
7874
7932
|
* Idempotent: guarded on column existence; a re-run on a database that already
|
|
7875
7933
|
* has the column is a no-op.
|
|
7876
7934
|
*/
|
|
7877
|
-
async function up$
|
|
7935
|
+
async function up$2(db) {
|
|
7878
7936
|
if ((await sql`
|
|
7879
7937
|
SELECT EXISTS (
|
|
7880
7938
|
SELECT 1 FROM information_schema.columns
|
|
@@ -7885,14 +7943,14 @@ async function up$1(db) {
|
|
|
7885
7943
|
`.execute(db)).rows[0]?.exists) return;
|
|
7886
7944
|
await sql`ALTER TABLE public.cluster_settings ADD COLUMN check_run_tracking_ttl_days INTEGER`.execute(db);
|
|
7887
7945
|
}
|
|
7888
|
-
async function down$
|
|
7946
|
+
async function down$2(db) {
|
|
7889
7947
|
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS check_run_tracking_ttl_days`.execute(db);
|
|
7890
7948
|
}
|
|
7891
7949
|
//#endregion
|
|
7892
7950
|
//#region src/db/migrations/107_check_run_tracking_updated_at_index.ts
|
|
7893
7951
|
var _107_check_run_tracking_updated_at_index_exports = /* @__PURE__ */ __exportAll({
|
|
7894
|
-
down: () => down,
|
|
7895
|
-
up: () => up
|
|
7952
|
+
down: () => down$1,
|
|
7953
|
+
up: () => up$1
|
|
7896
7954
|
});
|
|
7897
7955
|
/**
|
|
7898
7956
|
* Add `idx_check_run_tracking_updated_at` on `check_run_tracking (updated_at)`.
|
|
@@ -7913,16 +7971,61 @@ var _107_check_run_tracking_updated_at_index_exports = /* @__PURE__ */ __exportA
|
|
|
7913
7971
|
*
|
|
7914
7972
|
* Idempotent: `IF NOT EXISTS` makes a re-run a no-op.
|
|
7915
7973
|
*/
|
|
7916
|
-
async function up(db) {
|
|
7974
|
+
async function up$1(db) {
|
|
7917
7975
|
await sql`
|
|
7918
7976
|
CREATE INDEX IF NOT EXISTS idx_check_run_tracking_updated_at
|
|
7919
7977
|
ON public.check_run_tracking (updated_at)
|
|
7920
7978
|
`.execute(db);
|
|
7921
7979
|
}
|
|
7922
|
-
async function down(db) {
|
|
7980
|
+
async function down$1(db) {
|
|
7923
7981
|
await sql`DROP INDEX IF EXISTS public.idx_check_run_tracking_updated_at`.execute(db);
|
|
7924
7982
|
}
|
|
7925
7983
|
//#endregion
|
|
7984
|
+
//#region src/db/migrations/108_unroutable_fast_fail.ts
|
|
7985
|
+
var _108_unroutable_fast_fail_exports = /* @__PURE__ */ __exportAll({
|
|
7986
|
+
down: () => down,
|
|
7987
|
+
up: () => up
|
|
7988
|
+
});
|
|
7989
|
+
/**
|
|
7990
|
+
* Fast-fail support for jobs nothing in the fleet can run.
|
|
7991
|
+
*
|
|
7992
|
+
* Three additive, nullable columns:
|
|
7993
|
+
*
|
|
7994
|
+
* - `cluster_settings.unroutable_grace_ms` — how long a job may stay
|
|
7995
|
+
* continuously unroutable before it is terminalized. NULL means the
|
|
7996
|
+
* orchestrator's configured default applies; 0 disables fast-fail and leaves
|
|
7997
|
+
* the `queue_timeout_ms` backstop as the only path.
|
|
7998
|
+
* - `dispatch_queue.unroutable_since` — when the job first read unroutable.
|
|
7999
|
+
* Persisted rather than in-memory so a restart mid-grace resumes the same
|
|
8000
|
+
* clock instead of resetting it; an orchestrator that bounces every 90s must
|
|
8001
|
+
* not be able to keep a genuinely dead job alive forever. Cleared the moment
|
|
8002
|
+
* the job reads routable again.
|
|
8003
|
+
* - `execution_jobs.routing_reason` — the operator-facing reason, visible while
|
|
8004
|
+
* the job is still queued. Cleared on recovery.
|
|
8005
|
+
*
|
|
8006
|
+
* Idempotent: each column is guarded on existence, so a re-run is a no-op.
|
|
8007
|
+
*/
|
|
8008
|
+
async function columnExists(db, table, column) {
|
|
8009
|
+
return (await sql`
|
|
8010
|
+
SELECT EXISTS (
|
|
8011
|
+
SELECT 1 FROM information_schema.columns
|
|
8012
|
+
WHERE table_schema = 'public'
|
|
8013
|
+
AND table_name = ${table}
|
|
8014
|
+
AND column_name = ${column}
|
|
8015
|
+
) AS exists
|
|
8016
|
+
`.execute(db)).rows[0]?.exists === true;
|
|
8017
|
+
}
|
|
8018
|
+
async function up(db) {
|
|
8019
|
+
if (!await columnExists(db, "cluster_settings", "unroutable_grace_ms")) await sql`ALTER TABLE public.cluster_settings ADD COLUMN unroutable_grace_ms INTEGER`.execute(db);
|
|
8020
|
+
if (!await columnExists(db, "dispatch_queue", "unroutable_since")) await sql`ALTER TABLE public.dispatch_queue ADD COLUMN unroutable_since TIMESTAMPTZ`.execute(db);
|
|
8021
|
+
if (!await columnExists(db, "execution_jobs", "routing_reason")) await sql`ALTER TABLE public.execution_jobs ADD COLUMN routing_reason TEXT`.execute(db);
|
|
8022
|
+
}
|
|
8023
|
+
async function down(db) {
|
|
8024
|
+
await sql`ALTER TABLE public.execution_jobs DROP COLUMN IF EXISTS routing_reason`.execute(db);
|
|
8025
|
+
await sql`ALTER TABLE public.dispatch_queue DROP COLUMN IF EXISTS unroutable_since`.execute(db);
|
|
8026
|
+
await sql`ALTER TABLE public.cluster_settings DROP COLUMN IF EXISTS unroutable_grace_ms`.execute(db);
|
|
8027
|
+
}
|
|
8028
|
+
//#endregion
|
|
7926
8029
|
//#region src/db/migration-provider.ts
|
|
7927
8030
|
function createMigrationProvider() {
|
|
7928
8031
|
return { async getMigrations() {
|
|
@@ -8033,7 +8136,8 @@ function createMigrationProvider() {
|
|
|
8033
8136
|
"104_check_run_terminal_sent": _104_check_run_terminal_sent_exports,
|
|
8034
8137
|
"105_org_trust_policy": _105_org_trust_policy_exports,
|
|
8035
8138
|
"106_cluster_settings_check_run_tracking_ttl_days": _106_cluster_settings_check_run_tracking_ttl_days_exports,
|
|
8036
|
-
"107_check_run_tracking_updated_at_index": _107_check_run_tracking_updated_at_index_exports
|
|
8139
|
+
"107_check_run_tracking_updated_at_index": _107_check_run_tracking_updated_at_index_exports,
|
|
8140
|
+
"108_unroutable_fast_fail": _108_unroutable_fast_fail_exports
|
|
8037
8141
|
};
|
|
8038
8142
|
} };
|
|
8039
8143
|
}
|
|
@@ -10047,6 +10151,21 @@ function parseLocalConfig(s) {
|
|
|
10047
10151
|
const parsed = LocalSourceConfigSchema.safeParse(raw);
|
|
10048
10152
|
return parsed.success ? parsed.data : null;
|
|
10049
10153
|
}
|
|
10154
|
+
/**
|
|
10155
|
+
* Read a local source's stored config over whichever transport the caller is
|
|
10156
|
+
* already on — direct DB when `--database-url` / KICI_DATABASE_URL is in play,
|
|
10157
|
+
* otherwise the admin API. Used to preserve `repoBasePath` when only the clone
|
|
10158
|
+
* base is being changed; returns null when the id names no local source.
|
|
10159
|
+
*/
|
|
10160
|
+
async function readLocalSourceConfig(id, databaseUrl, getClient) {
|
|
10161
|
+
const dbUrl = resolveDirectDbUrl$9(databaseUrl);
|
|
10162
|
+
if (dbUrl) {
|
|
10163
|
+
const row = await withGenericManager(dbUrl, (mgr) => mgr.getById(id));
|
|
10164
|
+
return row ? parseLocalConfig(row) : null;
|
|
10165
|
+
}
|
|
10166
|
+
const { source } = await getClient().getGenericSource(id);
|
|
10167
|
+
return parseLocalConfig(source);
|
|
10168
|
+
}
|
|
10050
10169
|
function safeParse(value) {
|
|
10051
10170
|
try {
|
|
10052
10171
|
return JSON.parse(value);
|
|
@@ -10592,17 +10711,26 @@ function registerSourceCommands(program, getClient) {
|
|
|
10592
10711
|
try {
|
|
10593
10712
|
const data = {};
|
|
10594
10713
|
if (opts.name) data.name = opts.name;
|
|
10595
|
-
if (opts.path !== void 0) {
|
|
10596
|
-
|
|
10597
|
-
|
|
10714
|
+
if (opts.path !== void 0 || opts.cloneUrlBase !== void 0) {
|
|
10715
|
+
let repoBasePath = opts.path;
|
|
10716
|
+
if (repoBasePath === void 0) {
|
|
10717
|
+
const existing = await readLocalSourceConfig(id, opts.databaseUrl, getClient);
|
|
10718
|
+
if (!existing) {
|
|
10719
|
+
console.error(`Error: no local source with id ${id}`);
|
|
10720
|
+
process.exit(1);
|
|
10721
|
+
}
|
|
10722
|
+
repoBasePath = existing.repoBasePath;
|
|
10723
|
+
}
|
|
10724
|
+
if (!path.isAbsolute(repoBasePath)) {
|
|
10725
|
+
console.error(`Error: --path must be an absolute path: ${repoBasePath}`);
|
|
10598
10726
|
process.exit(1);
|
|
10599
10727
|
}
|
|
10600
|
-
const localConfig = { repoBasePath
|
|
10728
|
+
const localConfig = { repoBasePath };
|
|
10601
10729
|
if (opts.cloneUrlBase) localConfig.cloneUrlBase = opts.cloneUrlBase;
|
|
10602
10730
|
data.localConfig = localConfig;
|
|
10603
10731
|
}
|
|
10604
10732
|
if (Object.keys(data).length === 0) {
|
|
10605
|
-
console.error("Error: no fields to update. Provide --path and/or --
|
|
10733
|
+
console.error("Error: no fields to update. Provide --path, --name, and/or --clone-url-base.");
|
|
10606
10734
|
process.exit(1);
|
|
10607
10735
|
}
|
|
10608
10736
|
const dbUrl = resolveDirectDbUrl$9(opts.databaseUrl);
|
|
@@ -11092,6 +11220,11 @@ function registerRunsCommands(program, getClient) {
|
|
|
11092
11220
|
String(j.steps?.length ?? 0)
|
|
11093
11221
|
]);
|
|
11094
11222
|
console.log(renderTable$2(jobHeaders, jobRows));
|
|
11223
|
+
const unroutableJobs = jobs.filter((j) => j.routingReason && (j.status === ExecutionJobStatus.enum.pending || j.status === ExecutionJobStatus.enum.queued));
|
|
11224
|
+
if (unroutableJobs.length > 0) {
|
|
11225
|
+
console.log("");
|
|
11226
|
+
for (const job of unroutableJobs) console.log(` ! ${job.jobName}: ${job.routingReason}`);
|
|
11227
|
+
}
|
|
11095
11228
|
const jobsWithSteps = jobs.filter((j) => (j.steps?.length ?? 0) > 0);
|
|
11096
11229
|
if (jobsWithSteps.length > 0) for (const job of jobsWithSteps) {
|
|
11097
11230
|
console.log("");
|
|
@@ -11403,6 +11536,12 @@ const baseSchema = z.object({
|
|
|
11403
11536
|
queueMaxDepth: z.coerce.number().default(1e3),
|
|
11404
11537
|
queueTimeoutMs: z.coerce.number().default(36e5),
|
|
11405
11538
|
/**
|
|
11539
|
+
* Grace a job may stay continuously unroutable (nothing in the fleet matches
|
|
11540
|
+
* its selectors) before it is terminalized. Cluster default; the live value
|
|
11541
|
+
* is the `unroutable_grace_ms` cluster setting. 0 = fast-fail disabled.
|
|
11542
|
+
*/
|
|
11543
|
+
unroutableGraceMs: z.coerce.number().default(12e4),
|
|
11544
|
+
/**
|
|
11406
11545
|
* Operator-facing backpressure warning threshold for the dispatch queue.
|
|
11407
11546
|
* When pending-queue depth stays at or above this value for at least two
|
|
11408
11547
|
* consecutive refresher ticks (~10s), the orchestrator emits a
|
|
@@ -11758,6 +11897,7 @@ const envDef = defineEnv({
|
|
|
11758
11897
|
lockfileCacheMaxBytes: "KICI_LOCKFILE_CACHE_MAX_BYTES",
|
|
11759
11898
|
queueMaxDepth: "KICI_QUEUE_MAX_DEPTH",
|
|
11760
11899
|
queueTimeoutMs: "KICI_QUEUE_TIMEOUT_MS",
|
|
11900
|
+
unroutableGraceMs: "KICI_UNROUTABLE_GRACE_MS",
|
|
11761
11901
|
queueBackpressureThreshold: "KICI_QUEUE_BACKPRESSURE_THRESHOLD",
|
|
11762
11902
|
workerConcurrency: "KICI_WORKER_CONCURRENCY",
|
|
11763
11903
|
concurrencyWaitTimeoutMs: "KICI_CONCURRENCY_WAIT_TIMEOUT_MS",
|
|
@@ -18306,7 +18446,7 @@ async function refreshAgentPackages(storage, version, opts, deps) {
|
|
|
18306
18446
|
const ALL_PLATFORMS = AgentPlatform.options;
|
|
18307
18447
|
/** The orchestrator's own version (single-version invariant) = the packaged agent version. */
|
|
18308
18448
|
function resolveKiciVersion() {
|
|
18309
|
-
return "0.
|
|
18449
|
+
return "0.4.0";
|
|
18310
18450
|
}
|
|
18311
18451
|
/** Parse the --platform value: default set | single | CSV | `all`. */
|
|
18312
18452
|
function parsePlatforms(raw) {
|
|
@@ -20943,6 +21083,12 @@ const KNOBS$1 = [
|
|
|
20943
21083
|
flag: "ownership-db-check-timeout-ms",
|
|
20944
21084
|
min: 100,
|
|
20945
21085
|
label: "Ownership DB check timeout (ms)"
|
|
21086
|
+
},
|
|
21087
|
+
{
|
|
21088
|
+
field: "unroutableGraceMs",
|
|
21089
|
+
flag: "unroutable-grace-ms",
|
|
21090
|
+
min: 0,
|
|
21091
|
+
label: "Unroutable fast-fail grace (ms)"
|
|
20946
21092
|
}
|
|
20947
21093
|
];
|
|
20948
21094
|
/** The cluster-global text knobs. */
|