A manifest can list the same path twice #170

Closed
opened 2026-10-07 10:38:41 +02:00 by clawbot · 1 comment
Collaborator

Problem

A manifest can list the same path twice:

  • mfer gen a b lists each argument's files relative to that argument, so a file x.txt in both a and b gives two entries x.txt; mfer gen . . lists every file twice.
  • Builder.AddFile and Builder.AddFileWithHash (mfer/builder.go) accept a path they already hold.
  • Loading (mfer/deserialize.go) accepts a manifest that lists a path twice. check then checks the one file against both entries and fails one of them, while fetch refuses the manifest as a name clash.

Definition of done

  • Failing tests first for each point below.
  • Builder.AddFile and Builder.AddFileWithHash refuse a path already added, naming it.
  • gen given arguments whose files would share a path fails before hashing anything, naming the path. The paths entries get stay as they are.
  • Loading refuses a manifest that lists a path twice (byte-for-byte equal; the letter-case comparison stays in fetch).
  • The Path Rules section of docs/FORMAT.md says each path appears at most once and readers reject a manifest that repeats one.
  • make check passes.

Model: opus-5-5

## Problem A manifest can list the same path twice: - `mfer gen a b` lists each argument's files relative to that argument, so a file `x.txt` in both `a` and `b` gives two entries `x.txt`; `mfer gen . .` lists every file twice. - `Builder.AddFile` and `Builder.AddFileWithHash` (`mfer/builder.go`) accept a path they already hold. - Loading (`mfer/deserialize.go`) accepts a manifest that lists a path twice. `check` then checks the one file against both entries and fails one of them, while `fetch` refuses the manifest as a name clash. ## Definition of done - Failing tests first for each point below. - `Builder.AddFile` and `Builder.AddFileWithHash` refuse a path already added, naming it. - `gen` given arguments whose files would share a path fails before hashing anything, naming the path. The paths entries get stay as they are. - Loading refuses a manifest that lists a path twice (byte-for-byte equal; the letter-case comparison stays in `fetch`). - The Path Rules section of `docs/FORMAT.md` says each path appears at most once and readers reject a manifest that repeats one. - `make check` passes. Model: opus-5-5
Author
Collaborator

Built in #174, for review. gen refuses arguments whose files share a path while it lists them, naming the path and both files; the builder and loading refuse a repeated path, compared byte for byte; the Path Rules in docs/FORMAT.md state the rule.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/mfer/pulls/174, for review. `gen` refuses arguments whose files share a path while it lists them, naming the path and both files; the builder and loading refuse a repeated path, compared byte for byte; the Path Rules in `docs/FORMAT.md` state the rule. 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/mfer#170