@usine/server 0.4.1-next.311.ge26a371 → 0.4.1-next.312.g8cd2d1c

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/README.md CHANGED
@@ -139,6 +139,8 @@ In **Configuration → Settings**, select **Upgrade when idle** to stop admittin
139
139
 
140
140
  Install the helper service and polkit rule in the [server guide](https://docs.usine.dev/guides/run-the-orchestrator-on-a-server/) before using app upgrades. The independent helper installs into the same npm prefix and restores the previous version if installation or the new operator API fails. Its result is in `.usine/upgrade/result.json`; inspect `journalctl -u usine-upgrade.service` for progress. For npm `ETARGET` or `E404` errors, the helper tries installation up to three times, 60 seconds apart. After a successful rollback from an install failure, automatic mode can retry that version. A version that failed its health check, or whose rollback record does not identify the failure stage, requires a manual retry. Rollback restores packages; maintain database backups for releases with incompatible storage changes.
141
141
 
142
+ If a failed installation leaves the previous version in the installed `package.json`, the helper restarts it without reinstalling. If a rollback installation fails but leaves the previous version installed, the helper also restarts it. Both paths verify the previous version's API and record `status=failed` with the original upgrade failure reason, so retry the upgrade manually. Recovery errors advise reinstalling only when the installed version matches neither the target nor the previous version, including an unreadable package manifest.
143
+
142
144
  Configuration forms for agents, workers, settings, and repositories save revisions through the operator API. The server supplies supported harnesses and efforts, installation repositories, and live repository labels. GitHub choices return an availability error in setup mode or when GitHub cannot answer; configuration editing remains available.
143
145
 
144
146
  The loop form checks CEL and prompt expressions as you type and previews matches from stored GitHub items. New loops start paused. **Resume** shows a fresh preview count before allowing the loop to open runs. The check and preview endpoints are available in setup mode, using configuration and items already stored by the instance.
@@ -81,6 +81,26 @@ install_version() {
81
81
  done
82
82
  }
83
83
 
84
+ installed_version() {
85
+ node -p 'JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8")).version' \
86
+ "$prefix/lib/node_modules/@usine/server/package.json"
87
+ }
88
+
89
+ restore_previous() {
90
+ if [ "$failure_stage" = install ] && [ "$(installed_version)" = "$previous" ]; then
91
+ recovery_status=failed
92
+ printf 'upgrade recovery version=%s action=restart reason=previous-version-still-installed\n' "$previous"
93
+ return 0
94
+ fi
95
+ if install_version "$previous"; then return 0; fi
96
+ if [ "$(installed_version)" = "$previous" ]; then
97
+ recovery_status=failed
98
+ printf 'upgrade recovery version=%s action=restart reason=rollback-install-failed\n' "$previous"
99
+ return 0
100
+ fi
101
+ return 1
102
+ }
103
+
84
104
  # The lock is outside node_modules and survives replacement of the package.
85
105
  exec 9> "$folder/helper.lock"
86
106
  flock -n 9 || exit 0
@@ -100,9 +120,15 @@ if install_version "$target"; then
100
120
  fi
101
121
  fi
102
122
  printf 'upgrade rollback previous=%s target=%s failure_stage=%s reason=%s\n' "$previous" "$target" "$failure_stage" "$reason"
103
- if stop_server && install_version "$previous" && timeout 30s systemctl start "$unit" && healthy "$previous"; then
104
- record rolled-back "$reason"
123
+ recovery_status=rolled-back
124
+ if stop_server && restore_previous && timeout 30s systemctl start "$unit" && healthy "$previous"; then
125
+ record "$recovery_status" "$reason"
126
+ if [ "$recovery_status" = failed ]; then exit 1; fi
105
127
  else
106
- record failed 'Rollback failed. Check the upgrade service journal and reinstall the previous version.'
128
+ installed=$(installed_version) || installed=
129
+ case "$installed" in
130
+ "$previous"|"$target") record failed 'Rollback failed. Check the upgrade service journal.';;
131
+ *) record failed 'Rollback failed. Check the upgrade service journal and reinstall the previous version.';;
132
+ esac
107
133
  exit 1
108
134
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usine/server",
3
- "version": "0.4.1-next.311.ge26a371",
3
+ "version": "0.4.1-next.312.g8cd2d1c",
4
4
  "description": "The usine orchestrator as a headless server: a thin CLI over @usine/orchestrator that serves the web UI.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -23,19 +23,19 @@
23
23
  "@effect/platform-node": "4.0.6",
24
24
  "@effect/platform-node-shared": "4.0.6",
25
25
  "effect": "4.0.6",
26
- "@usine/durable": "0.2.1-next.311.ge26a371",
27
- "@usine/engine": "0.5.1-next.311.ge26a371",
28
- "@usine/config": "0.4.1-next.311.ge26a371",
29
- "@usine/orchestrator": "0.4.1-next.311.ge26a371",
30
- "@usine/core": "0.5.1-next.311.ge26a371",
31
- "@usine/github": "0.3.1-next.311.ge26a371",
32
- "@usine/expression": "0.4.1-next.311.ge26a371"
26
+ "@usine/config": "0.4.1-next.312.g8cd2d1c",
27
+ "@usine/core": "0.5.1-next.312.g8cd2d1c",
28
+ "@usine/expression": "0.4.1-next.312.g8cd2d1c",
29
+ "@usine/github": "0.3.1-next.312.g8cd2d1c",
30
+ "@usine/engine": "0.5.1-next.312.g8cd2d1c",
31
+ "@usine/orchestrator": "0.4.1-next.312.g8cd2d1c",
32
+ "@usine/durable": "0.2.1-next.312.g8cd2d1c"
33
33
  },
34
34
  "devDependencies": {
35
35
  "typescript": "7.0.2",
36
36
  "vitest": "5.0.5",
37
37
  "yaml": "2.9.1",
38
- "@usine/executor": "0.4.1-next.311.ge26a371",
38
+ "@usine/executor": "0.4.1-next.312.g8cd2d1c",
39
39
  "@usine/tsconfig": "0.0.0",
40
40
  "@usine/web": "0.0.0"
41
41
  },