Files
core/TODO.md
T

188 lines
11 KiB
Markdown
Raw Normal View History

# TODO / open architecture questions
Deliberately not resolved in this V1 (see spec section 63 and AGENTS.md's
"no over-abstraction" rule) -- tracked here rather than solved
speculatively.
## Migration
- [x] **Migrate `yet` onto `core/paths`/`core/config`.** `internal/config`
already used `core/config`/`core/paths` (shared `Application{Name:
"yetano"}`). `internal/store`'s own `$YETANO_HOME` (formerly
`os.UserConfigDir()/yetano`, one monolithic root) has now been split
across three independently overridable `core/paths` categories for
`Application{Name: "yet", Kind: core.CLI}`: `store.Home()` (`DataDir`;
store/packages/profiles/sources/credentials/trust-policy/deployments/
share-lib-etc), `store.CacheHome()` (`CacheDir`; the blob cache), and
`store.BinDir()` (`BinDir`; managed command entrypoints, shared across
every Yetano application). This is a deliberate default-path and
env-var-shape change (`$YETANO_HOME` no longer exists; see
`YET_DATA_HOME`/`YETANO_DATA_HOME`, `YET_CACHE_HOME`/
`YETANO_CACHE_HOME`, `YET_BIN_HOME`/`YETANO_BIN_HOME` instead) --
existing installations are not migrated (see `yet`'s
`docs/install-store-and-profiles.md`).
- [x] `yaseva` was built on `core/paths`/`core/config` from the start.
- [x] The remaining applications across the `yetano`, `yak`, and
`yamase` meta-repos were migrated on 2026-09-22; the open
follow-ups are in the meta-repo's `TODO.md` ("core/paths:
Folge-Punkte"; the former `TODO-pathchange.md` is in its git history).
## Standard commands
- [x] `manual` (v0.2.0), `completion`, `doctor` (v0.3.0), `secretref`
(v0.4.0), `configcmd` and `version` (v0.5.0) -- see
docs/program-conventions.md in the meta-repository.
- [x] `configcmd.OneOf`: `UndocumentedKeys` and `upgrade` know structs
whose fields are alternatives (SecretRef `env`/`file`/`value`);
`completion.Files` completes paths for programs without subcommands
(yamc) -- 2026-10-31.
- [x] `backup` (v0.11.0): archive format, rotation, verify, safe
extract for the optional `<program> backup` command -- 2026-11-05.
2026-11-01 13:35:54 +01:00
- [x] `doctor.Check` with optional `area` and `hint` (JSON and table,
omitted when empty), `Report.Add` -- 2026-11-01, for v0.10.0.
- [x] macOS CLI/Service system-scope `RuntimeDir` is `/var/run/<app>`
(was `/run/<app>`, which macOS does not have) -- v0.5.0.
- [x] `core/gui`: the native WebView host from
`prototypes/yetano-webview`, as the nested module
`yetano.dev/yetano/core/gui` (`gui/v0.1.0`). The prototype uses it.
- [ ] Move yet-gui off its copy in `yet/gui/internal` onto `core/gui`
(steps in [gui/README.md](gui/README.md)).
- [ ] `core/gui` (macOS): the web view should accept the first mouse
click in an inactive window (a WKWebView subclass with
`acceptsFirstMouse:` YES) -- today the first click only activates
the window, so a dialog shown at start looks dead (yanks,
2026-11-14; yanks now waits for the focus before showing it).
- [ ] `core/gui`: Linux/FreeBSD backend (WebKitGTK) -- see gui/README.md.
- [x] `core/tui`: shared TUI kernel (themes, styles, Paint/Outer,
ListState, text helpers) as the nested module
`yetano.dev/yetano/core/tui` (`tui/v0.1.0`).
- [ ] Move yet's and yavebu's `internal/tui` onto `core/tui` (steps in
[tui/README.md](tui/README.md)); yalsh menuconfig after an owner
decision on `yalsh.dev` -> `yetano.dev` imports.
## Platform tuning
- [x] macOS Desktop's `RuntimeDir()` now prefers `$TMPDIR` (the
OS-managed, per-user, securely permissioned ephemeral directory every
macOS process gets -- what `NSTemporaryDirectory()` returns), the real
native equivalent to XDG_RUNTIME_DIR's role. It falls back to the
previous `~/Library/Application Support/<App>/Runtime` placeholder only
when `TMPDIR` is unset in the resolved environment (simulated/test
environments that never set it).
- [x] `LogAliasDir()` (spec section 39: `~/.local/log/<app>` as a Unix
convenience symlink target) now has a creation API:
`Resolver.EnsureLogAlias()` creates the `LogDir()` symlink if missing,
leaves any pre-existing entry untouched, and is a no-op alias of
`EnsureLogDir()` on Windows/macOS Desktop (where the two already
coincide).
- **Low priority, not an MVP blocker:** FreeBSD's flavor (`freebsd.go`)
is a best-effort first pass. Other BSD and Unix-family `GOOS` values
(`openbsd`, `netbsd`, `dragonfly`, `solaris`, `illumos`, ...) currently
fall back to the Linux flavor (`flavor()`'s default case) -- verified
to compile and behave sensibly, not verified against each OS's actual
convention. Nobody has asked for one of these yet; adding a dedicated
flavor table for one is a small, additive change (a new `<os>.go` file
plus one `case` in `flavor()`), never a redesign, and can wait until a
real consumer needs it.
## Windows
- **BinDir / installer strategy.** `paths.BinDir()` for Windows
resolves `%LOCALAPPDATA%\Yetano\bin` (user) /
`%PROGRAMDATA%\Yetano\bin` (system) as *locations*, per spec section
19. Whether/how `yet` actually adds either to `PATH`, and how a
package gets "activated" there (symlink vs. junction vs. copy/shim
launcher, spec section 20) is explicitly out of scope for `core` --
path resolution and package activation stay separate concerns (spec
section 20's own instruction).
- [x] **The native `SHGetKnownFolderPath` fallback has now been run on a
real Windows host** (Windows 10, Go 1.25), not just cross-compiled.
With `APPDATA`/`LOCALAPPDATA`/`PROGRAMDATA` all unset, `ConfigDir()`/
`DataDir()`/system-scope `ConfigDir()` correctly resolved the real
roaming/local/`ProgramData` known folders via the native API (source
reported as `windows-known-folder`), confirmed via `Explain()` across
every category. `go build`/`go test ./...` are clean on real Windows.
`go vet ./...` reports exactly one finding there, and it is expected
and permanent, not a bug: `knownfolders_windows.go:71` converts a
`uintptr` returned via `SHGetKnownFolderPath`'s out-parameter to
`unsafe.Pointer` to walk the UTF-16 string it points to -- `go vet`'s
`unsafeptr` check can never prove this safe (the pointer is written
into memory by the syscall, not derived from a Go pointer in the same
expression), for any formulation of this code, without depending on
`golang.org/x/sys/windows` (deliberately not done, per this module's
minimal-dependency policy -- see the file's own comment). Plain `go
vet ./...` on macOS/Linux never sees this file at all (`//go:build
windows`); only `GOOS=windows go vet ./...`/vet run on a real Windows
host reports it. Verification commands for future reference: `go
build ./... && go test ./...` (clean), `go vet ./...` (clean on
macOS/Linux; one documented, accepted `unsafeptr` finding on Windows).
- [x] **Running on a real Windows host also surfaced and fixed a real,
previously-invisible bug**, unrelated to `SHGetKnownFolderPath`: see
"WithRoot cross-platform-simulation bug" below.
## WithRoot cross-platform-simulation bug (found via real-Windows testing)
`WithRoot` lets tests sandbox real filesystem I/O under a temp directory
while `WithPlatform` simulates a *different* platform's path logic (see
README's "Testing on any host") -- e.g. `WithPlatform("linux")` with
`WithRoot(t.TempDir())` on any host. `root` (typically `t.TempDir()`) is
always in the REAL host's native address family, which does not have to
match the *simulated* platform's family. `applyRoot` previously assumed
they always matched (choosing unix- or windows-style joining purely from
`r.platform`), so root's own separators were never normalized: on a real
Windows host simulating Linux, `ConfigDir()` etc. produced mixed-
separator paths (`C:\...\001/home/test/.config/yet`), and in one case
(an override value that itself already embedded `root`) an outright
invalid path (a mid-string drive letter). This was invisible on
macOS/Linux hosts, where `t.TempDir()` happens to already share the
simulated Unix family with whatever was being tested, and was only
exposed by actually running this package's own test suite on a real
Windows host for the first time (see the `SHGetKnownFolderPath`
verification above) -- **this class of bug is exactly why "verified to
compile via cross-compilation" is not the same as "verified on the real
platform," and is worth remembering before declaring any future
Windows/macOS-specific change done from cross-compilation alone.**
Fixed: `applyRoot` (now `applyRootRebase` in `join.go`) decomposes the
resolved path into plain segments and re-joins them onto `root` using
root's *own* family, inferred from its content (the same technique
`JoinDirFile` already used) -- not `r.platform`'s. Two call sites that
joined an already-rooted value with one more suffix (`logDirUnix`,
`darwinDesktopStateDir`/`darwinDesktopRuntimeDir`'s fallback) were
switched from a hardcoded `unixJoin` to the family-aware `JoinDirFile`
for the same reason. `core/config`'s working-directory layer had the
identical bug one level up (`JoinFamily` decided family from the
simulated platform, not from `r.workdirPath`'s own content when it had
one) -- fixed via a new `paths.JoinDirFileFamily`, which behaves like
`JoinDirFile` whenever `dir` has a separator of its own, falling back to
`JoinFamily`'s platform-driven choice only for an ambiguous bare `dir`
like the default `"."`. See `TestApplyRootRebaseMismatchedFamily` and
`TestJoinDirFileFamily` for the regression coverage (constructing a
mismatched root/platform pair directly, so this no longer depends on
which host CI happens to run on).
## Portability / distribution model
- `paths.WithRoot`/`YETANO_HOME`-style portable mode: `WithRoot` exists
and is tested, but there is no ecosystem-wide "portable install"
concept wired up yet (spec section 41's "optional later:
`YETANO_HOME` or portable mode").
- The `yet` package store (spec sections 2/37/38) lives in `yet`
(`internal/store`), built on these primitives; `core/paths` itself
stays store-agnostic.
- Plugin/extension search paths: no dedicated category exists yet;
`paths.FindFile` is generic enough that a caller can build one today
(e.g. over `DataSearchDirs()` with a `plugins/` suffix) without
needing a new `PathKind`.
- Atomic package activation, versioning/rollback for the store: `yet`'s
business, not core's.
## Central Yetano config
- `config.WithYetanoDefaults(true)` resolves the shared
`~/.config/yetano/` (or platform equivalent) via a pseudo-`Application
{Name: "yetano", Kind: core.CLI}`. This is deliberately always
CLI-shaped (XDG-flavored everywhere), even for a Desktop or Service
caller, since it's a shared, admin/CLI-facing location -- revisit only
if a real consumer needs the shared config to follow a different
convention on macOS/Windows Desktop apps specifically.