gencow 0.1.205 → 0.1.207

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.
@@ -643,6 +643,8 @@ export function createDeployCommand({
643
643
  environment: parsed.envTarget,
644
644
  requestId: parsed.requestId,
645
645
  platformFetchImpl,
646
+ capabilityTimeoutMs: 15_000,
647
+ allowCapabilityTimeoutFallback: true,
646
648
  })
647
649
  : undefined,
648
650
  failReleaseAttempt: failReleaseAttemptImpl
@@ -75,11 +75,11 @@ async function responseError(response, fallback, creds, parsedBody) {
75
75
  throwResponseError(response, fallback, body, creds);
76
76
  }
77
77
 
78
- async function releaseCapability({ creds, appId, environment, platformFetchImpl }) {
78
+ async function releaseCapability({ creds, appId, environment, platformFetchImpl, signal }) {
79
79
  const response = await platformFetchImpl(
80
80
  creds,
81
81
  `/platform/apps/${appId}/release-capability?environment=${environment}`,
82
- { method: "GET" },
82
+ { method: "GET", ...(signal ? { signal } : {}) },
83
83
  );
84
84
  if (response.status === 404 || response.status === 405) {
85
85
  const body = (await response.json().catch(() => ({}))) || {};
@@ -108,8 +108,41 @@ export async function prepareReleaseAttempt({
108
108
  createReleaseSourcePackageImpl = createReleaseSourcePackage,
109
109
  platformFetchImpl = platformFetch,
110
110
  unlinkImpl = unlink,
111
+ capabilityTimeoutMs = null,
112
+ allowCapabilityTimeoutFallback = false,
113
+ capabilityTimeoutSetTimeoutImpl = setTimeout,
114
+ capabilityTimeoutClearTimeoutImpl = clearTimeout,
111
115
  }) {
112
- const capability = await releaseCapability({ creds, appId, environment, platformFetchImpl });
116
+ const capabilityRequest = (signal) => releaseCapability({ creds, appId, environment, platformFetchImpl, signal });
117
+ let capability;
118
+ if (Number.isFinite(capabilityTimeoutMs) && capabilityTimeoutMs > 0) {
119
+ let timeout;
120
+ const controller = new AbortController();
121
+ try {
122
+ capability = await Promise.race([
123
+ capabilityRequest(controller.signal),
124
+ new Promise((_, reject) => {
125
+ timeout = capabilityTimeoutSetTimeoutImpl(
126
+ () => {
127
+ controller.abort();
128
+ reject(new Error("APP_RELEASE_CAPABILITY_TIMEOUT"));
129
+ },
130
+ capabilityTimeoutMs,
131
+ );
132
+ timeout?.unref?.();
133
+ }),
134
+ ]);
135
+ } catch (error) {
136
+ if (!(allowCapabilityTimeoutFallback && error?.message === "APP_RELEASE_CAPABILITY_TIMEOUT")) {
137
+ throw error;
138
+ }
139
+ capability = null;
140
+ } finally {
141
+ if (timeout !== undefined) capabilityTimeoutClearTimeoutImpl(timeout);
142
+ }
143
+ } else {
144
+ capability = await capabilityRequest();
145
+ }
113
146
  if (!capability) return null;
114
147
  const requestId = releaseRequestId(explicitRequestId);
115
148
  const sourcePackage = await createReleaseSourcePackageImpl({
@@ -304,6 +304,8 @@ export function createStaticDeployRuntime({
304
304
  environment: opts.envTarget || "dev",
305
305
  requestId: opts.requestId || null,
306
306
  platformFetchImpl,
307
+ capabilityTimeoutMs: 15_000,
308
+ allowCapabilityTimeoutFallback: true,
307
309
  });
308
310
  releaseAttemptId = releaseAttempt?.attemptId ?? null;
309
311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gencow",
3
- "version": "0.1.205",
3
+ "version": "0.1.207",
4
4
  "description": "Gencow — AI Backend Engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,9 +33,9 @@
33
33
  "devDependencies": {
34
34
  "@types/node": "^25.9.5",
35
35
  "better-auth": "^1.6.23",
36
+ "@gencow/core": "0.1.43",
36
37
  "@gencow/client": "0.2.6",
37
- "@gencow/react": "0.2.6",
38
- "@gencow/core": "0.1.43"
38
+ "@gencow/react": "0.2.6"
39
39
  },
40
40
  "scripts": {
41
41
  "prebuild": "pnpm --filter @gencow/migration-contract run build && pnpm --filter @gencow/server run build",
@@ -184437,6 +184437,7 @@ import { and as and10, eq as eq12, inArray as inArray5, isNull as isNull5, ne as
184437
184437
  async function hasReadyDeploymentExecutor(input) {
184438
184438
  const now = input.now ?? /* @__PURE__ */ new Date();
184439
184439
  const staleAfterMs = input.staleAfterMs ?? 45e3;
184440
+ const reconcilerStaleAfterMs = Math.max(staleAfterMs, RECONCILER_SCAN_STALE_AFTER_MS);
184440
184441
  const recoverySloMs = input.recoverySloMs ?? 5 * 6e4;
184441
184442
  const rows4 = await input.db.select({ ownerId: deploymentExecutorWorkers.ownerId }).from(deploymentExecutorWorkers).where(
184442
184443
  and10(
@@ -184449,7 +184450,7 @@ async function hasReadyDeploymentExecutor(input) {
184449
184450
  )}`,
184450
184451
  sql61`${deploymentExecutorWorkers.reconcilerProgressSeq} > 0`,
184451
184452
  sql61`${deploymentExecutorWorkers.reconcilerLastScanAt} >= ${toPostgresTimestamp2(
184452
- new Date(now.getTime() - staleAfterMs)
184453
+ new Date(now.getTime() - reconcilerStaleAfterMs)
184453
184454
  )}`,
184454
184455
  isNull5(deploymentExecutorWorkers.reconcilerLastErrorCode),
184455
184456
  or7(
@@ -184481,6 +184482,7 @@ async function hasStalledDeploymentExecutor(input) {
184481
184482
  async function loadReadyDeploymentExecutorGeneration(input) {
184482
184483
  const now = input.now ?? /* @__PURE__ */ new Date();
184483
184484
  const staleAfterMs = input.staleAfterMs ?? 45e3;
184485
+ const reconcilerStaleAfterMs = Math.max(staleAfterMs, RECONCILER_SCAN_STALE_AFTER_MS);
184484
184486
  const recoverySloMs = input.recoverySloMs ?? 5 * 6e4;
184485
184487
  const result2 = await input.db.execute(sql61`
184486
184488
  SELECT owner_id AS "ownerId",
@@ -184498,7 +184500,7 @@ async function loadReadyDeploymentExecutorGeneration(input) {
184498
184500
  AND generation_digest ~ '^[a-f0-9]{64}$'
184499
184501
  AND heartbeat_at >= ${toPostgresTimestamp2(new Date(now.getTime() - staleAfterMs))}
184500
184502
  AND reconciler_progress_seq > 0
184501
- AND reconciler_last_scan_at >= ${toPostgresTimestamp2(new Date(now.getTime() - staleAfterMs))}
184503
+ AND reconciler_last_scan_at >= ${toPostgresTimestamp2(new Date(now.getTime() - reconcilerStaleAfterMs))}
184502
184504
  AND reconciler_last_error_code IS NULL
184503
184505
  AND (
184504
184506
  reconciler_oldest_candidate_at IS NULL
@@ -184512,12 +184514,14 @@ async function loadReadyDeploymentExecutorGeneration(input) {
184512
184514
  const rows4 = Array.isArray(result2) ? result2 : result2?.rows ?? [];
184513
184515
  return rows4[0] ?? null;
184514
184516
  }
184517
+ var RECONCILER_SCAN_STALE_AFTER_MS;
184515
184518
  var init_deployment_executor_worker_store = __esm({
184516
184519
  "../platform/src/deployment-executor-worker-store.ts"() {
184517
184520
  "use strict";
184518
184521
  init_schema();
184519
184522
  init_postgres_temporal2();
184520
184523
  init_deployment_executor_operation();
184524
+ RECONCILER_SCAN_STALE_AFTER_MS = 5 * 6e4;
184521
184525
  }
184522
184526
  });
184523
184527
 
@@ -408938,6 +408942,10 @@ function buildAppDatabaseUrl(appName, role = "app") {
408938
408942
  async function dropAppDatabase(appName) {
408939
408943
  const dbName = buildAppDatabaseName(appName);
408940
408944
  if (databaseAdminLifecycleCapability) {
408945
+ if (CACHED_DATABASE_URL && await inspectTenantDatabaseCatalog({ dbName, runtimeDatabaseUrl: CACHED_DATABASE_URL }) === "absent") {
408946
+ return;
408947
+ }
408948
+ if (!await databaseAdminLifecycleCapability.databaseExists(dbName)) return;
408941
408949
  await databaseAdminLifecycleCapability.dropDatabase(dbName);
408942
408950
  return;
408943
408951
  }
@@ -451834,7 +451842,7 @@ function createBackgroundDeepHealthProbe(input) {
451834
451842
 
451835
451843
  // ../server/dist/server-core-admission.js
451836
451844
  function isPlatformCoreSlotIdentityReady(env2) {
451837
- if (env2.GENCOW_PLATFORM_SLOT_CANDIDATE === "true")
451845
+ if (env2.GENCOW_PLATFORM_SLOT_CANDIDATE === "true" && env2.GENCOW_CUSTOMER_CLI_INVESTIGATION_MODE !== "1" && env2.CUSTOMER_CLI_INVESTIGATION_CORE_ADMISSION !== "1")
451838
451846
  return false;
451839
451847
  if (env2.GENCOW_PLATFORM_SLOT_PROMOTION_PROTOCOL !== "v2")
451840
451848
  return false;