feat(manifest): add version and compatibility checks to dream update#350
feat(manifest): add version and compatibility checks to dream update#350buddy0323 wants to merge 4 commits intoLight-Heart-Labs:mainfrom
Conversation
…ma_version and version-compat check in dream update
2ca719b to
a01e40f
Compare
Lightheartdevs
left a comment
There was a problem hiding this comment.
Review: feat(manifest): add version and compatibility checks to dream update
Good concept — version gating before updates is the right safety mechanism. Several issues to resolve.
Blocking
-
Semver comparison is major-only.
_semver_major()extracts just the first component, somin_compatible_dream_version: "1.5.0"vs installed"1.2.0"passes because both are major1. The check is advertised as semver-aware but only compares major versions.dream-update.shalready has a fullsemver_compare()— reuse it or implement proper 3-component comparison. -
Pre-update backup removed with no replacement. The old
cmd_update()created a backup viadream-backup.shbefore pulling. This PR deletes that block entirely. Meanwhile PR #358 adds rollback snapshots todream-update.sh's update path. After both merge,dream update(CLI) has zero safety net while the standalone script has a robust one. Don't remove backup without replacing it — coordinate with #358 to integrate snapshots into the CLI path too. -
2>/dev/nullin_manifest_field(). Both thejqandpython3calls suppress errors. Ifmanifest.jsonis malformed, the function silently returns empty and the version check is skipped (return 0). Per CLAUDE.md: never2>/dev/null. At minimum log warnings on parse failures.
Should-fix
-
Unrelated changes bundled. New workflow API endpoints (
/api/workflows/categories,/api/workflows/n8n/status,POST /api/workflows/{id}/disable), action validation refactor inupdates.py, andloggingimport inagent_monitor.pyshould be separate PRs. -
Negative
major_jump(downgrade) silently skips warning. The regex[[ "$major_jump" =~ ^[0-9]+$ ]]won't match negative numbers. Either warn or block on downgrades explicitly. -
Shell injection risk in Python fallback.
open('$file')andd.get('$field')use string interpolation — paths with quotes or special chars will break or inject. Usesys.argvinstead.
Version source conflict with PR #349
This PR reads version from DREAM_VERSION in .env + manifest.json. PR #349 reads/writes .version file exclusively. After both merge, three different version sources with no single source of truth. Coordinate before merging either.
…grade guard, pre-update snapshot
|
All review items addressed: Blocking — Semver comparison is major-only Blocking — Pre-update backup removed Blocking — Should-fix — Negative Should-fix — Shell injection in Python fallback Should-fix — Version source conflict with PR #349 Note on unrelated changes |
Summary
dream_version,min_compatible_dream_version, andschema_versiontomanifest.json_check_version_compat()todream-cli— hard-blocks updates belowmin_compatible_dream_version, warns and requires confirmation when jumping more than 1 major versionDREAM_VERSIONin.envat install time sodream updatealways has a baseline to compare against--forceflag todream updateto bypass version-compat promptsWhat changed and why
manifest.jsonschema_version2dream_version"2.1.0"dream-climin_compatible_dream_version"1.0.0"dream_version. If an installation is below this,dream updatehard-blocks unless--forceis used.Also bumped
release.version→2.1.0, updated date, addedintelGPU backend entry, and addeddocker-compose.arc.ymltocontracts.compose.canonical.dream-cli— new helpers_semver_major()— extracts the major version number from a semver string._manifest_field()— reads a named field frommanifest.jsonusingjqwith apython3fallback, so it works on systems withoutjq._check_version_compat(force)— full version compatibility check:DREAM_VERSIONin.env(falls back tomanifest.json, then hardcoded$VERSION)manifest.jsonon diskmin_compatible_dream_versionfrommanifest.json--force): installed major <min_compatible_dream_versionmajor — prints a red banner with upgrade path instructions--force): target major − installed major > 1 — prints a yellow warning with incremental upgrade recommendationdream-cli—cmd_update()changes--force/-fflag before any other logic_check_version_compatbefore anydocker compose pull— exits cleanly on user cancel or hard blockUpdating: vX.Y.Z → vA.B.Cwhen versions differ_env_set DREAM_VERSION <target>after a successful update so future runs know what was last installedupdate|u)dispatcher now passes"$@"so--forcereaches the functioninstallers/phases/06-directories.shAdded
DREAM_VERSION=${VERSION:-2.1.0}to the.envtemplate so every fresh install writes the installed version — givingdream updatea baseline on the very first update.Behaviour summary
--forceskips promptmin_compatible_dream_version--forceoverrides with warningdream update --forceTest plan
.envcontainsDREAM_VERSION=2.1.0after Phase 06 completesdream updatewith same version installed: no version output, proceeds silentlyDREAM_VERSION=1.9.0in.env, rundream updatewith a v2.x manifest: no warning (1 major jump is allowed)DREAM_VERSION=1.0.0in.env, rundream updatewith a v3.x manifest: yellow warning with confirmation promptNat the prompt: confirm update exits cleanly with no containers touchedYat the prompt: confirmdocker compose pullruns andDREAM_VERSIONis updated in.envdream update --forcewith a 2+ major jump: confirm no prompt, warning logged, update proceedsDREAM_VERSION=0.9.0in.envand setmin_compatible_dream_versionto"1.0.0": confirm red hard-block with no containers touched--force: confirm warning is logged and update proceedsjq: confirmpython3fallback correctly readsdream_versionfrom manifest