An exclude pattern that does not compile is skipped during the backup instead of refused when the config loads #455

Closed
opened 2026-11-11 09:18:05 +01:00 by clawbot · 1 comment
Collaborator

Found by the review of #399 (#399 (comment)).

Bug. An exclude pattern that does not compile, in exclude or in a snapshot's exclude, is skipped with a log warning during the backup (compileExcludePatterns in internal/snapshot/scanner.go). The config still loads, and the backup goes on to store what the user meant to leave out. A set but invalid config value must fail loudly at startup.

Definition of done

  • Config.Validate in internal/config refuses an exclude pattern that does not compile, naming the setting (exclude[2] or snapshots.home.exclude[0]) and quoting the pattern. It uses the same compile step as the scanner, through one shared function, so the two cannot disagree.
  • With every pattern checked at load, the scanner no longer needs its skip-and-warn path. Remove it.
  • A test that fails on current next loads a config with a pattern that does not compile, both in the global and in a snapshot's exclude, and checks the error.
  • Add nothing to docs/TODO.md. Change no README.md text unless a sentence becomes false; #399 rewrites the README.
  • make check passes.

Package. The compile step moves to a function both internal/config and internal/snapshot can call. Put it in internal/config, which internal/snapshot already imports.

Model: opus-5-5

Found by the review of https://git.eeqj.de/sneak/vaultik/pulls/399 (https://git.eeqj.de/sneak/vaultik/pulls/399#issuecomment-178232). **Bug.** An exclude pattern that does not compile, in `exclude` or in a snapshot's `exclude`, is skipped with a log warning during the backup (`compileExcludePatterns` in `internal/snapshot/scanner.go`). The config still loads, and the backup goes on to store what the user meant to leave out. A set but invalid config value must fail loudly at startup. **Definition of done** - `Config.Validate` in `internal/config` refuses an exclude pattern that does not compile, naming the setting (`exclude[2]` or `snapshots.home.exclude[0]`) and quoting the pattern. It uses the same compile step as the scanner, through one shared function, so the two cannot disagree. - With every pattern checked at load, the scanner no longer needs its skip-and-warn path. Remove it. - A test that fails on current `next` loads a config with a pattern that does not compile, both in the global and in a snapshot's `exclude`, and checks the error. - Add nothing to `docs/TODO.md`. Change no `README.md` text unless a sentence becomes false; https://git.eeqj.de/sneak/vaultik/pulls/399 rewrites the README. - `make check` passes. **Package.** The compile step moves to a function both `internal/config` and `internal/snapshot` can call. Put it in `internal/config`, which `internal/snapshot` already imports. Model: opus-5-5
clawbot self-assigned this 2026-11-11 09:18:05 +01:00
Author
Collaborator

Built in #456: Config.Validate refuses an exclude pattern that does not compile, global or per snapshot, naming the setting and quoting the pattern. The compile step is now config.CompileExcludePattern, shared with the scanner; the scanner's skip-and-warn path is gone.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/vaultik/pulls/456: `Config.Validate` refuses an exclude pattern that does not compile, global or per snapshot, naming the setting and quoting the pattern. The compile step is now `config.CompileExcludePattern`, shared with the scanner; the scanner's skip-and-warn path is gone. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#455