gencow 0.1.211 → 0.1.213

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.
@@ -19,7 +19,7 @@ const APP_DELETE_ACTIVE_STATES = new Set([
19
19
  const APP_DELETE_TERMINAL_FAILURE_STATES = new Set(["blocked_catalog_outcome_unknown"]);
20
20
  const CORRELATION_ID_PATTERN = /^[A-Za-z0-9_-]{8,128}$/u;
21
21
  const DIAGNOSTIC_CODE_PATTERN = /^[A-Za-z][A-Za-z0-9_]{2,127}$/u;
22
- const APP_ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+){2}$/u;
22
+ const APP_ID_PATTERN = /^(?=.{3,63}$)[a-z][a-z0-9]*(?:-[a-z0-9]+){2,7}$/u;
23
23
 
24
24
  function isAllowedStatusPath(value, operationId, expectedAppId) {
25
25
  if (value === undefined) return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gencow",
3
- "version": "0.1.211",
3
+ "version": "0.1.213",
4
4
  "description": "Gencow — AI Backend Engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,8 +34,8 @@
34
34
  "@types/node": "^25.9.5",
35
35
  "better-auth": "^1.6.23",
36
36
  "@gencow/core": "0.1.43",
37
- "@gencow/react": "0.2.6",
38
- "@gencow/client": "0.2.6"
37
+ "@gencow/client": "0.2.7",
38
+ "@gencow/react": "0.2.7"
39
39
  },
40
40
  "scripts": {
41
41
  "prebuild": "pnpm --filter @gencow/migration-contract run build && pnpm --filter @gencow/server run build",
@@ -174749,7 +174749,11 @@ async function probeGatewayAttempt(params) {
174749
174749
  });
174750
174750
  return {
174751
174751
  reachable: response.ok,
174752
- retryable: false,
174752
+ // The stable node gateway can briefly return 5xx while a Blue-Green
174753
+ // route or readiness observation converges. Keep 4xx deterministic,
174754
+ // but give bounded 5xx observations the same retry budget as transport
174755
+ // failures before rejecting placement.
174756
+ retryable: response.status >= 500,
174753
174757
  reasonClass: response.ok ? "reachable" : response.status >= 500 ? "http_5xx" : response.status >= 400 ? "http_4xx" : "http_other"
174754
174758
  };
174755
174759
  } catch (error51) {
@@ -174827,7 +174831,7 @@ var init_app_create_gateway_probe = __esm({
174827
174831
  "use strict";
174828
174832
  init_node_origin_policy();
174829
174833
  init_node_proxy_readiness();
174830
- DEFAULT_GATEWAY_PROBE_ATTEMPTS = 2;
174834
+ DEFAULT_GATEWAY_PROBE_ATTEMPTS = 3;
174831
174835
  DEFAULT_GATEWAY_PROBE_DELAY_MS = 75;
174832
174836
  DEFAULT_GATEWAY_PROBE_JITTER_RATIO = 0.2;
174833
174837
  DEFAULT_GATEWAY_PROBE_TIMEOUT_MS = 1e3;
@@ -184439,12 +184443,11 @@ var init_deployment_executor_operation = __esm({
184439
184443
 
184440
184444
  // ../platform/src/deployment-executor-worker-store.ts
184441
184445
  import { createHash as createHash34 } from "node:crypto";
184442
- import { and as and10, eq as eq12, inArray as inArray5, isNull as isNull5, ne as ne6, or as or7, sql as sql61 } from "drizzle-orm";
184446
+ import { and as and10, eq as eq12, inArray as inArray5, isNull as isNull5, ne as ne6, sql as sql61 } from "drizzle-orm";
184443
184447
  async function hasReadyDeploymentExecutor(input) {
184444
184448
  const now = input.now ?? /* @__PURE__ */ new Date();
184445
184449
  const staleAfterMs = input.staleAfterMs ?? 45e3;
184446
184450
  const reconcilerStaleAfterMs = Math.max(staleAfterMs, RECONCILER_SCAN_STALE_AFTER_MS);
184447
- const recoverySloMs = input.recoverySloMs ?? 5 * 6e4;
184448
184451
  const rows4 = await input.db.select({ ownerId: deploymentExecutorWorkers.ownerId }).from(deploymentExecutorWorkers).where(
184449
184452
  and10(
184450
184453
  eq12(deploymentExecutorWorkers.status, "ready"),
@@ -184458,13 +184461,7 @@ async function hasReadyDeploymentExecutor(input) {
184458
184461
  sql61`${deploymentExecutorWorkers.reconcilerLastScanAt} >= ${toPostgresTimestamp2(
184459
184462
  new Date(now.getTime() - reconcilerStaleAfterMs)
184460
184463
  )}`,
184461
- isNull5(deploymentExecutorWorkers.reconcilerLastErrorCode),
184462
- or7(
184463
- isNull5(deploymentExecutorWorkers.reconcilerOldestCandidateAt),
184464
- sql61`${deploymentExecutorWorkers.reconcilerOldestCandidateAt} >= ${toPostgresTimestamp2(
184465
- new Date(now.getTime() - recoverySloMs * 2)
184466
- )}`
184467
- )
184464
+ isNull5(deploymentExecutorWorkers.reconcilerLastErrorCode)
184468
184465
  )
184469
184466
  ).limit(1);
184470
184467
  return Boolean(rows4[0]);
@@ -184489,7 +184486,6 @@ async function loadReadyDeploymentExecutorGeneration(input) {
184489
184486
  const now = input.now ?? /* @__PURE__ */ new Date();
184490
184487
  const staleAfterMs = input.staleAfterMs ?? 45e3;
184491
184488
  const reconcilerStaleAfterMs = Math.max(staleAfterMs, RECONCILER_SCAN_STALE_AFTER_MS);
184492
- const recoverySloMs = input.recoverySloMs ?? 5 * 6e4;
184493
184489
  const result2 = await input.db.execute(sql61`
184494
184490
  SELECT owner_id AS "ownerId",
184495
184491
  slot_id AS "slotId",
@@ -184508,12 +184504,6 @@ async function loadReadyDeploymentExecutorGeneration(input) {
184508
184504
  AND reconciler_progress_seq > 0
184509
184505
  AND reconciler_last_scan_at >= ${toPostgresTimestamp2(new Date(now.getTime() - reconcilerStaleAfterMs))}
184510
184506
  AND reconciler_last_error_code IS NULL
184511
- AND (
184512
- reconciler_oldest_candidate_at IS NULL
184513
- OR reconciler_oldest_candidate_at >= ${toPostgresTimestamp2(
184514
- new Date(now.getTime() - recoverySloMs * 2)
184515
- )}
184516
- )
184517
184507
  ORDER BY updated_at DESC
184518
184508
  LIMIT 1
184519
184509
  `);
@@ -185085,7 +185075,7 @@ var init_apps_deploy_failures = __esm({
185085
185075
  });
185086
185076
 
185087
185077
  // ../platform/src/deployment-executor-store.ts
185088
- import { and as and11, asc as asc3, eq as eq13, gt as gt4, inArray as inArray6, lte as lte4, or as or8, sql as sql64 } from "drizzle-orm";
185078
+ import { and as and11, asc as asc3, eq as eq13, gt as gt4, inArray as inArray6, lte as lte4, or as or7, sql as sql64 } from "drizzle-orm";
185089
185079
  function attemptConditions(attempt) {
185090
185080
  return and11(
185091
185081
  eq13(deployments.id, attempt.deploymentId),
@@ -185838,7 +185828,7 @@ var init_deployment_executor_http_presentation = __esm({
185838
185828
 
185839
185829
  // ../platform/src/app-delete-operation-store.ts
185840
185830
  import { createHash as createHash37 } from "node:crypto";
185841
- import { and as and13, desc as desc4, eq as eq15, gt as gt5, inArray as inArray7, lte as lte5, or as or9, sql as sql65 } from "drizzle-orm";
185831
+ import { and as and13, desc as desc4, eq as eq15, gt as gt5, inArray as inArray7, lte as lte5, or as or8, sql as sql65 } from "drizzle-orm";
185842
185832
  function isAppDeleteTerminalState(state2) {
185843
185833
  return APP_DELETE_TERMINAL_STATES.includes(state2);
185844
185834
  }
@@ -186104,7 +186094,12 @@ async function calculateLogicalSpoolBytes(spoolRoot2) {
186104
186094
  if (!entry.isFile()) continue;
186105
186095
  const payloadRef = PAYLOAD_REF.test(entry.name) ? entry.name : STAGING_REF.exec(entry.name)?.[1];
186106
186096
  if (!payloadRef) continue;
186107
- const size2 = (await stat8(resolve54(spoolRoot2, entry.name))).size;
186097
+ const metadata = await stat8(resolve54(spoolRoot2, entry.name)).catch((error51) => {
186098
+ if (error51.code === "ENOENT") return null;
186099
+ throw error51;
186100
+ });
186101
+ if (!metadata) continue;
186102
+ const size2 = metadata.size;
186108
186103
  logicalSizes.set(payloadRef, Math.max(logicalSizes.get(payloadRef) ?? 0, size2));
186109
186104
  }
186110
186105
  return [...logicalSizes.values()].reduce((total, size2) => total + size2, 0);
@@ -189710,7 +189705,7 @@ var require_typescript = __commonJS({
189710
189705
  optionsForBuild: () => optionsForBuild,
189711
189706
  optionsForWatch: () => optionsForWatch,
189712
189707
  optionsHaveChanges: () => optionsHaveChanges,
189713
- or: () => or23,
189708
+ or: () => or22,
189714
189709
  orderedRemoveItem: () => orderedRemoveItem,
189715
189710
  orderedRemoveItemAt: () => orderedRemoveItemAt,
189716
189711
  packageIdToPackageName: () => packageIdToPackageName,
@@ -191456,7 +191451,7 @@ var require_typescript = __commonJS({
191456
191451
  function and72(f2, g2) {
191457
191452
  return (arg) => f2(arg) && g2(arg);
191458
191453
  }
191459
- function or23(...fs6) {
191454
+ function or22(...fs6) {
191460
191455
  return (...args) => {
191461
191456
  let lastResult;
191462
191457
  for (const f2 of fs6) {
@@ -210246,7 +210241,7 @@ ${lanes.join("\n")}
210246
210241
  checks.push(isFileModuleFromUsingJSXTag);
210247
210242
  }
210248
210243
  checks.push(isFileForcedToBeModuleByFormat);
210249
- const combined = or23(...checks);
210244
+ const combined = or22(...checks);
210250
210245
  const callback = (file2) => void (file2.externalModuleIndicator = combined(file2, options));
210251
210246
  return callback;
210252
210247
  }
@@ -211020,7 +211015,7 @@ ${lanes.join("\n")}
211020
211015
  ModuleSpecifierEnding2[ModuleSpecifierEnding2["TsExtension"] = 3] = "TsExtension";
211021
211016
  return ModuleSpecifierEnding2;
211022
211017
  })(ModuleSpecifierEnding || {});
211023
- function usesExtensionsOnImports({ imports }, hasExtension2 = or23(hasJSFileExtension, hasTSFileExtension)) {
211018
+ function usesExtensionsOnImports({ imports }, hasExtension2 = or22(hasJSFileExtension, hasTSFileExtension)) {
211024
211019
  return firstDefined(imports, ({ text: text31 }) => pathIsRelative(text31) && !fileExtensionIsOneOf(text31, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text31) : void 0) || false;
211025
211020
  }
211026
211021
  function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
@@ -245664,7 +245659,7 @@ ${lanes.join("\n")}
245664
245659
  location.initializer,
245665
245660
  /*requireStringLiteralLikeArgument*/
245666
245661
  true
245667
- ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or23(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? void 0 : _d.moduleSpecifier) || ((_e2 = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e2.moduleReference.expression);
245662
+ ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or22(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? void 0 : _d.moduleSpecifier) || ((_e2 = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e2.moduleReference.expression);
245668
245663
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
245669
245664
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
245670
245665
  const resolvedModule = (_f = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _f.resolvedModule;
@@ -245675,7 +245670,7 @@ ${lanes.join("\n")}
245675
245670
  error210(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
245676
245671
  }
245677
245672
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
245678
- const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or23(isImportEqualsDeclaration, isExportDeclaration));
245673
+ const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or22(isImportEqualsDeclaration, isExportDeclaration));
245679
245674
  if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
245680
245675
  error210(
245681
245676
  errorNode,
@@ -245684,7 +245679,7 @@ ${lanes.join("\n")}
245684
245679
  );
245685
245680
  }
245686
245681
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
245687
- const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or23(isImportEqualsDeclaration, isExportDeclaration));
245682
+ const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or22(isImportEqualsDeclaration, isExportDeclaration));
245688
245683
  if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
245689
245684
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
245690
245685
  error210(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
@@ -251747,7 +251742,7 @@ ${lanes.join("\n")}
251747
251742
  }
251748
251743
  const flag = modifierFlags & ~1024 | (isStatic2 ? 256 : 0);
251749
251744
  const name = getPropertyNameNodeForSymbol(p2, context2);
251750
- const firstPropertyLikeDecl = (_a22 = p2.declarations) == null ? void 0 : _a22.find(or23(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
251745
+ const firstPropertyLikeDecl = (_a22 = p2.declarations) == null ? void 0 : _a22.find(or22(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
251751
251746
  if (p2.flags & 98304 && useAccessors) {
251752
251747
  const result2 = [];
251753
251748
  if (p2.flags & 65536) {
@@ -251824,7 +251819,7 @@ ${lanes.join("\n")}
251824
251819
  /*initializer*/
251825
251820
  void 0
251826
251821
  ),
251827
- ((_e2 = p2.declarations) == null ? void 0 : _e2.find(or23(isPropertyDeclaration, isVariableDeclaration))) || firstPropertyLikeDecl
251822
+ ((_e2 = p2.declarations) == null ? void 0 : _e2.find(or22(isPropertyDeclaration, isVariableDeclaration))) || firstPropertyLikeDecl
251828
251823
  );
251829
251824
  }
251830
251825
  if (p2.flags & (8192 | 16)) {
@@ -284778,7 +284773,7 @@ ${lanes.join("\n")}
284778
284773
  node.kind !== 261
284779
284774
  /* VariableDeclaration */
284780
284775
  );
284781
- const importDeclaration = findAncestor(node, or23(isImportDeclaration, isImportEqualsDeclaration));
284776
+ const importDeclaration = findAncestor(node, or22(isImportDeclaration, isImportEqualsDeclaration));
284782
284777
  const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "...";
284783
284778
  const importedIdentifier = unescapeLeadingUnderscores(isIdentifier2(errorNode) ? errorNode.escapedText : symbol2.escapedName);
284784
284779
  error210(
@@ -286119,7 +286114,7 @@ ${lanes.join("\n")}
286119
286114
  if (nodeIsMissing(name)) {
286120
286115
  return void 0;
286121
286116
  }
286122
- const isJSDoc2 = findAncestor(name, or23(isJSDocLinkLike, isJSDocNameReference, isJSDocMemberName));
286117
+ const isJSDoc2 = findAncestor(name, or22(isJSDocLinkLike, isJSDocNameReference, isJSDocMemberName));
286123
286118
  const meaning = isJSDoc2 ? 788968 | 1920 | 111551 : 111551;
286124
286119
  if (name.kind === 80) {
286125
286120
  if (isJSXTagName(name) && isJsxIntrinsicTagName(name)) {
@@ -286136,7 +286131,7 @@ ${lanes.join("\n")}
286136
286131
  getHostSignatureFromJSDoc(name)
286137
286132
  );
286138
286133
  if (!result2 && isJSDoc2) {
286139
- const container = findAncestor(name, or23(isClassLike, isInterfaceDeclaration));
286134
+ const container = findAncestor(name, or22(isClassLike, isInterfaceDeclaration));
286140
286135
  if (container) {
286141
286136
  return resolveJSDocMemberName(
286142
286137
  name,
@@ -336695,7 +336690,7 @@ ${lanes.join("\n")}
336695
336690
  return getMeaningFromRightHandSideOfImportEquals(node);
336696
336691
  } else if (isDeclarationName(node)) {
336697
336692
  return getMeaningFromDeclaration(parent2);
336698
- } else if (isEntityName(node) && findAncestor(node, or23(isJSDocNameReference, isJSDocLinkLike, isJSDocMemberName))) {
336693
+ } else if (isEntityName(node) && findAncestor(node, or22(isJSDocNameReference, isJSDocLinkLike, isJSDocMemberName))) {
336699
336694
  return 7;
336700
336695
  } else if (isTypeReference(node)) {
336701
336696
  return 2;
@@ -338877,7 +338872,7 @@ ${lanes.join("\n")}
338877
338872
  function syntaxRequiresTrailingSemicolonOrASI(kind) {
338878
338873
  return kind === 244 || kind === 245 || kind === 247 || kind === 252 || kind === 253 || kind === 254 || kind === 258 || kind === 260 || kind === 173 || kind === 266 || kind === 273 || kind === 272 || kind === 279 || kind === 271 || kind === 278;
338879
338874
  }
338880
- var syntaxMayBeASICandidate = or23(
338875
+ var syntaxMayBeASICandidate = or22(
338881
338876
  syntaxRequiresTrailingCommaOrSemicolonOrASI,
338882
338877
  syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI,
338883
338878
  syntaxRequiresTrailingModuleBlockOrSemicolonOrASI,
@@ -344309,7 +344304,7 @@ interface Symbol {
344309
344304
  const { file: file2 } = context2;
344310
344305
  const span = getRefactorContextSpan(context2);
344311
344306
  const token = getTokenAtPosition(file2, span.start);
344312
- const importDecl = considerPartialSpans ? findAncestor(token, or23(isImportDeclaration, isJSDocImportTag)) : getParentNodeInSpan(token, file2, span);
344307
+ const importDecl = considerPartialSpans ? findAncestor(token, or22(isImportDeclaration, isJSDocImportTag)) : getParentNodeInSpan(token, file2, span);
344313
344308
  if (importDecl === void 0 || !(isImportDeclaration(importDecl) || isJSDocImportTag(importDecl))) return { error: "Selection is not an import declaration." };
344314
344309
  const end = span.start + span.length;
344315
344310
  const nextToken = findNextToken(importDecl, importDecl.parent, file2);
@@ -353688,7 +353683,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
353688
353683
  function makeChange7(changeTracker, sourceFile, pos, program, host, preferences) {
353689
353684
  var _a3, _b, _c;
353690
353685
  const token = getTokenAtPosition(sourceFile, pos);
353691
- const importNode = findAncestor(token, or23(isImportDeclaration, isImportTypeNode));
353686
+ const importNode = findAncestor(token, or22(isImportDeclaration, isImportTypeNode));
353692
353687
  Debug.assert(!!importNode, "Expected position to be owned by an ImportDeclaration or ImportType.");
353693
353688
  const useSingleQuotes = getQuotePreference(sourceFile, preferences) === 0;
353694
353689
  const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importNode);
@@ -359366,7 +359361,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
359366
359361
  );
359367
359362
  }
359368
359363
  if (getObjectFlags(type) & 16) {
359369
- const decl = find2(type.symbol.declarations || emptyArray, or23(isFunctionTypeNode, isMethodSignature, isMethodDeclaration));
359364
+ const decl = find2(type.symbol.declarations || emptyArray, or22(isFunctionTypeNode, isMethodSignature, isMethodDeclaration));
359370
359365
  if (decl === void 0) return createUndefined();
359371
359366
  const signature = checker.getSignaturesOfType(
359372
359367
  type,
@@ -360311,7 +360306,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
360311
360306
  if (!identifier || identifier.parent.kind !== 184) return;
360312
360307
  const checker = program.getTypeChecker();
360313
360308
  const symbol2 = checker.getSymbolAtLocation(identifier);
360314
- return find2((symbol2 == null ? void 0 : symbol2.declarations) || emptyArray, or23(isImportClause, isImportSpecifier, isImportEqualsDeclaration));
360309
+ return find2((symbol2 == null ? void 0 : symbol2.declarations) || emptyArray, or22(isImportClause, isImportSpecifier, isImportEqualsDeclaration));
360315
360310
  }
360316
360311
  function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) {
360317
360312
  if (importDeclaration.kind === 272) {
@@ -368203,7 +368198,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
368203
368198
  if (!namedExports) {
368204
368199
  return 0;
368205
368200
  }
368206
- const localsContainer = findAncestor(namedExports, or23(isSourceFile, isModuleDeclaration));
368201
+ const localsContainer = findAncestor(namedExports, or22(isSourceFile, isModuleDeclaration));
368207
368202
  completionKind = 5;
368208
368203
  isNewIdentifierLocation = false;
368209
368204
  (_a3 = localsContainer.locals) == null ? void 0 : _a3.forEach((symbol2, name) => {
@@ -369099,7 +369094,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
369099
369094
  function getSingleLineReplacementSpanForImportCompletionNode(node) {
369100
369095
  var _a3;
369101
369096
  if (!node) return void 0;
369102
- const top = findAncestor(node, or23(isImportDeclaration, isImportEqualsDeclaration, isJSDocImportTag)) ?? node;
369097
+ const top = findAncestor(node, or22(isImportDeclaration, isImportEqualsDeclaration, isJSDocImportTag)) ?? node;
369103
369098
  const sourceFile = top.getSourceFile();
369104
369099
  if (rangeIsOnSingleLine(top, sourceFile)) {
369105
369100
  return createTextSpanFromNode(top, sourceFile);
@@ -372433,7 +372428,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
372433
372428
  }
372434
372429
  }
372435
372430
  function getContainingNodeIfInHeritageClause(node) {
372436
- return isIdentifier2(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or23(isClassLike, isInterfaceDeclaration)) : void 0;
372431
+ return isIdentifier2(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or22(isClassLike, isInterfaceDeclaration)) : void 0;
372437
372432
  }
372438
372433
  function isImplementationExpression(node) {
372439
372434
  switch (node.kind) {
@@ -374764,11 +374759,11 @@ ${content}
374764
374759
  function placeClassNodeGroup(originalFile, changeTracker, changes, focusLocations) {
374765
374760
  let classOrInterface;
374766
374761
  if (!focusLocations || !focusLocations.length) {
374767
- classOrInterface = find2(originalFile.statements, or23(isClassLike, isInterfaceDeclaration));
374762
+ classOrInterface = find2(originalFile.statements, or22(isClassLike, isInterfaceDeclaration));
374768
374763
  } else {
374769
374764
  classOrInterface = forEach(focusLocations, (location) => findAncestor(
374770
374765
  getTokenAtPosition(originalFile, location.start),
374771
- or23(isClassLike, isInterfaceDeclaration)
374766
+ or22(isClassLike, isInterfaceDeclaration)
374772
374767
  ));
374773
374768
  }
374774
374769
  if (!classOrInterface) {
@@ -374809,7 +374804,7 @@ ${content}
374809
374804
  for (const location of focusLocations) {
374810
374805
  const scope = findAncestor(
374811
374806
  getTokenAtPosition(originalFile, location.start),
374812
- (block) => or23(isBlock, isSourceFile)(block) && some2(block.statements, (origStmt) => changes.some((newStmt) => matchNode(newStmt, origStmt)))
374807
+ (block) => or22(isBlock, isSourceFile)(block) && some2(block.statements, (origStmt) => changes.some((newStmt) => matchNode(newStmt, origStmt)))
374813
374808
  );
374814
374809
  if (scope) {
374815
374810
  const start2 = scope.statements.find((stmt) => changes.some((node) => matchNode(node, stmt)));
@@ -376763,7 +376758,7 @@ ${content}
376763
376758
  }
376764
376759
  return false;
376765
376760
  }
376766
- var isImport2 = or23(isImportDeclaration, isImportEqualsDeclaration);
376761
+ var isImport2 = or22(isImportDeclaration, isImportEqualsDeclaration);
376767
376762
  function getSelectionChildren(node) {
376768
376763
  var _a3;
376769
376764
  if (isSourceFile(node)) {
@@ -385213,7 +385208,7 @@ ${options.prefix}` : "\n" : options.prefix
385213
385208
  optionsForBuild: () => optionsForBuild,
385214
385209
  optionsForWatch: () => optionsForWatch,
385215
385210
  optionsHaveChanges: () => optionsHaveChanges,
385216
- or: () => or23,
385211
+ or: () => or22,
385217
385212
  orderedRemoveItem: () => orderedRemoveItem,
385218
385213
  orderedRemoveItemAt: () => orderedRemoveItemAt,
385219
385214
  packageIdToPackageName: () => packageIdToPackageName,
@@ -412584,7 +412579,7 @@ var init_legacy_runtime_automatic_preparation = __esm({
412584
412579
  });
412585
412580
 
412586
412581
  // ../platform/src/runtime-authority-operation-lease.ts
412587
- import { and as and19, eq as eq23, lte as lte7, or as or10, sql as sql75 } from "drizzle-orm";
412582
+ import { and as and19, eq as eq23, lte as lte7, or as or9, sql as sql75 } from "drizzle-orm";
412588
412583
  function hasValidRuntimeAuthorityMutationLease(current, expected, now) {
412589
412584
  if (!expected) return !current || current.expiresAt <= now;
412590
412585
  return Boolean(
@@ -412610,7 +412605,7 @@ async function acquireRuntimeAuthorityOperationLease(input) {
412610
412605
  updatedAt: now
412611
412606
  }).onConflictDoUpdate({
412612
412607
  target: runtimeAuthorityOperationLeases.appId,
412613
- setWhere: or10(
412608
+ setWhere: or9(
412614
412609
  lte7(runtimeAuthorityOperationLeases.expiresAt, now),
412615
412610
  and19(
412616
412611
  eq23(runtimeAuthorityOperationLeases.ownerId, input.ownerId),
@@ -414893,6 +414888,9 @@ async function assessAppServingRouteConvergence(input) {
414893
414888
  deadLetteredProjectorIds
414894
414889
  };
414895
414890
  }
414891
+ function assessAppServingRouteConvergenceFresh(input) {
414892
+ return input.db.transaction((tx) => assessAppServingRouteConvergence({ db: tx, eventId: input.eventId }));
414893
+ }
414896
414894
  var EVENT_ID, SHA2566;
414897
414895
  var init_app_serving_route_receipt_store = __esm({
414898
414896
  "../platform/src/app-serving-route-receipt-store.ts"() {
@@ -416410,10 +416408,10 @@ var init_runtime_desired_state_bootstrap = __esm({
416410
416408
  });
416411
416409
 
416412
416410
  // ../platform/src/runtime-candidate-cleanup.ts
416413
- import { and as and24, eq as eq28, inArray as inArray12, isNull as isNull8, ne as ne9, or as or11, sql as sql83 } from "drizzle-orm";
416411
+ import { and as and24, eq as eq28, inArray as inArray12, isNull as isNull8, ne as ne9, or as or10, sql as sql83 } from "drizzle-orm";
416414
416412
  import { createConnection as createConnection2 } from "node:net";
416415
416413
  function incompleteCandidatePredicate() {
416416
- return or11(
416414
+ return or10(
416417
416415
  and24(
416418
416416
  inArray12(appRuntimeInstances.state, [...CANDIDATE_INSTANCE_STATES]),
416419
416417
  inArray12(appDeploymentActivations.state, [...CANDIDATE_ACTIVATION_STATES])
@@ -416669,7 +416667,7 @@ var init_runtime_candidate_cleanup = __esm({
416669
416667
 
416670
416668
  // ../platform/src/runtime-candidate-identity.ts
416671
416669
  import { createHash as createHash67 } from "node:crypto";
416672
- import { and as and25, eq as eq29, inArray as inArray13, isNull as isNull9, or as or12, sql as sql84 } from "drizzle-orm";
416670
+ import { and as and25, eq as eq29, inArray as inArray13, isNull as isNull9, or as or11, sql as sql84 } from "drizzle-orm";
416673
416671
  function sha25613(value) {
416674
416672
  return createHash67("sha256").update(value).digest("hex");
416675
416673
  }
@@ -417058,24 +417056,24 @@ async function recordRuntimeCandidateProcessIdentity(input) {
417058
417056
  eq29(appRuntimeInstances.processIdentityHash, expected.processIdentityHash),
417059
417057
  eq29(appRuntimeInstances.readyContractHash, expected.readyContractHash),
417060
417058
  inArray13(appRuntimeInstances.state, ["starting", "ready", "unknown"]),
417061
- or12(isNull9(appRuntimeInstances.pid), eq29(appRuntimeInstances.pid, observed.pid)),
417062
- or12(
417059
+ or11(isNull9(appRuntimeInstances.pid), eq29(appRuntimeInstances.pid, observed.pid)),
417060
+ or11(
417063
417061
  isNull9(appRuntimeInstances.pidStartTicks),
417064
417062
  eq29(appRuntimeInstances.pidStartTicks, observed.pidStartTicks)
417065
417063
  ),
417066
- or12(
417064
+ or11(
417067
417065
  isNull9(appRuntimeInstances.processGroupId),
417068
417066
  eq29(appRuntimeInstances.processGroupId, observed.processGroupId)
417069
417067
  ),
417070
- or12(
417068
+ or11(
417071
417069
  isNull9(appRuntimeInstances.processGroupStartTicks),
417072
417070
  eq29(appRuntimeInstances.processGroupStartTicks, observed.processGroupStartTicks)
417073
417071
  ),
417074
- or12(
417072
+ or11(
417075
417073
  isNull9(appRuntimeInstances.cgroupRefHash),
417076
417074
  eq29(appRuntimeInstances.cgroupRefHash, observed.cgroupRefHash)
417077
417075
  ),
417078
- or12(
417076
+ or11(
417079
417077
  isNull9(appRuntimeInstances.runnerSessionId),
417080
417078
  eq29(appRuntimeInstances.runnerSessionId, observed.runnerSessionId)
417081
417079
  )
@@ -417508,7 +417506,7 @@ var init_deployment_control_plane_orchestrator = __esm({
417508
417506
 
417509
417507
  // ../platform/src/deployment-schema-revision.ts
417510
417508
  import { createHash as createHash68 } from "node:crypto";
417511
- import { and as and26, eq as eq30, isNull as isNull10, or as or13 } from "drizzle-orm";
417509
+ import { and as and26, eq as eq30, isNull as isNull10, or as or12 } from "drizzle-orm";
417512
417510
  function fail21(code) {
417513
417511
  throw Object.assign(new Error(code), { code });
417514
417512
  }
@@ -417583,7 +417581,7 @@ async function inheritReadySchemaRevision(input) {
417583
417581
  and26(
417584
417582
  eq30(deployments.id, input.targetDeploymentId),
417585
417583
  eq30(deployments.appId, input.appId),
417586
- or13(isNull10(deployments.schemaRevisionId), eq30(deployments.schemaRevisionId, id))
417584
+ or12(isNull10(deployments.schemaRevisionId), eq30(deployments.schemaRevisionId, id))
417587
417585
  )
417588
417586
  ).returning({ id: deployments.id });
417589
417587
  if (!deploymentsUpdated[0]) return fail21("SCHEMA_REVISION_INHERITANCE_BINDING_FAILED");
@@ -417876,7 +417874,7 @@ var init_backup_programmatic_catalog = __esm({
417876
417874
  });
417877
417875
 
417878
417876
  // ../platform/gencow/backup-expiry-catalog.ts
417879
- import { and as and28, asc as asc4, eq as eq32, gt as gt8, lte as lte8, or as or14 } from "drizzle-orm";
417877
+ import { and as and28, asc as asc4, eq as eq32, gt as gt8, lte as lte8, or as or13 } from "drizzle-orm";
417880
417878
  var init_backup_expiry_catalog = __esm({
417881
417879
  "../platform/gencow/backup-expiry-catalog.ts"() {
417882
417880
  "use strict";
@@ -420125,7 +420123,7 @@ var init_runtime_stop_dispatch_recovery = __esm({
420125
420123
 
420126
420124
  // ../platform/src/runtime-stop-intent-store.ts
420127
420125
  import { createHash as createHash71 } from "node:crypto";
420128
- import { and as and32, eq as eq36, gt as gt9, inArray as inArray15, isNotNull as isNotNull2, isNull as isNull12, lte as lte9, or as or15, sql as sql90 } from "drizzle-orm";
420126
+ import { and as and32, eq as eq36, gt as gt9, inArray as inArray15, isNotNull as isNotNull2, isNull as isNull12, lte as lte9, or as or14, sql as sql90 } from "drizzle-orm";
420129
420127
  function sha25616(value) {
420130
420128
  return createHash71("sha256").update(value).digest("hex");
420131
420129
  }
@@ -420492,7 +420490,7 @@ async function consumeRuntimeStopIntent(input) {
420492
420490
  eq36(runtimeStopIntents.leaseEpoch, input.leaseEpoch),
420493
420491
  isNull12(runtimeStopIntents.consumedAt),
420494
420492
  isNull12(runtimeStopIntents.cancelledAt),
420495
- or15(gt9(runtimeStopIntents.expiresAt, now), isNotNull2(runtimeStopIntents.dispatchStartedAt))
420493
+ or14(gt9(runtimeStopIntents.expiresAt, now), isNotNull2(runtimeStopIntents.dispatchStartedAt))
420496
420494
  )
420497
420495
  ).returning(intentSelection());
420498
420496
  if (!consumed[0]) {
@@ -420581,7 +420579,7 @@ var init_runtime_stop_intent_store = __esm({
420581
420579
  });
420582
420580
 
420583
420581
  // ../platform/src/runtime-exit-store.ts
420584
- import { and as and33, eq as eq37, gt as gt10, inArray as inArray16, isNotNull as isNotNull3, isNull as isNull13, or as or16 } from "drizzle-orm";
420582
+ import { and as and33, eq as eq37, gt as gt10, inArray as inArray16, isNotNull as isNotNull3, isNull as isNull13, or as or15 } from "drizzle-orm";
420585
420583
  async function recordRuntimeControlPlaneExit(input) {
420586
420584
  const now = input.now ?? /* @__PURE__ */ new Date();
420587
420585
  const [appRows, instanceRows] = await Promise.all([
@@ -420614,7 +420612,7 @@ async function recordRuntimeControlPlaneExit(input) {
420614
420612
  eq37(runtimeStopIntents.leaseEpoch, input.leaseEpoch),
420615
420613
  isNull13(runtimeStopIntents.consumedAt),
420616
420614
  isNull13(runtimeStopIntents.cancelledAt),
420617
- or16(gt10(runtimeStopIntents.expiresAt, now), isNotNull3(runtimeStopIntents.dispatchStartedAt))
420615
+ or15(gt10(runtimeStopIntents.expiresAt, now), isNotNull3(runtimeStopIntents.dispatchStartedAt))
420618
420616
  )
420619
420617
  );
420620
420618
  const intent = intentRows[0];
@@ -420820,7 +420818,7 @@ var init_runtime_convergence_command_store = __esm({
420820
420818
  });
420821
420819
 
420822
420820
  // ../platform/src/runtime-process-identity-adoption.ts
420823
- import { and as and35, eq as eq39, inArray as inArray18, isNull as isNull14, or as or17 } from "drizzle-orm";
420821
+ import { and as and35, eq as eq39, inArray as inArray18, isNull as isNull14, or as or16 } from "drizzle-orm";
420824
420822
  async function adoptExactRuntimeProcessIdentity(input) {
420825
420823
  if (!isCompleteRuntimeProcessIdentity(input.observed)) {
420826
420824
  throw new Error("RUNTIME_PROCESS_IDENTITY_ADOPTION_INCOMPLETE");
@@ -420849,24 +420847,24 @@ async function adoptExactRuntimeProcessIdentity(input) {
420849
420847
  eq39(appRuntimeInstances.processIdentityHash, target.processIdentityHash),
420850
420848
  eq39(appRuntimeInstances.readyContractHash, target.readyContractHash),
420851
420849
  inArray18(appRuntimeInstances.state, ["serving", "draining"]),
420852
- or17(isNull14(appRuntimeInstances.pid), eq39(appRuntimeInstances.pid, observed.pid)),
420853
- or17(
420850
+ or16(isNull14(appRuntimeInstances.pid), eq39(appRuntimeInstances.pid, observed.pid)),
420851
+ or16(
420854
420852
  isNull14(appRuntimeInstances.pidStartTicks),
420855
420853
  eq39(appRuntimeInstances.pidStartTicks, observed.pidStartTicks)
420856
420854
  ),
420857
- or17(
420855
+ or16(
420858
420856
  isNull14(appRuntimeInstances.processGroupId),
420859
420857
  eq39(appRuntimeInstances.processGroupId, observed.processGroupId)
420860
420858
  ),
420861
- or17(
420859
+ or16(
420862
420860
  isNull14(appRuntimeInstances.processGroupStartTicks),
420863
420861
  eq39(appRuntimeInstances.processGroupStartTicks, observed.processGroupStartTicks)
420864
420862
  ),
420865
- or17(
420863
+ or16(
420866
420864
  isNull14(appRuntimeInstances.cgroupRefHash),
420867
420865
  eq39(appRuntimeInstances.cgroupRefHash, observed.cgroupRefHash)
420868
420866
  ),
420869
- or17(
420867
+ or16(
420870
420868
  isNull14(appRuntimeInstances.runnerSessionId),
420871
420869
  eq39(appRuntimeInstances.runnerSessionId, observed.runnerSessionId)
420872
420870
  )
@@ -421086,10 +421084,21 @@ async function deployWithRuntimeControlPlane(input) {
421086
421084
  authSchemaMode: input.claim.authSchema.mode,
421087
421085
  callableBackend: true,
421088
421086
  convergeServingRouteDecision: async (decision) => {
421089
- const convergence = await assessAppServingRouteConvergence({
421087
+ const convergence = await assessAppServingRouteConvergenceFresh({
421090
421088
  db: input.db,
421091
421089
  eventId: decision.eventId
421092
421090
  });
421091
+ if (convergence.status !== "converged") {
421092
+ logger3.warn("[deployment-control-plane] route prepare convergence deferred", {
421093
+ eventId: decision.eventId,
421094
+ status: convergence.status,
421095
+ required: convergence.required,
421096
+ acknowledged: convergence.acknowledged,
421097
+ rejected: convergence.rejected,
421098
+ deadLettered: convergence.deadLettered,
421099
+ missingProjectorIds: convergence.missingProjectorIds
421100
+ });
421101
+ }
421093
421102
  if (convergence.status === "converged") return "converged";
421094
421103
  if (convergence.status === "dead_letter") return "blocked";
421095
421104
  return "pending";
@@ -422803,7 +422812,7 @@ var init_deployment_executor_spool_compensation = __esm({
422803
422812
 
422804
422813
  // ../platform/src/app-release-restore-operation.ts
422805
422814
  import { createHash as createHash75, randomUUID as randomUUID32 } from "node:crypto";
422806
- import { and as and45, eq as eq49, gt as gt13, inArray as inArray22, isNull as isNull20, like as like3, lte as lte11, or as or18, sql as sql93 } from "drizzle-orm";
422815
+ import { and as and45, eq as eq49, gt as gt13, inArray as inArray22, isNull as isNull20, like as like3, lte as lte11, or as or17, sql as sql93 } from "drizzle-orm";
422807
422816
  var DEFAULT_LEASE_MS, DEFAULT_HEARTBEAT_MS;
422808
422817
  var init_app_release_restore_operation = __esm({
422809
422818
  "../platform/src/app-release-restore-operation.ts"() {
@@ -424479,7 +424488,7 @@ var init_runtime_app_delete_retirement_debt = __esm({
424479
424488
  });
424480
424489
 
424481
424490
  // ../platform/src/runtime-control-plane-production-adapter.ts
424482
- import { and as and54, eq as eq59, gt as gt15, isNotNull as isNotNull5, isNull as isNull24, or as or19 } from "drizzle-orm";
424491
+ import { and as and54, eq as eq59, gt as gt15, isNotNull as isNotNull5, isNull as isNull24, or as or18 } from "drizzle-orm";
424483
424492
  function createRuntimeControlPlaneProductionAdapter(input) {
424484
424493
  const fetchImpl = input.fetchImpl ?? fetch;
424485
424494
  const logger3 = input.logger ?? console;
@@ -424860,7 +424869,7 @@ function createRuntimeControlPlaneProductionAdapter(input) {
424860
424869
  eq59(runtimeStopIntents.appId, appId),
424861
424870
  isNull24(runtimeStopIntents.consumedAt),
424862
424871
  isNull24(runtimeStopIntents.cancelledAt),
424863
- or19(gt15(runtimeStopIntents.expiresAt, now), isNotNull5(runtimeStopIntents.dispatchStartedAt))
424872
+ or18(gt15(runtimeStopIntents.expiresAt, now), isNotNull5(runtimeStopIntents.dispatchStartedAt))
424864
424873
  )
424865
424874
  );
424866
424875
  let dispatched = 0;
@@ -425723,7 +425732,7 @@ var init_legacy_runtime_evidence_observer = __esm({
425723
425732
  });
425724
425733
 
425725
425734
  // ../platform/src/legacy-runtime-bootstrap-store.ts
425726
- import { and as and56, eq as eq61, inArray as inArray29, isNull as isNull26, or as or20, sql as sql99 } from "drizzle-orm";
425735
+ import { and as and56, eq as eq61, inArray as inArray29, isNull as isNull26, or as or19, sql as sql99 } from "drizzle-orm";
425727
425736
  function sameDesired(left, right) {
425728
425737
  if (!left || !right) return left === null && !right;
425729
425738
  return left.authorityMode === right.authorityMode && left.desiredRuntimeState === right.desiredRuntimeState && left.desiredActivationId === right.desiredActivationId && left.activationEpoch === right.activationEpoch && left.nodeId === right.nodeId && left.nodeEpoch === right.nodeEpoch;
@@ -425810,7 +425819,7 @@ async function commitLegacyRuntimeSafeAbsence(input) {
425810
425819
  and56(
425811
425820
  eq61(appDeploymentActivations.id, input.snapshot.legacyActivation.id),
425812
425821
  eq61(appDeploymentActivations.appId, input.snapshot.appId),
425813
- or20(
425822
+ or19(
425814
425823
  eq61(appDeploymentActivations.activationKind, "legacy_observed"),
425815
425824
  and56(
425816
425825
  isNull26(appDeploymentActivations.activationKind),
@@ -427769,7 +427778,7 @@ async function resumeRuntimeWithControlPlane(input) {
427769
427778
  app: current,
427770
427779
  environment: deploymentRows[0].env,
427771
427780
  currentDeploymentId: current.currentDeployId,
427772
- requestId: `lifecycle_resume_${current.id}_${current.currentDeployId}`
427781
+ requestId: input.requestId ?? `lifecycle_resume_${current.id}_${current.currentDeployId}`
427773
427782
  });
427774
427783
  await projectAppStatus(input.db, {
427775
427784
  status: "running",
@@ -427929,7 +427938,7 @@ var init_app_delete_terminal_evidence = __esm({
427929
427938
  });
427930
427939
 
427931
427940
  // ../platform/src/app-delete-catalog-finalizer.ts
427932
- import { and as and66, eq as eq71, gt as gt18, inArray as inArray38, isNotNull as isNotNull7, ne as ne11, or as or21, sql as sql106 } from "drizzle-orm";
427941
+ import { and as and66, eq as eq71, gt as gt18, inArray as inArray38, isNotNull as isNotNull7, ne as ne11, or as or20, sql as sql106 } from "drizzle-orm";
427933
427942
  var init_app_delete_catalog_finalizer = __esm({
427934
427943
  "../platform/src/app-delete-catalog-finalizer.ts"() {
427935
427944
  "use strict";
@@ -428200,7 +428209,7 @@ var init_platform_mutation_http_presentation = __esm({
428200
428209
  });
428201
428210
 
428202
428211
  // ../platform/src/platform-api-runtime-convergence.ts
428203
- import { and as and70, eq as eq76, or as or22 } from "drizzle-orm";
428212
+ import { and as and70, eq as eq76, or as or21 } from "drizzle-orm";
428204
428213
  function startLegacyPlatformApp(input) {
428205
428214
  return executeLegacyRuntimeEffect({
428206
428215
  command: "resume",
@@ -428254,7 +428263,7 @@ async function admitPlatformRuntimeResume(input) {
428254
428263
  function stoppedRuntimeOperationCondition(operationId2) {
428255
428264
  return and70(
428256
428265
  eq76(runtimeLifecycleRequests.id, operationId2),
428257
- or22(
428266
+ or21(
428258
428267
  eq76(runtimeLifecycleRequests.action, "operator_stop"),
428259
428268
  and70(
428260
428269
  eq76(runtimeLifecycleRequests.action, "converge"),