feat(p11): temps réel complet (watcher checkout principal + topic settings)

P11-A — branche du checkout principal modifiée hors Arboretum :
- fs-watcher: pin « permanent » non évinçable (pinRepo/unpinRepo, repoPins dans evictIfNeeded)
- worktree-manager: armMainCheckoutWatchers() + arm/désarm sur addRepo/découverte/removeRepo/hidden
- index.ts: armMainCheckoutWatchers() dans runDaemon → git checkout CLI sur le principal → worktree_update <500ms sans watch client

P11-B — réglages en temps réel :
- protocole additif: type SettingsBroadcast (source unique, réutilisé par SettingsResponse), topic 'settings', message settings_update (validés parseClientMessage + gateway)
- core/settings-bus.ts (EventEmitter) ; routes/settings émet après PATCH ; gateway relaie aux abonnés 'settings'
- web: ws-client subscribeSettings + routage ; store settings applySettings/startRealtime ; AppShell abonne globalement ; SettingsView re-sync des drafts scalaires sans écraser une saisie en cours
- tests: protocol (topic settings) + fs-watcher (pinRepo non évincé) ; acceptance-p11.mjs (checkout principal <500ms + settings_update)
This commit is contained in:
2026-06-27 14:08:44 +02:00
parent 92670a796a
commit e8d10b7ec0
16 changed files with 304 additions and 38 deletions

View File

@@ -100,6 +100,21 @@ describe('FsWatcherService', () => {
expect(s.isWatching('b', b)).toBe(false);
});
it('pinRepo (checkout principal, P11) : jamais évincé par la LRU', () => {
const s = new FsWatcherService({ maxWatchers: 1 });
services.push(s);
const a = makeTmpRepo();
const b = makeTmpRepo();
s.pinRepo('a', a); // épingle permanente
s.watch('b', b);
s.unwatch('b', b);
expect(s.isWatching('a', a)).toBe(true); // toujours là malgré le dépassement du plafond
s.unpinRepo('a', a);
const c = makeTmpRepo();
s.watch('c', c); // 'a' n'est plus épinglé et idle → évinçable
expect(s.isWatching('a', a)).toBe(false);
});
it('closeAll libère tout', async () => {
const repo = makeTmpRepo();
const s = new FsWatcherService();