You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recording scan stops at 8,192 directory entries, breaking timeline and export with long retention #11
collectRecordingIntervals in recording_intervals.go fails once it has counted more than 8,192 directory entries (maxRecordingScanEntries). The request then returns an error (503 "Recording metadata unavailable; no partial timeline or export was returned"), so the timeline and exports stop working for that request.
What the code does
It lists each camera directory and increments one scanned counter for every entry, before checking the file name or the requested time window. A narrow time window does not reduce the count.
The counter is shared across all cameras scanned in one call.
Each file's duration comes from ffprobe. The duration cache holds 2,048 entries, probing runs two at a time, each probe has a 5 second budget, and the whole request has a 30 second metadata budget.
Retention cleanup (cleanup.go) globs the whole camera directory every 5 minutes.
Why it matters
Continuous recordings are 10 minutes long (runContinuousRecorder passes 600 seconds), which is 144 files per camera per day.
One camera reaches 8,192 entries after about 57 days.
Eight cameras scanned together reach it after about 7 days (if the caller scans all of them in one call; not verified).
A 365 day retention is about 52,560 files per camera.
This already affects long retention, and the download queue work in #10 uses the same scan. It also blocks any move to shorter recording segments (1 minute segments would be 525,600 files per camera per year).
Suggested directions
Skip entries outside the requested window using the timestamp in the file name, before counting them or probing them.
Scan only the cameras that are needed for the request.
Cache durations or intervals for the whole retention period, or keep a recording index, so a request does not probe every file.
Consider date-based subdirectories so a directory never holds hundreds of thousands of entries.
Make cleanup avoid globbing the whole directory.
To confirm first
Which cameras the timeline and export callers pass into collectRecordingIntervals per request.
Whether the timeline currently fails for the oldest footage with your retention setting.
Acceptance
Timeline and export work with 365 day retention and 8 cameras at 10 minute segments.
Request time grows with the requested window, not with total retention.
Tests cover a directory with far more than 8,192 files.
Goal: timeline and exports work at 34 cameras x 365 days (10-minute segments); request cost grows with the requested window, not retention; no partial result on failure; tests cover far more than 8,192 files.
Design (decided):<camera>/<YYYYMMDD>/<start>_E<end>_<label>.mp4, UTC day of the start; inclusion rule start < window end && end > window start; timeline and exports trust the name end; no duration cache or probe; 8,192 entries per folder and 400 day folders per camera. Old flat recordings are not supported (clean slate).
What scrutiny of the findings changed
Create the day folder inside the media lease during publish, not before it. Otherwise retention could remove a just-created empty folder before the rename.
The scan still needs one lstat per in-window file (for Size and the file identity that exports compare). Files outside the window get no syscall. An empty or non-regular in-window file is an error, never a silent skip.
Safety bound: at most 20,000 in-window candidates per call (the timeline needs about 5,300 at 34 cameras), counting only relevant entries.
Delete-all shares the retention engine (deleteAllPublishedLeased calls deletePublishedLeased), so one engine change covers both. app.js and /api/recordings/list are not loaded by index.html.
The camera_id filter is no longer needed at 34 cameras: the unfiltered day timeline reads about 34 x 3 day folders and does no probing. It moves to the end as optional.
Test scale: 1.79 million files cannot be created in CI. Tests use 20,000+ empty files and many day folders, and assert counters (entries read, lstat calls), not time.
Partial events: an event's name end is its planned end (the temp and final names must match), so a cut-short event shows a longer interval than its media.
Checkpoints, in order
Each checkpoint is one commit, then a diff-stat check, then a read of the CI check runs on the head commit; I report an apt-step failure as infrastructure.
Done: name parser, inclusion rule and day-folder list (0787987, CI green).
Publish into day folders. Create the day folder and sync its parent under the lease inside publication; build the stamped final path. Tests: new folder, collision, no-replace, retention racing creation.
Producers and recovery. Continuous recorder builds the final name after capture; events use end = event start + duration and keep the temp file in the camera root; recoverPartialRecordings takes the end from mtime (clamped so end > start); inspectEventRecovery looks in the day folder for stamped names and in the root otherwise. Update event_recovery_lifecycle_contract_test.go.
Serving.servePrivateRecordingAt and openPrivateMediaAt accept /recordings/<camera>/<day>/<file>.mp4 (day is 8 digits and matches the file name), same descriptor and no-symlink rules; update private_media_test.go. Required for playback.
Scan. Name-based collectRecordingIntervals; remove the duration cache, probe code and their tests, and the cache parameters; timeline FilePath includes the day; header values change; export callers updated. Tests: 20,000+ files, narrow window, 34 cameras, unparseable names, all boundary cases, counters grow with the window only. Fix compile ripple in unread tests.
Retention and deletion. Engine handles day folders (whole expired days, then the boundary day, then empty-folder removal); this covers the retention tick and delete-all. Camera deletion accepts 8-digit day folders holding only stamped .mp4 files; orphan cleanup descends one level; add the scanEventStaging root-count test. Existing flat-fixture tests must pass unchanged; add large-tree tests asserting work grows with expired days, not retention.
Disk usage. Per-day-folder size cache validated by folder identity and mtime; evict on camera deletion.
Docs. README, docs/LARGE_MEDIA_EXPORTS.md, retention docs (search for 8,192, 8192, maxRecordingScanEntries, retention): layout, inclusion rule, changed headers, limits, and that old flat files are not read.
Optional: server camera_id filter plus a one-line script in index.html (see decisions).
camera_id filter (checkpoint 8): default is to skip it.
/api/recordings/list (listRecordingsHandler, unused by the page): default is to leave it unchanged and document that it lists only loose root files.
Playback continuation needs the next clip to start exactly where the previous ends; playback.js cannot be edited safely, so default is to document it as a known limit.
Known limits to state in the PR
Name ends are wall-clock, so a wrong end gives a wrong interval, not an error; recovered files have an mtime-derived end; partial events show their planned end; tests do not reach production scale.
Implemented in f2ba3fb, corrected in 1e1d36a on PR #13. Adds UTC stamped-path construction and day-folder creation under the shared media lease, then delegates to the existing durable no-replace publisher. Tests cover path construction, rounding, invalid inputs, unsafe directory entries, publication, collisions and preservation after failure.
The initial failure was an incorrect test expectation for a positive sub-second span. The fix accepts outward rounding and rejects empty/negative spans before rounding.
Scope: helpers are not wired into the recorder yet; production behavior is unchanged. The planned concurrent retention/publication test remains outstanding (current tests check lease requirements, not an actual concurrent retention pass).
Next: checkpoint 2, producers and recovery. Browser acceptance fixtures also need stamped names/day directories when the scan and serving switch over. CI workflow consolidation is deferred at the owner's request; no workflow changes or separate PR will be prepared.
Checkpoint 8 complete — Timeline camera filter, skip-and-report and warning
Uses Plan v2 numbering. Verified directly from PR #13's current head and its check runs: all eight required checks completed successfully on 2e1b33bd4f6f23ca54339a423c0109517089cf1b, run 45696730551 (completed 2026-11-25 20:42 UTC, run by the owner):
safety / Core — build, race, storage & lifecycle
safety / Chrome acceptance — isolated runs 1 and 2
prepared_browser / Prepared jobs and native playback — attempts 1 and 2
Delivered, in order: 3f6dbc4 (the playback page sends one camera_id per selected camera, from the new static/js/timeline-camera-filter.js, with one script line added to templates/index.html; playback.js is unchanged); e85b447 (the timeline leaves out an unusable in-window recording, counts it in the new X-Timeline-Unreadable-Count header and continues, while downloads and exports keep the strict scan and still fail whole; skipped candidates still count toward the 20,000 bound); 23156a8 (a warning toast when that count is above zero); 2e1b33b (README and docs/RECORDING_LAYOUT.md updated for the new behavior and header).
This head also contains checkpoint 7's documentation, so the run covers the current documentation state, and it is the first verification of every commit after d5f9665's checkpoint 6 run. It deliberately reverses, for the timeline only, the checkpoint 4 rule that any unusable in-window candidate fails the whole call. Cancellation, any other error, a folder that cannot be read completely and the 8,192-entry, 400-day and 20,000-candidate bounds still fail the whole timeline request.
This is check-run verification, not a claim that the assistant ran code locally. Individual job logs were not inspected: the run and job pages could not be fetched from the assistant's environment. Which tests ran, how long the 20,004-file candidate-budget test and the 34-camera fixtures took, and the race detector output have not been read. The wrapper script has no frontend test, and I have not seen evidence that the browser acceptance jobs exercise the unreadable-recording warning. PR #13 remains draft and issue #11 remains open. The PR description still shows checkpoint 8 as acceptance-pending and needs its own update.
Checkpoint 9 — Final audit and closure: plan in slices
Planning baseline: 2e1b33bd4f6f23ca54339a423c0109517089cf1b. Plan v2 step 9: read job evidence, map each acceptance criterion to evidence, update the PR description, remove WIP and write "Closes #11" only if every criterion is met, and list the remaining limits. This is an audit of what exists, not a replay of earlier checkpoints, and it adds no feature work.
Acceptance criteria to map
Timeline and export work with 365-day retention and 8 cameras at 10-minute segments (Plan v2 decision 1 raised the target to 34 cameras x 365 days).
Request time grows with the requested window, not with total retention.
Tests cover a directory with far more than 8,192 files.
The problem statement also names: per-file probing on every request, cleanup that globs the whole camera directory, and failures returning no usable timeline.
Known gaps going in
The evidence is counters and bounded fixtures (up to about 24,752 files), not 1.79 million files. Cold-start time for the disk usage figure is unmeasured. No real-camera or production-scale run is claimed.
No job logs have been read for any of checkpoints 3 to 8.
Status text in committed documents predates later results: docs/RECORDING_SERVING.md (checkpoint 3 pending), docs/CHECKPOINT6_READINESS.md (acceptance pending) and docs/CHECKPOINT7_READINESS.md (PR update pending).
maxRecordingScanEntries in recording_intervals.go appeared unused in the checkpoint 7 audit, and the glob-based cleanupOldRecordings appeared to be called only by its tests. Neither has been re-verified on the current head.
About 82 of the roughly 85 dated audit notes, several other documents and the Python, shell and CommonJS helpers under tests/ have not been read.
Slice A — evidence audit (read only, no commits)
For each acceptance criterion, list the exact tests, counters and bounds that evidence it, from source on the current head, and note anything it does not show.
Read job logs if the owner supplies them or an accessible route exists; otherwise state plainly that they were not inspected. Check the durations of the heaviest tests and the race detector results.
Read the unread test helpers and any test that depends on timeline or scan error behavior. Verify the two dead-code observations on the head. Search the documents for stale statements (probed durations, a single 8,192 cap, all-or-nothing timeline, flat-layout paths) and list each one.
Output: a findings comment on this issue and no head change.
Slice B — code cleanup (only if decided)
Remove maxRecordingScanEntries and, if the owner agrees, the test-only glob cleanup with its tests, only after slice A confirms they are unused. Any code change makes the current CI run stale for the final head.
Slice C — documentation reconciliation
Correct the stale status text found above and any stale statements slice A lists, without rewriting dated historical records. Add docs/CHECKPOINT9_CLOSEOUT.md: each acceptance criterion, its evidence, its limits and the remaining known limits. Documentation only; under the owner's earlier decision for documentation-only commits, no CI run.
Slice D — optional frontend test
Read the existing tests/ conventions, then decide whether to add a test for the fetch wrapper (camera filter, empty selection, unreadable-count warning). Default is to skip it and document the gap.
Slice E — final acceptance
If slice B or D changed code, the owner runs CI on the exact final head, all eight checks must succeed, and relevant job evidence is inspected or stated as not inspected. If only documentation changed after 2e1b33b, the run above stands for the code and the closure record says so.
This comment records checkpoint 8 completion and a checkpoint 9 plan only. It does not change code or documentation, request CI, change labels, merge the PR or close the issue.
Read-only audit of PR #13 at head 6540fb5c7f392ec857ba41b7f0f6b39f17fdf858. No code or documentation changed by this comment. Builds on the checkpoint 9 plan.
Owner decisions recorded (2026-11-25)
Dead code is removed. Done in 3ab0c1d: the unused maxRecordingScanEntries constant, and the glob-based cleanupOldRecordings and cleanupOldRecordingsContext (test-only, and blind to day folders). Four test sites now run the production cleanup path instead. No test was deleted; one redundant assertion was removed from the canceled-tick test.
A frontend test for the wrapper script is wanted. Done in 6540fb5: tests/timeline-camera-filter.cjs (15 tests) and timeline_camera_filter_frontend_test.go, run by the existing Go race suite through runFrontendRegression.
Job logs are inspected only if a check fails or the owner supplies them.
3ab0c1d and 6540fb5 have not been compiled or run. They need a CI run on the final head before closure.
Acceptance criteria mapped to evidence
The evidence is source-level (test names and counters read on this head), not execution evidence for these two newest commits. The last green run, 2e1b33b, covers everything before them.
1. Timeline and export work with 365-day retention (target raised to 34 cameras x 365 days).
TestStampedScan34CamerasIgnoresOlderRetention: 34 cameras, three retained days versus a full year plus a future folder; identical intervals and identical work counters.
TestStampedScanLargeRetentionNarrowWindow: 30 days x 700 files (more than 20,000 physical files); a narrow request succeeds and the timeline returns day-folder paths.
TestStampedScanCandidateLimitIsCallWide (exactly 20,000 across four cameras succeeds, 20,001 fails before inspection) and TestStampedScanFolderBoundIsPerFolder (8,192 and 8,193 entries per folder).
Exports: TestPreparedExportUsesStampedDayFolder (real ffmpeg), TestWholeClipExportDeclaresRangePolicy, TestTrimLimitsCancellationAndHandlerPolicy, the network and phase-cancellation fixtures, and the runtime browser and export acceptance scripts all use day-folder paths.
At 34 x 365: TestRetention34CameraWorkIgnoresSkippedContents (24,752 counted files), TestDiskUsage34CamerasYearOfDayFolders (12,410 day folders), TestEventStagingCountsDayRootsNotPublishedContents (8,760 files under 365 day folders).
Not shown: a run with 34 real cameras for 365 days (about 1.79 million files); the 8-camera case specifically (covered by the 34-camera fixtures).
2. Request time grows with the requested window, not total retention.
Counters, not timings: the scan counters are asserted equal before and after growing retention from three days to a year; TestRetentionSkippedContentsDoNotIncreaseWork; the cached disk usage render makes one stat per day folder and reads no day contents; TestRecordingIntervalsTrustNamesAndNeverProbe runs with no media tools on the path.
Limits to state: no wall-clock measurement exists; an opened folder is still enumerated by name; the root listing for retention, camera deletion and disk usage grows with the number of day folders (at most 400 per camera).
3. Tests cover a directory with far more than 8,192 files.
The more-than-20,000-file fixtures are spread over day folders, each below the 8,192-entry bound. A single folder over that bound is refused by design: scans fail closed and the exact 8,192 and 8,193 boundaries are tested for scan, retention, camera deletion, orphan cleanup and disk usage. A camera's total file count is no longer limited to 8,192.
Problem statement items. Per-file probing on every request: removed (duration cache gone; export validation probes kept separately). Cleanup globbing the whole directory: the production tick reads with Readdirnames(64) and is day-aware, and the glob function is gone. Failure with no usable timeline: the timeline now skips and reports an unusable recording, and fails whole only for the bounded error cases listed in the checkpoint 8 record.
Other findings
No leftover references to removed names were found. Searches for the duration cache, probed-media, maxRecordingScanEntries, serveTimelineWithDurations and cleanupOldRecordings returned only files this PR already rewrote or, for the last name, two dated audit notes. The code search index reflects main, so this is a lead check and not proof; the compile step in CI is the proof.
Stale status text in documents (to fix in slice C): docs/DISK_USAGE.md (checkpoint 6 "stays acceptance-pending"), docs/RETENTION_SELECTION.md and docs/ORPHAN_DAY_CLEANUP.md (remaining slices and unrun tests), docs/RECORDING_SERVING.md (checkpoint 3 acceptance pending), docs/CHECKPOINT6_READINESS.md and docs/CHECKPOINT7_READINESS.md (acceptance and PR update pending), docs/CHECKPOINT_CI.md (label route still to be exercised).
Dated audit notes AUDIT_FINAL_CLOSEOUT.md and MEDIA_OWNERSHIP_ADMISSION.md mention cleanupOldRecordings*, which no longer exists. Slice C adds this to the superseded list in docs/audit/README.md and leaves the dated records unchanged.
Frontend interplay: the wrapper wraps whichever fetch exists when its script loads, after core.js, so any session-expiry handling installed earlier still sees timeline requests. tests/browser_ci_diagnostics.py classifies requests by path, which the added camera_id does not change. Both were checked by reading; the browser acceptance runs on 2e1b33b passed with the wrapper in place.
Not reviewed: about 82 of the roughly 85 dated audit notes and the remaining unread documents. The superseded-statements section already says so.
Job logs: none read for any checkpoint. The durations of the heaviest new tests and the race detector output are unknown.
Next
Slice C (documentation only): fix the stale status text above, extend the superseded list, and add docs/CHECKPOINT9_CLOSEOUT.md mapping each criterion to the evidence and limits above. Slice E: the owner runs CI on the final head, since 3ab0c1d and 6540fb5 changed code. Slice F: update the PR description and title, mark the PR ready for review, post the closure record, and write "Closes #11" if everything holds. Merge, release and version changes are not included.
Checkpoint 9 — slice C complete; final acceptance pending
Slice C documentation is committed. The current closeout-docs head is 389145abd0ca29f93fefb45149d41f97e2fd1336 on fix/recording-scan-window. No CI was requested for the documentation commit. PR #13's description now identifies this as the final acceptance target and keeps the PR draft.
Delivered
Added docs/CHECKPOINT9_CLOSEOUT.md, mapping all three issue acceptance criteria and the original problem statements to named tests/counters, with the bounds and what those fixtures do not establish. It records that the owner accepts test-based evidence and that no production-scale run is required. It explicitly leaves step 9 pending the final CI run.
Updated docs/audit/README.md to index the 18 stale statements found when all 95 audit notes were read. The dated notes were not edited. cleanupOldRecordings* is identified as a test-only glob helper removed in 3ab0c1d.
Reconciled stale status text in DISK_USAGE.md, RETENTION_SELECTION.md, ORPHAN_DAY_CLEANUP.md, RECORDING_SERVING.md, CHECKPOINT6_READINESS.md, CHECKPOINT7_READINESS.md and CHECKPOINT_CI.md.
Acceptance and remaining work
The last identified green run is 45696730551 on 2e1b33bd4f6f23ca54339a423c0109517089cf1b (eight required checks successful). It does not cover later code changes 3ab0c1d (dead-code removal and production-path retention test adjustments) or 6540fb5 (timeline wrapper regression test). No CI result is recorded for the current head 389145a; the owner will run the eight checks on the exact current final head.
Once those checks are green, record the run and review any failures/logs as the owner requested. If green, perform the final closeout decision: update PR #13's readiness/title, and decide whether to write "Closes #11". Until then, checkpoint 9 is pending, issue #11 stays open and PR #13 stays draft. No merge, release or deployment is part of this comment.
prepared_browser / Prepared jobs and native playback — attempt 1
prepared_browser / Prepared jobs and native playback — attempt 2
This is a check-run result only. Job logs for this run were not inspected.
Earlier failure on the previous head
Run 45704356923 on 389145a failed in safety / Core: TestCorrAdmissionConcurrentContentionMatrix/prefix=true/phase=5/cancel=true returned a nil error where context.Canceled was expected. The cause was not identified. Reading corrStreamRun, a cancel before release at phase 5 should always return context.Canceled. The test passed on dde087f with no change to the code under test; dde087f only added detail to that test's failure message. One pass does not establish that the test is flaky.
Acceptance criteria (design target 34 cameras x 365 days)
Source and test mapping is in docs/CHECKPOINT9_CLOSEOUT.md. That file was written before the final-head run and still describes checkpoint 9 as pending; it was not edited, because any new commit would move the head and need a fresh CI run. This comment and the PR description are the current record.
Timeline and export at 365-day retention:TestStampedScan34CamerasIgnoresOlderRetention, TestStampedScanLargeRetentionNarrowWindow, TestPreparedExportUsesStampedDayFolder, TestWholeClipExportDeclaresRangePolicy.
Work grows with the requested window, not total retention: per-call scan counters, TestRetentionSkippedContentsDoNotIncreaseWork, TestRecordingIntervalsTrustNamesAndNeverProbe, TestDiskUsage34CamerasYearOfDayFolders.
Tests above 8,192 files:TestStampedScanLargeRetentionNarrowWindow (more than 20,000 files) plus exact 8,192/8,193 and 400/401 boundary tests.
The owner accepts bounded fixture and counter evidence as sufficient for these criteria.
Limits that remain
No 1.79-million-file physical run, real-camera 365-day run or wall-clock scaling measurement is claimed.
Job logs for checkpoints 3–8 and the final run were not inspected, so fixture durations and race-detector output are unknown.
Disk-usage cold-start time at 34 cameras x 365 days is unmeasured.
The unreadable-recording warning is transient, not a persistent timeline marker.
Retention's agreed option-2 policy delays cleanup of exceptional content in newer skipped days. Orphan cleanup keeps its trusted-ancestor/pathname-race limit.
A single opened folder above 8,192 entries deliberately fails closed.
Decision
The owner has decided to close this issue. PR #13 will close it when merged via "Closes #11" in its description. Merge, release and deployment are not part of this record.
Activity
mouldybread commentedon Nov 23, 2026
mouldybread commentedon Nov 23, 2026
mouldybread commentedon Nov 23, 2026
mouldybread commentedon Nov 23, 2026
mouldybread commentedon Nov 23, 2026
Plan v2 (supersedes the earlier plans)
Goal: timeline and exports work at 34 cameras x 365 days (10-minute segments); request cost grows with the requested window, not retention; no partial result on failure; tests cover far more than 8,192 files.
Design (decided):
<camera>/<YYYYMMDD>/<start>_E<end>_<label>.mp4, UTC day of the start; inclusion rulestart < window end && end > window start; timeline and exports trust the name end; no duration cache or probe; 8,192 entries per folder and 400 day folders per camera. Old flat recordings are not supported (clean slate).What scrutiny of the findings changed
lstatper in-window file (forSizeand the file identity that exports compare). Files outside the window get no syscall. An empty or non-regular in-window file is an error, never a silent skip.deleteAllPublishedLeasedcallsdeletePublishedLeased), so one engine change covers both.app.jsand/api/recordings/listare not loaded byindex.html.camera_idfilter is no longer needed at 34 cameras: the unfiltered day timeline reads about 34 x 3 day folders and does no probing. It moves to the end as optional.lstatcalls), not time.Checkpoints, in order
Each checkpoint is one commit, then a diff-stat check, then a read of the CI check runs on the head commit; I report an apt-step failure as infrastructure.
0787987, CI green).recoverPartialRecordingstakes the end from mtime (clamped so end > start);inspectEventRecoverylooks in the day folder for stamped names and in the root otherwise. Updateevent_recovery_lifecycle_contract_test.go.servePrivateRecordingAtandopenPrivateMediaAtaccept/recordings/<camera>/<day>/<file>.mp4(day is 8 digits and matches the file name), same descriptor and no-symlink rules; updateprivate_media_test.go. Required for playback.collectRecordingIntervals; remove the duration cache, probe code and their tests, and thecacheparameters; timelineFilePathincludes the day; header values change; export callers updated. Tests: 20,000+ files, narrow window, 34 cameras, unparseable names, all boundary cases, counters grow with the window only. Fix compile ripple in unread tests..mp4files; orphan cleanup descends one level; add thescanEventStagingroot-count test. Existing flat-fixture tests must pass unchanged; add large-tree tests asserting work grows with expired days, not retention.docs/LARGE_MEDIA_EXPORTS.md, retention docs (search for8,192,8192,maxRecordingScanEntries,retention): layout, inclusion rule, changed headers, limits, and that old flat files are not read.camera_idfilter plus a one-line script inindex.html(see decisions).Decisions needed (defaults apply if no reply)
camera_idfilter (checkpoint 8): default is to skip it./api/recordings/list(listRecordingsHandler, unused by the page): default is to leave it unchanged and document that it lists only loose root files.playback.jscannot be edited safely, so default is to document it as a known limit.Known limits to state in the PR
Name ends are wall-clock, so a wrong end gives a wrong interval, not an error; recovered files have an mtime-derived end; partial events show their planned end; tests do not reach production scale.
mouldybread commentedon Nov 23, 2026
Checkpoint 1 complete — publishing helpers
Implemented in
f2ba3fb, corrected in1e1d36aon PR #13. Adds UTC stamped-path construction and day-folder creation under the shared media lease, then delegates to the existing durable no-replace publisher. Tests cover path construction, rounding, invalid inputs, unsafe directory entries, publication, collisions and preservation after failure.The initial failure was an incorrect test expectation for a positive sub-second span. The fix accepts outward rounding and rejects empty/negative spans before rounding.
Verified via PR #13 check runs: all 8 checks passed on
1e1d36a, including Core, full Go build/race/vet, and the required-checks gate.Scope: helpers are not wired into the recorder yet; production behavior is unchanged. The planned concurrent retention/publication test remains outstanding (current tests check lease requirements, not an actual concurrent retention pass).
Next: checkpoint 2, producers and recovery. Browser acceptance fixtures also need stamped names/day directories when the scan and serving switch over. CI workflow consolidation is deferred at the owner's request; no workflow changes or separate PR will be prepared.
Timeline: scan stamped day folders by name, no probing; optional came…
Exports use stamped name scan (no probing); retire /api/recordings/li…
Test stamped prepared-export selection (refs #11)
Exports: stamp trim and enlarged cancellation fixtures (refs #11)
Exports: stamp network fixture; retain profile/render cancellation co…
Retention and camera deletion walk stamped day folders (refs #11)
Document stamped recording layout, timeline paths and retention (refs #…
Migrate runtime export acceptance fixture to stamped day layout (refs #…
Stamp browser media fixtures and native playback observer paths (refs #…
40 remaining items
Timeline: skip and report unreadable in-window recordings; downloads …
Playback: warn when the timeline leaves out unreadable recordings (refs
Docs: timeline skips and reports unreadable recordings; exports stay …
mouldybread commentedon Nov 25, 2026
Checkpoint 8 complete — Timeline camera filter, skip-and-report and warning
Uses Plan v2 numbering. Verified directly from PR #13's current head and its check runs: all eight required checks completed successfully on
2e1b33bd4f6f23ca54339a423c0109517089cf1b, run 45696730551 (completed 2026-11-25 20:42 UTC, run by the owner):Delivered, in order:
3f6dbc4(the playback page sends onecamera_idper selected camera, from the newstatic/js/timeline-camera-filter.js, with one script line added totemplates/index.html;playback.jsis unchanged);e85b447(the timeline leaves out an unusable in-window recording, counts it in the newX-Timeline-Unreadable-Countheader and continues, while downloads and exports keep the strict scan and still fail whole; skipped candidates still count toward the 20,000 bound);23156a8(a warning toast when that count is above zero);2e1b33b(README anddocs/RECORDING_LAYOUT.mdupdated for the new behavior and header).This head also contains checkpoint 7's documentation, so the run covers the current documentation state, and it is the first verification of every commit after
d5f9665's checkpoint 6 run. It deliberately reverses, for the timeline only, the checkpoint 4 rule that any unusable in-window candidate fails the whole call. Cancellation, any other error, a folder that cannot be read completely and the 8,192-entry, 400-day and 20,000-candidate bounds still fail the whole timeline request.This is check-run verification, not a claim that the assistant ran code locally. Individual job logs were not inspected: the run and job pages could not be fetched from the assistant's environment. Which tests ran, how long the 20,004-file candidate-budget test and the 34-camera fixtures took, and the race detector output have not been read. The wrapper script has no frontend test, and I have not seen evidence that the browser acceptance jobs exercise the unreadable-recording warning. PR #13 remains draft and issue #11 remains open. The PR description still shows checkpoint 8 as acceptance-pending and needs its own update.
Checkpoint 9 — Final audit and closure: plan in slices
Planning baseline:
2e1b33bd4f6f23ca54339a423c0109517089cf1b. Plan v2 step 9: read job evidence, map each acceptance criterion to evidence, update the PR description, remove WIP and write "Closes #11" only if every criterion is met, and list the remaining limits. This is an audit of what exists, not a replay of earlier checkpoints, and it adds no feature work.Acceptance criteria to map
The problem statement also names: per-file probing on every request, cleanup that globs the whole camera directory, and failures returning no usable timeline.
Known gaps going in
docs/RECORDING_SERVING.md(checkpoint 3 pending),docs/CHECKPOINT6_READINESS.md(acceptance pending) anddocs/CHECKPOINT7_READINESS.md(PR update pending).maxRecordingScanEntriesinrecording_intervals.goappeared unused in the checkpoint 7 audit, and the glob-basedcleanupOldRecordingsappeared to be called only by its tests. Neither has been re-verified on the current head.tests/have not been read.Slice A — evidence audit (read only, no commits)
Slice B — code cleanup (only if decided)
maxRecordingScanEntriesand, if the owner agrees, the test-only glob cleanup with its tests, only after slice A confirms they are unused. Any code change makes the current CI run stale for the final head.Slice C — documentation reconciliation
docs/CHECKPOINT9_CLOSEOUT.md: each acceptance criterion, its evidence, its limits and the remaining known limits. Documentation only; under the owner's earlier decision for documentation-only commits, no CI run.Slice D — optional frontend test
tests/conventions, then decide whether to add a test for the fetch wrapper (camera filter, empty selection, unreadable-count warning). Default is to skip it and document the gap.Slice E — final acceptance
2e1b33b, the run above stands for the code and the closure record says so.Slice F — closure
Decisions needed (defaults apply if no reply)
This comment records checkpoint 8 completion and a checkpoint 9 plan only. It does not change code or documentation, request CI, change labels, merge the PR or close the issue.
Remove dead scan constant and test-only glob cleanup; tests now run t…
Test the timeline camera filter and unreadable-recording warning wrap…
mouldybread commentedon Nov 25, 2026
Checkpoint 9, slice A — evidence audit findings
Read-only audit of PR #13 at head
6540fb5c7f392ec857ba41b7f0f6b39f17fdf858. No code or documentation changed by this comment. Builds on the checkpoint 9 plan.Owner decisions recorded (2026-11-25)
3ab0c1d: the unusedmaxRecordingScanEntriesconstant, and the glob-basedcleanupOldRecordingsandcleanupOldRecordingsContext(test-only, and blind to day folders). Four test sites now run the production cleanup path instead. No test was deleted; one redundant assertion was removed from the canceled-tick test.6540fb5:tests/timeline-camera-filter.cjs(15 tests) andtimeline_camera_filter_frontend_test.go, run by the existing Go race suite throughrunFrontendRegression.3ab0c1dand6540fb5have not been compiled or run. They need a CI run on the final head before closure.Acceptance criteria mapped to evidence
The evidence is source-level (test names and counters read on this head), not execution evidence for these two newest commits. The last green run,
2e1b33b, covers everything before them.1. Timeline and export work with 365-day retention (target raised to 34 cameras x 365 days).
TestStampedScan34CamerasIgnoresOlderRetention: 34 cameras, three retained days versus a full year plus a future folder; identical intervals and identical work counters.TestStampedScanLargeRetentionNarrowWindow: 30 days x 700 files (more than 20,000 physical files); a narrow request succeeds and the timeline returns day-folder paths.TestStampedScanCandidateLimitIsCallWide(exactly 20,000 across four cameras succeeds, 20,001 fails before inspection) andTestStampedScanFolderBoundIsPerFolder(8,192 and 8,193 entries per folder).TestPreparedExportUsesStampedDayFolder(real ffmpeg),TestWholeClipExportDeclaresRangePolicy,TestTrimLimitsCancellationAndHandlerPolicy, the network and phase-cancellation fixtures, and the runtime browser and export acceptance scripts all use day-folder paths.TestRetention34CameraWorkIgnoresSkippedContents(24,752 counted files),TestDiskUsage34CamerasYearOfDayFolders(12,410 day folders),TestEventStagingCountsDayRootsNotPublishedContents(8,760 files under 365 day folders).2. Request time grows with the requested window, not total retention.
TestRetentionSkippedContentsDoNotIncreaseWork; the cached disk usage render makes one stat per day folder and reads no day contents;TestRecordingIntervalsTrustNamesAndNeverProberuns with no media tools on the path.3. Tests cover a directory with far more than 8,192 files.
Problem statement items. Per-file probing on every request: removed (duration cache gone; export validation probes kept separately). Cleanup globbing the whole directory: the production tick reads with
Readdirnames(64)and is day-aware, and the glob function is gone. Failure with no usable timeline: the timeline now skips and reports an unusable recording, and fails whole only for the bounded error cases listed in the checkpoint 8 record.Other findings
probed-media,maxRecordingScanEntries,serveTimelineWithDurationsandcleanupOldRecordingsreturned only files this PR already rewrote or, for the last name, two dated audit notes. The code search index reflectsmain, so this is a lead check and not proof; the compile step in CI is the proof.docs/DISK_USAGE.md(checkpoint 6 "stays acceptance-pending"),docs/RETENTION_SELECTION.mdanddocs/ORPHAN_DAY_CLEANUP.md(remaining slices and unrun tests),docs/RECORDING_SERVING.md(checkpoint 3 acceptance pending),docs/CHECKPOINT6_READINESS.mdanddocs/CHECKPOINT7_READINESS.md(acceptance and PR update pending),docs/CHECKPOINT_CI.md(label route still to be exercised).AUDIT_FINAL_CLOSEOUT.mdandMEDIA_OWNERSHIP_ADMISSION.mdmentioncleanupOldRecordings*, which no longer exists. Slice C adds this to the superseded list indocs/audit/README.mdand leaves the dated records unchanged.fetchexists when its script loads, aftercore.js, so any session-expiry handling installed earlier still sees timeline requests.tests/browser_ci_diagnostics.pyclassifies requests by path, which the addedcamera_iddoes not change. Both were checked by reading; the browser acceptance runs on2e1b33bpassed with the wrapper in place.Next
Slice C (documentation only): fix the stale status text above, extend the superseded list, and add
docs/CHECKPOINT9_CLOSEOUT.mdmapping each criterion to the evidence and limits above. Slice E: the owner runs CI on the final head, since3ab0c1dand6540fb5changed code. Slice F: update the PR description and title, mark the PR ready for review, post the closure record, and write "Closes #11" if everything holds. Merge, release and version changes are not included.Docs: checkpoint 9 closeout record, current status text and supersede…
Docs: complete checkpoint 9 reconciliation and acceptance matrix (refs …
Docs: add checkpoint 9 evidence and limits closeout record (refs #11)
mouldybread commentedon Nov 25, 2026
Checkpoint 9 — slice C complete; final acceptance pending
Slice C documentation is committed. The current closeout-docs head is
389145abd0ca29f93fefb45149d41f97e2fd1336onfix/recording-scan-window. No CI was requested for the documentation commit. PR #13's description now identifies this as the final acceptance target and keeps the PR draft.Delivered
docs/CHECKPOINT9_CLOSEOUT.md, mapping all three issue acceptance criteria and the original problem statements to named tests/counters, with the bounds and what those fixtures do not establish. It records that the owner accepts test-based evidence and that no production-scale run is required. It explicitly leaves step 9 pending the final CI run.docs/audit/README.mdto index the 18 stale statements found when all 95 audit notes were read. The dated notes were not edited.cleanupOldRecordings*is identified as a test-only glob helper removed in3ab0c1d.DISK_USAGE.md,RETENTION_SELECTION.md,ORPHAN_DAY_CLEANUP.md,RECORDING_SERVING.md,CHECKPOINT6_READINESS.md,CHECKPOINT7_READINESS.mdandCHECKPOINT_CI.md.Acceptance and remaining work
The last identified green run is
45696730551on2e1b33bd4f6f23ca54339a423c0109517089cf1b(eight required checks successful). It does not cover later code changes3ab0c1d(dead-code removal and production-path retention test adjustments) or6540fb5(timeline wrapper regression test). No CI result is recorded for the current head389145a; the owner will run the eight checks on the exact current final head.Once those checks are green, record the run and review any failures/logs as the owner requested. If green, perform the final closeout decision: update PR #13's readiness/title, and decide whether to write "Closes #11". Until then, checkpoint 9 is pending, issue #11 stays open and PR #13 stays draft. No merge, release or deployment is part of this comment.
Test: add diagnostic detail to owner-cancellation failure message (refs
mouldybread commentedon Nov 25, 2026
Final closeout (Plan v2 step 9)
PR: #13. Final head:
dde087f71eb4f23894d1092e313ec2807cdb4152.CI on the final head
All eight required checks passed on
dde087f71eb4f23894d1092e313ec2807cdb4152: run 45708447732.This is a check-run result only. Job logs for this run were not inspected.
Earlier failure on the previous head
Run 45704356923 on
389145afailed insafety / Core:TestCorrAdmissionConcurrentContentionMatrix/prefix=true/phase=5/cancel=truereturned a nil error wherecontext.Canceledwas expected. The cause was not identified. ReadingcorrStreamRun, a cancel before release at phase 5 should always returncontext.Canceled. The test passed ondde087fwith no change to the code under test;dde087fonly added detail to that test's failure message. One pass does not establish that the test is flaky.Acceptance criteria (design target 34 cameras x 365 days)
Source and test mapping is in
docs/CHECKPOINT9_CLOSEOUT.md. That file was written before the final-head run and still describes checkpoint 9 as pending; it was not edited, because any new commit would move the head and need a fresh CI run. This comment and the PR description are the current record.TestStampedScan34CamerasIgnoresOlderRetention,TestStampedScanLargeRetentionNarrowWindow,TestPreparedExportUsesStampedDayFolder,TestWholeClipExportDeclaresRangePolicy.TestRetentionSkippedContentsDoNotIncreaseWork,TestRecordingIntervalsTrustNamesAndNeverProbe,TestDiskUsage34CamerasYearOfDayFolders.TestStampedScanLargeRetentionNarrowWindow(more than 20,000 files) plus exact 8,192/8,193 and 400/401 boundary tests.The owner accepts bounded fixture and counter evidence as sufficient for these criteria.
Limits that remain
Decision
The owner has decided to close this issue. PR #13 will close it when merged via "Closes #11" in its description. Merge, release and deployment are not part of this record.
Merge pull request #13 from mouldybread/fix/recording-scan-window