diff --git a/RELEASES-COMMITS-MAP.md b/RELEASES-COMMITS-MAP.md index f62b961..b4cccfd 100644 --- a/RELEASES-COMMITS-MAP.md +++ b/RELEASES-COMMITS-MAP.md @@ -39,3 +39,4 @@ Ship recipe: **`HOWTO-DEVEL-DEPLOY.md`**. - uncommitted: `DeskApp.Sync()` matches `downloadAll` (disabled / master-off clips) | 0.6.81 | `02aff5715a386a68333dc65aa44af05836e6adb3` | dirty | 2026-09-15T21:06:49-03:00 | `0a0266909c800a58620b3e0c8a47919a8315000a19accc1c1405f76fc6e0b113` | build | | 0.7.0 | `60b19e108776101a1e3c038c9a6819da01c8e6cf` | dirty | 2026-09-15T22:36:42-03:00 | `9098dfbf31e60e9fada3141d0b0ae91f9d5b5b4e5c0ba2dfaf46a72794c704a2` | build | +| 0.7.1 | `a27057daf60a2399706ccef1d0ef99299304b6b5` | dirty | 2026-09-16T07:22:19-03:00 | `1dcf52bc466ce7b537621b8bedcba1ffb7edd352a68625692f99083be32792f1` | build | diff --git a/autostart.go b/autostart.go index 768bc5b..af6777e 100644 --- a/autostart.go +++ b/autostart.go @@ -55,8 +55,14 @@ func decideAutostart(exists bool, currentTarget, exe string) string { return "update" } +// skipAutostart is true for an explicit opt-out or a lab device: a test box +// must not register itself to start with the user session. +func skipAutostart(noAutostartEnv, root string) bool { + return noAutostartEnv != "" || develMarked(root) +} + func ensureUserAutostart() { - if os.Getenv("MMRADIO_NO_AUTOSTART") != "" { + if skipAutostart(os.Getenv("MMRADIO_NO_AUTOSTART"), exeDir()) { return } exe, err := currentExe() diff --git a/autostart_test.go b/autostart_test.go index aae59ea..b28ff83 100644 --- a/autostart_test.go +++ b/autostart_test.go @@ -1,6 +1,7 @@ package main import ( + "os" "path/filepath" "runtime" "testing" @@ -36,3 +37,22 @@ func TestSamePathWindowsFold(t *testing.T) { t.Fatal("windows should ignore case") } } + +func TestSkipAutostartOnDevelMark(t *testing.T) { + root := t.TempDir() + if skipAutostart("", root) { + t.Fatal("plain store box must register autostart") + } + if !skipAutostart("1", root) { + t.Fatal("env opt-out must skip") + } + if err := os.WriteFile(filepath.Join(root, develMarkName), nil, 0o644); err != nil { + t.Fatal(err) + } + if !skipAutostart("", root) { + t.Fatal("devel mark must skip autostart") + } + if skipAutostart("", "") { + t.Fatal("empty root must not skip") + } +} diff --git a/protocol.go b/protocol.go index 173f45f..c9aff9c 100644 --- a/protocol.go +++ b/protocol.go @@ -45,15 +45,21 @@ func resolveWSURL(root string) string { if v := strings.TrimSpace(os.Getenv("MMRADIO_WS_URL")); v != "" { return v } - if root != "" { - st, err := os.Stat(filepath.Join(root, develMarkName)) - if err == nil && !st.IsDir() { - return develWSURL - } + if develMarked(root) { + return develWSURL } return defaultWSURL } +// develMarked reports whether the lab marker file sits next to the exe. +func develMarked(root string) bool { + if root == "" { + return false + } + st, err := os.Stat(filepath.Join(root, develMarkName)) + return err == nil && !st.IsDir() +} + type heartbeatLive struct { FileID int Filename string