@camunda8/cli 4.5.0-alpha.3 → 4.5.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.
@@ -68,7 +68,7 @@ plugin update.
68
68
 
69
69
  | Alias | Resolves to |
70
70
  |----------|-------------|
71
- | `stable` | Highest minor release that is GA (e.g. `8.9`) |
71
+ | `stable` | Highest minor release that is GA (e.g. `8.10`) |
72
72
  | `alpha` | Highest minor release overall (e.g. `8.10-alpha1`) |
73
73
 
74
74
  A `<major>.<minor>` version like `8.8` or `8.9` is also treated as a rolling
@@ -119,7 +119,8 @@ export async function discoverLatestVersions() {
119
119
  * - Minor version directories (e.g. "8.8/", "8.9/") are rolling releases
120
120
  * updated in-place.
121
121
  * - An alpha train exists when there are "X.Y.0-alphaN/" directories
122
- * for a given minor that has NOT yet shipped a GA release (X.Y.0/).
122
+ * for a given minor that has NOT yet shipped a GA release (any X.Y.Z/
123
+ * directory without a prerelease suffix).
123
124
  * The highest such minor is the alpha train.
124
125
  * - stable = highest minor that is NOT in the alpha train.
125
126
  * - alpha = highest minor overall (regardless of alpha train membership).
@@ -129,8 +130,10 @@ export function parseVersionsFromHtml(html) {
129
130
  const minorMatches = [...html.matchAll(/href="(\d+\.\d+)\/"/g)].map(m => m[1]);
130
131
  // Match alpha directories like "8.9.0-alpha5/"
131
132
  const alphaMatches = [...html.matchAll(/href="(\d+\.\d+)\.0-alpha\d+\/"/g)].map(m => m[1]);
132
- // Match GA release directories like "8.9.0/"
133
- const gaMatches = [...html.matchAll(/href="(\d+\.\d+)\.0\/"/g)].map(m => m[1]);
133
+ // Match GA release directories like "8.9.0/" or "8.10.4/". Any non-prerelease
134
+ // X.Y.Z directory proves the minor has shipped: a listing can contain a patch
135
+ // release without the X.Y.0 directory (e.g. "8.6.11/" without "8.6.0/").
136
+ const gaMatches = [...html.matchAll(/href="(\d+\.\d+)\.\d+\/"/g)].map(m => m[1]);
134
137
 
135
138
  if (minorMatches.length === 0) return null;
136
139
 
@@ -2097,14 +2100,57 @@ export function liveRecordedPids(cacheDir) {
2097
2100
  return record.pids.filter((pid) => recordedPidIsLive(pid, record.signatures?.[pid]));
2098
2101
  }
2099
2102
 
2103
+ /**
2104
+ * Block the calling thread for `ms` without spinning. `recordRunningClusterPids`
2105
+ * is synchronous (its fingerprint source is `execFileSync` anyway), so its
2106
+ * retry backoff has to be synchronous too.
2107
+ */
2108
+ function sleepSync(ms) {
2109
+ if (ms > 0) {
2110
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
2111
+ }
2112
+ }
2113
+
2114
+ /**
2115
+ * Fingerprint a PID, retrying while the PID is still alive. `signatureOf` returns
2116
+ * null both for "the process is gone" and for "the platform query failed or timed
2117
+ * out" (a loaded Windows runner can exceed the PowerShell/CIM budget). Only the
2118
+ * second case is transient, and the two are told apart by liveness: a dead PID is
2119
+ * final, a live PID whose query came back empty is retried with backoff. A
2120
+ * signature is still only ever persisted when it was actually captured, so the
2121
+ * retry cannot widen the PID-reuse exposure — it only stops a started process
2122
+ * from being left out of the stop record because of one slow query.
2123
+ */
2124
+ function captureSignature(pid, { signatureOf, attempts, retryDelayMs }) {
2125
+ for (let attempt = 1; ; attempt += 1) {
2126
+ const sig = signatureOf(pid);
2127
+ if (sig || attempt >= attempts || !isPidAlive(pid)) {
2128
+ return sig;
2129
+ }
2130
+ sleepSync(retryDelayMs * 2 ** (attempt - 1));
2131
+ }
2132
+ }
2133
+
2100
2134
  /**
2101
2135
  * Snapshot the live c8run PIDs for the just-started version into the durable
2102
2136
  * cache-root record, so the cluster stays trackable (status/stop) even if its
2103
2137
  * install dir is later replaced or removed (#560). Each PID is fingerprinted
2104
2138
  * with a start signature so a later stop/status can tell the recorded process
2105
2139
  * apart from an unrelated one that reused its PID.
2140
+ * A transient fingerprint failure on a live PID is retried
2141
+ * (`signatureAttempts`, exponential backoff from `signatureRetryDelayMs`)
2142
+ * rather than silently dropping the PID.
2106
2143
  */
2107
- export function recordRunningClusterPids(config, { signatureOf = processStartSignature, skipEmpty = false, startupFailed = false } = {}) {
2144
+ export function recordRunningClusterPids(
2145
+ config,
2146
+ {
2147
+ signatureOf = processStartSignature,
2148
+ skipEmpty = false,
2149
+ startupFailed = false,
2150
+ signatureAttempts = 3,
2151
+ signatureRetryDelayMs = 250,
2152
+ } = {},
2153
+ ) {
2108
2154
  const canFingerprint = platformSupportsProcessSignature();
2109
2155
  const pids = [];
2110
2156
  const signatures = {};
@@ -2120,10 +2166,22 @@ export function recordRunningClusterPids(config, { signatureOf = processStartSig
2120
2166
  // process, so it is omitted: persisting it without a signature would let
2121
2167
  // a later reuse of the number fall back to numeric liveness and let the
2122
2168
  // reap path signal an unrelated process.
2123
- const sig = signatureOf(pid);
2169
+ //
2170
+ // A null can also be a transient query failure/timeout on a live process;
2171
+ // captureSignature() retries those, because a PID dropped here is never
2172
+ // signalled by stop and would be left behind as an orphan.
2173
+ const sig = captureSignature(pid, {
2174
+ signatureOf,
2175
+ attempts: signatureAttempts,
2176
+ retryDelayMs: signatureRetryDelayMs,
2177
+ });
2124
2178
  if (sig) {
2125
2179
  signatures[pid] = sig;
2126
2180
  pids.push(pid);
2181
+ } else if (isPidAlive(pid)) {
2182
+ getLogger().warn(
2183
+ `Could not fingerprint running cluster process ${pid}; it will not be tracked for "c8ctl cluster stop" and may need to be stopped manually.`,
2184
+ );
2127
2185
  }
2128
2186
  } else if (isPidAlive(pid)) {
2129
2187
  // This platform can't fingerprint any process, so no recorded PID can
@@ -7,7 +7,7 @@
7
7
  "main": "c8ctl-plugin.js",
8
8
  "c8ctl": {
9
9
  "versionAliases": {
10
- "stable": "8.9",
10
+ "stable": "8.10",
11
11
  "alpha": "8.10"
12
12
  }
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda8/cli",
3
- "version": "4.5.0-alpha.3",
3
+ "version": "4.5.0",
4
4
  "description": "Camunda 8 CLI - minimal-dependency CLI for Camunda 8 operations",
5
5
  "type": "module",
6
6
  "engines": {