Skip to content

Commit de194f8

Browse files
committed
docs: clarify runtime diagnostics and logs
1 parent 206cbd4 commit de194f8

4 files changed

Lines changed: 64 additions & 1 deletion

File tree

apps/desktop/src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5895,9 +5895,11 @@ function SettingsView({
58955895

58965896
function copyDiagnostics() {
58975897
const summary = [
5898+
`Health: ${healthLabel(snapshot.health.state)}`,
58985899
`Locality process: ${daemonStopped ? "Stopped" : "Running"}`,
58995900
snapshot.mount.provider ? `Provider: ${providerStatusLabel(snapshot.mount.provider)}` : null,
59005901
"State folder: ~/.loc",
5902+
"Logs folder: ~/.loc/logs",
59015903
`Projection: ${snapshot.mount.projection}`,
59025904
`Connection: ${snapshot.connection.status}`,
59035905
`Mount: ${snapshot.mount.status}`,
@@ -6198,6 +6200,7 @@ function SettingsView({
61986200
<SettingRow title="Provider" value={providerStatusLabel(snapshot.mount.provider)} />
61996201
)}
62006202
<SettingRow title="State folder" value="~/.loc" />
6203+
<SettingRow title="Logs folder" value="~/.loc/logs" />
62016204
<SettingRow title="Projection" value={snapshot.mount.projection} />
62026205
<div className="button-row">
62036206
<SecondaryButton compact onClick={copyDiagnostics}>

docs/daemon.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,36 @@ Timed-out `push` requests do not fall back because the daemon may already own an
196196
in-flight remote mutation. Stop or recover the daemon before retrying the push.
197197
Set `LOCALITY_DAEMON_DISABLE=1` to force direct execution without the fallback warning.
198198

199+
### Development Schema Skew
200+
201+
The SQLite state under `~/.loc` is durable user state. Do not delete it as the
202+
first response to a daemon startup failure. In development, a common failure is
203+
version skew between a freshly rebuilt desktop app and stale debug sidecars under
204+
`target/debug/`. A newer desktop can migrate `~/.loc/state.sqlite3`; an older
205+
`target/debug/localityd` can then fail with an unsupported schema or component
206+
version.
207+
208+
The dev sidecar prep path builds fresh `loc` and `localityd` binaries before it
209+
uses `loc daemon stop`, then terminates any remaining `localityd` process. This
210+
keeps the stop/restart path from relying on an old CLI that may no longer be able
211+
to open the upgraded state database.
212+
213+
Use these checks before assuming state corruption:
214+
215+
```bash
216+
./target/debug/localityd --build-info
217+
./target/debug/loc daemon status
218+
tail -50 ~/.loc/logs/localityd.err.log
219+
tail -50 ~/.loc/logs/desktop.log
220+
```
221+
222+
Recovery should rebuild the debug sidecars and relaunch the desktop app:
223+
224+
```bash
225+
make prepare-desktop-dev-sidecars
226+
make dev-tauri
227+
```
228+
199229
## Runtime Loop
200230

201231
`DaemonRuntime` is the foreground daemon's control plane. It owns the scheduler

docs/desktop-app.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,35 @@ write localityd logs in the same folder. The UI should point support and power u
142142
to that one directory instead of asking them to inspect terminal output,
143143
launchd, and helper logs separately.
144144

145+
Desktop health labels map to separate runtime layers:
146+
147+
- `Stopped` means the `localityd` daemon is not ready. Background sync, hydration,
148+
and Live Mode are paused until the daemon starts again.
149+
- `Runtime Needs Repair` means the platform projection is stopped, unregistered,
150+
or otherwise unavailable. On macOS this is usually File Provider; on Windows it
151+
is Cloud Files; on Linux it is the FUSE projection.
152+
- `Reconnect Needed` means a connector credential or workspace connection needs
153+
repair before sync can continue.
154+
- `Needs Review` means Locality is running, but one or more files require human
155+
review before push or automatic sync.
156+
157+
The Settings diagnostics surface should include both `~/.loc` and
158+
`~/.loc/logs`. `desktop.log`, `localityd.log`, `localityd.err.log`, and projection
159+
helper logs belong in that one logs directory so support does not have to collect
160+
terminal output, LaunchAgent output, and helper output separately.
161+
162+
In development, schema skew usually means the desktop process and the
163+
`localityd` sidecar were built at different times. `make dev-tauri` runs
164+
`prepare-dev-sidecars`, which must build fresh `loc` and `localityd` binaries
165+
before restarting the daemon. Direct background launches, LaunchAgent starts, and
166+
`LOCALITY_DESKTOP_SKIP_DEV_SIDECARS=1` bypass that protection, so recovery should
167+
be a sidecar rebuild, not deletion of `~/.loc/state.sqlite3`:
168+
169+
```bash
170+
make prepare-desktop-dev-sidecars
171+
make dev-tauri
172+
```
173+
145174
### 4. Create Workspace Mount
146175

147176
The desktop product target is a workspace-level Notion mount using the access

docs/desktop-ui-screens.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ Diagnostics
837837
838838
Locality process Running
839839
State folder ~/.loc
840+
Logs folder ~/.loc/logs
840841
Mounts watched 1
841842
Projection macOS File Provider
842843
@@ -890,7 +891,7 @@ The UI needs desktop-facing data shaped around product concepts:
890891

891892
```text
892893
app_health
893-
state: ready | preparing | needs_review | reconnect_needed | stopped
894+
state: ready | preparing | needs_review | reconnect_needed | stopped | runtime_stopped
894895
attention_count
895896
896897
connection

0 commit comments

Comments
 (0)