Never skip a local index error for a directory or symlink #285

Merged
clawbot merged 1 commits from fix-skip-errors-directory-index-error into next 2026-10-08 12:59:27 +02:00
Collaborator

Closes #284.

Under --skip-errors, an error recording a directory or symlink in the local index was skipped as if the entry could not be read. The snapshot then completed without the entry, so a restore did not recreate the directory with its stored owner, mode and times, or did not recreate the symlink.

processFileWithErrorHandling now records a directory or symlink itself, before any of the skip handling, and returns any error, so the backup stops as it already did without the flag. processFileStreaming now handles only regular files: the skip sees only their errors, and of those a packer error still stops the run, as before. countFailedFile loses its directory check, since no directory reaches it any more.

The new test in internal/vaultik/snapshot_skip_errors_test.go adds a SQLite trigger that makes the local index refuse the directory's files row, runs CreateSnapshot with SkipErrors, and checks that the run fails and the snapshot has no CompletedAt.

Judgement call: the README and the --skip-errors help are unchanged. Both already limit the flag to files that cannot be read, and the change makes neither false.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/vaultik/issues/284. Under `--skip-errors`, an error recording a directory or symlink in the local index was skipped as if the entry could not be read. The snapshot then completed without the entry, so a restore did not recreate the directory with its stored owner, mode and times, or did not recreate the symlink. `processFileWithErrorHandling` now records a directory or symlink itself, before any of the skip handling, and returns any error, so the backup stops as it already did without the flag. `processFileStreaming` now handles only regular files: the skip sees only their errors, and of those a packer error still stops the run, as before. `countFailedFile` loses its directory check, since no directory reaches it any more. The new test in `internal/vaultik/snapshot_skip_errors_test.go` adds a SQLite trigger that makes the local index refuse the directory's `files` row, runs `CreateSnapshot` with `SkipErrors`, and checks that the run fails and the snapshot has no `CompletedAt`. Judgement call: the README and the `--skip-errors` help are unchanged. Both already limit the flag to files that cannot be read, and the change makes neither false. Model: opus-5-5
clawbot added the needs-review label 2026-10-08 11:08:52 +02:00
clawbot self-assigned this 2026-10-08 11:08:52 +02:00
Author
Collaborator
  1. internal/snapshot/scanner.go:1409-1413: countFailedFile still returns early for a directory, and its comment still says a directory is not counted there. After this change no directory reaches countFailedFile, because processFileWithErrorHandling records directories and symlinks before any of the skip handling and returns their errors. The branch can no longer run, and it tells a reader that a directory can fail in phase 2 and be skipped, which the new comment in processFileWithErrorHandling says cannot happen. Acceptable: remove the IsDir early return and the sentence about directories from countFailedFile's comment.

Model: opus-5-5

1. `internal/snapshot/scanner.go:1409-1413`: `countFailedFile` still returns early for a directory, and its comment still says a directory is not counted there. After this change no directory reaches `countFailedFile`, because `processFileWithErrorHandling` records directories and symlinks before any of the skip handling and returns their errors. The branch can no longer run, and it tells a reader that a directory can fail in phase 2 and be skipped, which the new comment in `processFileWithErrorHandling` says cannot happen. Acceptable: remove the `IsDir` early return and the sentence about directories from `countFailedFile`'s comment. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-08 11:44:51 +02:00
clawbot added 1 commit 2026-10-08 12:12:51 +02:00
Under --skip-errors, an error recording a directory or symlink in the
local index was skipped like an unreadable file. The snapshot completed
without the entry, and a restore did not recreate it.

processFileWithErrorHandling now records a directory or symlink itself
and returns any error, which stops the backup with or without the flag.
The skip sees only a regular file's errors, so countFailedFile no longer
checks for a directory.

The test injects the error with a SQLite trigger that refuses the
directory's files row.

Model: opus-5-5
clawbot force-pushed fix-skip-errors-directory-index-error from 4c3ea7ae15 to 91e4bf92ab 2026-10-08 12:12:51 +02:00 Compare
Author
Collaborator

Rework:

  1. Fixed: removed the IsDir early return from countFailedFile and the sentence about directories from its comment.

Model: opus-5-5

Rework: 1. Fixed: removed the `IsDir` early return from `countFailedFile` and the sentence about directories from its comment. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-08 12:13:04 +02:00
Author
Collaborator

Review passed.
Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 05bf73c48a into next 2026-10-08 12:59:27 +02:00
clawbot deleted branch fix-skip-errors-directory-index-error 2026-10-08 12:59:27 +02:00
Sign in to join this conversation.