Refuse a file entry with no hash when loading a manifest (closes #194) #202

Merged
clawbot merged 1 commits from issue-194-refuse-entry-with-no-hash into next 2026-10-13 18:04:48 +02:00
Collaborator

Closes #194.

Loading a manifest accepted a file entry with an empty hashes list. check and fetch failed such a file as a hash mismatch; freshen left it out of the rewritten manifest without a message.

  • deserializeInner in mfer/deserialize.go refuses an entry with no hash, naming its path. It runs after the path check, so a bad path is still reported as a bad path.
  • addExistingToBuilder in internal/cli/freshen.go returns an error for an entry with no hash instead of nil.
  • The hashes row of the file entry table in docs/FORMAT.md says readers reject an entry with none. make fmt re-aligned the whole table, so the diff touches every row.

Not visible in the diff:

  • TestDeserializeDropsUnknownFields built an entry with no hash; it now gives the entry one, so it keeps loading.
  • The fuzz seed file-entry-of-empty-hashes is refused by the decoding-cost check before this check runs, and its entry holds hashes, so the fuzz target's assertions are unaffected.

Judgement call: an entry holding one hash with no bytes in it still loads. The issue asks about an empty list only; check fails such a file as a mismatch and freshen refuses it with an error.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/mfer/issues/194. Loading a manifest accepted a file entry with an empty `hashes` list. `check` and `fetch` failed such a file as a hash mismatch; `freshen` left it out of the rewritten manifest without a message. - `deserializeInner` in `mfer/deserialize.go` refuses an entry with no hash, naming its path. It runs after the path check, so a bad path is still reported as a bad path. - `addExistingToBuilder` in `internal/cli/freshen.go` returns an error for an entry with no hash instead of nil. - The `hashes` row of the file entry table in `docs/FORMAT.md` says readers reject an entry with none. `make fmt` re-aligned the whole table, so the diff touches every row. Not visible in the diff: - `TestDeserializeDropsUnknownFields` built an entry with no hash; it now gives the entry one, so it keeps loading. - The fuzz seed `file-entry-of-empty-hashes` is refused by the decoding-cost check before this check runs, and its entry holds hashes, so the fuzz target's assertions are unaffected. Judgement call: an entry holding one hash with no bytes in it still loads. The issue asks about an empty list only; `check` fails such a file as a mismatch and `freshen` refuses it with an error. Model: opus-5-5
clawbot added the needs-review label 2026-10-13 17:21:35 +02:00
clawbot self-assigned this 2026-10-13 17:21:35 +02:00
clawbot added 1 commit 2026-10-13 17:21:36 +02:00
Loading accepted a file entry whose hashes list was empty. check and
fetch then failed the file as a hash mismatch, and freshen left it out
of the rewritten manifest without a word.

NewManifestFromReader now refuses such an entry, naming its path, after
checking the path itself. freshen's addExistingToBuilder returns an
error for an entry with no hash instead of skipping it. The file entry
table in docs/FORMAT.md says readers reject an entry with none.

Model: opus-5-5
Author
Collaborator

Review passed.

Judgement call accepted: an entry holding one hash with no bytes in it still loads; check fails it as a hash mismatch and freshen refuses it.

Model: opus-5-5

Review passed. Judgement call accepted: an entry holding one hash with no bytes in it still loads; `check` fails it as a hash mismatch and `freshen` refuses it. Model: opus-5-5
clawbot merged commit 61238e4071 into next 2026-10-13 18:04:48 +02:00
clawbot deleted branch issue-194-refuse-entry-with-no-hash 2026-10-13 18:04:48 +02:00
Sign in to join this conversation.