Commit Graph
257 Commits
Author SHA1 Message Date
Arnaud Dartois 3cef2ab3d7 chore(ci): add aggressive disk cleanup to prevent runner OOM
The CI runner was failing at 100% disk capacity (67G/69G) during
coverage report generation. Add two cleanup steps:
1. Aggressive cleanup before CI execution (removes unnecessary
   packages, Docker images, caches)
2. Cleanup after CI before coverage report (removes build
   artifacts, test results)
2026-07-24 14:36:53 +00:00
Arnaud Dartois 261f922ad1 fix(web): disable HTTPS redirection when not configured
The application forced HTTPS redirection and secure cookies
even in HTTP-only mode (Docker deployment), preventing
plain HTTP connections.

Make UseHttpsRedirection() conditional on ASPNETCORE_URLS
and change CookieSecurePolicy from Always to SameAsRequest.
2026-07-24 13:52:22 +00:00
Arnaud Dartois fc5108a4fa fix(agent): add ffmpegPath parameter to CameraStreamService for deterministic testability 2026-07-24 06:38:15 +00:00
Arnaud Dartois b851a20dde test(web): add bUnit tests for StatusChip and FilterBar with ManualMockKeyInterceptorService 2026-07-23 20:40:56 +00:00
Arnaud Dartois 9df02856ad ci: enable bunit-enabled for Blazor component tests 2026-07-23 20:26:35 +00:00
Arnaud Dartois 55f01cb922 ci: add explicit Web.Tests (bUnit) step to CI pipeline 2026-07-23 19:52:16 +00:00
Arnaud Dartois 3d7137a865 test(web): add bUnit shared component tests for PaginationBar, EmptyState, LoadingSkeleton, SectionCard 2026-07-23 19:38:30 +00:00
Arnaud Dartois 0745903fef test: add remaining handler tests for Users, Groups, Persons, Assignments, Discovery; more Agent + E2E tests 2026-07-23 19:19:05 +00:00
Arnaud Dartois a94afed6b5 test(e2e): add Playwright E2E tests for Blazor pages; refactor Program.cs to support test server 2026-07-23 18:12:47 +00:00
Arnaud Dartois 7678b4703a chore: add InternalsVisibleTo for Agent tests 2026-07-23 17:00:22 +00:00
Arnaud Dartois 79d60abca3 docs: add test coverage design doc and implementation plan 2026-07-23 16:31:22 +00:00
Arnaud Dartois 262adc07cf test(agent): add service tests for CameraStream, ConfigReceiver, FrameAnalyzer, SystemMetrics, DTOs 2026-07-23 15:37:20 +00:00
Arnaud Dartois 06247d4f5c test(web): add Web.Tests unit tests and extended IntegrationTests 2026-07-23 15:27:34 +00:00
Arnaud Dartois 5d06c39160 test(infrastructure): add service tests for Security, Data, Discovery, Jobs layers 2026-07-23 15:08:09 +00:00
Arnaud Dartois fed55bb1ab test(application): add CQRS handler tests for Sites, Cameras, Agents, Auth, Events, Settings, Groups, Users, Assignments, Discovery, Persons, Stats, Audit 2026-07-23 14:32:33 +00:00
Arnaud Dartois ddd0664a71 fix(test): replace NSubstitute-based DbSet mock with InMemoryDbSet - fixes nested substitution issue 2026-07-23 14:22:21 +00:00
Arnaud Dartois d9c2a24949 test(application): add MockDbSetHelper and CreateSiteHandler tests 2026-07-23 09:59:30 +00:00
Arnaud Dartois 7da799c0c4 test(application): add AutoMapper mapping profile validation tests 2026-07-23 09:56:11 +00:00
Arnaud Dartois 6ba08d1f39 test(application): add ValidationBehavior and LoggingBehavior pipeline tests 2026-07-23 09:54:47 +00:00
Arnaud Dartois 7328c12dbf test(application): add ServiceResult and ServiceResult<T> unit tests 2026-07-23 09:53:07 +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 0f2d556c26 fix(cqrs): robust RedactValue with centralized sensitive key patterns
- Move sensitive patterns to typed arrays (SensitiveKeyPatterns, SensitiveValueTypePatterns)
- Add missing patterns: apikey, api_key, credential, jwt, privatekey, connectionstring
- Use LINQ Any() for cleaner matching logic
2026-07-22 20:36:04 +00:00
Arnaud Dartois deb4af9412 fix(cqrs): reduce controller boilerplate with TryGetUserId extension
- Create ControllerBaseExtensions.TryGetUserId()
- Replace 8 occurrences of manual ClaimTypes.NameIdentifier parsing
- Same namespace (Heimdall.Api.Controllers) as existing controllers
2026-07-22 20:34:21 +00:00
Arnaud Dartois 1a6f2b037f fix(cqrs): restore ServiceResult encapsulation, use factory methods in ValidationBehavior
- Revert ServiceResult to protected set + protected constructors
- Remove new() constraint from ValidationBehavior
- Use static Failure() factory method via reflection instead
2026-07-22 20:32:45 +00:00
Arnaud Dartois 55620b0776 fix(cqrs): address code review findings
Critical fixes:
- Publish EventCreatedNotification (SignalR broadcast was broken)
- Use ValidateAsync in ValidationBehavior (async validators were skipped)

