Files
Heimdall/skills/heartbeat-failover/SKILL.md
T
arnaud.dartois d12e16c6e5
Heimdall Gitea / Detect CI scope (push) Successful in 17s
Heimdall Gitea / Build and tests (push) Successful in 25m35s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan server image (push) Successful in 15m3s
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Successful in 27m31s
Heimdall Gitea / Build and scan agent image (push) Successful in 16m55s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 39s
Heimdall Gitea / CI policy (push) Successful in 1s
docs: migrate work tracking to Gitea issues (#170)
Refs #169

## Changements

- Remplace `todo.md` par les issues Gitea comme source de suivi; crée un skill dédié au format de ticket, aux labels, aux maquettes, à la liaison PR et à la clôture.
- Met à jour les skills et guides qui pointaient vers le backlog supprimé.
- Ajuste le plan CI et ajoute un test ciblé pour s’assurer que la suppression de `todo.md` ne devient pas un changement documentaire ignoré.

## Vérifications

- `python3 scripts/ci/test_ci.py TestPlanTests` — 4 tests réussis.
- `git diff --check` — réussi.
- Aucun test .NET exécuté; le plan CI déclenche les suites pertinentes sur cette PR.

La tentative de créer la taxonomie de labels dans Gitea a expiré côté API; le skill documente les règles, mais les labels doivent encore être créés et appliqués lorsque l’écriture API sera disponible.

Reviewed-on: #170
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-06 14:11:28 +01:00

3.2 KiB
Raw Blame History

name, description
name description
heartbeat-failover Validate that stale Agents are marked offline and assigned cameras move safely to online peers.

Heimdall heartbeat and Agent failover

Read AGENTS.md, the Heartbeat/failover Gitea issue, skills/heimdall-dotnet/SKILL.md, and skills/compose-disposable-recipe/SKILL.md before changing this path.

Behavior contract

  • Use the configured global heartbeat interval or per-Agent override, bounded to 5–300 seconds. A stale Agent is not eligible for new work.
  • The failover sweep owns the stale-to-Offline transition and camera reassignment. Do not add a competing heartbeat monitor that races this transition.
  • Preserve camera assignment history: close the old row and create a new active row for an online Agent in the same site. If there is no replacement, clear the active assignment and let periodic reconciliation retry when an Agent recovers.
  • Use short-lived EF Core contexts and test status, camera ownership, and assignment history against PostgreSQL.

Required validation

  1. Run the PostgreSQL tests in HeartbeatMonitorJobTests, AgentFailoverJobTests, and CameraAssignmentServiceTests.
  2. Run the integration scenario with two registered Agents: heartbeat both, assign a camera to the source, age only the source heartbeat past the maximum accepted timeout, execute the real AgentFailoverJob and CameraAssignmentService, then verify the source is Offline, the online peer owns the camera, and both assignment records retain the correct released/active state.
  3. Before any build/start, install an EXIT cleanup trap. Build Central from the changed source in a unique disposable Compose project. Generate database/JWT credentials, use unique loopback ports, network, volumes and image tag, empty Sentry DSN, bootstrap a synthetic admin/site and two synthetic Agents, and assign a synthetic camera. Age the source heartbeat only in the disposable PostgreSQL fixture and let the real Hangfire recurring failover job run; verify the active assignment and historical rows through API/PostgreSQL.
  4. The trap tears down that project with volumes/orphans, verifies zero project containers, volumes and networks, then removes and verifies absence of the exact source-built Central image tag even on failure. Keep upstream Postgres/.NET base images, preserve test exit status, report cleanup failures, and never use --rmi all or broad image pruning.
  5. Mark physical Agent loss, network partitions and multi-host timing as unverified unless exercised against deployed Agents.

Current local evidence

5 November 2026: new relational integration scenario passed 1/1. Disposable source-built project hmd-failover-1793882220-a9bc9c registered two Agents, assigned the synthetic camera to the first, aged its heartbeat to 900 seconds, and observed the real Hangfire failover mark it Offline and move the camera to the still-online peer. PostgreSQL confirmed the previous assignment was released and the replacement assignment active. Teardown left zero containers/volumes/networks and removed/verified absence of the exact Central image tag. This proves the local scheduled path and relational state, not a real network partition or deployed multi-host timing.