Sign or timestamp an unchanged tree's manifest in freshen (closes #190) #220

Merged
clawbot merged 1 commits from issue-190-freshen-sign-unchanged into next 2026-10-14 00:42:47 +02:00
Collaborator

Fixes #190.

freshen skipped writing the manifest whenever no file was added, changed or removed, so mfer freshen --sign-key key.asc on an unchanged tree left it unsigned, and --include-timestamps was dropped the same way. The write is now skipped only when the manifest would come out the same: nothing in the tree changed, the manifest is signed by the --sign-key key (or unsigned when none is given), and it has a createdAt timestamp exactly when --include-timestamps asks for one. --include-permissions needs no check of its own there, because the scan already counts a file whose recorded mode is not what that flag asks for as changed.

Not visible in the diff:

  • Running freshen again with the same key, or with --include-timestamps again, leaves the manifest untouched; a different key rewrites it.
  • freshen without --include-timestamps on an unchanged tree whose manifest has a createdAt timestamp now rewrites it without one. Before, it was left alone.

Disclosures:

  • Deviation: the fix needed two read-only additions to the mfer package, SecretKeyFingerprint and a loaded manifest's CreatedAt; the issue placed the fix in internal/cli/freshen.go only.
  • Judgement call: the showProgress local in freshenManifestOperation is inlined to keep that function within the lint length limit.
  • Judgement call: the signer comparison is exact, so a manifest whose signer fingerprint is written in lower case (mfer never writes one) is rewritten once.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/mfer/issues/190. freshen skipped writing the manifest whenever no file was added, changed or removed, so `mfer freshen --sign-key key.asc` on an unchanged tree left it unsigned, and `--include-timestamps` was dropped the same way. The write is now skipped only when the manifest would come out the same: nothing in the tree changed, the manifest is signed by the `--sign-key` key (or unsigned when none is given), and it has a createdAt timestamp exactly when `--include-timestamps` asks for one. `--include-permissions` needs no check of its own there, because the scan already counts a file whose recorded mode is not what that flag asks for as changed. Not visible in the diff: - Running freshen again with the same key, or with `--include-timestamps` again, leaves the manifest untouched; a different key rewrites it. - freshen without `--include-timestamps` on an unchanged tree whose manifest has a createdAt timestamp now rewrites it without one. Before, it was left alone. Disclosures: - Deviation: the fix needed two read-only additions to the `mfer` package, `SecretKeyFingerprint` and a loaded manifest's `CreatedAt`; the issue placed the fix in `internal/cli/freshen.go` only. - Judgement call: the `showProgress` local in `freshenManifestOperation` is inlined to keep that function within the lint length limit. - Judgement call: the signer comparison is exact, so a manifest whose signer fingerprint is written in lower case (mfer never writes one) is rewritten once. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 00:17:42 +02:00
clawbot self-assigned this 2026-10-14 00:17:42 +02:00
clawbot added 1 commit 2026-10-14 00:17:42 +02:00
freshen skipped the write whenever no file was added, changed or
removed, so --sign-key and --include-timestamps on an unchanged tree
did nothing. It now skips only when the manifest would come out the
same: nothing in the tree changed, the manifest is signed by the
--sign-key key (unsigned without one), and it has a createdAt
timestamp exactly when --include-timestamps asks for one. A file whose
recorded mode is not what --include-permissions asks for already
counts as changed.

Deviation: the mfer package gains SecretKeyFingerprint and a loaded
manifest's CreatedAt, which the comparison needs.

Model: opus-5-5
Author
Collaborator

Review passed.

Judgement call: the two read-only additions to the mfer package are accepted as needed for the comparison the issue asks for, although the issue placed the fix in internal/cli/freshen.go only.

Model: opus-5-5

Review passed. Judgement call: the two read-only additions to the `mfer` package are accepted as needed for the comparison the issue asks for, although the issue placed the fix in `internal/cli/freshen.go` only. Model: opus-5-5
clawbot merged commit 0baf83deb6 into next 2026-10-14 00:42:47 +02:00
clawbot deleted branch issue-190-freshen-sign-unchanged 2026-10-14 00:42:48 +02:00
Sign in to join this conversation.