diff --git a/skills/camera-toggle-acceptance/SKILL.md b/skills/camera-toggle-acceptance/SKILL.md index 4a5b55e..55e7454 100644 --- a/skills/camera-toggle-acceptance/SKILL.md +++ b/skills/camera-toggle-acceptance/SKILL.md @@ -49,7 +49,7 @@ This acceptance proves the source-built Central/Agent software lifecycle with a - Do not count `docker top` output when the runtime's `top` implementation differs. Prefer an in-container process identity check (`/proc/*/comm` equals `ffmpeg`) and ensure the inspection process cannot match itself. A shell command line containing the text `ffmpeg` creates a false positive if the check scans all command lines. - Before asserting lifecycle timing, first confirm Agent `Online`, persisted camera assignment, effective config enabled value and version, and `LastAppliedCameraConfigVersion` acknowledgement. A failed precondition is not an OFF/ON timing result. - On failed acceptance, collect sanitized Central, Agent, RTSP server and publisher diagnostics before the cleanup trap runs. Then verify project resource counts and exact image tags as described above. -- Current disposable attempts proved bootstrap, registration, assignment and Disabled config acknowledgement, but have not yet proved toggle timing or restart persistence. Treat #59/#199 as open until a corrected process measurement completes the whole cycle. +- Earlier disposable attempts proved bootstrap, registration, assignment and Disabled config acknowledgement, but did not prove toggle timing or restart persistence. The completed source-built run below supersedes those incomplete attempts; physical camera and deployed-host validation remain external. ## Latest source-built run @@ -65,7 +65,7 @@ The sixth historical run kept the FFmpeg process deadline separate from the conf ## Source-built acceptance — 2026-11-12 -`acceptance.sh` passed with project `heimdall-157-1794486043-22368`, Central tag `heimdall:heimdall-157-1794486043-22368-central`, and Agent tag `heimdall-agent:heimdall-157-1794486043-22368-agent`. It exercised three ON/OFF cycles with FFmpeg release at 1,232ms, 309ms, and 359ms, then a final OFF at 1,134ms before restart. Each transition verified the exact Central config digest ACK and the expected `camera..enabled` value. The process monitor rejected counts above one. Agent restart while ON preserved its identity and resumed capture; Agent and Central restart while OFF preserved Disabled and produced no FFmpeg process. Cleanup verified zero project containers, volumes, and networks and absence of both exact local image tags. This is synthetic source-built software evidence, not camera hardware or deployed-host timing. +`acceptance.sh` passed with project `heimdall-157-1794487097-5472`, Central tag `heimdall:heimdall-157-1794487097-5472-central`, and Agent tag `heimdall-agent:heimdall-157-1794487097-5472-agent`. Central and PostgreSQL published only on `127.0.0.1`. After confirming the ON config digest ACK, it exercised three ON/OFF cycles with FFmpeg release at 1,153ms, 309ms, and 333ms, then a final OFF at 907ms before restart. Each transition verified the exact Central config digest ACK and expected `camera..enabled` value. The process monitor rejected counts above one. Agent restart while ON preserved its identity and resumed capture; Agent and Central restart while OFF preserved Disabled and produced no FFmpeg process. Cleanup verified zero project containers, volumes, and networks and absence of both exact local image tags. This is synthetic source-built software evidence, not camera hardware or deployed-host timing. ## Camera status contract acceptance diff --git a/skills/camera-toggle-acceptance/acceptance.sh b/skills/camera-toggle-acceptance/acceptance.sh index c227a07..c63c9da 100755 --- a/skills/camera-toggle-acceptance/acceptance.sh +++ b/skills/camera-toggle-acceptance/acceptance.sh @@ -11,6 +11,7 @@ env_next="$temp_dir/acceptance.env.next" compose_override="$temp_dir/compose.override.yml" config_headers="$temp_dir/config.headers" config_body="$temp_dir/config.json" +stage=setup local_image_tags=("heimdall:${project}-central" "heimdall-agent:${project}-agent") compose_files=(-f "$root/docker/docker-compose.yml" -f "$compose_override") cleanup() { @@ -18,7 +19,8 @@ cleanup() { trap - EXIT cleanup_failed=0 if (( status != 0 )); then - docker compose -p "$project" --env-file "$env_file" "${compose_files[@]}" logs --no-color --tail 250 heimdall-agent 2>/dev/null | + printf 'acceptance failed at stage=%s\n' "$stage" >&2 + docker compose -p "$project" --env-file "$env_file" "${compose_files[@]}" logs --timestamps --no-color --tail 250 heimdall-agent 2>/dev/null | grep -E 'Config update received: config\.invalidated|Full configuration fetched successfully|Stream stopped for camera|camera config ACK' | tail -40 || true fi docker compose -p "$project" --env-file "$env_file" "${compose_files[@]}" down --volumes --remove-orphans >/dev/null 2>&1 || cleanup_failed=1 @@ -50,13 +52,13 @@ cat >"$env_file" </dev/null +stage=initial-on request -X POST "$api/api/cameras/$camera_id/toggle-status" >/dev/null wait_count 1 10 +wait_ack true off_once() { started=$(date +%s%N) @@ -199,19 +207,23 @@ off_once() { wait_ack false } for iteration in 1 2 3; do + stage="cycle-${iteration}-off" off_once + stage="cycle-${iteration}-on" request -X POST "$api/api/cameras/$camera_id/toggle-status" >/dev/null wait_count 1 10 wait_ack true count=$(ffmpeg_count) [[ "$count" == 1 ]] done +stage=agent-restart-on compose restart heimdall-agent wait_count 1 10 agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20") old_agent_id=$(jq -er '[.items[]? | select(.name=="camera-157-agent")][0].id' <<<"$agents") [[ "$old_agent_id" == "$agent_id" ]] wait_ack true +stage=final-off off_once agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20") old_agent_id=$(jq -er '[.items[]? | select(.name=="camera-157-agent")][0].id' <<<"$agents") @@ -220,6 +232,7 @@ wait_count 0 10 agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20") new_agent_id=$(jq -er '[.items[]? | select(.name=="camera-157-agent")][0].id' <<<"$agents") [[ "$old_agent_id" == "$new_agent_id" && "$new_agent_id" == "$agent_id" ]] +stage=central-restart-off compose restart heimdall wait_http sleep 2