Arnaud Dartois
ca43c6d28e
feat(analysis): scheduler de jobs d'analyse avec routage par capacités, priorités et dead-letter ( #159 )
2026-08-26 23:44:38 +02:00
Arnaud Dartois
6b611e908a
feat(notifications): abonnement par type d'événement + priorité ntfy ( Fixes #61 ) ( #154 )
...
## Contexte
Issue #61 : Gestion des types d'alertes — abonnement par type d'événement + sévérité/priorité.
Les utilisateurs ne peuvent pas filtrer quelles notifications push/email ils reçoivent. Tous les événements (mouvement, personne, caméra hors ligne...) sont envoyés sans distinction.
## Changements
### Domaine
- **EventTypePriorityMap** (`src/Heimdall.Domain/Helpers/`) : mapping `EventType` → priorité ntfy (1-5)
- CameraOffline/UnknownPerson = 5 (urgent), PersonDetected/FaceRecognized = 4 (high), MotionDetected/VehicleDetected/LicensePlateDetected = 3 (default), CameraOnline = 2 (low)
- **UserNotificationConfig** : ajout `SubscribedEventsJson` (JSON array), `GetSubscribedEvents()`, `IsEventTypeSubscribed()`, `SetSubscribedEvents()`
- `null` ou `[]` = recevoir tous les événements (comportement par défaut)
### Infrastructure
- **NotificationService.DispatchToExternalChannelsAsync** : filtre par `IsEventTypeSubscribed()` avant envoi email/ntfy
- Priorité ntfy calculée via `EventTypePriorityMap.GetPriority()` et passée à `NtfyService`
### UI (Profile.razor)
- Checkboxes par type d'événement dans la section Notifications
- Texte explicatif : « Si aucun n'est sélectionné, tous les événements sont notifiés »
- Sauvegarde via `UpdateNotificationConfigRequest.SubscribedEvents`
### Tests
- 10 tests Domain : `UserNotificationConfig` (GetSubscribedEvents, IsEventTypeSubscribed, cas limites JSON invalide/vidé/unknown)
- 1 test Domain : `EventTypePriorityMap` (couvre les 8 EventTypes + null)
- 3 tests Infrastructure : filtrage par abonnement + priorité ntfy + filtre vide
## Vérification
- `dotnet build` : 0 erreur, 0 warning
- Domain.Tests : 161 passed
- Infrastructure.Tests : 180 passed
- Application.Tests : 421 passed
- Web.Tests : 243 passed
- Agent.Tests : 206 passed
- Total : 1211 tests ✅
Closes #61
Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/154
2026-08-20 15:10:37 +02:00
Arnaud Dartois
4792b69e46
feat(agent): télémétrie inventaire matériel — CPU/mémoire/disque/GPU/OS/réseau ( Fixes #82 #83 #84 #85 ) ( #137 )
...
## Contexte
Implémentation des tickets #82 , #83 , #84 , #85 — télémétrie inventaire matériel agent. L'objectif est de fournir au central un maximum d'informations sur les machines des agents (CPU, mémoire, disques, GPU, OS, réseau, conteneur) sans SSH.
## Changements
### Nouveaux collecteurs (src/Heimdall.Agent/Services/)
- **CpuInfoProvider** : parse `/proc/cpuinfo` (vendor, modèle, cœurs physiques/logiques, fréquence, flags AVX/AVX2/FMA/AVX512, cache), topologie, détection cgroup CPU (`/sys/fs/cgroup/cpu.max` v2)
- **DiskInventoryProvider** : énumère les montages (`/proc/mounts`), capacité/libre/type SSD/HDD via `/sys/block/*/queue/rotation`
- **GpuInventoryProvider** : nvidia-smi, sysfs DRM, vainfo, rocm-smi avec fallback silencieux, multi-GPU
- **HostInfoProvider** : os-release, uname, `/proc/uptime` (uptime machine ≠ process), températures sysfs
- **ContainerInfoProvider** : détection Docker (/.dockerenv, cgroup), ID conteneur, limites CPU/mémoire
### Refonte SystemMetricsProvider
- Séparation host vs process (RAM machine ≠ RAM conteneur ≠ WorkingSet64)
- Uptime machine (`/proc/uptime`) distinct de l'uptime process
- Mémoire swap
### Entité Agent + Migration
- Champs structurés CPU/mémoire/disque/GPU/OS/réseau (tous nullable, rétrocompatible)
- Migration EF `AddAgentTelemetryInventory`
### Transport heartbeat
- Inventaire au register + refresh périodique (5 min, pas à chaque tick)
- Champs JSON pour listes (disques, GPU, interfaces réseau, températures)
### UI Admin (AgentDetail.razor)
- Sections CPU, Mémoire/Disques, GPU, Machine/Conteneur avec barres de progression et badges
### Tests
- 40+ tests unitaires : providers, handlers, entité Agent
- Total : 999 tests verts (Domain 149, Application 397, Agent 210, Web 243)
## Tickets liés
- Fixes #82 — CPU inventory
- Fixes #83 — Mémoire & disque
- Fixes #84 — GPU inventory
- Fixes #85 — OS, conteneur, réseau
## Résultats des tests
- `dotnet build` : 0 erreur, 0 warning
- Domain.Tests : 149 passed
- Application.Tests : 397 passed
- Agent.Tests : 210 passed
- Web.Tests : 243 passed
- Total : 999 tests ✅
## Checklist
- [x] `dotnet build` vert (TreatWarningsAsErrors)
- [x] Tests unitaires verts
- [x] Migration EF créée
- [x] Champs nullable (rétrocompatible)
- [x] Pas de référence Infrastructure dans les contrôleurs
- [x] Collecteurs avec fallback silencieux (pas de crash sans GPU/Docker/sysfs)
Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/137
2026-08-20 14:13:06 +02:00
Arnaud Dartois
29ff980db5
feat(domain): entités métier Vehicle/Recording/LicensePlate/StoragePolicy + relations Event→Vehicle/Recording, Camera→StoragePolicy ( Fixes #6 )
2026-08-11 21:42:46 +02:00
Arnaud Dartois
f800103239
feat: remplacer Gotify par ntfy — push notifications multi-utilisateur avec isolation par topic
...
- Nouveau NtfyService: topic isolé par user (heimdall_{userId})
- Configuration globale Ntfy:BaseUrl + Ntfy:Token (plus de token par user)
- Renommage UserNotificationConfig: Gotify* → Ntfy*
- Migration des colonnes DB: gotify_enabled/url/token → ntfy_enabled/url
- Ajout service ntfy dans docker-compose (binwiederhier/ntfy)
- Mise à jour .env.example avec NTFY__BASE_URL et NTFY__TOKEN
- Suppression GotifyService et IGotifyService
2026-07-27 04:56:16 +00:00
Arnaud Dartois
f9be0f1e0d
feat: implémenter SignalR hubs (Monitoring, Notifications, Admin) + système de notifications complet
...
SignalR Hubs:
- MonitoringHub (/hubs/monitoring) — statuts agents/caméras/stockage/GPU jobs
- NotificationsHub (/hubs/notifications) — notifications in-app badge temps réel
- AdminHub (/hubs/admin) — broadcast changements config (Admin only)
Notification System:
- Nouvelles entités: Notification, NotificationTemplate, UserNotificationConfig
- CQRS/MediatR: 6 handlers (list, unread, mark-read, mark-all, config get/update)
- Infrastructure: NotificationService orchestrator + EmailService + GotifyService
- Rate limiter IMemoryCache (20 events/min/camera/type)
- Hangfire jobs: SendNotification, DailyDigest, WeeklyDigest
- NotificationsController API (6 endpoints)
- Blazor UI: NotificationsPage + NotificationBadge
- Migration AddNotifications (3 nouvelles tables)
- 644 nouveaux tests (Domain: 131, Application: 321, Infra: 151, Integration: 120, +autres)
2026-07-26 20:45:35 +00:00
Arnaud Dartois
a44414a543
test(domain): add entity tests for CameraAssignment, CameraCredentials, CameraEvent, Group, Person, CameraDiscoveryResult, DiscoveredStreamUrl, UserGroup, CameraDetectionProfile; augment CameraTests and AgentTests
2026-07-23 09:52:30 +00:00
Arnaud Dartois
1525fabffe
test(domain): add ApiKey, AppSetting, AgentSetting, AuditLog, RevokedRefreshToken entity tests
2026-07-23 09:50:43 +00:00
Arnaud Dartois
3cedffb43c
test(domain): add enum values tests for all 11 enum types
2026-07-23 09:49:35 +00:00
Arnaud Dartois
c02ebe460e
test(domain): add Entity<TId> and ValueObject equality tests
2026-07-23 09:48:58 +00:00
Arnaud Dartois
58a3ce5b1b
chore: vire toute trace d'InMemory, remplace par Testcontainers PostgreSQL
...
- Supprime InMemory de tous les .csproj (Infrastructure, Domain.Tests, IntegrationTests)\n- Supprime le branchement Database:Provider=InMemory de DependencyInjection.cs\n (plus que du PostgreSQL natif)\n- Infrastructure.Tests: CameraAssignment + CameraEvent tests -> Testcontainers\n- PostgreSqlContainerFixture ajoute aux Infrastructure.Tests\n- appsettings.Testing.json: retire Database:Provider et Hangfire:Enabled\n- 4 tests echouent encore: bugs pre-existants masques par InMemory\n (FK non respectees, donnees de test erronees)\n\nTests: 222/226 passed (4 pre-existants lies aux FK)
2026-07-21 12:19:43 +00:00
Arnaud Dartois
b217c932e8
feat(mvp): implement MVP multi-site platform
...
Complete MVP implementation (Étape 1) covering:
- Domain: primitives (Entity<TId>, ValueObject), 10 entities, 6 enums
- EF Core: AppDbContext + Identity, 8 EntityTypeConfigurations, audit/soft-delete interceptors, initial migration
- Application: service interfaces, DTOs, FluentValidation, ServiceResult pattern
- Security: Identity + JWT + API Key multi-auth, role-based permissions, constant-time key validation
- API: Auth/Sites/Agents controllers with explicit auth scheme policies
- Workers: Hangfire PostgreSQL setup with schema isolation, HeartbeatMonitorJob
- Agent: registration service + 30s heartbeat loop
- Docker: multi-stage Dockerfiles for central + agent, docker-compose.yml
- CI/CD: GitHub Actions pipeline with build+test and Docker build
- Tests: 13 domain tests (Site, Agent, Camera entities)
Architecture decisions per deliberation council:
- API Key via AuthenticationHandler<T> (not middleware)
- Explicit [Authorize(AuthenticationSchemes)] on all endpoints
- Event/Recording/Person/Vehicle deferred from initial migration
- Hangfire compatible with .NET 10 (v1.8.17)
2026-07-16 20:53:56 +00:00
Arnaud Dartois
bfb3e06bc1
feat: initialize .NET 10 Clean Architecture solution
...
Create Heimdall solution with 17 projects following Clean
Architecture for a maintainable and loosely coupled codebase.
src/ (9 projects):
- Domain, Domain.Primitives, Contracts (core layer, no deps)
- Application (ref. Domain) — CQRS/MediatR ready
- Infrastructure (ref. Application + Domain) — EF Core
PostgreSQL ready
- Api, Web (Blazor), Agent, Workers (hosts, ref. Application +
Infrastructure)
tests/ (8 projects):
- xUnit + Shouldly + NSubstitute + bUnit (Web.Tests)
- One test project per source project (Domain -> IntegrationTests)
Config: Directory.Build.props (Nullable, ImplicitUsings,
TreatWarningsAsErrors)
2026-07-16 19:09:28 +00:00