Repository navigation
Release v2.2.0
[2.2.0] - 2026-10-02
Minor bump. Substantial new behaviour (backup integrity verification) and a
large body of fixes, but no breaking interface change: backup.sh and
restore.sh keep their existing flags and environment variables, and
backups taken before this release still restore.
The guiding theme of this release is that the framework had checks that could
not fail. Several safeguards existed only on paper -- an assert helper with
no callers, a verification harness invoking a flag that never existed, a
standards document mandating a versioning scheme nothing used -- so a test
suite could be comprehensively green while a data-loss bug sat in
restore.sh. Each item below is a case where a check was made to actually
exercise the behaviour it claimed to cover.
Backup and restore integrity
-
Backups are now recorded and verified. Each run of
backup.shwrites
amanifest_<timestamp>.jsonrecording the backup filename, source path and
a SHA-256 of the copied content.restore.shverifies a backup against its
manifest before overwriting anything; a mismatch names the file, refuses it,
and continues with the remaining sources.--dry-runreports the same
verdict, so it cannot be used to discover that a corrupt backup would
have been installed. Manifests are written600via a temp file and rename,
so a reader never sees a partial one, and a run that failed partway writes
none. -
A manifest cannot redirect a write. It is read as text, never evaluated,
and only a digest is taken from it; the destination always comes from
BACKUP_SOURCES. A tampered manifest can force a refusal but cannot cause a
file to be written elsewhere. This property has a test that fails when
broken. -
A 0-byte backup is refused outright. Checked before the manifest is
consulted, because the SHA-256 of empty content is a fixed constant: a
manifest written for an empty backup matches it perfectly, so the hash check
alone could never catch this. -
Safety copies can no longer overwrite each other. The pre-restore safety
copy is what makes a restore reversible, yet its name had one-second
resolution, so two restores of one source inside the same second destroyed
the first copy. Measured before: one copy in four runs out of five. After:
two in five out of five. A symlink at the chosen name is still refused
rather than skipped past, preserving the fail-closed behaviour. -
Legacy backups still restore. Any backup predating manifests lacks one
and is restored with a notice rather than refused; refusing them would
strand real backups. -
Backup naming and permissions. Backups are keyed on the source path
relative to$HOMErather than basename, so~/.ssh/configand a top-level
~/configno longer share one backup file.BACKUP_SOURCESaccepts a
newline-separated list for paths containing spaces, and a token that looks
like a split space-containing path is warned about. Backup files are written
600byinstall -m 600, removing the window in which a copy of
~/.ssh/configexisted at the source's mode.BACKUP_DIRitself is
tightened to700, and any pre-existing permissive store is tightened too.
Destructive-path safety
- Path validation before deletion.
uninstall.shvalidates its
install directory before removing anything and fails closed on/,//,
relative paths, and top-level paths such as/usr/local. - Only named artefacts are removed outside
INSTALL_DIR, and only after
that validation. The install marker,config/andVERSIONare the only
paths ever touched. - Test isolation. The destructive-path tests resolve paths from the test's
own temporary directory, so a regression cannot delete a real dotfile.
A loggingrmstub asserts that no removal was even attempted. repo-clean.shno longer treats an installed copy as a scratch tree, and
reports honest failures instead of claiming success.
Secrets handling
lib/secrets.shwas dead code with a real contract; it is now wired,
documented and covered by tests. Call sites document that item names may be
visible in process listings, and the 1Password read path fails loudly when
jqis absent rather than silently falling through to a different backend.
Diagnostics and correctness
- Systematic exit codes.
diecall sites pass adie "$EX_*"value
where they had passed a bare name, which produced "numeric argument
required" crashes instead of the intended code. - Absent tools are reported as an incomplete environment, never as a lint
failure, so a missing ShellCheck cannot be mistaken for a code defect. update.shparses arguments properly, skipsgit pullgracefully with no
upstream or in detached HEAD, andmake syntaxgates every batch.sync.shretries its fetch and explains an unreachable remote in its own
words instead of leaking git's stderr; it documents that it prunes.check-project.shreports every failure in one pass instead of aborting at
the first, and checksVERSION,Makefile,config, required utilities and
each of the ten utility scripts by name.
CI
- Tool versions are pinned and asserted: exact apt versions on Ubuntu, and
an explicit version check afterbrew installon macOS, since Homebrew has
no per-version pin.bats_require_minimum_versionis declared rather than
left to warn.
Documentation and dead code
- The shell coding standards documented a per-script SemVer header that no
script had used since 2.1.0; it now describes the singleVERSIONfile the
whole project actually uses. - Removed: the unused
eval-basedasserthelper, two existence predicates
with zero call sites, andlib/colors.sh, whose constants were used by none
of the six scripts that sourced it and were already provided by
logging.sh. doctor.shnow checksbatsand reports whether the installedVERSION
still matches the source, which is what previously let the live machine run
several releases behind unnoticed.