@postman-cse/onboarding-repo-sync 2.6.3 → 2.6.5

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.cjs CHANGED
@@ -136524,8 +136524,8 @@ var PostmanGatewayAssetsClient = class {
136524
136524
  return { candidates, nameOnlyMatchCount: nameOnly.length, nameOnlyEnvironments };
136525
136525
  }
136526
136526
  /**
136527
- * Rebind the sole same-name monitor in this workspace onto the current
136528
- * collection UID.
136527
+ * Replace the sole same-name monitor in this workspace when its collection
136528
+ * UID changed.
136529
136529
  *
136530
136530
  * The canonical Smoke collection can legitimately change UID (a bootstrap
136531
136531
  * re-import after a marker/stranger miss, or an operator rebuild). The
@@ -136533,13 +136533,18 @@ var PostmanGatewayAssetsClient = class {
136533
136533
  * (which requires the full collection+environment+name triple) misses and a
136534
136534
  * second monitor with the same name would be created on every run, orphaning
136535
136535
  * the old one. Name plus environment is the stable identity across a
136536
- * collection re-import, so recover it here instead.
136536
+ * collection re-import, so recover it here instead. Monitoring API does not
136537
+ * allow `collection` in a jobTemplate update body, so replacement is the
136538
+ * supported mutation: create or adopt the desired monitor first, then delete
136539
+ * the stale monitor. This order preserves the existing monitor if creation
136540
+ * fails and never deletes the only usable monitor before its replacement
136541
+ * exists.
136537
136542
  *
136538
136543
  * Returns null when nothing needs rebinding (no same-name monitor, or it is
136539
136544
  * already bound to this collection). Refuses to guess when several same-name
136540
136545
  * monitors match, matching `selectExactMatch` semantics elsewhere.
136541
136546
  */
