ardent-cli 0.0.30 → 0.0.32

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.
Files changed (2) hide show
  1. package/dist/index.js +80 -3
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -762,6 +762,42 @@ branchCommand.command("diff [name]", { hidden: true }).description("(removed) Sh
762
762
  // src/commands/connector/index.ts
763
763
  import { Command as Command2 } from "commander";
764
764
 
765
+ // src/lib/connector_warnings.ts
766
+ var YELLOW = "\x1B[33m";
767
+ var RESET = "\x1B[0m";
768
+ async function fetchConnectorWarnings(projectId, connectorId) {
769
+ const listed = await api.get(
770
+ `/v1/cli/connectors?project_id=${encodeURIComponent(projectId)}`
771
+ );
772
+ if (!listed.connectors) {
773
+ throw new Error("connector list response missing connectors array");
774
+ }
775
+ for (const connector of listed.connectors) {
776
+ if (connector.id === connectorId) {
777
+ return connector.warnings ?? [];
778
+ }
779
+ }
780
+ throw new Error(
781
+ `connector ${connectorId} absent from /v1/cli/connectors response`
782
+ );
783
+ }
784
+ function printDegradedWarnings(warnings) {
785
+ if (warnings.length > 0) {
786
+ console.log(
787
+ `${YELLOW}\u26A0 This connector is degraded \u2014 some source objects are excluded from branches:${RESET}`
788
+ );
789
+ for (const warning of warnings) {
790
+ console.log(`${YELLOW} \u2022 ${warning}${RESET}`);
791
+ }
792
+ } else {
793
+ console.log(
794
+ `${YELLOW}\u26A0 This connector is degraded \u2014 some source objects are excluded from branches.${RESET}`
795
+ );
796
+ }
797
+ console.log("");
798
+ console.log(" Review this connector with: ardent connector list");
799
+ }
800
+
765
801
  // src/lib/engine_setup_result.ts
766
802
  var SUCCESS_ENGINE_STATUSES = /* @__PURE__ */ new Set(["healthy", "degraded"]);
767
803
  var RETRYABLE_ENGINE_STATUSES = /* @__PURE__ */ new Set(["configuration_verified"]);
@@ -1456,6 +1492,17 @@ async function promptForUnsupportedExtensions(connectorId, unsupported, alreadyP
1456
1492
  console.log(`\u2713 Saved drop selection: ${merged.join(", ")}`);
1457
1493
  return "applied";
1458
1494
  }
1495
+ function printUnloggedTablesPreflight(preflight) {
1496
+ if (!preflight) return;
1497
+ const unavailableWarning = preflight.warning ?? "UNLOGGED-table preflight is unavailable for this connector. Contact Ardent support.";
1498
+ const message = preflight.status === "unavailable" ? unavailableWarning : (preflight.message ?? "").trim();
1499
+ if (!message) return;
1500
+ const yellow = "\x1B[33m";
1501
+ const reset2 = "\x1B[0m";
1502
+ console.log("");
1503
+ console.log(`${yellow}\u26A0 ${message}${reset2}`);
1504
+ console.log("");
1505
+ }
1459
1506
  async function createAction2(type, url, options) {
1460
1507
  const supportedTypes = ["postgresql"];
1461
1508
  if (!supportedTypes.includes(type.toLowerCase())) {
@@ -1632,6 +1679,7 @@ async function createAction2(type, url, options) {
1632
1679
  process.exit(1);
1633
1680
  }
1634
1681
  }
1682
+ printUnloggedTablesPreflight(connector.unlogged_tables_preflight ?? null);
1635
1683
  if (connector.branching_engine_status === "configuration_verified") {
1636
1684
  await handleReplicaIdentityPreflight(
1637
1685
  connectorId,
@@ -1663,13 +1711,30 @@ async function createAction2(type, url, options) {
1663
1711
  setCacheEntry("connectors", cachedConnectors);
1664
1712
  setConfig("currentConnectorId", connectorId);
1665
1713
  setConfig("currentConnectorName", connectorName);
1714
+ const isDegraded = finalConnector.branching_engine_status === "degraded";
1666
1715
  trackEvent("CLI: connector create succeeded", {
1667
1716
  db_type: type,
1668
1717
  byoc: isByoc,
1669
- deployment_model: deploymentModel
1718
+ deployment_model: deploymentModel,
1719
+ degraded: isDegraded
1670
1720
  });
1671
- console.log("\u2713 Connector created and ready");
1672
- console.log(` ID: ${connectorId}`);
1721
+ if (isDegraded) {
1722
+ console.log("\u2713 Connector created");
1723
+ console.log(` ID: ${connectorId}`);
1724
+ console.log("");
1725
+ let warnings = [];
1726
+ try {
1727
+ warnings = await fetchConnectorWarnings(currentProjectId, connectorId);
1728
+ } catch (warningsErr) {
1729
+ trackEvent("CLI: connector create degraded warnings unavailable", {
1730
+ reason: warningsErr instanceof Error ? warningsErr.message : "unknown"
1731
+ });
1732
+ }
1733
+ printDegradedWarnings(warnings);
1734
+ } else {
1735
+ console.log("\u2713 Connector created and ready");
1736
+ console.log(` ID: ${connectorId}`);
1737
+ }
1673
1738
  showNextStep();
1674
1739
  } catch (err) {
1675
1740
  if (isPermissionError(err)) {
@@ -1689,6 +1754,7 @@ async function createAction2(type, url, options) {
1689
1754
 
1690
1755
  // src/lib/connector_render.ts
1691
1756
  var GREEN = "\x1B[32m";
1757
+ var YELLOW2 = "\x1B[33m";
1692
1758
  var CYAN = "\x1B[36m";
1693
1759
  var RED = "\x1B[31m";
1694
1760
  function pendingHint(state, connectorName) {
@@ -1712,6 +1778,9 @@ function renderConnectorIcon(connector) {
1712
1778
  if (connector.status === "healthy") {
1713
1779
  return { kind: "ready", icon: "\u25CF", color: GREEN };
1714
1780
  }
1781
+ if (connector.status === "degraded") {
1782
+ return { kind: "degraded", icon: "\u25CF", color: YELLOW2 };
1783
+ }
1715
1784
  return { kind: "broken", icon: "\u25CB", color: RED };
1716
1785
  }
1717
1786
 
@@ -1951,12 +2020,16 @@ async function retrySetupAction(name, options = {}) {
1951
2020
  connector_id: connector.id,
1952
2021
  dispatched
1953
2022
  });
2023
+ let postSetupConnector;
1954
2024
  try {
1955
2025
  const refreshed = await api.get(
1956
2026
  `/v1/cli/connectors?project_id=${currentProjectId}`
1957
2027
  );
1958
2028
  if (refreshed.connectors) {
1959
2029
  setCacheEntry("connectors", refreshed.connectors);
2030
+ postSetupConnector = refreshed.connectors.find(
2031
+ (candidate) => candidate.id === connector.id
2032
+ );
1960
2033
  }
1961
2034
  } catch {
1962
2035
  }
@@ -1965,6 +2038,10 @@ async function retrySetupAction(name, options = {}) {
1965
2038
  } else {
1966
2039
  console.log("\u2713 Engine setup complete");
1967
2040
  }
2041
+ if (postSetupConnector?.branching_engine_status === "degraded") {
2042
+ console.log("");
2043
+ printDegradedWarnings(postSetupConnector.warnings ?? []);
2044
+ }
1968
2045
  } catch (err) {
1969
2046
  const failureTelemetry = connectorRetrySetupFailureTelemetry(err);
1970
2047
  if (isPermissionError(err)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ardent-cli",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "Git for Data infrastructure",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "build": "tsup",
11
11
  "dev": "tsup --watch",
12
12
  "start": "node dist/index.js",
13
- "test": "tsx --test src/lib/*.test.ts"
13
+ "//test": "Keep --test-concurrency=1: the *.test.ts files mutate process-wide globals (process.env.HOME, globalThis.fetch) and race if run in parallel. Remove only after introducing per-file process isolation.",
14
+ "test": "tsx --test --test-concurrency=1 src/lib/*.test.ts"
14
15
  },
15
16
  "files": [
16
17
  "dist"