Merge branch 'main' into fix/302-notification-center
Heimdall Gitea / Detect CI scope (pull_request) Successful in 4s
Heimdall Gitea / Build and tests (pull_request) Successful in 15m27s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Successful in 5m48s
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 9m36s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Successful in 24m29s
Heimdall Gitea / CI policy (pull_request) Successful in 1s

This commit is contained in:
arnaud.dartois committed 2026-11-08 14:44:27 +01:00
commit 381a545a26
9 files changed
+113 -12

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ Refs #
## Vérification
<!-- Liens des runs Gitea, suites exécutées, résultats et item actualisé dans todo.md. -->
<!-- Issue Gitea liée, liens des runs Gitea, suites exécutées et résultats observés. -->
- [ ] Build and tests : compilation, PostgreSQL, Chromium, archives et images
- [ ] Contrôles NuGet et images sans HIGH/CRITICAL
+25
View File
@@ -0,0 +1,25 @@
---
name: detail-route-not-found
description: Keep Heimdall detail pages consistent when an API object no longer exists.
---
# Missing objects on detail routes
Use this workflow when a detail page already has an explicit “not found” state and an API read can return HTTP 404. Current routes covered are Agent (`AgentDetail.razor`), Camera (`CameraDetail.razor`), and Person (`PersonDetailPage.razor`).
## Implementation
- Keep the API client's normal `GetFromJsonAsync` behavior. A 404 raises `HttpRequestException` with `StatusCode == NotFound`. Agent and Camera resource-boundary checks intentionally return 403 for missing or out-of-scope records; treat that expected privacy response like the existing not-found rendering too. Person reads use 404.
- Preserve the generic error notification for unexpected failures. Do not treat 401, server, timeout, or malformed-response errors as “not found”.
- Do not fetch dependent page data after the primary object is absent. In particular, Camera must not load events, recordings, snapshots, or start periodic refresh, and Person must not load faces, vehicles, or events.
- Keep authorization and API responses unchanged. The UI behavior handles stale links and objects deleted between navigation and load.
## Acceptance
1. Add a component test for each route with a synthetic UUID and its expected hidden/missing response (Agent/Camera 403, Person 404).
2. Assert the existing not-found state is rendered, no snackbar is shown, and no dependent API call is made.
3. Retain or add an unexpected HTTP failure check proving the generic notification still appears.
4. Run the focused Web tests and Web build.
5. Run the disposable Compose recipe from `skills/compose-disposable-recipe/SKILL.md`; verify all three routes through the app boundary using isolated synthetic data and record exact project/image cleanup evidence.
The route-level checks require an authenticated synthetic account. Do not create or retain real people, cameras, Agents, or camera connection data for acceptance.
+1
View File
@@ -79,6 +79,7 @@ Render long historical logs as a clearly separated `<details><summary>Historique
## Pull requests and closure
- Before opening/updating a PR, verify the issue number, link, acceptance criteria, focused skill, and test/acceptance evidence are present.
- Keep `.gitea/PULL_REQUEST_TEMPLATE.md` aligned with this workflow: request the linked Gitea issue and observed CI/acceptance evidence; never direct contributors to update a markdown backlog.
- Use `Closes #N` only when the PR completes every criterion owned by that issue. For partial work use `Refs #N` and leave the issue open with unchecked criteria and evidence updated.
- Gitea closes a `Closes #N` issue when the PR merges. After merge, verify the issue state changed; if not, close it manually only after checking all criteria and posting the merge/CI/acceptance evidence.
- Do not close tickets merely because code was merged when required acceptance (including the disposable Compose recipe, CI gate, external deployment, camera, storage, or release run) remains outstanding. Create a separate validation issue if code delivery and external validation have different owners or timelines.
@@ -902,10 +902,17 @@ else
_ = LoadUpdateInfoAsync();
}
}
catch (HttpRequestException ex) when (IsMissingOrHiddenResource(ex))
{
// Le filtre d'accès renvoie 403 pour masquer un agent absent ou non accessible.
}
catch { Snackbar.Add(UiErrors.OperationFailed(), Severity.Error); }
finally { _loading = false; }
}
private static bool IsMissingOrHiddenResource(HttpRequestException exception) =>
exception.StatusCode is System.Net.HttpStatusCode.NotFound or System.Net.HttpStatusCode.Forbidden;
private void OnLanguageChanged() => _ = InvokeAsync(StateHasChanged);
private async Task LoadMetricHistoryAsync(string range)
@@ -372,14 +372,24 @@ else
_eventRecordingEnabled = _camera.EventRecordingEnabled;
}
}
catch (HttpRequestException ex) when (IsMissingOrHiddenResource(ex))
{
// Le filtre d'accès renvoie 403 pour masquer une caméra absente ou non accessible.
}
catch { Snackbar.Add(Text["CameraDetail_OperationFailed"], Severity.Error); }
finally { _loading = false; }
await LoadEventsAsync();
await LoadRecordingsAsync();
await LoadLatestSnapshotAsync();
if (_camera is not null)
{
await LoadEventsAsync();
await LoadRecordingsAsync();
await LoadLatestSnapshotAsync();
}
}
private static bool IsMissingOrHiddenResource(HttpRequestException exception) =>
exception.StatusCode is System.Net.HttpStatusCode.NotFound or System.Net.HttpStatusCode.Forbidden;
private void OnLanguageChanged() => _ = InvokeAsync(StateHasChanged);
// L'auto-refresh démarre après le premier rendu : une boucle infinie
@@ -389,7 +399,7 @@ else
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender && !_autoRefreshStarted)
if (firstRender && !_autoRefreshStarted && _camera is not null)
{
_autoRefreshStarted = true;
await StartAutoRefresh();
@@ -309,12 +309,19 @@ else
{
_person = await Api.GetPersonAsync(Id);
}
catch (HttpRequestException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound)
{
// La vue dédiée affiche l'état introuvable sans lancer les lectures associées.
}
catch { Snackbar.Add(Text["PersonDetailPage_OperationFailed"], Severity.Error); }
finally { _loading = false; }
await LoadFaces();
await LoadVehicles();
await LoadEvents();
if (_person is not null)
{
await LoadFaces();
await LoadVehicles();
await LoadEvents();
}
}
private async Task LoadFaces()
@@ -13,6 +13,38 @@ public class AgentDetailTests : PageTestBase
{
private static readonly Guid AgentId = Guid.NewGuid();
[Fact]
public void AgentDetail_AgentIntrouvable_NAffichePasDErreur()
{
// ResourceAccessFilter deliberately returns 403 to hide missing agents.
Handler.OnGet($"api/agents/{AgentId}", System.Net.HttpStatusCode.Forbidden);
LoginAs();
var cut = RenderPage<AgentDetail>(p => p.Add(x => x.Id, AgentId));
cut.WaitForAssertion(() =>
{
cut.Markup.ShouldContain("introuvable");
Services.GetRequiredService<ISnackbar>().ShownSnackbars.ShouldBeEmpty();
Handler.Requests.ShouldHaveSingleItem();
});
}
[Fact]
public void AgentDetail_ErreurServeur_AfficheSnackbarErreur()
{
Handler.OnGet($"api/agents/{AgentId}", System.Net.HttpStatusCode.InternalServerError);
LoginAs();
var cut = RenderPage<AgentDetail>(p => p.Add(x => x.Id, AgentId));
cut.WaitForAssertion(() =>
{
cut.Markup.ShouldContain("introuvable");
Services.GetRequiredService<ISnackbar>().ShownSnackbars.ShouldNotBeEmpty();
});
}
private static AgentItem Agent() => new()
{
Id = AgentId,
@@ -28,6 +28,23 @@ public class CameraDetailTests : PageTestBase
private void HandlerCamera(CameraItem camera)
=> Handler.OnGet("api/cameras/", camera);
[Fact]
public void CameraDetail_CameraIntrouvable_NAffichePasDErreurEtNeChargePasLesDetails()
{
// ResourceAccessFilter deliberately returns 403 to hide missing cameras.
Handler.OnGet("api/cameras/", System.Net.HttpStatusCode.Forbidden);
LoginAs();
var cut = RenderPage<CameraDetail>(p => p.Add(x => x.Id, CameraId));
cut.WaitForAssertion(() =>
{
cut.Markup.ShouldContain("introuvable");
Services.GetRequiredService<MudBlazor.ISnackbar>().ShownSnackbars.ShouldBeEmpty();
Handler.Requests.ShouldHaveSingleItem();
});
}
[Fact]
public async Task PlateAssociationConfirmation_PostsCameraPlateEventAndVehicleIds()
{
@@ -98,14 +98,16 @@ public class PersonDetailPageTests : PageTestBase
public void PersonDetail_PersonneIntrouvable_AfficheAlerte()
{
Handler.OnGet("api/persons/", System.Net.HttpStatusCode.NotFound);
Handler.OnGet($"api/persons/{PersonId}/faces", new List<KnownFaceClientItem>());
Handler.OnGet("api/vehicles", new List<VehicleClientItem>());
Handler.OnGet("api/events", new EventPageResult([], 0, 1, 50));
LoginAs();
var cut = RenderPage<PersonDetailPage>(p => p.Add(x => x.Id, PersonId));
cut.WaitForAssertion(() => cut.Markup.ShouldContain("Personne introuvable"));
cut.WaitForAssertion(() =>
{
cut.Markup.ShouldContain("Personne introuvable");
Services.GetRequiredService<ISnackbar>().ShownSnackbars.ShouldBeEmpty();
Handler.Requests.ShouldHaveSingleItem();
});
}
[Fact]