diff --git a/.github/workflows/checkpoint-ci.yml b/.github/workflows/checkpoint-ci.yml new file mode 100644 index 0000000..63c9aeb --- /dev/null +++ b/.github/workflows/checkpoint-ci.yml @@ -0,0 +1,36 @@ +name: Checkpoint verification +run-name: Checkpoint verification - ${{ github.event.pull_request.head.sha || github.sha }} + +on: + pull_request: + types: [labeled] + workflow_dispatch: + +permissions: + contents: read + +jobs: + safety: + if: >- + github.event_name == 'workflow_dispatch' || + (github.event.label.name == 'run-checkpoint-ci' && + github.event.pull_request.head.repo.full_name == github.repository) + uses: ./.github/workflows/safety-ci.yml + with: + checkpoint_sha: ${{ github.event.pull_request.head.sha || github.sha }} + prepared_go: + if: >- + github.event_name == 'workflow_dispatch' || + (github.event.label.name == 'run-checkpoint-ci' && + github.event.pull_request.head.repo.full_name == github.repository) + uses: ./.github/workflows/prepared-export-go.yml + with: + checkpoint_sha: ${{ github.event.pull_request.head.sha || github.sha }} + prepared_browser: + if: >- + github.event_name == 'workflow_dispatch' || + (github.event.label.name == 'run-checkpoint-ci' && + github.event.pull_request.head.repo.full_name == github.repository) + uses: ./.github/workflows/prepared-export-browser.yml + with: + checkpoint_sha: ${{ github.event.pull_request.head.sha || github.sha }} diff --git a/.github/workflows/prepared-export-browser.yml b/.github/workflows/prepared-export-browser.yml index 59df41c..e765d70 100644 --- a/.github/workflows/prepared-export-browser.yml +++ b/.github/workflows/prepared-export-browser.yml @@ -1,14 +1,21 @@ name: Prepared export browser verification on: - push: - branches: [fix/large-media-exports] - pull_request: workflow_dispatch: + workflow_call: + inputs: + checkpoint_sha: + description: Immutable commit selected by the checkpoint caller + required: false + type: string + default: '' permissions: contents: read +env: + CHECKPOINT_SHA: ${{ inputs.checkpoint_sha || github.sha }} + jobs: browser: name: Prepared jobs and native playback — attempt ${{ matrix.attempt }} @@ -20,6 +27,9 @@ jobs: attempt: [1, 2] steps: - uses: actions/checkout@v4 + with: + ref: ${{ env.CHECKPOINT_SHA }} + persist-credentials: false - run: bash .github/scripts/ci-media-apt.sh update - run: bash .github/scripts/ci-media-apt.sh install ffmpeg python3-venv openssl - name: Build the exact checkout runtime image @@ -34,12 +44,12 @@ jobs: run: | . "$RUNNER_TEMP/export-browser-venv/bin/activate" python -m unittest discover -s tests -p 'test_prepared_export_protocol.py' -v - bash tests/runtime-browser-acceptance.sh simplenvr-export-test "$RUNNER_TEMP/prepared-export-browser" + GITHUB_SHA="$CHECKPOINT_SHA" bash tests/runtime-browser-acceptance.sh simplenvr-export-test "$RUNNER_TEMP/prepared-export-browser" - name: Retain media, network, browser and container evidence if: always() uses: actions/upload-artifact@v4 with: - name: prepared-export-browser-${{ github.sha }}-${{ github.run_attempt }}-${{ matrix.attempt }} + name: prepared-export-browser-${{ env.CHECKPOINT_SHA }}-${{ github.run_attempt }}-${{ matrix.attempt }} path: ${{ runner.temp }}/prepared-export-browser if-no-files-found: warn retention-days: 14 diff --git a/.github/workflows/prepared-export-go.yml b/.github/workflows/prepared-export-go.yml index 2785f4f..5514a0c 100644 --- a/.github/workflows/prepared-export-go.yml +++ b/.github/workflows/prepared-export-go.yml @@ -1,14 +1,21 @@ name: Prepared export Go verification on: - push: - branches: [fix/large-media-exports] - pull_request: workflow_dispatch: + workflow_call: + inputs: + checkpoint_sha: + description: Immutable commit selected by the checkpoint caller + required: false + type: string + default: '' permissions: contents: read +env: + CHECKPOINT_SHA: ${{ inputs.checkpoint_sha || github.sha }} + jobs: go: name: Full Go build, race suite and vet @@ -19,6 +26,9 @@ jobs: SIMPLENVR_REQUIRE_FFMPEG: '1' steps: - uses: actions/checkout@v4 + with: + ref: ${{ env.CHECKPOINT_SHA }} + persist-credentials: false - uses: actions/setup-go@v5 with: go-version-file: go.mod @@ -37,7 +47,7 @@ jobs: git diff --exit-code -- go.mod go.sum go build ./... - name: Full race-enabled Go suite including Node and native media tests - run: bash tests/core-ci-evidence.sh "$RUNNER_TEMP/prepared-export-go" + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/core-ci-evidence.sh "$RUNNER_TEMP/prepared-export-go" - name: Static analysis if: always() run: go vet ./... @@ -45,7 +55,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: prepared-export-go-${{ github.sha }}-${{ github.run_attempt }} + name: prepared-export-go-${{ env.CHECKPOINT_SHA }}-${{ github.run_attempt }} path: ${{ runner.temp }}/prepared-export-go if-no-files-found: warn retention-days: 14 diff --git a/.github/workflows/safety-ci.yml b/.github/workflows/safety-ci.yml index ab349a5..ae0f2a2 100644 --- a/.github/workflows/safety-ci.yml +++ b/.github/workflows/safety-ci.yml @@ -1,15 +1,21 @@ name: Safety verification on: - push: - branches: [main, fix/recording-safety-audit, fix/session-expiry-redirect] - pull_request: workflow_dispatch: workflow_call: + inputs: + checkpoint_sha: + description: Immutable commit selected by the checkpoint caller + required: false + type: string + default: '' permissions: contents: read +env: + CHECKPOINT_SHA: ${{ inputs.checkpoint_sha || github.sha }} + jobs: core: name: Core — build, race, storage & lifecycle @@ -20,6 +26,9 @@ jobs: SIMPLENVR_REQUIRE_FFMPEG: '1' steps: - uses: actions/checkout@v4 + with: + ref: ${{ env.CHECKPOINT_SHA }} + persist-credentials: false - name: Browser CI diagnostic helper regression tests run: | python3 -m unittest discover -s tests -p 'test_browser_ci_diagnostics.py' -v @@ -45,12 +54,12 @@ jobs: run: python3 -m unittest discover -s tests -p 'test_core_ci_evidence.py' -v - name: Race-enabled tests including media and shutdown lifecycle shell: bash - run: bash tests/core-ci-evidence.sh "$RUNNER_TEMP/simplenvr-core-evidence" + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/core-ci-evidence.sh "$RUNNER_TEMP/simplenvr-core-evidence" - name: Retain core test execution evidence even on failure if: always() uses: actions/upload-artifact@v4 with: - name: core-test-execution-${{ github.sha }}-${{ github.run_attempt }} + name: core-test-execution-${{ env.CHECKPOINT_SHA }}-${{ github.run_attempt }} path: ${{ runner.temp }}/simplenvr-core-evidence if-no-files-found: error retention-days: 14 @@ -91,7 +100,7 @@ jobs: run: docker build -t simplenvr-safety-test . - name: Active runtime-container recording, SIGTERM and restart intent shell: bash - run: bash tests/active-container-storage.sh simplenvr-safety-test + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/active-container-storage.sh simplenvr-safety-test - name: Runtime container SIGTERM smoke test shell: bash run: | @@ -117,12 +126,12 @@ jobs: - name: Runtime export backpressure, disconnect, SIGTERM and restart timeout-minutes: 6 shell: bash - run: bash tests/runtime-export-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-export-evidence" + run: GITHUB_SHA="$CHECKPOINT_SHA" bash tests/runtime-export-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-export-evidence" - name: Retain runtime-export evidence even on failure if: always() uses: actions/upload-artifact@v4 with: - name: runtime-export-acceptance-${{ github.sha }}-${{ github.run_attempt }} + name: runtime-export-acceptance-${{ env.CHECKPOINT_SHA }}-${{ github.run_attempt }} path: ${{ runner.temp }}/simplenvr-export-evidence if-no-files-found: error retention-days: 14 @@ -137,6 +146,9 @@ jobs: attempt: [1, 2] steps: - uses: actions/checkout@v4 + with: + ref: ${{ env.CHECKPOINT_SHA }} + persist-credentials: false - name: Refresh Ubuntu package indexes timeout-minutes: 5 run: bash .github/scripts/ci-media-apt.sh update @@ -161,12 +173,12 @@ jobs: run: | set -euo pipefail . "$RUNNER_TEMP/simplenvr-browser-venv/bin/activate" - bash tests/runtime-browser-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-browser-evidence" + GITHUB_SHA="$CHECKPOINT_SHA" bash tests/runtime-browser-acceptance.sh simplenvr-safety-test "$RUNNER_TEMP/simplenvr-browser-evidence" - name: Retain runtime-browser acceptance evidence if: always() uses: actions/upload-artifact@v4 with: - name: runtime-browser-acceptance-${{ github.sha }}-${{ github.run_attempt }}-${{ matrix.attempt }} + name: runtime-browser-acceptance-${{ env.CHECKPOINT_SHA }}-${{ github.run_attempt }}-${{ matrix.attempt }} path: ${{ runner.temp }}/simplenvr-browser-evidence if-no-files-found: warn retention-days: 14 @@ -180,6 +192,9 @@ jobs: SIMPLENVR_CORRESPONDENCE_RESOURCE: '1' steps: - uses: actions/checkout@v4 + with: + ref: ${{ env.CHECKPOINT_SHA }} + persist-credentials: false - name: Prepare evidence directory run: | set -euo pipefail @@ -199,7 +214,7 @@ jobs: run: | set -euo pipefail { - printf 'head=%s run_attempt=%s\n' "$GITHUB_SHA" "$GITHUB_RUN_ATTEMPT" + printf 'head=%s run_attempt=%s\n' "$CHECKPOINT_SHA" "$GITHUB_RUN_ATTEMPT" uname -a go version ffmpeg -version @@ -218,7 +233,7 @@ jobs: shell: bash run: | set -euo pipefail - "$RUNNER_TEMP/correspondence-resource.test" -test.v -test.run '^TestCorrResource' -test.timeout=420s 2>&1 | tee "$RUNNER_TEMP/correspondence-resources/tests.log" + GITHUB_SHA="$CHECKPOINT_SHA" "$RUNNER_TEMP/correspondence-resource.test" -test.v -test.run '^TestCorrResource' -test.timeout=420s 2>&1 | tee "$RUNNER_TEMP/correspondence-resources/tests.log" test -s "$SIMPLENVR_CORRESPONDENCE_REPORT" git diff --exit-code -- go.mod go.sum - name: Evidence assessment regression tests @@ -230,7 +245,7 @@ jobs: run: | set -euo pipefail python3 tests/correspondence_assessment.py "$RUNNER_TEMP/correspondence-resources" \ - --expected-head "$GITHUB_SHA" \ + --expected-head "$CHECKPOINT_SHA" \ --output "$RUNNER_TEMP/correspondence-resources/assessment.json" \ --summary "$RUNNER_TEMP/correspondence-resources/assessment.md" - name: Publish evidence assessment summary @@ -240,7 +255,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: correspondence-resources-${{ github.sha }}-${{ github.run_attempt }} + name: correspondence-resources-${{ env.CHECKPOINT_SHA }}-${{ github.run_attempt }} path: ${{ runner.temp }}/correspondence-resources if-no-files-found: error retention-days: 14 diff --git a/README.md b/README.md index 2015c68..e2af9e8 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ The `exports` directory holds temporary prepared video files. Keep it private, w Keep your existing recordings, certificates, and credentials. Add the `/exports` mount and `NVR_EXPORT_SCRATCH_DIR` setting to your existing Compose service, create the host export directory with suitable permissions, then pull the image and recreate the service. Do not reset the password as part of a routine upgrade. Prepared export jobs are lost on restart; recording files are not export scratch storage. +### Recordings from versions before day folders + +Earlier versions wrote recordings directly into each camera folder. Newer versions write them into day folders (see [Recording storage, retention and disk usage](#recording-storage-retention-and-disk-usage)). Recordings left directly in a camera folder stay on disk but are not shown by the timeline or exports, and nothing migrates them. They are still counted in Disk Usage, are still expired by the retention cleanup using the date at the start of the file name (or the file's modification time when the name has no usable date; very short names are kept), and are removed together with the camera. + ## Session timeouts A session ends after 20 minutes without a request, or 8 hours after sign-in, whichever comes first. To change either limit, click the lock button in the dashboard header, enter the new values in minutes, and choose Save and restart (click twice to confirm). SimpleNVR saves the values to `settings.json` in the same directory as the credentials file (`/recordings/.auth/settings.json` by default), shuts down gracefully, and relies on the container's restart policy to start it again. Keep `restart: unless-stopped` (or `always`) in your Compose file: with `on-failure` or no policy the container stays stopped until you start it. The restart stops live views and exports, pauses recording until SimpleNVR is back, and ends all current sessions. Nothing restarts if the saved values already match the running ones. @@ -63,7 +67,15 @@ The idle timeout must be between 1 minute and 24 hours, and the maximum session - Live preview requires go2rtc on the host in the camera's RTSP URL, with its HTTP API on port `1984`. The camera name must be unique and match the go2rtc stream name. Direct-camera preview and custom go2rtc HTTP ports are not supported. - Use the timeline to find recordings and events. Playback does not automatically skip gaps. Use Export range to export video; see below. - Known continuous-recording failures appear as "Recording failed" or "Recording failed — retrying", with the recording setting and reason shown separately. "Recording enabled" is a setting, not proof that footage is being captured. -- Removing a camera can delete its published recordings. If removal fails or the result is unclear, refresh and check the camera and its recordings before retrying. +- Removing a camera can delete its published recordings. Removal is refused, with an error and the camera left registered and stopped, when the camera's folder holds anything SimpleNVR does not recognise as published recordings or empty staging folders, for example leftover capture files or event staging that is not empty. If removal fails or the result is unclear, refresh and check the camera and its recordings before retrying. + +## Recording storage, retention and disk usage + +- **Layout.** Published recordings are stored as `/recordings///_E_