NewChecker takes CheckerOptions instead of positional arguments (closes #78) #137

Merged
clawbot merged 1 commits from issue-78-checker-options into next 2026-10-04 12:19:32 +02:00
Collaborator

NewChecker now takes *CheckerOptions with the named fields ManifestPath, BasePath and Fs, named and passed like ScannerOptions in the same package. Every call site, tests included, uses named fields; no positional form is kept.

Zero values:

  • nil Fs: the OS filesystem, as before and as ScannerOptions.Fs does, so behaviour and the package's one convention both hold.
  • nil options or empty ManifestPath: error manifest path cannot be empty.
  • empty BasePath: error base path cannot be empty.

The issue's audit of the package's other exported constructors found one more with positional arguments: NewManifestFromFile(fs, path) now takes *ManifestFromFileOptions (Path, Fs) with the same rules. NewBuilder and NewScanner take nothing, NewScannerWithOptions already takes options, and NewManifestFromReader(r) is the single-reader case the Go style guide exempts.

  • Judgement call: both paths are required. An empty BasePath used to mean the working directory, so mfer check --base "" now fails; the flag defaults to ., so normal use is unchanged.
  • Judgement call: options are passed by pointer, like NewScannerWithOptions; a nil pointer gets the empty-path error, not a panic.
  • The empty-manifest-path error is declared in checker.go though deserialize.go also returns it, to stay out of the error block #128 changes.
  • Deviation: no TODO.md entry, per #76.

Closes #78

Model: opus-5-5

`NewChecker` now takes `*CheckerOptions` with the named fields `ManifestPath`, `BasePath` and `Fs`, named and passed like `ScannerOptions` in the same package. Every call site, tests included, uses named fields; no positional form is kept. Zero values: - nil `Fs`: the OS filesystem, as before and as `ScannerOptions.Fs` does, so behaviour and the package's one convention both hold. - nil options or empty `ManifestPath`: error `manifest path cannot be empty`. - empty `BasePath`: error `base path cannot be empty`. The issue's audit of the package's other exported constructors found one more with positional arguments: `NewManifestFromFile(fs, path)` now takes `*ManifestFromFileOptions` (`Path`, `Fs`) with the same rules. `NewBuilder` and `NewScanner` take nothing, `NewScannerWithOptions` already takes options, and `NewManifestFromReader(r)` is the single-reader case the Go style guide exempts. - Judgement call: both paths are required. An empty `BasePath` used to mean the working directory, so `mfer check --base ""` now fails; the flag defaults to `.`, so normal use is unchanged. - Judgement call: options are passed by pointer, like `NewScannerWithOptions`; a nil pointer gets the empty-path error, not a panic. - The empty-manifest-path error is declared in `checker.go` though `deserialize.go` also returns it, to stay out of the error block https://git.eeqj.de/sneak/mfer/pulls/128 changes. - Deviation: no `TODO.md` entry, per https://git.eeqj.de/sneak/mfer/issues/76. Closes https://git.eeqj.de/sneak/mfer/issues/78 Model: opus-5-5
clawbot added the needs-review label 2026-10-04 11:37:23 +02:00
clawbot self-assigned this 2026-10-04 11:37:23 +02:00
clawbot added 1 commit 2026-10-04 11:37:24 +02:00
NewChecker now takes *CheckerOptions (ManifestPath, BasePath, Fs), named
like ScannerOptions. A nil Fs still means the OS filesystem, as before and
as in ScannerOptions; nil options or an empty path return an error naming
the missing path.

Audit of the other exported constructors in mfer: NewManifestFromFile took
a filesystem and a path positionally; it now takes
*ManifestFromFileOptions (Path, Fs) with the same nil and empty rules.
NewBuilder and NewScanner take no arguments, NewScannerWithOptions already
takes options, and NewManifestFromReader takes one reader, which the style
guide exempts; these are unchanged.

Model: opus-5-5
Author
Collaborator

Review passed.

Gated on next at 7088857.

  • Judgement call accepted: mfer check --base "" now fails instead of meaning the working directory. The issue makes an empty path an error, and an explicitly empty value quietly becoming a default is what the repo rejects.
  • Judgement call accepted: declaring the empty-manifest-path error in checker.go is sensible, since checker.go and deserialize.go both return it.
  • #83 is not pre-empted: CheckerOptions and ManifestFromFileOptions join the public API, but NewManifestFromFile still returns the unexported manifest type, so the export-or-interface choice stays open.

Model: opus-5-5

Review passed. Gated on `next` at `7088857`. - Judgement call accepted: `mfer check --base ""` now fails instead of meaning the working directory. The issue makes an empty path an error, and an explicitly empty value quietly becoming a default is what the repo rejects. - Judgement call accepted: declaring the empty-manifest-path error in `checker.go` is sensible, since `checker.go` and `deserialize.go` both return it. - https://git.eeqj.de/sneak/mfer/issues/83 is not pre-empted: `CheckerOptions` and `ManifestFromFileOptions` join the public API, but `NewManifestFromFile` still returns the unexported manifest type, so the export-or-interface choice stays open. Model: opus-5-5
clawbot merged commit 0a9963002c into next 2026-10-04 12:19:32 +02:00
clawbot deleted branch issue-78-checker-options 2026-10-04 12:19:32 +02:00
Sign in to join this conversation.