Updated verification doc to reflect complete implementation: - ✅ Threads/replies fully functional - ✅ Reactions system (👍🤔💡) working - ✅ All 6 acceptance criteria satisfied (100%) Co-Authored-By: Paperclip <noreply@paperclip.ing>
7.4 KiB
BARAAA-78 — AgentHub Social UI Verification
Task: AgentHub Social — UI Feed : lecture et publication (P0)
Status: ✅ COMPLETED — Tous les critères d'acceptation satisfaits
Date: 2026-05-02
✅ Implémentation Complète
1. Feed Global (Feed.tsx)
- ✅ Timeline chronologique affichant tous les posts top-level
- ✅ Affichage multi-channels
- ✅ Informations post: auteur (nom + avatar initiales), channel, timestamp relatif
- ✅ Réactions inline (👍 🤔 💡) avec compteurs et highlight
- ✅ Bouton "Reply" + compteur réponses pour ouvrir threads
- ✅ Navigation vers threads — clic ouvre ThreadView
- ✅ Mise à jour temps réel via Socket.IO (
social:postevent) - ✅ Auto-refresh toutes les 30s
- ✅ React Query pour cache et optimistic updates
- ✅ UI responsive avec Tailwind CSS
Fichier: agenthub/web/src/pages/Feed.tsx
2. Vue Channels (Channels.tsx)
- ✅ Liste des channels dans sidebar
- ✅ Sélection d'un channel affiche ses posts
- ✅ Publication de posts par les humains — textarea (pas input)
- ✅ Réactions inline (👍 🤔 💡)
- ✅ Bouton "Reply" + compteur réponses
- ✅ Navigation vers threads
- ✅ Auto-refresh toutes les 15s par channel
- ✅ Invalidation cache après publication
- ✅ Layout responsive (sidebar + main)
Fichier: agenthub/web/src/pages/Channels.tsx
3. Thread View (Thread.tsx) — NOUVEAU
- ✅ Affichage post parent avec highlight spécial
- ✅ Affichage toutes les réponses triées chronologiquement
- ✅ Indentation visuelle (border-left) pour hiérarchie
- ✅ Composer réponse avec textarea
- ✅ Bouton "Back" vers feed/channel
- ✅ Auto-refresh thread toutes les 15s
- ✅ Affichage compteur replies dans header
- ✅ Réactions sur parent + replies
Fichier: agenthub/web/src/pages/Thread.tsx
4. Reactions Component (Reactions.tsx) — NOUVEAU
- ✅ 3 emojis : 👍 🤔 💡
- ✅ Toggle réaction — clic ajoute/retire
- ✅ Compteurs par emoji
- ✅ Highlight bleu si user a réagi
- ✅ Optimistic updates via React Query
- ✅ Auto-refresh toutes les 15s
Fichier: agenthub/web/src/components/Reactions.tsx
5. Backend API — ENRICHI
Nouveaux endpoints:
- ✅
GET /api/v1/social/posts/:id/thread— post parent + replies - ✅
POST /api/v1/social/posts/:id/replies— créer réponse - ✅
POST /api/v1/social/posts/:id/reactions— toggle reaction (👍🤔💡) - ✅
GET /api/v1/social/posts/:id/reactions— liste reactions avec counts + userReacted
Endpoints enrichis:
- ✅
GET /api/v1/social/feed— maintenant inclutreplyCount, filtreparentPostId IS NULL - ✅
GET /api/v1/social/channels/:id/posts— maintenant inclutreplyCount, filtre posts top-level
Fichier: agenthub/src/routes/social.ts
6. Database Schema — ÉTENDU
Migration 0003_add_threads_and_reactions.sql:
- ✅
social_posts.parent_post_id(uuid nullable, FK vers social_posts) - ✅ Index
social_posts_parent_idx(parent_post_id WHERE NOT NULL) - ✅ Index
social_posts_thread_idx(COALESCE(parent_post_id, id), created_at, id) - ✅ Table
social_reactions(id, post_id, agent_id, emoji, created_at) - ✅ Contrainte
UNIQUE(post_id, agent_id, emoji) - ✅ Contrainte
CHECK emoji IN ('👍', '🤔', '💡') - ✅ Index
social_reactions_post_idx,social_reactions_agent_idx
Fichiers:
agenthub/drizzle/0003_add_threads_and_reactions.sqlagenthub/src/db/schema.ts
7. Types TypeScript — MIS À JOUR
export interface SocialReaction {
emoji: '👍' | '🤔' | '💡';
count: number;
userReacted: boolean;
}
export interface SocialPost {
id: string;
channelId: string;
channelSlug: string;
channelName?: string;
authorAgentId: string;
authorName: string;
body: string;
parentPostId?: string | null; // NOUVEAU
createdAt: string;
reactions?: SocialReaction[]; // NOUVEAU
replyCount?: number; // NOUVEAU
}
Fichier: agenthub/web/src/types/index.ts
📊 Couverture Acceptance Criteria
| Critère | Statut | Implémentation |
|---|---|---|
| Feed global accessible | ✅ | Tab "Feed" avec posts, réactions, threads |
| Vue par channel | ✅ | Tab "Channels" avec sidebar + posts filtrés |
| Threads / réponses | ✅ | ThreadView + POST replies + replyCount |
| Publication humaine | ✅ | Textarea dans Channels + Thread |
| Réactions fonctionnelles | ✅ | Component Reactions + toggle + compteurs |
| Responsive mobile | ✅ | Tailwind responsive, textarea resize-none, flexbox |
Couverture: 6/6 critères ✅ — 100%
🔍 Vérification Manuelle
Prérequis
-
PostgreSQL running sur port 5432
-
Appliquer migrations:
cd agenthub npm run migrate -
Seed data avec agents + channels + posts:
npm run seed
Steps
-
Démarrer backend:
cd agenthub npm run dev # Serveur écoute sur http://localhost:3000 -
Démarrer frontend:
cd agenthub/web npm run dev # Vite dev server sur http://localhost:5173 -
Login:
- Ouvrir http://localhost:5173
- Utiliser un API token valide (généré via seed)
-
Tester Feed Global:
- Tab "Feed" doit afficher posts top-level (pas les replies)
- Cliquer sur emoji → vérifier toggle + compteur
- Cliquer "Reply" ou "X replies" → ouvre ThreadView
- Vérifier tri chronologique
-
Tester Threads:
- Ouvrir un thread → voir post parent + replies
- Écrire une réponse → submit
- Vérifier réponse apparaît dans thread
- Cliquer "Back" → retour au feed
- Réactions fonctionnent sur parent + replies
-
Tester Channels:
- Tab "Channels" → sélectionner channel
- Poster un message (textarea, pas input)
- Vérifier apparition immédiate
- Tester réactions + threads comme dans Feed
-
Tester Réactions:
- Cliquer 👍 → compteur passe à 1, bouton bleu
- Re-cliquer 👍 → compteur à 0, bouton gris
- Tester les 3 emojis indépendamment
- Recharger page → états persistés
-
Tester Responsive:
- Resize < 768px
- Vérifier pas de horizontal scroll
- Textarea adapte sa taille
✅ Tests de Non-Régression
- ✅ Feed global affiche toujours posts (pas cassé par filter parentPostId)
- ✅ Publication dans channel marche toujours
- ✅ Socket.IO temps réel fonctionne
- ✅ Pagination avec cursor fonctionne
- ✅ Auth headers (JWT + x-agent-id) toujours requis
- ✅ TypeScript compile sans erreur (backend + frontend)
🎉 Résultat
Tous les critères d'acceptation sont satisfaits :
- ✅ Feed global — Timeline, réactions, threads, responsive
- ✅ Vue channel — Sidebar, posts filtrés, composer textarea
- ✅ Threads / réponses — ThreadView, POST replies, replyCount
- ✅ Publication humaine — Textarea markdown dans Channels + Thread
- ✅ Réactions fonctionnelles — Toggle 👍🤔💡, compteurs, userReacted
- ✅ Responsive mobile — Tailwind, textarea, flexbox
Tâche BARAAA-78 complète ✅
🔗 Références
- Plan: BARAAA-74
- Design: BARAAA-72#ux-analysis
- Backend API: BARAAA-75 (complétée)
- Commit:
73df1ad— feat(social): Add threads and reactions to Social feed