Merge pull request #138 Co-authored-by: Arnaud Dartois <admin@tordais.cc>
5.2 KiB
name, description
| name | description |
|---|---|
| agent-runtime-acceptance | Validate Heimdall Agent reconnect, camera configuration replacement, acknowledgement, and runtime diagnostics without camera hardware. |
Heimdall Agent runtime acceptance
Read AGENTS.md, the Agent item in todo.md, and skills/heimdall-dotnet/SKILL.md before changing Agent runtime behavior.
Camera configuration synchronization
ConfigReceiverServicefetches the complete camera settings snapshot after initial connection and reconnection;CameraConfigStore.ReplaceCentralvalidates the digest and publishes all assignments atomically.- The Central acknowledgement is keyed to that exact digest. Retry network failures and HTTP 408/429/5xx at most three times with short bounded delays; stop on permanent 4xx responses. Do not log the API key, camera URLs, configuration payload, or response body.
- Keep the latest applied snapshot active when an acknowledgement is rejected. A later config reload/reconnect fetches and acknowledges the current snapshot again.
FetchFullConfigAsync_RetriesTransientAcknowledgementUntilCentralPersistsItuses an in-process Kestrel Central simulator: config GET is served once; ACK receives 503 then 204; both posts must carry the same digest; the camera snapshot change event fires once; and Central records one successful ACK.HEIMDALL_ACK_FIXTURE_PORTpins the listener for Compose, while the API key fixture can be injected throughHEIMDALL_ACK_FIXTURE_API_KEY.- Also retain the SignalR reconnect test that proves rejoin, full replacement (including removals), and applied values.
Central log upload contract
- Agent log levels must use the exact
AgentLogLevelnames accepted by Central's parser:InformationandWarning(not the common aliasesInfo/Warn), alongsideTrace,Debug,Error, andCritical. - Keep
ToCentralLevel_MapsMicrosoftNamesToAgentContractasserting both the emitted name and that Central's enum parser accepts it at the corresponding severity. - Agent logging is API-key authenticated. A source-built disposable Compose check can register a synthetic Agent, submit one entry at each severity to
/api/agents/{id}/logs, and read them back through the authorized Central log query. Keep generated credentials and project resources isolated and clean up exact locally built tags per the Compose recipe.
Local checks
dotnet restore tests/Heimdall.Agent.Tests/Heimdall.Agent.Tests.csproj --locked-mode
dotnet test tests/Heimdall.Agent.Tests/Heimdall.Agent.Tests.csproj --no-restore
For the focused Kestrel ACK acceptance, copy only the test project's source dependencies into a temporary directory outside the repository. Use a uniquely named Compose project with the pinned .NET SDK image, the temporary source mounted at /workspace, a project-scoped NuGet/result volume, a project-scoped bridge, a generated fixture API key, and a loopback-only port. Put the two locked restore/test commands in /workspace/run-ack-test.sh and set entrypoint: ["/bin/bash", "/workspace/run-ack-test.sh"]; avoid a scalar command with bash -lc, which Compose passes as multiple arguments and can run dotnet without its subcommand. The test itself proves Central returns a transient 503 and then persists the exact digest once. This SDK-only recipe builds no local images; keep the shared upstream SDK image. Install an EXIT cleanup trap before starting, tear down only that project with down --volumes --remove-orphans, verify its containers, volumes, and network are gone, and remove the temporary source even on failure. The acceptance record must state local image tags: none; if future changes add a local image build, record its unique tag and remove/verify that exact tag in the same trap. Serialize Docker acceptance when another source build is using the shared daemon.
This SDK-only recipe does not build a local Heimdall image; keep the shared upstream SDK image. If the recipe is extended to build an app image, assign a project-unique tag and remove/verify that exact tag after teardown per skills/compose-disposable-recipe/SKILL.md.
For camera enable/disable timing, distinguish Central's requested state, the exact configuration digest acknowledged by the Agent, and actual FFmpeg process release. A status transition alone is not proof that capture stopped. Poll /proc/<pid>/comm (or an equivalent exact process identity that cannot match the harness command); measure stop convergence separately from config ACK convergence. The synthetic-camera acceptance must cover initial OFF, ON, OFF, ON, restart while ON, then OFF and restart while OFF with the persisted Agent identity, asserting the newest digest after each update. Record the observed OFF latency and keep the item open if it exceeds the product's 2-second expectation. Every attempt uses a new project and exact source-built Central/Agent tags, records both before build, and removes/verifies them plus all project resources in its EXIT trap.
Acceptance boundary
In-memory SignalR/HTTP fixtures and a local Agent container validate reconnect and runtime behavior without a physical camera. Mark real-camera stream stability, resource release on the deployed host, and LAN discovery as open until they pass on representative hardware and network equipment.