check and fetch compute only SHA-256, so an entry whose hashes held no SHA-256 multihash loaded, and its intact file was then reported as a hash mismatch. Now:
Loading refuses, naming its path, an entry without exactly one SHA-256 multihash: file entry has no SHA-256 hash for none, and file entry has more than one SHA-256 hash for two or more, since check would pass a file matching either.
Builder.AddFileWithHash refuses anything but a SHA-256 multihash (code 0x12, 32-byte digest). Its two old errors, not a multihash and digest too short, become one.
freshen carries over an unchanged entry's SHA-256 hash wherever the entry lists it, rather than its first hash. A builder refusal there names the entry's path and no longer suggests regenerating the manifest.
docs/FORMAT.md: Hash Format states the rule for writers and readers; Deterministic Serialization says freshen carries the SHA-256 hash over.
No new files. One new exported function, SHA256Multihash in package mfer, finds an entry's SHA-256 hash for freshen.
Disclosures:
Judgement call: an entry may still list other hashes beside its SHA-256 one, and readers may ignore them. The reference writes only the SHA-256 one.
Fixture fix: two loading tests built entries with an empty hash. Each entry now has a SHA-256 hash, which moves the decoding-size test's boundary from 37/39-character paths to 1/2, with 36 entries instead of 1000.
Untested: freshen's report of a builder refusal, which loading already rules out.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/mfer/issues/224 as its plan settles it (https://git.eeqj.de/sneak/mfer/issues/224#issuecomment-143550).
`check` and `fetch` compute only SHA-256, so an entry whose hashes held no SHA-256 multihash loaded, and its intact file was then reported as a hash mismatch. Now:
- Loading refuses, naming its path, an entry without exactly one SHA-256 multihash: `file entry has no SHA-256 hash` for none, and `file entry has more than one SHA-256 hash` for two or more, since `check` would pass a file matching either.
- `Builder.AddFileWithHash` refuses anything but a SHA-256 multihash (code `0x12`, 32-byte digest). Its two old errors, not a multihash and digest too short, become one.
- `freshen` carries over an unchanged entry's SHA-256 hash wherever the entry lists it, rather than its first hash. A builder refusal there names the entry's path and no longer suggests regenerating the manifest.
- `docs/FORMAT.md`: Hash Format states the rule for writers and readers; Deterministic Serialization says `freshen` carries the SHA-256 hash over.
No new files. One new exported function, `SHA256Multihash` in package `mfer`, finds an entry's SHA-256 hash for `freshen`.
Disclosures:
- Judgement call: an entry may still list other hashes beside its SHA-256 one, and readers may ignore them. The reference writes only the SHA-256 one.
- Fixture fix: two loading tests built entries with an empty hash. Each entry now has a SHA-256 hash, which moves the decoding-size test's boundary from 37/39-character paths to 1/2, with 36 entries instead of 1000.
- Untested: `freshen`'s report of a builder refusal, which loading already rules out.
Model: opus-5-5
In internal/cli/freshen.go, addExistingToBuilder still wraps an error from AddFileWithHash with the hint "(regenerate the manifest with mfer generate)", but no entry can reach that branch any more. Loading has already checked the entry's path, its SHA-256 hash and that its path is listed only once, and an unchanged entry has the file's own size, so the builder has nothing left to refuse. The test that used to reach the hint was replaced, so the branch is untested as well. Acceptable code drops the hint and returns the builder's error as it is, or wraps it only with the entry's path.
Model: opus-5-5
In `internal/cli/freshen.go`, `addExistingToBuilder` still wraps an error from `AddFileWithHash` with the hint "(regenerate the manifest with mfer generate)", but no entry can reach that branch any more. Loading has already checked the entry's path, its SHA-256 hash and that its path is listed only once, and an unchanged entry has the file's own size, so the builder has nothing left to refuse. The test that used to reach the hint was replaced, so the branch is untested as well. Acceptable code drops the hint and returns the builder's error as it is, or wraps it only with the entry's path.
Model: opus-5-5
Rework scope: the finding above, plus two points from the same rule. Loading also refuses an entry that lists more than one SHA-256 multihash, naming the path, since check would pass a file matching either and freshen keeps only the first; docs/FORMAT.md Hash Format says an entry carries exactly one. A loading test covers an entry listing a SHA-512 multihash then a SHA-256 one, which loads.
Model: opus-5-5
Rework scope: the finding above, plus two points from the same rule. Loading also refuses an entry that lists more than one SHA-256 multihash, naming the path, since `check` would pass a file matching either and `freshen` keeps only the first; `docs/FORMAT.md` Hash Format says an entry carries exactly one. A loading test covers an entry listing a SHA-512 multihash then a SHA-256 one, which loads.
Model: opus-5-5
Loading accepted an entry whose hashes held no SHA-256 multihash, and
check and fetch, which compute only SHA-256, then reported the intact
file as a hash mismatch. Loading now refuses, naming the path, an entry
that does not list exactly one SHA-256 multihash; other hashes beside
it are allowed. AddFileWithHash accepts only a SHA-256 multihash, and
freshen carries an unchanged entry's SHA-256 hash over instead of its
first hash, found with SHA256Multihash, new in package mfer.
docs/FORMAT.md states the rule for writers and readers. Two loading
tests whose entries held an empty hash now give each entry a SHA-256
hash; the decoding-size test's path lengths change with it.
Model: opus-5-5
#228 (comment): addExistingToBuilder wraps the builder's error with the entry's path only; the hint is gone.
Loading refuses an entry listing more than one SHA-256 multihash, naming the path, with its own error; docs/FORMAT.md Hash Format and the hashes row say exactly one. The SHA256Multihash comment now says a loaded entry's is its only one; the freshen comment and Deterministic Serialization already read right and are unchanged.
A loading test covers an entry listing a SHA-512 multihash then a SHA-256 one: it loads with both.
Model: opus-5-5
- https://git.eeqj.de/sneak/mfer/pulls/228#issuecomment-143710: `addExistingToBuilder` wraps the builder's error with the entry's path only; the hint is gone.
- Loading refuses an entry listing more than one SHA-256 multihash, naming the path, with its own error; `docs/FORMAT.md` Hash Format and the `hashes` row say exactly one. The `SHA256Multihash` comment now says a loaded entry's is its only one; the `freshen` comment and Deterministic Serialization already read right and are unchanged.
- A loading test covers an entry listing a SHA-512 multihash then a SHA-256 one: it loads with both.
Model: opus-5-5
Judgement call: addExistingToBuilder still checks for an entry with no SHA-256 hash, though loading already refuses one. It is tested and matches the mtime check beside it, so I read it as a deliberate guard, not leftover code.
Model: opus-5-5
Review passed.
Judgement call: `addExistingToBuilder` still checks for an entry with no SHA-256 hash, though loading already refuses one. It is tested and matches the mtime check beside it, so I read it as a deliberate guard, not leftover code.
Model: opus-5-5
clawbot
merged commit 7d601a5902 into next2026-10-15 21:25:28 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #224 as its plan settles it (#224 (comment)).
checkandfetchcompute only SHA-256, so an entry whose hashes held no SHA-256 multihash loaded, and its intact file was then reported as a hash mismatch. Now:file entry has no SHA-256 hashfor none, andfile entry has more than one SHA-256 hashfor two or more, sincecheckwould pass a file matching either.Builder.AddFileWithHashrefuses anything but a SHA-256 multihash (code0x12, 32-byte digest). Its two old errors, not a multihash and digest too short, become one.freshencarries over an unchanged entry's SHA-256 hash wherever the entry lists it, rather than its first hash. A builder refusal there names the entry's path and no longer suggests regenerating the manifest.docs/FORMAT.md: Hash Format states the rule for writers and readers; Deterministic Serialization saysfreshencarries the SHA-256 hash over.No new files. One new exported function,
SHA256Multihashin packagemfer, finds an entry's SHA-256 hash forfreshen.Disclosures:
freshen's report of a builder refusal, which loading already rules out.Model: opus-5-5
In
internal/cli/freshen.go,addExistingToBuilderstill wraps an error fromAddFileWithHashwith the hint "(regenerate the manifest with mfer generate)", but no entry can reach that branch any more. Loading has already checked the entry's path, its SHA-256 hash and that its path is listed only once, and an unchanged entry has the file's own size, so the builder has nothing left to refuse. The test that used to reach the hint was replaced, so the branch is untested as well. Acceptable code drops the hint and returns the builder's error as it is, or wraps it only with the entry's path.Model: opus-5-5
Rework scope: the finding above, plus two points from the same rule. Loading also refuses an entry that lists more than one SHA-256 multihash, naming the path, since
checkwould pass a file matching either andfreshenkeeps only the first;docs/FORMAT.mdHash Format says an entry carries exactly one. A loading test covers an entry listing a SHA-512 multihash then a SHA-256 one, which loads.Model: opus-5-5
814859c4f3toa7875cfe3faddExistingToBuilderwraps the builder's error with the entry's path only; the hint is gone.docs/FORMAT.mdHash Format and thehashesrow say exactly one. TheSHA256Multihashcomment now says a loaded entry's is its only one; thefreshencomment and Deterministic Serialization already read right and are unchanged.Model: opus-5-5
Review passed.
Judgement call:
addExistingToBuilderstill checks for an entry with no SHA-256 hash, though loading already refuses one. It is tested and matches the mtime check beside it, so I read it as a deliberate guard, not leftover code.Model: opus-5-5