DECISION: where gen DIR writes its manifest and how it lists the files #178

Closed
opened 2026-10-07 16:03:57 +02:00 by clawbot · 4 comments
Collaborator

Question for sneak: where should mfer gen DIR write its manifest, and what should it list?

Today mfer gen sub writes index.mf in the current directory and lists sub's files as if they sat next to it (b.txt for sub/b.txt), so checking that manifest fails. mfer gen a.txt, given a file, stops with "path cannot be empty". The README says each listed path is relative to the manifest, but not where gen puts the manifest when given a directory.

Options:

A. (recommended) gen DIR writes DIR/index.mf, the manifest of that tree, which is where check DIR looks for one and where fetch --dest saves one. With --output, or with several arguments, each file is listed by its path relative to the output file's directory, and a file outside that directory is refused. A file argument is listed the same way.
B. gen always writes ./index.mf (or --output) and lists each file relative to the output file's directory, so gen sub lists sub/b.txt; a file outside that directory is refused.

Both make every manifest gen writes check correctly from its own directory. Nothing else waits on this: the fix for check and freshen, #177, does not depend on it.

Model: opus-5-5

Question for sneak: where should `mfer gen DIR` write its manifest, and what should it list? Today `mfer gen sub` writes `index.mf` in the current directory and lists `sub`'s files as if they sat next to it (`b.txt` for `sub/b.txt`), so checking that manifest fails. `mfer gen a.txt`, given a file, stops with "path cannot be empty". The README says each listed path is relative to the manifest, but not where `gen` puts the manifest when given a directory. Options: A. (recommended) `gen DIR` writes `DIR/index.mf`, the manifest of that tree, which is where `check DIR` looks for one and where `fetch --dest` saves one. With `--output`, or with several arguments, each file is listed by its path relative to the output file's directory, and a file outside that directory is refused. A file argument is listed the same way. B. `gen` always writes `./index.mf` (or `--output`) and lists each file relative to the output file's directory, so `gen sub` lists `sub/b.txt`; a file outside that directory is refused. Both make every manifest `gen` writes check correctly from its own directory. Nothing else waits on this: the fix for `check` and `freshen`, https://git.eeqj.de/sneak/mfer/issues/177, does not depend on it. Model: opus-5-5
sneak was assigned by clawbot 2026-10-07 16:03:57 +02:00
Owner

a, but without the paths being relative to the output file.

a, but without the paths being relative to the output file.
Owner

the manifest bytes should be the same no matter where the output file is written, same as a shell redirect.

the manifest bytes should be the same no matter where the output file is written, same as a shell redirect.
Author
Collaborator

Ruling from sneak (#178 (comment) and #178 (comment)): option A, gen DIR writes DIR/index.mf, but listed paths are not relative to the output file. The manifest's bytes are the same wherever the output is written, as with a shell redirect: --output only chooses where the bytes go and never changes what is listed. Paths are relative to the tree being scanned.

Readings taken for the cases the ruling leaves open, each keeping the bytes independent of the output location:

  • A file argument is listed by its own name, as Scanner.EnumerateFile already does.
  • Several arguments: one manifest; each directory's files are listed relative to that directory and each file by its name, as today; a path two arguments share is refused, as today.
  • Default output: index.mf in the directory the single argument names, or holds when it is a file; with no argument or several, index.mf in the current directory, as today.

Definition of done

  • Failing tests first.
  • mfer gen DIR writes DIR/index.mf, listing DIR's files relative to DIR.
  • mfer gen FILE writes index.mf beside the file, listing it by its name; today it stops with "path cannot be empty".
  • With --seed and an unchanged tree, gen writes byte-identical manifests whatever --output names: inside the scanned tree, outside it, or under another name. The output file and its temp file are never listed.
  • The existing-output refusal and --force apply to the output path actually used.
  • The --output help text and the README's Tool Examples state the default.
  • make check passes.

Model: opus-5-5

**Ruling from sneak** (https://git.eeqj.de/sneak/mfer/issues/178#issuecomment-132614 and https://git.eeqj.de/sneak/mfer/issues/178#issuecomment-132619): option A, `gen DIR` writes `DIR/index.mf`, but listed paths are not relative to the output file. The manifest's bytes are the same wherever the output is written, as with a shell redirect: `--output` only chooses where the bytes go and never changes what is listed. Paths are relative to the tree being scanned. Readings taken for the cases the ruling leaves open, each keeping the bytes independent of the output location: - A file argument is listed by its own name, as `Scanner.EnumerateFile` already does. - Several arguments: one manifest; each directory's files are listed relative to that directory and each file by its name, as today; a path two arguments share is refused, as today. - Default output: `index.mf` in the directory the single argument names, or holds when it is a file; with no argument or several, `index.mf` in the current directory, as today. ## Definition of done - Failing tests first. - `mfer gen DIR` writes `DIR/index.mf`, listing `DIR`'s files relative to `DIR`. - `mfer gen FILE` writes `index.mf` beside the file, listing it by its name; today it stops with "path cannot be empty". - With `--seed` and an unchanged tree, `gen` writes byte-identical manifests whatever `--output` names: inside the scanned tree, outside it, or under another name. The output file and its temp file are never listed. - The existing-output refusal and `--force` apply to the output path actually used. - The `--output` help text and the README's Tool Examples state the default. - `make check` passes. Model: opus-5-5
sneak was unassigned by clawbot 2026-10-07 22:58:15 +02:00
clawbot self-assigned this 2026-10-07 22:58:15 +02:00
Author
Collaborator

Built in #180 to the readings in the ruling above. One judgement call is noted there: a file argument is listed even when it is a dotfile or a symlink, as EnumerateFile already lists it.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/mfer/pulls/180 to the readings in the ruling above. One judgement call is noted there: a file argument is listed even when it is a dotfile or a symlink, as `EnumerateFile` already lists it. Model: opus-5-5
Sign in to join this conversation.