- SUMMARY.md with protocol types, registry, labels, socket server - STATE.md updated: plan 3/3, decisions, metrics - ROADMAP.md updated: phase 02 progress - REQUIREMENTS.md: DISC-04, STATE-04 complete
115 lines
4.0 KiB
Markdown
115 lines
4.0 KiB
Markdown
---
|
|
phase: 02-daemon-et-i3-bridge
|
|
plan: 01
|
|
subsystem: daemon
|
|
tags: [go, unix-socket, ipc, json, proc, registry]
|
|
|
|
requires:
|
|
- phase: 01-session-discovery
|
|
provides: "FindClaudeProcesses, FindSessionForProcess, DetectState, ExtractPreview"
|
|
provides:
|
|
- "SessionRegistry avec tracking WaitingSince"
|
|
- "LabelStore persistent dans ~/.vmux/labels.json"
|
|
- "Protocol IPC (Request/Response/SessionInfo) sur Unix socket"
|
|
- "Daemon avec poll loop 5s et socket server list/label/stop"
|
|
affects: [02-02, 02-03, 03-notifications]
|
|
|
|
tech-stack:
|
|
added: [net/unix-socket]
|
|
patterns: [registry-update-pattern, stale-socket-cleanup, json-ipc]
|
|
|
|
key-files:
|
|
created: [protocol.go, protocol_test.go, daemon.go, daemon_test.go]
|
|
modified: [types.go]
|
|
|
|
key-decisions:
|
|
- "WaitingSince tracked par transition dans le registre (pas par le caller)"
|
|
- "LabelStore avec MkdirAll pour creer ~/.vmux/ au premier Set"
|
|
- "Scan initial synchrone avant d'accepter les connexions socket"
|
|
- "workspaceResolver comme fonction injectable (nil dans ce plan)"
|
|
|
|
patterns-established:
|
|
- "Registry Update pattern: caller passe SessionInfo, le registre gere les transitions"
|
|
- "Stale socket cleanup: dial avant listen, supprimer si pas de reponse"
|
|
- "Test daemon pattern: tmpdir pour socket/proc/claude, populate apres Start"
|
|
|
|
requirements-completed: [DISC-04, STATE-04]
|
|
|
|
duration: 5min
|
|
completed: 2026-03-23
|
|
---
|
|
|
|
# Phase 02 Plan 01: Daemon vmuxd Summary
|
|
|
|
**Daemon vmuxd avec registre de sessions, Unix socket IPC (list/label/stop), labels persistants et tracking WaitingSince**
|
|
|
|
## Performance
|
|
|
|
- **Duration:** 5 min
|
|
- **Started:** 2026-03-23T16:41:05Z
|
|
- **Completed:** 2026-03-23T16:46:06Z
|
|
- **Tasks:** 2
|
|
- **Files modified:** 5
|
|
|
|
## Accomplishments
|
|
- SessionRegistry avec suivi automatique des transitions WaitingSince
|
|
- LabelStore persistant en JSON avec creation automatique du repertoire
|
|
- Unix socket server gerant list, label et stop
|
|
- Poll loop toutes les 5s avec scan initial synchrone
|
|
- 14 tests dedies (protocol + registry + label + daemon integration), tous passent avec -race
|
|
|
|
## Task Commits
|
|
|
|
Each task was committed atomically:
|
|
|
|
1. **Task 1: Protocol types + SessionRegistry + LabelStore** - `a49f7d1` (test) + `5315e88` (feat)
|
|
2. **Task 2: Unix socket server + poll loop + stop handler** - `4b142a7` (feat)
|
|
|
|
## Files Created/Modified
|
|
- `protocol.go` - Types IPC : Request, Response, SessionInfo, SwitchArgs, LabelArgs
|
|
- `protocol_test.go` - Tests serialisation/deserialisation JSON
|
|
- `daemon.go` - SessionRegistry, LabelStore, Daemon (socket server + poll loop)
|
|
- `daemon_test.go` - Tests registre, labels, daemon integration via socket
|
|
- `types.go` - Session enrichi avec Workspace, Label, WaitingSince
|
|
|
|
## Decisions Made
|
|
- WaitingSince est gere entierement par le registre lors des transitions d'etat, pas par le caller
|
|
- LabelStore cree le repertoire parent au premier Set (MkdirAll)
|
|
- Le daemon fait un scan synchrone avant d'ouvrir le socket (evite les reponses vides au demarrage)
|
|
- workspaceResolver est une fonction injectable, nil par defaut (plan 02-02 fournira l'implementation)
|
|
|
|
## Deviations from Plan
|
|
|
|
### Auto-fixed Issues
|
|
|
|
**1. [Rule 1 - Bug] Test populate apres Start au lieu d'avant**
|
|
- **Found during:** Task 2 (daemon tests)
|
|
- **Issue:** Le scan initial supprimait les sessions pre-populees via RemoveStale
|
|
- **Fix:** Populer le registre apres Start() dans les tests
|
|
- **Files modified:** daemon_test.go
|
|
- **Verification:** Tests passent avec -race
|
|
- **Committed in:** 4b142a7
|
|
|
|
---
|
|
|
|
**Total deviations:** 1 auto-fixed (1 bug)
|
|
**Impact on plan:** Fix necessaire pour la coherence du scan initial. Pas de scope creep.
|
|
|
|
## Issues Encountered
|
|
None
|
|
|
|
## User Setup Required
|
|
None - no external service configuration required.
|
|
|
|
## Known Stubs
|
|
None - all code is fully wired.
|
|
|
|
## Next Phase Readiness
|
|
- Protocol types et registry prets pour le plan 02-02 (i3 bridge)
|
|
- workspaceResolver a brancher sur ResolveWorkspace du plan 02-02
|
|
- Handler "switch" a ajouter dans le plan 02-03
|
|
|
|
---
|
|
*Phase: 02-daemon-et-i3-bridge*
|
|
*Completed: 2026-03-23*
|