Review round 2: a media restart no longer starts an app the household stopped (R-721); the file manager's header name file appears whole (R-1100 race, 44/300 -> 0/300); both red-proved; unreleased
gates / gates (push) Successful in 1m22s

This commit is contained in:
admin committed 2026-10-24 15:26:56 +02:00
1 parent 321df1f87a
commit b01bb4b88d
8 files changed
+163 -31

No files matched your search

@@ -0,0 +1,49 @@
package web
import (
"go/ast"
"go/parser"
"go/token"
"os"
"strings"
"testing"
)
// Review round 2 (2026-10-24, DOC-D2 U2): both web paths that recreate the media apps must take their list from
// mediaAppsToRecreate (which leaves out the apps the household stopped, R-721), never from mediaApps(). A source pin:
// the decision itself is tested in stacks (TestMediaAppsToRecreate_SkipsAppsTheHouseholdStopped); this pins the
// WIRING, the half a seam test cannot see. COMPANION RED-PROOF: put `s.mediaApps()` back in either loop → this fails.
func TestR2_MediaRecreateLoopsSkipStoppedApps(t *testing.T) {
src, err := os.ReadFile("media_events.go")
if err != nil {
t.Fatal(err)
}
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "media_events.go", src, 0)
if err != nil {
t.Fatal(err)
}
want := map[string]bool{"restartMediaApps": false, "mediaSafeRemoval": false}
for _, d := range f.Decls {
fn, ok := d.(*ast.FuncDecl)
if !ok {
continue
}
if _, tracked := want[fn.Name.Name]; !tracked {
continue
}
body := string(src[fset.Position(fn.Body.Pos()).Offset:fset.Position(fn.Body.End()).Offset])
if strings.Contains(body, "range s.mediaApps()") {
t.Errorf("%s ranges over s.mediaApps(): it would recreate (start) an app the household stopped", fn.Name.Name)
}
if !strings.Contains(body, "s.mediaAppsToRecreate(") || !strings.Contains(body, "RestartStack(") {
t.Errorf("%s no longer recreates from s.mediaAppsToRecreate", fn.Name.Name)
}
want[fn.Name.Name] = true
}
for name, seen := range want {
if !seen {
t.Errorf("function %s not found in media_events.go — the pin is stale", name)
}
}
}