test(02-02): add failing tests for PPID chain walk + workspace resolution

- TestReadPPID, TestReadPPIDMissing
- TestResolveWorkspace, TestResolveWorkspaceNotFound, TestResolveWorkspaceMaxDepth
- TestBuildTerminalWorkspaceMapUnit
- Add go.i3wm.org/i3/v4 dependency
This commit is contained in:
Pierre Martin
2026-03-23 17:42:44 +01:00
parent a49f7d1c57
commit c9a28df3dc
4 changed files with 213 additions and 0 deletions

32
workspace.go Normal file
View File

@@ -0,0 +1,32 @@
package main
import (
i3 "go.i3wm.org/i3/v4"
)
// X11PIDResolver abstrait la lecture de _NET_WM_PID pour testabilite.
type X11PIDResolver interface {
GetPID(windowID int64) (int, error)
}
// I3TreeProvider abstrait i3.GetTree() pour testabilite.
type I3TreeProvider interface {
GetTree() (i3.Tree, error)
}
// ReadPPID lit le PPid depuis /proc/PID/status. procDir injectable pour les tests.
func ReadPPID(procDir string, pid int) (int, error) {
return 0, nil
}
// ResolveWorkspace remonte la chaine PPID depuis claudePID jusqu'a trouver
// un PID connu dans terminalWorkspaces. Max 20 niveaux.
func ResolveWorkspace(procDir string, claudePID int, terminalWorkspaces map[int]string) string {
return ""
}
// BuildTerminalWorkspaceMap construit la map terminalPID -> workspaceName.
// Utilise i3 GetTree + X11 _NET_WM_PID.
func BuildTerminalWorkspaceMap(tree I3TreeProvider, x11 X11PIDResolver) (map[int]string, error) {
return nil, nil
}