Commit Graph

5 Commits

Author SHA1 Message Date
16740b0de0 Browser: keep the file list live (re-read on change, re-sort, no idle frames)
The browser list was cached: files added/removed/renamed, or whose mtime
changed, did not show up (and did not re-sort) until the user navigated
away and back in. In particular, opening a file and returning showed a
stale list — a new file created elsewhere only appeared after navigating
up and back down.

The browser now re-reads the current directory while it is on screen:

- A short (~1 s) timer re-reads the visible directory so external changes
  (including inbound syncs) appear live, re-sorted in the current sort
  mode. A landing re-index repopulates the visible+prefetch pages
  synchronously (no flicker), preserves the scroll offset, and re-filters
  an active search without a scroll jump.
- Returning to the browser from the editor triggers one immediate re-read
  so the list is current the moment you land back.
- Bounded to one read per directory: a refresh while a read of the same
  directory is in flight coalesces, and a stale result for a directory the
  user has since left is dropped rather than clobbering the current view.
- A failed background refresh keeps the last good view (the next tick
  retries); a failed navigation still recovers to the previous directory.
- Change detection: a refresh that finds the directory unchanged rebuilds
  nothing and emits no frame, preserving the event-driven emission
  contract (TestNoFramesWhileIdle_Browser) while the browser idles.

Verified on-device: external add while sitting in the browser appears and
re-sorts to the top within ~1 s; an external add+remove made while in the
editor is reflected immediately on return; an external delete drops the
row within ~1 s.
2026-09-02 18:23:16 -04:00
06b1444207 gofmt: format all remaining files with the go1.27 toolchain
The tree was formatted with an older gofmt; go1.27's gofmt additionally
wants: EOF exactly one newline (no trailing blank lines), imports sorted
alphabetically within a block, mixed-precedence binary expressions
re-spaced for grouping ((a+b)/c), single-field composite literals
un-aligned, adjacent one-line method signatures aligned, and one-line
bodies containing a compound statement expanded. Applied repo-wide
(31 files under internal/); pure formatting, no semantic changes —
build and the full test suite pass.
2026-08-23 10:03:27 -04:00
58725a5e6c Make state single-owner and stabilize race detector
Frame now carries view state (scale/focus/query) to the main goroutine,
which reads only the frame-receiver-stored snapshot. Renderer owns Gio
widget editors (registered by ID) and the draw scale. Autosave timer
sends a token to the logic goroutine instead of touching state;
Shutdown waits for the owner to exit before FlushAll.

Tests access state only through owner-side Inspect/WithState helpers
(harness + in-package). Fixed double-Harness.Run race in two e2e tests,
made TestWorkerPool_PriorityPreemption deterministic, and raised the
lazy-loading test timeout that was too short under -race.

go test -race ./... is now green.
2026-08-16 01:32:27 -04:00
d73cb0be2c Integrate real filesystem with interface abstraction
- Define pool.FileSystem interface in internal/io/pool/filesystem.go
- Move DirEntry interface to internal/io/pool/types/types.go to break
  the pool <-> mock import cycle
- Implement real.FileSystem with atomic writes (temp file + os.Rename)
- Update mock.FileSystem to satisfy pool.FileSystem interface
- Update worker pool tasks to accept pool.FileSystem interface
- Update main.go to use RealFileSystem by default, with -root flag
- Update all browser/editor/test references to types.DirEntry
2026-06-04 16:19:38 -04:00
94db42d2ad feat(browser): Implement lazy loading and E2E tests for browser 2026-06-01 20:37:59 -04:00