Important fixes:
- Remove dead UnitOfWorkBehavior (handlers manage saves themselves)
- Remove dead ConfigChangedNotification (controller broadcasts directly)
- Guard MappingProfile Activator.CreateInstance against missing ctor
- Add CA1711 pragma with justification
2026-07-22 20:22:34 +00:00
Arnaud Dartois 6978d2e9ab fix(cqrs): implement missing auth service interfaces and fix tests
- Create RolePermissionService (delegates to AppPermissions)
- Create AuthSignInService (wraps SignInManager)
- Create AuthDataService (handles settings, first-user, token revocation)
- Register all new services in Infrastructure DI
- Fix AuthDataService RevokedRefreshToken constructor usage
- All 226 tests passing
2026-07-22 20:05:59 +00:00
Arnaud Dartois df644c8b2a docs(cqrs): update spec and implementation docs
- Add CQRS architectural decision (D7) to Master Spec
- Update implementation.md with CQRS migration phase
- Update readme to reflect CQRS/MediatR architecture
2026-07-22 20:01:55 +00:00
Arnaud Dartois d67cbd64cc refactor(cqrs): cleanup old service layer, preserve discovery/assignment services for handlers
- Remove 13 old service interfaces from Application/Services
- Remove 13 old service implementations from Infrastructure/Services
- Remove old SnapshotService (no CQRS replacement needed)
- Update Infrastructure DI to register only CQRS-compatible services
- Preserve CameraEventService + PersonService for existing tests
- Clean up duplicate IUserRepository registration
2026-07-22 20:00:49 +00:00
Arnaud Dartois 1d1ac8387e feat(cqrs): update controllers, add AutoMapper profiles, SignalR notifications, Hangfire config
- 13 controllers migrated from service DI to IMediator dispatch
- 11 AutoMapper mapping profiles (Sites, Cameras, Auth, Users, Agents, Events, Assignments, Settings, Groups, Persons, Discovery)
- SignalR notifications bridged via MediatR INotificationHandler
- Hangfire config moved from Program.cs to Infrastructure/BackgroundJobs
- 0 build errors, 0 warnings
2026-07-22 19:54:55 +00:00
Arnaud Dartois c1b3b3d3b4 feat(cqrs): migrate Events, Agents, Assignments, Discovery, Others to CQRS
- Events: CRUD commands/queries + EventCreatedNotification for SignalR
- Agents: Register (with API key gen), Heartbeat, queries
- Assignments: Assign, Failover, Release commands + queries
- Discovery: 10 handlers delegating to existing probes/services
- Groups/Persons/Settings/Audit/Stats: full CQRS for remaining domains
- Extend IApplicationDbContext with all DbSets
2026-07-22 19:48:16 +00:00
Arnaud Dartois 11f7fd8d20 feat(cqrs): migrate Sites, Auth, Users, Cameras to CQRS
- Sites: CreateSite, UpdateSite, DeleteSite, GenerateToken commands + handlers
- Auth: Login, Register, RefreshToken, 2FA, ChangePassword, Logout commands
- Users: CRUD, roles, sites, lock/unlock, reset-password commands + queries
- Cameras: CRUD, SetCredentials commands + queries
- Add IApplicationDbContext abstraction for Clean Architecture
- Add ICredentialProtector, IJwtService interfaces to Application layer
- 0 build errors, 0 warnings
2026-07-22 19:43:13 +00:00
Arnaud Dartois 649af93f56 feat(cqrs): add MediatR, AutoMapper and pipeline infrastructure
- Add MediatR 12.5.0, AutoMapper 13.0.1 packages
- Create ValidationBehavior (FluentValidation pipeline)
- Create LoggingBehavior (structured logging pipeline)
- Create MappingProfile with IMapFrom<T> convention
- Make ServiceResult properties public for pipeline use
- Update Application DI with MediatR + AutoMapper registration
2026-07-22 19:31:51 +00:00
Arnaud Dartois 31794c86c0 chore: update opencode submodule to publish-agent scripts 2026-07-22 15:43:03 +00:00
Arnaud Dartois 416a5971ae chore: update opencode submodule to 3690405 (skillServer cleanup) 2026-07-22 15:28:26 +00:00
Arnaud Dartois eea8813307 chore: install superpowers plugin, update opencode submodule to 136706e 2026-07-22 15:15:36 +00:00
Arnaud Dartois 9c424f1011 chore: update opencode submodule to 65a57d4 (agents from SkillServer) 2026-07-22 15:08:22 +00:00
Arnaud Dartois 71a9145cf5 refactor(ci): use docker-images list (image + dockerfile per line) 2026-07-22 14:41:21 +00:00
Arnaud Dartois 4d4ae955d9 refactor(ci): add release + renovate workflows (identical across all projects)
All 3 projects share exact same 3 workflows:
- ci.yml (ci-full)     → build, test, coverage, docker, trivy
- release.yml (ci-release) → version, publish, release, docker
- renovate.yml (ci-renovate) → dependency updates
2026-07-22 14:20:14 +00:00
Arnaud Dartois ff65c73724 refactor(ci): use ci-full mega-action (identical across all projects)
All 3 projects now share the exact same CI pipeline via
nonobis/templates/.forgejo/actions/ci-full. Only params differ.
2026-07-22 13:52:59 +00:00
Arnaud Dartois cd7bdea66c chore: update opencode submodule to 0e4b768 (skills removed, agents English) 2026-07-22 13:50:38 +00:00
Arnaud Dartois ef2f3886e3 fix(tests): use Coverlet msbuild props instead of --collect (quoting issue)
Vault auth now working! Tests failed due to bad --collect quoting.
Switched to -p:CollectCoverage=true (Cleaner syntax).
2026-07-22 13:48:29 +00:00
Arnaud Dartois 390c7430e8 chore: update opencode submodule to 3efb503 (agents on skill.tordais.cc) 2026-07-22 13:44:04 +00:00
Arnaud Dartois 29eecf869b fix(ci): sonar secrets from Vault env (not forgejo secrets) 2026-07-22 11:14:26 +00:00
Arnaud Dartois f88d9e52d6 fix(ci): enable Vault (VAULT_URL=https://vault.tordais.cc) 2026-07-22 10:28:46 +00:00
Arnaud Dartois 6fc89d18c6 chore: update opencode submodule to c63c04c (skills metadata) 2026-07-22 10:14:25 +00:00
Arnaud Dartois 61613155d2 chore: update opencode submodule to ebda7d8 (merge perf agents) 2026-07-22 10:06:35 +00:00
Arnaud Dartois 9f35da2bc2 chore: update opencode submodule to 299307a (OCP dispatch via registry) 2026-07-22 09:58:01 +00:00