config init writes a config whose first backup on Linux stops on /Applications #408

Closed
opened 2026-11-10 20:49:42 +01:00 by clawbot · 1 comment
Collaborator

Listed under "Code bugs seen, not fixed" in #399.

Bug. vaultik config init writes defaultConfigTemplate (internal/cli/config.go) on every system. The template has an apps snapshot whose only path is /Applications. That directory exists only on macOS. On Linux, a supported platform, the first vaultik snapshot create runs every configured snapshot and stops on the missing path, unless --skip-errors is given.

Decided fix. Write the apps snapshot, with its comment block, only on macOS. On every other system the file is the same without it. The home snapshot stays everywhere: an exclude pattern for a path that does not exist matches nothing. Reversing this means putting the block back for all systems.

Definition of done

  • On macOS, config init writes the same file as on current next, byte for byte.
  • On any other system, it writes that file without the apps snapshot and the comment lines that belong to it. Nothing else differs.
  • The operating system is read from runtime.GOOS in one place. The function that returns the file's text takes the operating system name as a parameter, so one test run on Linux covers both cases.
  • The existing default-config test in internal/cli/config_test.go checks the macOS text. A new test, which fails on current next, checks that the text for linux loads as a config with a home snapshot and no apps snapshot.
  • README.md on next, in the getting-started block: the comment that says the default config backs up ~ and /Applications says that /Applications is backed up only on macOS. Change no other README text: #399 rewrites the README, and it is updated after this merges.
  • make check passes.

Package. internal/cli, file config.go, where config init and its template live. No new package.

Model: opus-5-5

Listed under "Code bugs seen, not fixed" in https://git.eeqj.de/sneak/vaultik/pulls/399. **Bug.** `vaultik config init` writes `defaultConfigTemplate` (`internal/cli/config.go`) on every system. The template has an `apps` snapshot whose only path is `/Applications`. That directory exists only on macOS. On Linux, a supported platform, the first `vaultik snapshot create` runs every configured snapshot and stops on the missing path, unless `--skip-errors` is given. **Decided fix.** Write the `apps` snapshot, with its comment block, only on macOS. On every other system the file is the same without it. The `home` snapshot stays everywhere: an exclude pattern for a path that does not exist matches nothing. Reversing this means putting the block back for all systems. **Definition of done** - On macOS, `config init` writes the same file as on current `next`, byte for byte. - On any other system, it writes that file without the `apps` snapshot and the comment lines that belong to it. Nothing else differs. - The operating system is read from `runtime.GOOS` in one place. The function that returns the file's text takes the operating system name as a parameter, so one test run on Linux covers both cases. - The existing default-config test in `internal/cli/config_test.go` checks the macOS text. A new test, which fails on current `next`, checks that the text for `linux` loads as a config with a `home` snapshot and no `apps` snapshot. - `README.md` on `next`, in the getting-started block: the comment that says the default config backs up `~` and `/Applications` says that `/Applications` is backed up only on macOS. Change no other README text: https://git.eeqj.de/sneak/vaultik/pulls/399 rewrites the README, and it is updated after this merges. - `make check` passes. **Package.** `internal/cli`, file `config.go`, where `config init` and its template live. No new package. Model: opus-5-5
clawbot self-assigned this 2026-11-10 20:49:42 +01:00
Author
Collaborator

Built in #413. defaultConfigText(goos) in internal/cli/config.go writes the apps snapshot and its comment only for darwin; config init passes runtime.GOOS. The macOS text matches the old template byte for byte. The new TestDefaultConfigOnLinux loads the linux text and checks for home and no apps.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/vaultik/pulls/413. `defaultConfigText(goos)` in `internal/cli/config.go` writes the `apps` snapshot and its comment only for `darwin`; `config init` passes `runtime.GOOS`. The macOS text matches the old template byte for byte. The new `TestDefaultConfigOnLinux` loads the `linux` text and checks for `home` and no `apps`. 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#408