From 8345e584a728acb1848edb9964830cc8edb805d0 Mon Sep 17 00:00:00 2001 From: Domagoj Zecevic Date: Fri, 19 Jun 2026 08:45:34 +0200 Subject: [PATCH] added jenkinsfile --- .ai/HANDOFF.md | 27 +++ .ai/PLAN.md | 2 +- .ai/REVIEW.md | 43 ++++ .ai/TASKS.md | 2 +- .claude/settings.local.json | 3 +- Dockerfile | 2 +- Jenkinsfile | 161 +++++++++++++++ README.md | 2 + internal/video/handler.go | 288 ++++++++++++++++++++++++++ internal/video/handler_test.go | 300 ++++++++++++++++++++++++++++ internal/video/stream.go | 94 +++++++++ internal/video/thumb.go | 93 +++++++++ internal/web/router.go | 5 + internal/web/router_test.go | 34 ++++ internal/web/templates/templates.go | 1 + internal/web/templates/videos.html | 111 ++++++++++ 16 files changed, 1164 insertions(+), 4 deletions(-) create mode 100644 Jenkinsfile create mode 100644 internal/video/handler.go create mode 100644 internal/video/handler_test.go create mode 100644 internal/video/stream.go create mode 100644 internal/video/thumb.go create mode 100644 internal/web/templates/videos.html diff --git a/.ai/HANDOFF.md b/.ai/HANDOFF.md index 3ab074e..df1d700 100644 --- a/.ai/HANDOFF.md +++ b/.ai/HANDOFF.md @@ -2,6 +2,20 @@ Append-only role handoff log. Each role adds one entry when its step is complete. +### T-006 — review — 2026-06-18T14:10:00Z + +| Field | Value | +|-------|-------| +| Agent | claude | +| Summary | Reviewed T-006 video browser; all 6 tests pass including SIGTERM/kill-on-cancel under race detector; three nit/minor findings, none blocking — accumulated shell-type triplication is the main tech debt. | +| Files Changed | .ai/REVIEW.md, .ai/TASKS.md, .ai/HANDOFF.md | +| Validation | `go fmt ./...`, `go vet ./...`, `go test ./internal/video/... -v`, `go test -race ./...` all pass. | +| Verdict | PASS_WITH_NOTES | +| Blocking Findings | none | +| Next Role | implement | + +--- + ### T-005 — review — 2026-06-18T13:45:00Z | Field | Value | @@ -241,3 +255,16 @@ Append-only role handoff log. Each role adds one entry when its step is complete | Next Role | none | --- + +### T-006 — implement — 2026-06-18T13:48:22Z + +| Field | Value | +|-------|-------| +| Agent | codex | +| Summary | Added on-demand MP4 remux streaming, cached video thumbnails, the deep-linkable video browser page, authenticated route wiring, and README coverage for video playback. | +| Files Changed | .ai/TASKS.md, .ai/HANDOFF.md, README.md, internal/video/handler.go, internal/video/handler_test.go, internal/video/stream.go, internal/video/thumb.go, internal/web/router.go, internal/web/router_test.go, internal/web/templates/templates.go, internal/web/templates/videos.html | +| Validation | `go fmt ./...` passed; `go vet ./...` passed; `go test ./internal/video/...` passed; `go test ./...` passed; `go test -race ./...` passed | +| Commit | `feat(video): add video browser and on-demand MP4 streaming` | +| Next Role | review | + +--- diff --git a/.ai/PLAN.md b/.ai/PLAN.md index 7412993..4fa8dd8 100644 --- a/.ai/PLAN.md +++ b/.ai/PLAN.md @@ -108,7 +108,7 @@ CamMonitor/ - `internal/web/router.go` — `NewRouter(cfg, db, idx)` returns `chi.Router`; mounts `/health` returning `{"status":"ok"}` - `Dockerfile`: ``` - FROM golang:1.22-bookworm AS builder + FROM golang:1.25-bookworm AS builder WORKDIR /src COPY go.mod go.sum ./ RUN go mod download diff --git a/.ai/REVIEW.md b/.ai/REVIEW.md index c50e1bd..e7f0bac 100644 --- a/.ai/REVIEW.md +++ b/.ai/REVIEW.md @@ -251,3 +251,46 @@ None. - Finding #1 (shell type duplication) is the main structural risk: T-006 will face the same choice and may add a third copy. The T-006 implementer should extract shared types before or during that task. --- + +## T-006 — Video browser + +**Verdict:** PASS_WITH_NOTES + +### Findings + +| # | Severity | File | Description | Required fix? | +|---|----------|------|-------------|---------------| +| 1 | minor | `internal/video/handler.go` (lines 28–41, 217–266) | `ShellData`, `MonthGroup`, `groupDaysByMonth`, `parseIndex`, and `pathEscape` are now copied into a **third** package (web → image → video). T-005 review flagged this as minor and asked T-006 to resolve it. The implementer did not extract shared types. This is accumulated tech debt that must be addressed in a follow-up cleanup before the codebase grows further. | no | +| 2 | nit | `internal/video/handler.go` (lines 143–158) | `resolveRequestPath` adds extra route-pattern/URL parsing not present in the image handler's equivalent. Both implementations pass the traversal test; the extra complexity in the video handler is confusing and inconsistent. | no | +| 3 | nit | `internal/video/handler.go` (lines 197–200) | Same buffer-less render pattern flagged in T-004 and T-005 (`Content-Type` written before `ExecuteTemplate`; `http.Error` fallback is a no-op). | no | + +### Required fixes + +None. + +### Verification + +**Steps performed:** +1. Read all new/changed files: `internal/video/stream.go`, `internal/video/thumb.go`, `internal/video/handler.go`, `internal/video/handler_test.go`, `internal/web/templates/videos.html`, `internal/web/templates/templates.go`, `internal/web/router.go`. +2. Cross-checked against `.ai/PLAN.md` Phase 6 scope. +3. Confirmed `groupDaysByMonth`, `parseIndex`, and `pathEscape` are byte-for-byte identical across all three packages (diff exit 0). +4. Ran `go fmt ./...` — clean. +5. Ran `go vet ./...` — clean. +6. Ran `go test ./internal/video/... -v` — all 6 tests PASS. +7. Ran `go test -race ./internal/video/... -run TestStreamKillsFFmpegOnContextCancel -v` — PASS under race detector. +8. Ran `go test -race ./...` — PASS, no races across the whole module. + +**Findings:** +- All acceptance criteria met: `Content-Type: video/mp4` and non-empty body verified (`TestStreamEndpointReturnsMP4HeadersAndBody`); thumbnail JPEG returned and decoded (`TestThumbnailEndpointReturnsJPEG`); thumbnail cache invokes ffmpeg only once (`TestThumbnailCacheReturnsStoredBytes`); player page has `