Release Redview 2.8.0: safeFile filesystem resilience and vectorize error tolerance #31

Merged
nimmo merged 7 commits from release/2.8.0 into main 2026-10-16 23:50:41 +01:00
Owner

Release Redview 2.8.0

Status: Accepted for stable publication.

Summary of Changes

  1. Vectorize Error Tolerance and SafeFile Resilience (SEARCH-01):
    • safeFile filesystem error handling: Tolerates filesystem errors (ENOENT, EACCES, EISDIR, ENOTDIR) during path resolution and validation.
    • Structural vs Thrown error differentiation:
      • Structural skips (where safeFile returns null because a path is missing or non-file) are safely skipped and recorded in skipped_media as safeFile: unsafe or missing path and counted in skipped_unsafe_files, without incrementing consecutiveErrors, preserving the SEARCH-01 baseline.
      • Thrown filesystem errnos (EACCES, ENOTDIR, EISDIR) increment consecutiveErrors and trigger the 5-consecutive runaway abort guard, rolling back cursor, error count, and skipped_unsafe_files to the run anchor to prevent runaway skipping on unmounted or corrupted storage.
    • Checkpoint integrity: Defensively snapshots skipped_media arrays in both vectorizeHandler and tagHandler to prevent concurrent mutation by deferred flushes in worker.ts.
    • Comprehensive error test suite: 14 test cases in tests/vectorize-error-tolerance.test.mjs covering all isolated failure skips, retry backoff, structural missing file continuation, directory paths, EACCES permission faults, ENOTDIR path errors, and safeFile thrown errno runaway abort.

