Record a removal's outcome, publish it, and read one directory once
mesh/merge-gate pass: builds systemd → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered

The record kept only the intent, so a failed unlink read as removed; each
link now gets a synced intent and outcome line, and the outcome is the
module's link.removal event so it is not only a file on one machine.
The put-back hint no longer advises a symlink, an aliased directory is
read once, a machine-wide removal from user scope is said, and the state
directory names no owner a machine without an account cannot resolve.
This commit is contained in:
jochen
2026-10-08 17:55:56 +02:00
parent 87c9d9f7e5
commit 1b368f9aaf
6 changed files with 286 additions and 29 deletions
+5 -2
View File
@@ -10,6 +10,7 @@ import (
"fmt"
"os"
"os/user"
"path/filepath"
"strconv"
"strings"
@@ -153,7 +154,8 @@ func tools(m *Manager) []stdio.Tool {
"`disable` leaves once the unit's file is gone — on the person's word: `why` is required. Each link is " +
"recorded first (its path, its target, the person's reason) in the module's state, then removed, and " +
"the manager reloaded. A link whose target exists, a package's, a generator's or the runtime's is left, " +
"and said. `wanted-by` shows what it would remove.",
"and said; a user-scope call that removes a machine-wide link says so. Each outcome is also published " +
"as the module's link.removal event. `wanted-by` shows what it would remove.",
Input: map[string]any{"scope": scopeArg, "unit": unitArgS,
"why": str("the person's reason for removing the links, kept in the record")},
Run: func(a map[string]any) (any, error) {
@@ -208,7 +210,8 @@ func fromEnv() *Manager {
}
return &Manager{Account: account, UID: uid, User: name, Run: execRunner, Read: readFile, Env: os.Environ(),
Home: home, ReadDir: readDir, Lstat: lstatEntry, Remove: os.Remove,
State: strings.TrimSpace(os.Getenv("MESH_SYSTEMD_STATE"))}
State: strings.TrimSpace(os.Getenv("MESH_SYSTEMD_STATE")), Resolve: filepath.EvalSymlinks,
Emit: func(eventType string, body any) error { return stdio.Emit(eventType, body) }}
}
func main() {