Arnaud Dartois
810900cd3e
fix(auth): add JWT__RefreshKey config and env var fallback in JwtService
...
- Add JWT__RefreshKey to .env.example with documentation
- Add JWT__RefreshKey to docker-compose.yml and docker-compose.prod.yml
- Fix JwtService to check both IConfiguration and env vars (JWT__REFRESHKEY)
for access token key and refresh token key, matching Program.cs pattern
- Fixes 'Jwt:RefreshKey is not configured' 500 error on register/login
2026-07-25 18:02:43 +00:00
Arnaud Dartois
f6fbc082a1
chore: update opencode submodule to e73b5c4
...
- Add CI/CD templates repo architecture documentation
- Document vault-secrets debugging
- Add troubleshooting table for CI failures
2026-07-25 16:39:53 +00:00
Arnaud Dartois
920722544b
fix(ci): push Docker images to eltruncho instead of nonobis
...
The docker-compose.prod.yml pulls from eltruncho/heimdall but the CI
was pushing to nonobis/heimdall. Fix the docker-images config in both
ci.yml and release.yml to match the deployment target.
2026-07-25 16:26:24 +00:00
Arnaud Dartois
d0da78188a
test(auth): add integration tests for authentication redirect flow
...
Add AuthFlowTests to catch Blazor redirect bugs:
- Get_Root_WithoutAuth_RedirectsToLogin: unauthenticated GET /
must redirect to /login (would have caught the /Account/Login bug)
- Get_LoginPage_ReturnsOk: verify login page renders
- Get_ProtectedApi_WithoutAuth_ReturnsUnauthorized: API auth check
- RegisterAdmin_ThenLogin_ReturnsJwt_AndAccessesProtectedApi:
full auth flow with JWT token refresh
- Register_WithWeakPassword_ReturnsBadRequest: password validation
- Register_ReturnsValidAuthResponse: success path
2026-07-24 19:39:47 +00:00
Arnaud Dartois
15cb65064a
chore: update opencode submodule to f7cde17
...
Auto-pipeline now runs at 4 checkpoints (startup, before/after work unit, session end)
instead of only after learning-agent invocations.
2026-07-24 19:29:34 +00:00
Arnaud Dartois
50507ad86a
fix(auth): move ConfigureApplicationCookie after AddInfrastructure
...
AddIdentity (called by AddInfrastructure) sets default cookie paths
(/Account/Login) that override our custom paths. Move
ConfigureApplicationCookie after AddInfrastructure to ensure our
custom paths (/login) take precedence.
2026-07-24 19:29:02 +00:00
Arnaud Dartois
a379f2b136
feat(logging): add comprehensive authentication logging
...
- Add cookie authentication event logging in Program.cs (redirect to login, access denied, principal validation)
- Add logging in RedirectToLogin.razor for redirection tracking
- Add detailed logging in Login.razor for login attempts, 2FA verification, and authentication completion
- Add structured logging in AuthController for all authentication endpoints (register, login, 2fa, refresh, change-password, logout, etc.)
- Use appropriate log levels (Information, Warning, Error, Debug) based on event importance
2026-07-24 18:25:33 +00:00
Arnaud Dartois
550c621f35
fix(auth): move ConfigureApplicationCookie to Program.cs to override Identity defaults
...
Move ConfigureApplicationCookie configuration from DependencyInjection.cs
to Program.cs, ensuring it's called AFTER AddAuthentication().AddCookie().
This prevents Identity default paths (/Account/Login) from overriding
custom login paths (/login).
2026-07-24 18:15:56 +00:00
Arnaud Dartois
e5fb13632f
fix(auth): configure Identity cookie paths to use custom login page
...
Add ConfigureApplicationCookie to override Identity default paths
(/Account/Login) with custom paths (/login). This fixes the 404 error
when unauthenticated users are redirected to the login page.
2026-07-24 17:55:23 +00:00
Arnaud Dartois
364e8e6f55
fix(stats): execute DB queries sequentially to avoid DbContext thread-safety issue
...
DbContext is not thread-safe for concurrent operations. Running multiple
queries in parallel with Task.WhenAll caused 'A second operation was
started on this context instance before a previous operation completed'
exceptions, resulting in 500 errors on the stats endpoint.
2026-07-24 17:09:17 +00:00
Arnaud Dartois
0eb2410638
chore: update opencode submodule to b7cbd1d
...
Learning-agent now invoked after every commit (unconditional trigger)
2026-07-24 17:08:14 +00:00
Arnaud Dartois
adbc38fa75
fix(ci): remove sudo commands from disk cleanup
2026-07-24 16:51:53 +00:00
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