diff --git a/docs/comprehension-history.md b/docs/comprehension-history.md index 81bf7b4..3aec070 100644 --- a/docs/comprehension-history.md +++ b/docs/comprehension-history.md @@ -449,3 +449,26 @@ Inherited architect, decided by: - Navigation: `data/svse/fs.go:1` `svse`: the step from a dot path to a folder goes through the lowered-namespace rule, stated only in the README and each package doc - Navigation: `internal/datafiles/datafiles.go:57` `labelled`: errors name sv_SE (address.json), not a path that opens as written - Locality: `fejkdata.go:99` `New`: New loads exactly its options, cancelled by `data/svse/fs.go:1`'s dependency on geose that nothing in Go expresses + +## 2026-10-11T13:08:34Z, PR #203 at fb2c809, against bf1becb + +Ruling: better + +| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall | +|---|---|---|---|---|---| +| Mid A | same | better | same | same | better | +| Inherited architect | better | better | same | better | better | + +Mid A, decided by: + +- Locality, Overall: `fejkdata.go:66` `WithDataFS`: the caller names every module and New refuses no data naming the fix, where the base prepended a package-level shippedSource behind config{shipped: true} +- Locality: `data/sv_SE/fs.go:19` `Modules`: sv_SE reading geo.SE is a Go import with a doc line, not only a template reference inside address.json +- Shape: `internal/datafiles/mount.go:13` `mounted`: a hand-built virtual fs.FS replaces a base string, balanced by Source losing a field and Walk, Load and Manifest turning path-agnostic + +Inherited architect, decided by: + +- Locality, Navigation, Overall: `data/sv_SE/fs.go:19` `Modules`: a locale reading its country's places is a Go import, one hop in code where the base needed the README or a trace through JSON references +- Locality, Self-sufficiency: `fejkdata.go:66` `WithDataFS`: every source is named at the call site, and leaving them all out gives an error that spells the fix +- Navigation: `data/modules.go:17` `Modules`: shipped data has a Go home inside data/, each module's manifest beside its files +- Shape: `internal/datafiles/mount.go:13` `mounted`: seven small types fake the folders above the mount, balanced by Source keeping one form and truthful per-module packages +- Self-sufficiency: `data/sv_SE/fs.go:1` `svse`: each module says in code which namespace it supplies and what it reads diff --git a/imports_test.go b/imports_test.go index 4aecb72..ccca1f2 100644 --- a/imports_test.go +++ b/imports_test.go @@ -38,7 +38,7 @@ func TestPackageImports(t *testing.T) { "data/misc": nil, "data/sv_SE": {"data/geo/SE"}, "internal/builtinfunc": {"internal/datatype", "internal/drawstate", "internal/grammar", "internal/invariant", "internal/proven"}, - "internal/datafiles": {"internal/grammar", "internal/invariant", "internal/jsonvalue"}, + "internal/datafiles": {"internal/grammar", "internal/jsonvalue"}, "internal/datatype": nil, "internal/drawstate": nil, "internal/grammar": nil, diff --git a/internal/datafiles/manifest.go b/internal/datafiles/manifest.go index ce68c9b..9313261 100644 --- a/internal/datafiles/manifest.go +++ b/internal/datafiles/manifest.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io/fs" + "path" "sort" "strings" @@ -49,7 +50,12 @@ func (s Source) Manifest() (Manifest, error) { } // ManifestPath is the manifest's path as errors name it. -func (s Source) ManifestPath() string { return s.labelled(ManifestFile) } +func (s Source) ManifestPath() string { + if m, isMounted := s.fsys.(mounted); isMounted { + return s.labelled(path.Join(m.at, ManifestFile)) + } + return s.labelled(ManifestFile) +} // decodeManifest decodes a manifest, refusing any key or shape it does not define, and // reports every mistake: first each entry's own, in path order, then each parent naming diff --git a/internal/datafiles/mount.go b/internal/datafiles/mount.go index 1e0ae9b..560848a 100644 --- a/internal/datafiles/mount.go +++ b/internal/datafiles/mount.go @@ -22,7 +22,10 @@ func (m mounted) Open(name string) (fs.File, error) { } if ok { f, err := m.fsys.Open(".") - return mountRoot{File: f, name: path.Base(name)}, err + if err != nil { + return nil, err + } + return mountRoot{File: f, name: path.Base(name)}, nil } if next, ok := m.towards(name); ok { return &mountDir{name: path.Base(name), next: next}, nil @@ -70,7 +73,10 @@ type mountRoot struct { func (r mountRoot) Stat() (fs.FileInfo, error) { info, err := r.File.Stat() - return renamed{FileInfo: info, name: r.name}, err + if err != nil { + return nil, err + } + return renamed{FileInfo: info, name: r.name}, nil } func (r mountRoot) ReadDir(n int) ([]fs.DirEntry, error) {