Release Redview 2.8.0: safeFile filesystem resilience and vectorize error tolerance #31
Loading…
Reference in a new issue
No description provided.
Delete branch "release/2.8.0"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Release Redview 2.8.0
Status: Accepted for stable publication.
Summary of Changes
safeFilefilesystem error handling: Tolerates filesystem errors (ENOENT,EACCES,EISDIR,ENOTDIR) during path resolution and validation.safeFilereturnsnullbecause a path is missing or non-file) are safely skipped and recorded inskipped_mediaassafeFile: unsafe or missing pathand counted inskipped_unsafe_files, without incrementingconsecutiveErrors, preserving the SEARCH-01 baseline.EACCES,ENOTDIR,EISDIR) incrementconsecutiveErrorsand trigger the 5-consecutive runaway abort guard, rolling back cursor, error count, andskipped_unsafe_filesto the run anchor to prevent runaway skipping on unmounted or corrupted storage.skipped_mediaarrays in bothvectorizeHandlerandtagHandlerto prevent concurrent mutation by deferred flushes inworker.ts.tests/vectorize-error-tolerance.test.mjscovering 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
nix build --no-link --print-build-logs .#redview) passed cleanly.acceptance/release-2.8.0.md.Automated code review
Reviewed commit:
5b0052515a16cb083bd492e4a8de7e088516e404Verdict: 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 incrementsconsecutiveErrorsand pushes intoskippedMedia, but issues noUPDATE jobs SET error_count = error_count + 1; the pre-existing embedImage file-error branch at src/jobs.ts:996-997 does bothrunErrorCount++and the error_count update. Consequently the rollback guarded byif (runErrorCount > 0)at src/jobs.ts:950-952 is a no-op for a pure safeFile-errno streak. src/app.ts:3232 selectserror_countinto 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 querySELECT 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) callsstat(filepath)andreadFile(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
Questions
!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.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.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
Diff coverage
CHANGELOG.md: reviewed — included in a context-limited batchREQUIREMENTS-TRACE.md: reviewed — included in a context-limited batchVERSION: reviewed — included in a context-limited batchacceptance/release-2.7.1.md: reviewed — included in a context-limited batchacceptance/release-2.8.0.md: reviewed — included in a context-limited batchpackage.json: reviewed — included in a context-limited batchsrc/jobs.ts: reviewed — included in a context-limited batchtests/vectorize-error-tolerance.test.mjs: reviewed — included in a context-limited batchReview metadata