Skip to content

Commit 839a536

Browse files
committed
docs(desktop): document the server log and startup diagnostic page
Refs #174
1 parent f558364 commit 839a536

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

docs/development/desktop.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,40 @@ PYOPS_MIGRATIONS_DIR=<bundled drizzle directory>
4747
PYOPS_MOD_DIR=<bundled mod directory>
4848
```
4949

50-
The shell drains the child-process output channel and retains its handle so shutdown can
51-
terminate the server cleanly.
50+
The shell retains the child-process handle so shutdown can terminate the server cleanly,
51+
and passes each path through `dunce` so Windows sidecars receive plain `C:\…` paths rather
52+
than `\\?\`-prefixed extended-length paths.
5253

5354
This split is why server path code must use `app/src/server/paths.server.ts`. The current
5455
working directory is not a reliable resource or data root in a packaged application.
5556

57+
### Server log
58+
59+
In a packaged build, everything the server prints — stdout and stderr — is written to
60+
`server.log` in the app-data directory, interleaved with launcher lifecycle lines that are
61+
stamped with seconds since launch (`[launcher +0.2s] server ready, opening the app`). Each
62+
launch starts a fresh log; the previous launch's log is kept as `server.log.old`.
63+
64+
This file is the primary diagnostic for startup failures on user machines: it records the
65+
resolved server entry path, the data directory, spawn errors, server crashes with their
66+
exit code, and the server's own output. Ask a user to attach it before anything else.
67+
Logging must never take the app down: if the file cannot be created, logging is silently
68+
disabled and startup proceeds.
69+
70+
Development builds do not write it — the server runs in the developer's terminal.
71+
72+
### Startup failure page
73+
74+
The shell waits up to 90 seconds for the server port, and bails out immediately if the
75+
server process exits or fails to spawn. If the server is not reachable, the window opens
76+
with a built-in diagnostic page instead of the webview's network-error page: it explains
77+
that the local server has not come up, shows the `server.log` path to attach to a bug
78+
report, and offers a retry button.
79+
80+
The page is not a dead end. The launcher keeps polling the port behind it and swaps in the
81+
application the moment the server becomes reachable, which absorbs slow first launches
82+
(for example, antivirus software scanning a fresh install).
83+
5684
### Fixed port and single instance
5785

5886
The webview URL uses fixed port `34115`. `tauri-plugin-single-instance` is registered before

docs/troubleshooting/faq.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ Yes. Create a separate project and sync it from the appropriate Factorio mod set
3232
project keeps its own reference data and plan. Confirm the active project before syncing,
3333
because the sync updates that project.
3434

35+
### The app says it couldn't reach its local server. What now?
36+
37+
The desktop app runs a local server in the background, and that page means the server has
38+
not come up yet. The window keeps checking and loads the app by itself as soon as the
39+
server is reachable — a first launch can take a while, for example while antivirus
40+
software scans the new installation. If nothing happens for a few minutes, close the app
41+
and start it again.
42+
43+
If it keeps failing, attach `server.log` to a bug report. The page shows its full path;
44+
it lives in the app's data directory:
45+
46+
- Windows: `%APPDATA%\com.apocdev.pyops\server.log`
47+
- macOS: `~/Library/Application Support/com.apocdev.pyops/server.log`
48+
- Linux: `~/.local/share/com.apocdev.pyops/server.log`
49+
50+
The log records what the server printed while starting, so it usually identifies the
51+
failure directly.
52+
3553
## Planning behavior
3654

3755
### Why does PyOps leave ingredients as imports?

0 commit comments

Comments
 (0)