|

cli: rename — don't bounce the container on a no-op re-run

cli: rename — don't bounce the container on a no-op re-run

Only the old-named container is stopped, and only when it will actually be
renamed. A running new-named container implies a fully-completed prior run
(start is the last step), so a redundant re-run no longer stops+restarts a
healthy container. Verified live: no-op re-run emits no incus stop/start.
Spec updated to match.
Author: Chris Tusa <chris.tusa@leafscale.com>
Date: Jul 16, 2026 10:29
Changeset: 6ebbce2c55ce122b1220602fc4a7a6a03179d41a
Branch: default

Diff

diff -r ef2a5413116f -r 6ebbce2c55ce docs/superpowers/specs/2026-07-15-repoman-rename-design.md
--- a/docs/superpowers/specs/2026-07-15-repoman-rename-design.md	Wed Jul 15 16:16:13 2026 -0500
+++ b/docs/superpowers/specs/2026-07-15-repoman-rename-design.md	Thu Jul 16 10:29:04 2026 -0500
@@ -144,7 +144,12 @@
    decoupled case the named repo dir that will be left untouched and why. Use
    `console.confirm_default_no`.
 4. Open the per-invocation log (after confirmation), verb `"rename"`.
-5. **Stop** the container if running (required before `incus rename`).
+5. **Stop** the container before renaming it — only the **old-named** container,
+   and only when it exists and is running (`incus rename` requires it stopped).
+   The new-named container is never stopped: if it is already running, a prior
+   run completed fully (start is the last step), so a no-op re-run does not bounce
+   a healthy container; a container needing device repair was left stopped by the
+   failed run.
 6. **Host dir** (directory tier only): if `<repos_root>/<old>` exists and
    `<repos_root>/<new>` does not → rename it. If `<new>` already exists and
    `<old>` is gone → skip (already done). If **both** exist → `Err` (never
diff -r ef2a5413116f -r 6ebbce2c55ce src/cli.reef
--- a/src/cli.reef	Wed Jul 15 16:16:13 2026 -0500
+++ b/src/cli.reef	Thu Jul 16 10:29:04 2026 -0500
@@ -1106,7 +1106,12 @@
         return 1
     end if
 
-    // Step: stop the container (whichever name it currently has) if running.
+    // Step: stop the container before renaming it. Only the OLD-named container
+    // is ever stopped, and only when it exists and is running — `incus rename`
+    // requires a stopped container. We never stop the new-named container: if it
+    // is already running, a prior run completed fully (restart is the last step),
+    // so there is nothing left to do and no reason to bounce a healthy container;
+    // if it needs a device repair it was left stopped by the failed run.
     if state_old == "RUNNING"
         log.write("==> incus stop " + old)
         let r = incus.stop(inc_project, old)
@@ -1114,13 +1119,6 @@
             log.write("repoman: error: " + rg.unwrap_err(r))
             return 1
         end if
-    elif state_new == "RUNNING"
-        log.write("==> incus stop " + new_name)
-        let r = incus.stop(inc_project, new_name)
-        if rg.is_err(r)
-            log.write("repoman: error: " + rg.unwrap_err(r))
-            return 1
-        end if
     end if
 
     // Step: host repo dir (coupled only).