@helyx/bot 0.4.26 → 0.4.27

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.27
4
+
5
+ ### Patch Changes
6
+
7
+ - Allow a strictly newer coordinated deployment to atomically replace an incompatible module-catalogue generation while preserving application and environment namespace isolation.
8
+
3
9
  ## 0.4.26
4
10
 
5
11
  ### Patch Changes
@@ -137,8 +137,22 @@ export class RedisShardCoordinator {
137
137
  const parsed = activeGenerationSchema.safeParse(parseJson(current ?? ""));
138
138
  if (parsed.success) {
139
139
  if (JSON.stringify(withoutDeploymentOrder(parsed.data)) !==
140
- JSON.stringify(accepted))
141
- throw new Error("Shard coordination namespace is owned by an incompatible generation");
140
+ JSON.stringify(accepted)) {
141
+ if (parsed.data.applicationId !== accepted.applicationId ||
142
+ parsed.data.environment !== accepted.environment ||
143
+ deploymentOrder <= parsed.data.deploymentOrder ||
144
+ !current)
145
+ throw new Error("Shard coordination namespace is owned by an incompatible generation");
146
+ const replaced = await compareAndReplace(this.#command, this.#generationKey(), current, serialized, GENERATION_TTL_MS);
147
+ if (replaced)
148
+ return deploymentOrder;
149
+ const winner = activeGenerationSchema.safeParse(parseJson((await this.#command.get(this.#generationKey())) ?? ""));
150
+ if (winner.success &&
151
+ JSON.stringify(withoutDeploymentOrder(winner.data)) ===
152
+ JSON.stringify(accepted))
153
+ return winner.data.deploymentOrder;
154
+ throw new Error("Shard coordination generation changed while it was being validated");
155
+ }
142
156
  if (!current ||
143
157
  !(await compareAndExpire(this.#command, this.#generationKey(), current, GENERATION_TTL_MS)))
144
158
  throw new Error("Shard coordination generation changed while it was being validated");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helyx/bot",
3
- "version": "0.4.26",
3
+ "version": "0.4.27",
4
4
  "description": "Production Discord runtime for the modular Helyx platform.",
5
5
  "keywords": [
6
6
  "helyx",