136542
- async rebindMonitorByName(name, collectionUid, environmentUid) {
136547
+ async rebindMonitorByName(name, collectionUid, environmentUid, cronSchedule) {
136543
136548
  const monitorName = String(name ?? "").trim();
136544
136549
  const collection = String(collectionUid ?? "").trim();
136545
136550
  const environment = String(environmentUid ?? "").trim();
@@ -136571,16 +136576,19 @@ var PostmanGatewayAssetsClient = class {
136571
136576
  if (match.collectionUid === collection) {
136572
136577
  return null;
136573
136578
  }
136574
- await this.gateway.requestJson(
136575
- {
136576
- service: "monitors",
136577
- method: "put",
136578
- path: `/jobTemplates/${this.toModelId(match.uid)}?_etc=true`,
136579
- body: { collection }
136580
- },
136581
- { retryTransient: false }
136579
+ const replacementUid = await this.createMonitor(
136580
+ this.workspaceId,
136581
+ monitorName,
136582
+ collection,
136583
+ environment,
136584
+ cronSchedule
136582
136585
  );
136583
- return { uid: match.uid, previousCollectionUid: match.collectionUid };
136586
+ await this.deleteMonitor(match.uid);
136587
+ return {
136588
+ uid: replacementUid,
136589
+ previousUid: match.uid,
136590
+ previousCollectionUid: match.collectionUid
136591
+ };
136584
136592
  }
136585
136593
  async runMonitor(uid) {
136586
136594
  await this.gateway.requestJson(
@@ -138455,6 +138463,10 @@ var PREBUILT_COLLECTION_ROLES = /* @__PURE__ */ new Set([
138455
138463
  ]);
138456
138464
  var SHA256_HEX = /^[a-f0-9]{64}$/;
138457
138465
  var PREBUILT_CLOUD_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]*$/;
138466
+ var PREBUILT_COLLECTION_MAX_DEPTH = 128;
138467
+ var PREBUILT_COLLECTION_MAX_TRAVERSAL_ENTRIES = LOCAL_SPEC_DISCOVERY_MAX_TRAVERSAL_ENTRIES;
138468
+ var PREBUILT_COLLECTION_MAX_FILE_BYTES = 32 * 1024 * 1024;
138469
+ var PREBUILT_COLLECTION_MAX_TOTAL_BYTES = 100 * 1024 * 1024;
138458
138470
  function failPrebuiltCollections(detail) {
138459
138471
  throw new Error(`CONTRACT_PREBUILT_COLLECTIONS_INVALID: ${detail}`);
138460
138472
  }
@@ -138566,8 +138578,9 @@ function assertPathWithinArtifactRoot(targetPath, artifactDir, fieldName) {
138566
138578
  existingPath = parent;
138567
138579
  }
138568
138580
  const realExisting = (0, import_node_fs5.realpathSync)(existingPath);
138569
- const realRelative = path3.relative(artifactRoot, realExisting);
138570
- if (realRelative.startsWith("..") || path3.isAbsolute(realRelative)) {
138581
+ const realArtifactRoot = (0, import_node_fs5.existsSync)(artifactRoot) ? (0, import_node_fs5.realpathSync)(artifactRoot) : void 0;
138582
+ const realRelative = realArtifactRoot ? path3.relative(realArtifactRoot, realExisting) : "";
138583
+ if (realArtifactRoot && (realRelative.startsWith("..") || path3.isAbsolute(realRelative))) {
138571
138584
  failPrebuiltCollections(
138572
138585
  `${fieldName} resolves outside artifact-dir via symlink; received ${targetPath}`
138573
138586
  );
@@ -138609,13 +138622,16 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
138609
138622
  return [];
138610
138623
  }
138611
138624
  const files = [];
138612
- const pendingDirectories = [absRoot];
138625
+ const pendingDirectories = [{ absolute: absRoot, depth: 0 }];
138613
138626
  const seenDirectories = /* @__PURE__ */ new Set();
138627
+ let traversalEntries = 1;
138628
+ let totalBytes = 0;
138614
138629
  while (pendingDirectories.length > 0) {
138615
- const currentAbsolute = pendingDirectories.pop();
138616
- if (!currentAbsolute) {
138630
+ const current = pendingDirectories.pop();
138631
+ if (!current) {
138617
138632
  break;
138618
138633
  }
138634
+ const { absolute: currentAbsolute, depth: currentDepth } = current;
138619
138635
  const currentStat = (0, import_node_fs5.lstatSync)(currentAbsolute);
138620
138636
  if (currentStat.isSymbolicLink() || !currentStat.isDirectory()) {
138621
138637
  failPrebuiltCollections(
@@ -138629,8 +138645,16 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
138629
138645
  );
138630
138646
  }
138631
138647
  seenDirectories.add(currentKey);
138632
- const entries = (0, import_node_fs5.readdirSync)(currentAbsolute, { withFileTypes: true });
138648
+ const entries = (0, import_node_fs5.readdirSync)(currentAbsolute, { withFileTypes: true }).sort(
138649
+ (left, right) => left.name.localeCompare(right.name)
138650
+ );
138633
138651
  for (const entry of entries) {
138652
+ traversalEntries += 1;
138653
+ if (traversalEntries > PREBUILT_COLLECTION_MAX_TRAVERSAL_ENTRIES) {
138654
+ failPrebuiltCollections(
138655
+ `prebuilt collection tree exceeded the ${PREBUILT_COLLECTION_MAX_TRAVERSAL_ENTRIES} traversal-entry budget`
138656
+ );
138657
+ }
138634
138658
  const abs = path3.join(currentAbsolute, entry.name);
138635
138659
  if (entry.isSymbolicLink()) {
138636
138660
  failPrebuiltCollections(
@@ -138638,7 +138662,13 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
138638
138662
  );
138639
138663
  }
138640
138664
  if (entry.isDirectory()) {
138641
- pendingDirectories.push(abs);
138665
+ const nextDepth = currentDepth + 1;
138666
+ if (nextDepth > PREBUILT_COLLECTION_MAX_DEPTH) {
138667
+ failPrebuiltCollections(
138668
+ `prebuilt collection tree exceeded the ${PREBUILT_COLLECTION_MAX_DEPTH} directory-depth budget`
138669
+ );
138670
+ }
138671
+ pendingDirectories.push({ absolute: abs, depth: nextDepth });
138642
138672
  continue;
138643
138673
  }
138644
138674
  if (!entry.isFile()) {
@@ -138652,6 +138682,17 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
138652
138682
  `prebuilt collection tree file changed or became unsupported at ${normalizeToPosix(path3.relative(absRoot, abs))}`
138653
138683
  );
138654
138684
  }
138685
+ if (fileLstat.size > PREBUILT_COLLECTION_MAX_FILE_BYTES) {
138686
+ failPrebuiltCollections(
138687
+ `prebuilt collection tree file ${normalizeToPosix(path3.relative(absRoot, abs))} exceeds the ${PREBUILT_COLLECTION_MAX_FILE_BYTES / (1024 * 1024)} MiB individual-file budget`
138688
+ );
138689
+ }
138690
+ totalBytes += fileLstat.size;
138691
+ if (totalBytes > PREBUILT_COLLECTION_MAX_TOTAL_BYTES) {
138692
+ failPrebuiltCollections(
138693
+ `prebuilt collection tree exceeded the ${PREBUILT_COLLECTION_MAX_TOTAL_BYTES / (1024 * 1024)} MiB total-byte budget`
138694
+ );
138695
+ }
138655
138696
  files.push({
138656
138697
  absolute: abs,
138657
138698
  relative: normalizeToPosix(path3.relative(absRoot, abs)),
@@ -138786,63 +138827,69 @@ async function preparePrivateMockCloudCollection(role, collectionId, postman) {
138786
138827
  }
138787
138828
  return collection;
138788
138829
  }
138830
+ var ARTIFACT_ACQUISITION_WIDTH = 2;
138831
+ async function runBoundedInOrder(items, width, worker) {
138832
+ const results = new Array(items.length);
138833
+ let nextIndex = 0;
138834
+ const failures = /* @__PURE__ */ new Map();
138835
+ const runWorker = async () => {
138836
+ while (failures.size === 0 && nextIndex < items.length) {
138837
+ const index = nextIndex;
138838
+ nextIndex += 1;
138839
+ try {
138840
+ results[index] = await worker(items[index], index);
138841
+ } catch (error) {
138842
+ failures.set(index, error);
138843
+ return;
138844
+ }
138845
+ }
138846
+ };
138847
+ await Promise.all(Array.from({ length: Math.min(width, items.length) }, () => runWorker()));
138848
+ const failedIndex = Math.min(...failures.keys());
138849
+ if (Number.isFinite(failedIndex)) {
138850
+ throw failures.get(failedIndex);
138851
+ }
138852
+ return results;
138853
+ }
138854
+ async function acquireCollectionArtifact(options) {
138855
+ const { role, collectionId, dirName, collectionsDir, prebuiltByRole, postman, core, privateMockAuth = false } = options;
138856
+ const expectedPath = `${collectionsDir}/${dirName}`;
138857
+ const forceCloudExport = privateMockAuth && (role === "smoke" || role === "contract");
138858
+ const entry = prebuiltByRole.get(role);
138859
+ if (entry && !forceCloudExport && tryReusePrebuiltCollection({
138860
+ prepared: entry,
138861
+ expectedPath,
138862
+ expectedCloudId: collectionId
138863
+ })) {
138864
+ core.info(`Reusing prebuilt ${role} collection tree at ${expectedPath} (artifactDigest match)`);
138865
+ return { reusePrebuilt: true };
138866
+ }
138867
+ if (entry) {
138868
+ core.info(forceCloudExport ? `Private mock requires cloud export for ${role} collection to reconcile managed root hook; exporting from cloud` : `Prebuilt ${role} collection entry present but did not exactly match; exporting from cloud`);
138869
+ }
138870
+ const cloud = forceCloudExport ? await preparePrivateMockCloudCollection(role, collectionId, postman) : await postman.getCollection(collectionId);
138871
+ return { reusePrebuilt: false, cloudCollection: cloud };
138872
+ }
138789
138873
  async function exportCollectionArtifact(options) {
138790
138874
  const {
138791
- role,
138792
138875
  collectionId,
138793
138876
  dirName,
138794
138877
  collectionsDir,
138795
- prebuiltByRole,
138796
- postman,
138797
- core,
138798
- privateMockAuth = false,
138799
- preparedCloudCollection
138878
+ artifactDir,
138879
+ acquisition
138800
138880
  } = options;
138801
138881
  if (!collectionId) {
138802
138882
  return void 0;
138803
138883
  }
138804
138884
  const expectedPath = `${collectionsDir}/${dirName}`;
138805
- const forceCloudExport = privateMockAuth && (role === "smoke" || role === "contract");
138806
- const entry = prebuiltByRole.get(role);
138807
- if (entry && !forceCloudExport) {
138808
- const reused = tryReusePrebuiltCollection({
138809
- prepared: entry,
138810
- expectedPath,
138811
- expectedCloudId: collectionId
138812
- });
138813
- if (reused) {
138814
- core.info(
138815
- `Reusing prebuilt ${role} collection tree at ${expectedPath} (artifactDigest match)`
138816
- );
138817
- return `../${expectedPath}`;
138818
- }
138819
- core.info(
138820
- `Prebuilt ${role} collection entry present but did not exactly match; exporting from cloud`
138821
- );
138822
- } else if (entry && forceCloudExport) {
138823
- core.info(
138824
- `Private mock requires cloud export for ${role} collection to reconcile managed root hook; exporting from cloud`
138825
- );
138885
+ if (acquisition.reusePrebuilt) {
138886
+ return `../${expectedPath}`;
138826
138887
  }
138827
- let collectionForExport;
138828
- if (forceCloudExport && preparedCloudCollection) {
138829
- collectionForExport = preparedCloudCollection;
138830
- } else if (forceCloudExport) {
138831
- const col = await postman.getCollection(collectionId);
138832
- const { collection } = applyPrivateMockExportCleanup(col, {
138833
- stripManagedBlocks: isPrivateMockLegacyExportCleanupEnabled()
138834
- });
138835
- if (!verifyPrivateMockRootHook(collection)) {
138836
- throw new Error(
138837
- `PRIVATE_MOCK_AUTH_ROOT_UNVERIFIED: Managed root hook missing from exported ${role} collection ${collectionId}`
138838
- );
138839
- }
138840
- collectionForExport = collection;
138841
- } else {
138842
- const col = await postman.getCollection(collectionId);
138843
- collectionForExport = col;
138844
- }
138845
- await convertAndSplitAnyCollection(collectionForExport, expectedPath);
138888
+ assertPathWithinArtifactRoot(expectedPath, artifactDir, "collection target");
138889
+ await convertAndSplitAnyCollection(
138890
+ acquisition.cloudCollection,
138891
+ expectedPath
138892
+ );
138846
138893
  return `../${expectedPath}`;
138847
138894
  }
138848
138895
  function hasControlCharacter2(value) {
@@ -138907,65 +138954,45 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
138907
138954
  ) : void 0;
138908
138955
  const prebuiltByRole = options.preparedPrebuiltCollections;
138909
138956
  const privateMockAuth = options.privateMockAuth === true;
138910
- const preparedPrivateMockCollections = /* @__PURE__ */ new Map();
138911
- if (privateMockAuth) {
138912
- for (const spec of [
138913
- { role: "smoke", collectionId: inputs.smokeCollectionId },
138914
- { role: "contract", collectionId: inputs.contractCollectionId }
138915
- ]) {
138916
- if (!spec.collectionId) {
138917
- continue;
138918
- }
138919
- preparedPrivateMockCollections.set(
138920
- spec.role,
138921
- await preparePrivateMockCloudCollection(
138922
- spec.role,
138923
- spec.collectionId,
138924
- dependencies.postman
138925
- )
138926
- );
138927
- }
138928
- }
138929
- const baselineRef = await exportCollectionArtifact({
138930
- role: "baseline",
138931
- collectionId: inputs.baselineCollectionId,
138932
- dirName: getCollectionDirectoryName("Baseline", assetProjectName),
138933
- collectionsDir,
138934
- prebuiltByRole,
138935
- postman: dependencies.postman,
138936
- core: dependencies.core,
138937
- privateMockAuth
138938
- });
138939
- if (baselineRef) {
138940
- manifestCollections[baselineRef] = inputs.baselineCollectionId;
138941
- }
138942
- const smokeRef = await exportCollectionArtifact({
138943
- role: "smoke",
138944
- collectionId: inputs.smokeCollectionId,
138945
- dirName: getCollectionDirectoryName("Smoke", assetProjectName),
138946
- collectionsDir,
138947
- prebuiltByRole,
138948
- postman: dependencies.postman,
138949
- core: dependencies.core,
138950
- privateMockAuth,
138951
- preparedCloudCollection: preparedPrivateMockCollections.get("smoke")
138952
- });
138953
- if (smokeRef) {
138954
- manifestCollections[smokeRef] = inputs.smokeCollectionId;
138957
+ const collectionSpecs = [
138958
+ { role: "baseline", collectionId: inputs.baselineCollectionId, dirName: getCollectionDirectoryName("Baseline", assetProjectName) },
138959
+ { role: "smoke", collectionId: inputs.smokeCollectionId, dirName: getCollectionDirectoryName("Smoke", assetProjectName) },
138960
+ { role: "contract", collectionId: inputs.contractCollectionId, dirName: getCollectionDirectoryName("Contract", assetProjectName) }
138961
+ ].filter((spec) => Boolean(spec.collectionId));
138962
+ const collectionStartedAt = Date.now();
138963
+ let collectionStatus = "success";
138964
+ let acquisitions;
138965
+ try {
138966
+ acquisitions = await runBoundedInOrder(
138967
+ collectionSpecs,
138968
+ ARTIFACT_ACQUISITION_WIDTH,
138969
+ (spec) => acquireCollectionArtifact({
138970
+ ...spec,
138971
+ collectionsDir,
138972
+ prebuiltByRole,
138973
+ postman: dependencies.postman,
138974
+ core: dependencies.core,
138975
+ privateMockAuth
138976
+ })
138977
+ );
138978
+ } catch (error) {
138979
+ collectionStatus = "failed";
138980
+ throw error;
138981
+ } finally {
138982
+ dependencies.core.info(
138983
+ `collection-acquisition count=${collectionSpecs.length} width=${ARTIFACT_ACQUISITION_WIDTH} ms=${Date.now() - collectionStartedAt} status=${collectionStatus}`
138984
+ );
138955
138985
  }
138956
- const contractRef = await exportCollectionArtifact({
138957
- role: "contract",
138958
- collectionId: inputs.contractCollectionId,
138959
- dirName: getCollectionDirectoryName("Contract", assetProjectName),
138960
- collectionsDir,
138961
- prebuiltByRole,
138962
- postman: dependencies.postman,
138963
- core: dependencies.core,
138964
- privateMockAuth,
138965
- preparedCloudCollection: preparedPrivateMockCollections.get("contract")
138966
- });
138967
- if (contractRef) {
138968
- manifestCollections[contractRef] = inputs.contractCollectionId;
138986
+ for (const [index, spec] of collectionSpecs.entries()) {
138987
+ const ref = await exportCollectionArtifact({
138988
+ ...spec,
138989
+ collectionsDir,
138990
+ artifactDir: inputs.artifactDir,
138991
+ acquisition: acquisitions[index]
138992
+ });
138993
+ if (ref) {
138994
+ manifestCollections[ref] = spec.collectionId;
138995
+ }
138969
138996
  }
138970
138997
  ensureDir(collectionsDir);
138971
138998
  ensureDir(environmentsDir);
@@ -138984,17 +139011,40 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
138984
139011
  ensureDir(ciDir);
138985
139012
  }
138986
139013
  }
138987
- for (const [envName, envUid] of Object.entries(envUids)) {
138988
- writeJsonFile(
138989
- `${environmentsDir}/${envName}.postman_environment.json`,
138990
- await dependencies.postman.getEnvironment(envUid),
138991
- true
139014
+ const environmentSpecs = [
139015
+ ...Object.entries(envUids).map(([envName, envUid]) => ({
139016
+ envName,
139017
+ envUid,
139018
+ filePath: `${environmentsDir}/${envName}.postman_environment.json`
139019
+ })),
139020
+ ...options.mockEnvironmentUid ? [{
139021
+ envName: "manual-validation",
139022
+ envUid: options.mockEnvironmentUid,
139023
+ filePath: `${mocksDir}/manual-validation.postman_environment.json`
139024
+ }] : []
139025
+ ];
139026
+ const environmentStartedAt = Date.now();
139027
+ let environmentStatus = "success";
139028
+ let environmentPayloads;
139029
+ try {
139030
+ environmentPayloads = await runBoundedInOrder(
139031
+ environmentSpecs,
139032
+ ARTIFACT_ACQUISITION_WIDTH,
139033
+ (spec) => dependencies.postman.getEnvironment(spec.envUid)
139034
+ );
139035
+ } catch (error) {
139036
+ environmentStatus = "failed";
139037
+ throw error;
139038
+ } finally {
139039
+ dependencies.core.info(
139040
+ `environment-artifact-acquisition count=${environmentSpecs.length} width=${ARTIFACT_ACQUISITION_WIDTH} ms=${Date.now() - environmentStartedAt} status=${environmentStatus}`
138992
139041
  );
138993
139042
  }
138994
- if (options.mockEnvironmentUid) {
139043
+ for (const [index, spec] of environmentSpecs.entries()) {
139044
+ assertPathWithinCwd(spec.filePath, "environment target");
138995
139045
  writeJsonFile(
138996
- `${mocksDir}/manual-validation.postman_environment.json`,
138997
- await dependencies.postman.getEnvironment(options.mockEnvironmentUid),
139046
+ spec.filePath,
139047
+ environmentPayloads[index],
138998
139048
  true
138999
139049
  );
139000
139050
  }
@@ -139004,6 +139054,7 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
139004
139054
  workspaceLinkEnabled: inputs.workspaceLinkEnabled,
139005
139055
  workspaceLinkStatus: options.workspaceLinkStatus
139006
139056
  });
139057
+ assertPathWithinCwd(".postman/resources.yaml", "resources state target");
139007
139058
  (0, import_node_fs5.writeFileSync)(".postman/resources.yaml", buildResourcesManifest(
139008
139059
  durableWorkspaceId,
139009
139060
  manifestCollections,
@@ -139022,6 +139073,7 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
139022
139073
  } catch {
139023
139074
  existingWorkflows = void 0;
139024
139075
  }
139076
+ assertPathWithinCwd(".postman/workflows.yaml", "workflows state target");
139025
139077
  (0, import_node_fs5.writeFileSync)(
139026
139078
  ".postman/workflows.yaml",
139027
139079
  buildSpecCollectionWorkflowManifest(
@@ -139071,18 +139123,19 @@ function createRepoSummary(outputs, envUids, pushed) {
139071
139123
  }
139072
139124
  async function commitAndPushGeneratedFiles(inputs, dependencies) {
139073
139125
  if (inputs.generateCiWorkflow) {
139074
- assertPathWithinCwd(inputs.ciWorkflowPath, "ci-workflow-path");
139075
139126
  const ciWorkflow = renderCiWorkflow(inputs);
139076
139127
  const parts = inputs.ciWorkflowPath.split("/");
139077
139128
  if (parts.length > 1) {
139078
139129
  const dir = parts.slice(0, -1).join("/");
139079
139130
  ensureDir(dir);
139080
139131
  }
139132
+ assertPathWithinCwd(inputs.ciWorkflowPath, "ci-workflow-path");
139081
139133
  (0, import_node_fs5.writeFileSync)(inputs.ciWorkflowPath, ciWorkflow);
139082
139134
  if (inputs.provider === "github" || inputs.provider === "unknown") {
139083
139135
  const gcPath = ".github/workflows/postman-preview-gc.yml";
139084
139136
  if (inputs.ciWorkflowPath.endsWith(".github/workflows/ci.yml") || inputs.ciWorkflowPath === ".github/workflows/ci.yml") {
139085
139137
  ensureDir(".github/workflows");
139138
+ assertPathWithinCwd(gcPath, "preview GC workflow path");
139086
139139
  (0, import_node_fs5.writeFileSync)(gcPath, renderGcWorkflowTemplate());
139087
139140
  }
139088
139141
  }
@@ -139528,35 +139581,25 @@ async function runRepoSyncInner(inputs, dependencies) {
139528
139581
  const rebound = await dependencies.postman.rebindMonitorByName(
139529
139582
  monitorName,
139530
139583
  inputs.smokeCollectionId,
139531
- monitorEnvUid
139584
+ monitorEnvUid,
139585
+ effectiveCron || void 0
139532
139586
  );
139533
139587
  if (rebound) {
139534
139588
  resolvedMonitorId = rebound.uid;
139535
139589
  dependencies.core.info(
139536
- `Rebound existing monitor ${rebound.uid} ("${monitorName}") from collection ${rebound.previousCollectionUid} to ${inputs.smokeCollectionId}`
139590
+ `Replaced stale monitor ${rebound.previousUid} ("${monitorName}") from collection ${rebound.previousCollectionUid} with ${rebound.uid} on ${inputs.smokeCollectionId}`
139537
139591
  );
139538
139592
  }
139539
139593
  } catch (error) {
139540
- if (error instanceof AmbiguousMonitorRebindError) {
139541
- throw new Error(
139542
- formatOrchestrationIssue({
139543
- operation: "Monitor rebind",
139544
- entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
139545
- cause: error,
139546
- remediation: monitorRemediation,
139547
- mask
139548
- }),
139549
- { cause: error }
139550
- );
139551
- }
139552
- dependencies.core.warning(
139594
+ throw new Error(
139553
139595
  formatOrchestrationIssue({
139554
139596
  operation: "Monitor rebind",
139555
139597
  entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
139556
139598
  cause: error,
139557
139599
  remediation: monitorRemediation,
139558
139600
  mask
139559
- })
139601
+ }),
139602
+ { cause: error }
139560
139603
  );
139561
139604
  }
139562
139605
  }