fix(host): APPIMAGE is believed only when this program runs from that image

The AppImage launcher sets APPIMAGE (the image's file) and APPDIR (where
it is mounted) for the program it starts, and every program that one
starts inherits both: a terminal, an editor, an agent's app. The host's
start, the agent's pointer file, the host's check for a replaced program
and `update` each read APPIMAGE and believed it whenever it named a file.

So a wanderbooks run from inside another app's AppImage took that app's
image for its own:

- it started that image as the host, and the books never opened ("the
  books server keeps failing to start");
- `connect` would have written that image into the agent's pointer file;
- `wanderbooks update` replaced that app's file with wanderbooks.

Found by the batch's gate: the_host_outlives_the_app_scope_that_started_it
passes its own environment on (the other tests clear it), and this gate
ran in a session started from an AppImage app. The first and the third
are reproduced by two new tests, which fail without this change (the
update test read an ELF header where the other app's file had been).

The rule now (start.rs INVARIANT 6, from the AppImage documentation's
"Environment variables"): the image is this program's own only when
APPIMAGE is an absolute file, APPDIR an absolute folder, and the running
executable's file is inside APPDIR, compared as resolved paths. One
function decides (`own_appimage`), and all four readers ask it. The host
is handed APPDIR beside APPIMAGE, and neither unless both are its own.

No books and no figure are touched. The tests that pretend to be an
AppImage now set APPDIR as a launcher does; translocation.rs used a bare
APPIMAGE to stand in for a macOS path, the very thing this closes, and
names the program's folder as the mount.

The failing test's message now lists the lines that did arrive, which is
what showed the host was refused rather than slow.

Not checked against a built AppImage (none has been built with this
change): the first trial of one shows `update` and a restart find the
image.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude committed 2026-11-10 02:28:05 -07:00
1 parent 0178809a3d
commit 3bc198594b
12 files changed
+331 -52

No files matched your search

+14
View File
@@ -101,6 +101,20 @@ books. The gaps are in what the gates do not see.
9. **P12 step 2 has never run on today's code**: the overnight mutation
and fuzz run (`just p12-night`). Owner, overnight.
10. **Another app's AppImage was taken for this program's own.** Found on
2026-11-10 by the batch's gate, not by the evaluation: one test
(`the_host_outlives_the_app_scope_that_started_it`) passes its own
environment on, and the gate ran in a session started from an
AppImage app. `APPIMAGE` was believed whenever it named a file, and
everything an AppImage app starts inherits it (a terminal, an editor,
an agent's app). From there wanderbooks started that app's image as
its host (the books never opened), would have named it in an agent's
pointer file, and `wanderbooks update` replaced that app's file with
wanderbooks; both reproduced by a test before the fix. Fixed: the
image is believed only when the running executable is inside
`APPDIR` (`start.rs` INVARIANT 6). Not checked against a built
AppImage: the first trial of one does.
## P2: the gates themselves
1. **CI's `check` took 72 minutes**, one test binary at a time. Done
+8
View File
@@ -34,6 +34,14 @@ and not yet pushed (one gate and one push at the end, D-60):
- **Every `Ledger` command mapped to its step of the Lean model**
(`docs/command-steps.md`, kept whole by a test): 119 commands, 14
steps, and the four gaps it found are written down for bookspec.
- **Another app's AppImage is no longer taken for this program's** (found
by the batch's gate, which ran in a session started from an AppImage
app): `APPIMAGE` was believed whenever it named a file, and every
program such an app starts inherits it. Run from that app's terminal
or agent, wanderbooks started that image as its host, and `wanderbooks
update` wrote wanderbooks over that app's file. Believed now only when
the program runs from inside the image's mount (`start.rs` INVARIANT
6), with a test for the host and one for the update.
- **Routing**: delegated work goes by tier (`docs/routing.md`), one line
per task in `docs/delegation-log.md`.