Validation & Acceptance

  • All 232 Node tests passed.
  • All 63 Python tests passed.
  • Nix package checks (nix build --no-link --print-build-logs .#redview) passed cleanly.
  • Acceptance document recorded at acceptance/release-2.8.0.md.
  • Automated code review on PR #30 completed with Verdict: Ready to merge.
# Release Redview 2.8.0 Status: Accepted for stable publication. ### Summary of Changes 1. **Vectorize Error Tolerance and SafeFile Resilience (SEARCH-01)**: - `safeFile` filesystem error handling: Tolerates filesystem errors (`ENOENT`, `EACCES`, `EISDIR`, `ENOTDIR`) during path resolution and validation. - Structural vs Thrown error differentiation: - Structural skips (where `safeFile` returns `null` because a path is missing or non-file) are safely skipped and recorded in `skipped_media` as `safeFile: unsafe or missing path` and counted in `skipped_unsafe_files`, without incrementing `consecutiveErrors`, preserving the SEARCH-01 baseline. - Thrown filesystem errnos (`EACCES`, `ENOTDIR`, `EISDIR`) increment `consecutiveErrors` and trigger the 5-consecutive runaway abort guard, rolling back cursor, error count, and `skipped_unsafe_files` to the run anchor to prevent runaway skipping on unmounted or corrupted storage. - Checkpoint integrity: Defensively snapshots `skipped_media` arrays in both `vectorizeHandler` and `tagHandler` to prevent concurrent mutation by deferred flushes in `worker.ts`. - Comprehensive error test suite: 14 test cases in `tests/vectorize-error-tolerance.test.mjs` covering all isolated failure skips, retry backoff, structural missing file continuation, directory paths, EACCES permission faults, ENOTDIR path errors, and safeFile thrown errno runaway abort. ### Validation & Acceptance - All 232 Node tests passed. - All 63 Python tests passed. - Nix package checks (`nix build --no-link --print-build-logs .#redview`) passed cleanly. - Acceptance document recorded at `acceptance/release-2.8.0.md`. - Automated code review on PR #30 completed with Verdict: Ready to merge.
Merge 2.7.1 release corrections into dev and begin 2.8.0 development
All checks were successful
Branch and package checks / check (pull_request) Successful in 38s
Build and Push Attic Cache / build (pull_request) Successful in 40s
AI pull-request review / review (pull_request) Successful in 6m53s
7ecc563cc7
Address review findings: test and record safeFile fs errors, include ENOTDIR, and align trace and release acceptance
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 43s
Branch and package checks / check (pull_request) Successful in 5s
AI pull-request review / review (pull_request) Successful in 13m14s
c8dd9c6144
Address review round 2: feed safeFile skips to consecutive error abort, record all unsafe media, and align trace and acceptance
All checks were successful
Branch and package checks / check (pull_request) Successful in 38s
Build and Push Attic Cache / build (pull_request) Successful in 40s
AI pull-request review / review (pull_request) Successful in 13m5s
1dd75bd649
Address review round 3: gate consecutive error abort on thrown safeFile errnos and preserve structural skip baseline
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 46s
Branch and package checks / check (pull_request) Successful in 6s
AI pull-request review / review (pull_request) Successful in 14m42s
88d23506f9
Merge pull request 'Sync 2.7.1 release corrections into dev' (#30) from sync/release-2.7.1 into dev
All checks were successful
Branch and package checks / check (push) Successful in 5s
60d9c98aa0
Prepare 2.8.0-rc.1
All checks were successful
Branch and package checks / check (push) Successful in 38s
cbef98865a
Release 2.8.0
All checks were successful
Branch and package checks / check (push) Successful in 37s
Build and Push Attic Cache / build (pull_request) Successful in 10s
Branch and package checks / check (pull_request) Successful in 5s
AI pull-request review / review (pull_request) Successful in 9m54s
5b0052515a
clankbot left a comment

Automated code review

Reviewed commit: 5b0052515a16cb083bd492e4a8de7e088516e404

Verdict: Ready to merge

No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.

Overall assessment

I re-checked the supplied diff against the checked-out code. The new vectorizeHandler branch (src/jobs.ts:936-959) matches the documented intent: unsafeReason is set only when safeFile actually threw, so structural null returns skip the consecutiveErrors increment and the 5-consecutive guard, while thrown EACCES/ENOTDIR/EISDIR feed it; the run-anchor rollback (src/jobs.ts:946-957) is symmetric with the pre-existing embedImage branch (src/jobs.ts:975-999) for runUnsafeCount, runErrorCount and the skippedMedia splice. The new fixtures in tests/vectorize-error-tolerance.test.mjs (lines 471, 514, 563, 605, 650) do exercise those paths: setupFixture writes 1.jpg/2.jpg/3.jpg as regular files, so dir/1.jpg/nested.jpg yields ENOTDIR from realpath, and chmod 0o000 on a subdirectory yields EACCES; safeFile (src/dedup.ts:20-32) returns null for directories via !file.isFile() and swallows only ENOENT. I found no defect that breaks the stated behavior. Two reporting/consistency observations are actionable; the rest are open questions and unverified acceptance claims.

Blocking findings

None.

Important findings

None.

Suggestions

  • Thrown safeFile errno skips never increment error_count, unlike the equivalent encoder file-error path (src/jobs.ts:943; medium confidence)
    The new if (unsafeReason) block at src/jobs.ts:943-961 increments consecutiveErrors and pushes into skippedMedia, but issues no UPDATE jobs SET error_count = error_count + 1; the pre-existing embedImage file-error branch at src/jobs.ts:996-997 does both runErrorCount++ and the error_count update. Consequently the rollback guarded by if (runErrorCount > 0) at src/jobs.ts:950-952 is a no-op for a pure safeFile-errno streak. src/app.ts:3232 selects error_count into the job detail response, and the new tests at tests/vectorize-error-tolerance.test.mjs:514, 563 and 650 assert only checkpoint fields (skipped_unsafe_files, skipped_media, consecutive_errors) and never query SELECT error_count FROM jobs WHERE id=1, unlike the sibling tests at lines 89, 142, 188, 244, 282, 321, 373, 460.
    Impact: A job that aborts with 'Vectorize stopped after 5 consecutive file errors' from EACCES/ENOTDIR/EISDIR reports error_count = 0 in the job panel while its checkpoint and abort message claim five file faults, so the two file-error paths surface the same fault class with different accounting. No state is wrong: cursor, skipped_unsafe_files and skipped_media roll back consistently.
    Suggested fix: Either increment error_count alongside runUnsafeCount for thrown safeFile errnos and keep the runErrorCount rollback symmetric, or state in acceptance/release-2.8.0.md and REQUIREMENTS-TRACE.md that safeFile errno skips are deliberately excluded from error_count; in the latter case pin that intent by asserting the expected error_count in the tests at lines 514/563/650.

  • 'ENOENT' in the safeFile catch whitelist at src/jobs.ts:929 is unreachable, and the acceptance wording conflates it with thrown errnos (src/jobs.ts:929; high confidence)
    safeFile (src/dedup.ts:20-32) wraps its entire body and converts ENOENT to a null return (if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null;), so no ENOENT can reach the catch at src/jobs.ts:927-933; the entry at src/jobs.ts:929 is dead. acceptance/release-2.8.0.md line 8 states 'Tolerates filesystem errors (ENOENT, EACCES, EISDIR, ENOTDIR)' under a 'safeFile error handling' bullet, while line 11 correctly lists only EACCES/ENOTDIR/EISDIR as thrown errnos. Note the second list at src/jobs.ts:975 is different: embedImage (src/vector.ts:212-214) calls stat(filepath) and readFile(filepath) after safeFile has passed, so an ENOENT there is reachable and that entry must not be removed.
    Impact: No behavioral defect: ENOENT is handled as a structural skip, which is the intended baseline. The dead list entry plus the acceptance wording invite a reader to expect ENOENT to increment consecutiveErrors and feed the runaway abort guard, which it does not.
    Suggested fix: Drop 'ENOENT' from the list at src/jobs.ts:929 only (leave src/jobs.ts:975 intact, or comment that safeFile swallows ENOENT), and reword acceptance/release-2.8.0.md line 8 to separate 'structural: safeFile returns null for ENOENT/unsafe paths' from 'thrown: EACCES/EISDIR/ENOTDIR tolerated as errno skips'.

Tests and validation

  • package-checks: success

Questions

  • Is 2.8.0 deliberately vectorize-only for safeFile errno tolerance? tagHandler at src/jobs.ts:850 evaluates !await safeFile(row) with no try/catch, so an EACCES or ENOTDIR still fails an entire tag job (its skipped_media push at src/jobs.ts:866 covers only tagger per-item errors), and verifiedFile (src/dedup.ts:34-41) and similar.ts propagate the same errnos.
  • Should structural missing-file skips reset consecutiveErrors? The supplied code neither increments nor resets them, so five thrown errno faults separated by missing files still abort. tests/vectorize-error-tolerance.test.mjs:383 pins the non-resetting behavior for encoder errors, but no supplied test covers thrown safeFile errnos interleaved with structural skips.
  • acceptance/release-2.7.1.md and acceptance/release-2.8.0.md both record authorisation on 2026-10-16 and both claim all tests pass; should the 2.7.1 document carry its own acceptance date rather than the 2.8.0 PR date, since it is added by this change?
  • acceptance/release-2.8.0.md asserts 'All Node unit tests (232 tests) and Python test suites (63 tests) pass cleanly' and 'Automated code review on PR #30 completed with Verdict: Ready to merge'; I could not verify either count or the review verdict from the supplied material (I counted 14 test( invocations in tests/vectorize-error-tolerance.test.mjs, which matches the '14 tests' claim and the REQUIREMENTS-TRACE.md '14 cases' wording).

Review limitations

  • I did not execute repository code or tests, so all 'tests pass' claims and the 232/63 test counts are unverified; the only supplied run evidence is a successful package-checks result.
  • The EACCES test at tests/vectorize-error-tolerance.test.mjs:514 is skipped when getuid() === 0, so permission-fault behavior is not exercised on a root host; the CI host uid is not in the supplied material.
  • The supplied test diff is truncated at the end of the last test; I read the checked-out file to confirm its finally block closes the service, restores REVIEW_V2_ENCODER_URL, closes db and removes the fixture directory.
  • No live-library, GPU/encoder, or sqlite-vec host evidence was supplied; the acceptance documents list real full-library completion and sqlite-vec host acceptance as open items.
  • I have no access to pull-request discussion, CI logs other than the supplied package-checks result, or the v1-preservation branch, so cross-branch and prior-review context could not be checked.
  • I dropped the observation that structural missing-file skips can fill the shared 20-entry skipped_media bound (src/jobs.ts:940) ahead of actionable encoder entries: it matches the documented intent in acceptance/release-2.8.0.md, no supplied evidence shows a defect, and skipped_unsafe_files still counts all skips.

Diff coverage

  • CHANGELOG.md: reviewed — included in a context-limited batch
  • REQUIREMENTS-TRACE.md: reviewed — included in a context-limited batch
  • VERSION: reviewed — included in a context-limited batch
  • acceptance/release-2.7.1.md: reviewed — included in a context-limited batch
  • acceptance/release-2.8.0.md: reviewed — included in a context-limited batch
  • package.json: reviewed — included in a context-limited batch
  • src/jobs.ts: reviewed — included in a context-limited batch
  • tests/vectorize-error-tolerance.test.mjs: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md
  • Commits considered: 7
  • Previous automated review: none found
  • Findings: 2
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `5b0052515a16cb083bd492e4a8de7e088516e404` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment I re-checked the supplied diff against the checked-out code. The new vectorizeHandler branch (src/jobs.ts:936-959) matches the documented intent: unsafeReason is set only when safeFile actually threw, so structural null returns skip the consecutiveErrors increment and the 5-consecutive guard, while thrown EACCES/ENOTDIR/EISDIR feed it; the run-anchor rollback (src/jobs.ts:946-957) is symmetric with the pre-existing embedImage branch (src/jobs.ts:975-999) for runUnsafeCount, runErrorCount and the skippedMedia splice. The new fixtures in tests/vectorize-error-tolerance.test.mjs (lines 471, 514, 563, 605, 650) do exercise those paths: setupFixture writes 1.jpg/2.jpg/3.jpg as regular files, so dir/1.jpg/nested.jpg yields ENOTDIR from realpath, and chmod 0o000 on a subdirectory yields EACCES; safeFile (src/dedup.ts:20-32) returns null for directories via !file.isFile() and swallows only ENOENT. I found no defect that breaks the stated behavior. Two reporting/consistency observations are actionable; the rest are open questions and unverified acceptance claims. ### Blocking findings None. ### Important findings None. ### Suggestions - **Thrown safeFile errno skips never increment error_count, unlike the equivalent encoder file-error path** (src/jobs.ts:943; medium confidence) The new `if (unsafeReason)` block at src/jobs.ts:943-961 increments `consecutiveErrors` and pushes into `skippedMedia`, but issues no `UPDATE jobs SET error_count = error_count + 1`; the pre-existing embedImage file-error branch at src/jobs.ts:996-997 does both `runErrorCount++` and the error_count update. Consequently the rollback guarded by `if (runErrorCount > 0)` at src/jobs.ts:950-952 is a no-op for a pure safeFile-errno streak. src/app.ts:3232 selects `error_count` into the job detail response, and the new tests at tests/vectorize-error-tolerance.test.mjs:514, 563 and 650 assert only checkpoint fields (`skipped_unsafe_files`, `skipped_media`, `consecutive_errors`) and never query `SELECT error_count FROM jobs WHERE id=1`, unlike the sibling tests at lines 89, 142, 188, 244, 282, 321, 373, 460. Impact: A job that aborts with 'Vectorize stopped after 5 consecutive file errors' from EACCES/ENOTDIR/EISDIR reports error_count = 0 in the job panel while its checkpoint and abort message claim five file faults, so the two file-error paths surface the same fault class with different accounting. No state is wrong: cursor, skipped_unsafe_files and skipped_media roll back consistently. Suggested fix: Either increment error_count alongside runUnsafeCount for thrown safeFile errnos and keep the runErrorCount rollback symmetric, or state in acceptance/release-2.8.0.md and REQUIREMENTS-TRACE.md that safeFile errno skips are deliberately excluded from error_count; in the latter case pin that intent by asserting the expected error_count in the tests at lines 514/563/650. - **'ENOENT' in the safeFile catch whitelist at src/jobs.ts:929 is unreachable, and the acceptance wording conflates it with thrown errnos** (src/jobs.ts:929; high confidence) safeFile (src/dedup.ts:20-32) wraps its entire body and converts ENOENT to a null return (`if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null;`), so no ENOENT can reach the catch at src/jobs.ts:927-933; the entry at src/jobs.ts:929 is dead. acceptance/release-2.8.0.md line 8 states 'Tolerates filesystem errors (ENOENT, EACCES, EISDIR, ENOTDIR)' under a 'safeFile error handling' bullet, while line 11 correctly lists only EACCES/ENOTDIR/EISDIR as thrown errnos. Note the second list at src/jobs.ts:975 is different: embedImage (src/vector.ts:212-214) calls `stat(filepath)` and `readFile(filepath)` after safeFile has passed, so an ENOENT there is reachable and that entry must not be removed. Impact: No behavioral defect: ENOENT is handled as a structural skip, which is the intended baseline. The dead list entry plus the acceptance wording invite a reader to expect ENOENT to increment consecutiveErrors and feed the runaway abort guard, which it does not. Suggested fix: Drop 'ENOENT' from the list at src/jobs.ts:929 only (leave src/jobs.ts:975 intact, or comment that safeFile swallows ENOENT), and reword acceptance/release-2.8.0.md line 8 to separate 'structural: safeFile returns null for ENOENT/unsafe paths' from 'thrown: EACCES/EISDIR/ENOTDIR tolerated as errno skips'. ### Tests and validation - package-checks: **success** ### Questions - Is 2.8.0 deliberately vectorize-only for safeFile errno tolerance? tagHandler at src/jobs.ts:850 evaluates `!await safeFile(row)` with no try/catch, so an EACCES or ENOTDIR still fails an entire tag job (its skipped_media push at src/jobs.ts:866 covers only tagger per-item errors), and verifiedFile (src/dedup.ts:34-41) and similar.ts propagate the same errnos. - Should structural missing-file skips reset `consecutiveErrors`? The supplied code neither increments nor resets them, so five thrown errno faults separated by missing files still abort. tests/vectorize-error-tolerance.test.mjs:383 pins the non-resetting behavior for encoder errors, but no supplied test covers thrown safeFile errnos interleaved with structural skips. - acceptance/release-2.7.1.md and acceptance/release-2.8.0.md both record authorisation on 2026-10-16 and both claim all tests pass; should the 2.7.1 document carry its own acceptance date rather than the 2.8.0 PR date, since it is added by this change? - acceptance/release-2.8.0.md asserts 'All Node unit tests (232 tests) and Python test suites (63 tests) pass cleanly' and 'Automated code review on PR #30 completed with Verdict: Ready to merge'; I could not verify either count or the review verdict from the supplied material (I counted 14 `test(` invocations in tests/vectorize-error-tolerance.test.mjs, which matches the '14 tests' claim and the REQUIREMENTS-TRACE.md '14 cases' wording). ### Review limitations - I did not execute repository code or tests, so all 'tests pass' claims and the 232/63 test counts are unverified; the only supplied run evidence is a successful package-checks result. - The EACCES test at tests/vectorize-error-tolerance.test.mjs:514 is skipped when getuid() === 0, so permission-fault behavior is not exercised on a root host; the CI host uid is not in the supplied material. - The supplied test diff is truncated at the end of the last test; I read the checked-out file to confirm its finally block closes the service, restores REVIEW_V2_ENCODER_URL, closes db and removes the fixture directory. - No live-library, GPU/encoder, or sqlite-vec host evidence was supplied; the acceptance documents list real full-library completion and sqlite-vec host acceptance as open items. - I have no access to pull-request discussion, CI logs other than the supplied package-checks result, or the v1-preservation branch, so cross-branch and prior-review context could not be checked. - I dropped the observation that structural missing-file skips can fill the shared 20-entry skipped_media bound (src/jobs.ts:940) ahead of actionable encoder entries: it matches the documented intent in acceptance/release-2.8.0.md, no supplied evidence shows a defect, and skipped_unsafe_files still counts all skips. ### Diff coverage - `CHANGELOG.md`: **reviewed** — included in a context-limited batch - `REQUIREMENTS-TRACE.md`: **reviewed** — included in a context-limited batch - `VERSION`: **reviewed** — included in a context-limited batch - `acceptance/release-2.7.1.md`: **reviewed** — included in a context-limited batch - `acceptance/release-2.8.0.md`: **reviewed** — included in a context-limited batch - `package.json`: **reviewed** — included in a context-limited batch - `src/jobs.ts`: **reviewed** — included in a context-limited batch - `tests/vectorize-error-tolerance.test.mjs`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md - Commits considered: 7 - Previous automated review: none found - Findings: 2 </details>
nimmo merged commit 3696dd21d1 into main 2026-10-16 23:50:41 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/redview!31
No description provided.