- SUMMARY.md with 2 tasks, 15 tests, 4 TDD commits - STATE.md updated: plan 2/3, decisions recorded - ROADMAP.md: phase 02 progress 2/3 - REQUIREMENTS.md: I3-01, I3-02 marked complete
124 lines
4.9 KiB
Markdown
124 lines
4.9 KiB
Markdown
---
|
|
phase: 02-daemon-et-i3-bridge
|
|
plan: 02
|
|
subsystem: i3-bridge
|
|
tags: [i3, x11, ppid, workspace, fuzzy-match, xgbutil, ewmh]
|
|
|
|
requires:
|
|
- phase: 01-session-discovery
|
|
provides: "Process struct, FindClaudeProcesses, /proc scanning pattern"
|
|
provides:
|
|
- "PPID chain walk (ReadPPID, ResolveWorkspace)"
|
|
- "Terminal-workspace map via i3 tree + X11 _NET_WM_PID (BuildTerminalWorkspaceMap)"
|
|
- "Fuzzy match sessions by label/branch/cwd (FuzzyMatch)"
|
|
- "Switch workspace via i3 IPC (SwitchToWorkspace)"
|
|
- "Interfaces I3TreeProvider, X11PIDResolver, I3Commander pour testabilite"
|
|
affects: [02-daemon-et-i3-bridge/02-03, 03-hooks]
|
|
|
|
tech-stack:
|
|
added: [go.i3wm.org/i3/v4, BurntSushi/xgbutil, BurntSushi/xgb]
|
|
patterns: [interface-based i3/X11 abstraction for testing, PPID chain walk with depth limit]
|
|
|
|
key-files:
|
|
created: [workspace.go, workspace_test.go, i3bridge.go, i3bridge_test.go, x11_resolver.go]
|
|
modified: [go.mod, go.sum]
|
|
|
|
key-decisions:
|
|
- "X11PIDResolver interface pour abstraire ewmh.WmPidGet et tester sans serveur X11"
|
|
- "I3TreeProvider interface pour mocker i3.GetTree dans les tests"
|
|
- "maxPPIDDepth = 20 pour securiser la remontee de chaine PPID"
|
|
- "Priorite fuzzy match : label > branche > cwd (label plus intentionnel)"
|
|
|
|
patterns-established:
|
|
- "Interface injection pour i3 et X11 : meme pattern que procDir injectable en Phase 1"
|
|
- "walkI3Tree recursif avec tracking du workspace courant"
|
|
|
|
requirements-completed: [I3-01, I3-02]
|
|
|
|
duration: 4min
|
|
completed: 2026-03-23
|
|
---
|
|
|
|
# Phase 02 Plan 02: i3 Bridge Summary
|
|
|
|
**Mapping PID-workspace via PPID chain + X11 _NET_WM_PID, fuzzy match label/branche/cwd, switch workspace i3 IPC**
|
|
|
|
## Performance
|
|
|
|
- **Duration:** 4 min
|
|
- **Started:** 2026-03-23T16:41:16Z
|
|
- **Completed:** 2026-03-23T16:45:53Z
|
|
- **Tasks:** 2
|
|
- **Files modified:** 7
|
|
|
|
## Accomplishments
|
|
- Resolution PID Claude -> workspace i3 via chaine PPID (ReadPPID + ResolveWorkspace)
|
|
- Construction de la map terminal-workspace en combinant i3 GetTree et X11 _NET_WM_PID
|
|
- Fuzzy match case-insensitive avec priorite label > branche > cwd
|
|
- Switch workspace via i3 IPC avec gestion d'erreurs
|
|
- 15 tests couvrant tous les cas (depth limit, not found, priorite, case-insensitive, erreurs i3)
|
|
|
|
## Task Commits
|
|
|
|
Each task was committed atomically:
|
|
|
|
1. **Task 1: PPID chain walk + workspace resolution**
|
|
- `c9a28df` (test: failing tests for ReadPPID, ResolveWorkspace, BuildTerminalWorkspaceMap)
|
|
- `a2fb37e` (feat: implement workspace resolution + X11 resolver)
|
|
2. **Task 2: Fuzzy match + switch workspace + i3 client interface**
|
|
- `4a298d5` (test: failing tests for FuzzyMatch, SwitchToWorkspace)
|
|
- `9427dd3` (feat: implement fuzzy match + switch workspace)
|
|
|
|
## Files Created/Modified
|
|
- `workspace.go` - ReadPPID, ResolveWorkspace, BuildTerminalWorkspaceMap, interfaces I3TreeProvider/X11PIDResolver
|
|
- `workspace_test.go` - 6 tests : ReadPPID, ResolveWorkspace (chain, not found, max depth), BuildTerminalWorkspaceMap
|
|
- `i3bridge.go` - FuzzyMatch, SwitchToWorkspace, interfaces I3Commander, RealI3Commander
|
|
- `i3bridge_test.go` - 9 tests : fuzzy match (label, branch, cwd, priority, no result, case), switch workspace (ok, error, i3 error)
|
|
- `x11_resolver.go` - RealX11Resolver avec xgbutil/ewmh pour production
|
|
- `go.mod` - Ajout go.i3wm.org/i3/v4 + deps transitives (xgb, xgbutil)
|
|
- `go.sum` - Hashes des nouvelles deps
|
|
|
|
## Decisions Made
|
|
- X11PIDResolver et I3TreeProvider comme interfaces pour tester sans X11/i3
|
|
- windowID en int64 (alignement avec le type Window du Node i3)
|
|
- walkI3Tree parcourt aussi les FloatingNodes pour ne pas rater de fenetres flottantes
|
|
- maxPPIDDepth = 20 contre les boucles de PPID (securite)
|
|
|
|
## Deviations from Plan
|
|
|
|
### Auto-fixed Issues
|
|
|
|
**1. [Rule 3 - Blocking] Fix unused imports in daemon.go**
|
|
- **Found during:** Task 1 (build verification)
|
|
- **Issue:** daemon.go importait fmt et net sans les utiliser (etat intermediaire du plan 02-01 parallele)
|
|
- **Fix:** Retrait des imports inutilises
|
|
- **Files modified:** daemon.go
|
|
- **Verification:** `go build ./...` passe
|
|
- **Note:** L'agent parallele 02-01 a ensuite ajoute du code qui utilise ces imports, rendant le fix obsolete
|
|
|
|
---
|
|
|
|
**Total deviations:** 1 auto-fixed (1 blocking)
|
|
**Impact on plan:** Fix necessaire pour que le build passe. Aucun impact sur le scope.
|
|
|
|
## Issues Encountered
|
|
- Tests daemon_test.go (plan 02-01) echouent (TestDaemonListOverSocket, TestDaemonLabelOverSocket) mais hors scope de ce plan. Tests 02-02 passent tous avec -race.
|
|
|
|
## User Setup Required
|
|
None - no external service configuration required.
|
|
|
|
## Next Phase Readiness
|
|
- workspace.go et i3bridge.go sont prets pour integration dans le daemon (plan 02-03)
|
|
- Le daemon pourra utiliser `BuildTerminalWorkspaceMap` + `ResolveWorkspace` comme workspaceResolver
|
|
- `FuzzyMatch` + `SwitchToWorkspace` seront cables sur l'action "switch" du socket
|
|
|
|
## Known Stubs
|
|
None - all functions are fully implemented with real logic.
|
|
|
|
---
|
|
*Phase: 02-daemon-et-i3-bridge*
|
|
*Completed: 2026-03-23*
|
|
|
|
## Self-Check: PASSED
|
|
All files found. All commit hashes verified.
|