commit aa92ad40a02f8c3e4ac3646f8eef15e87cc69fbc
parent 377776db54ded9a439a1bc1b474a4340368a2277
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 17 Nov 2026 14:59:16 -0500
headed Connects: declare WAYLAND_DISPLAY, XAUTHORITY, XDG_RUNTIME_DIR
envVars.test's "every variable the code reads is declared" caught the
three the display search reads; ENVIRONMENT.md regenerated. A windowless
stand-in browser's display reads "no display (this browser opens no window)".
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md
@@ -183,6 +183,9 @@ The publish pipeline sets these for a process it spawns. Listed so a reader know
| `SITE_ID` | — | Which site a compose or an export build is for. The build stage (`archilyzer publish build <id>`) sets it for its children; `compose site`, `build site` and `deploy site` fall back to it when no id is given. | common/bin/compose-site.ts, export/app/lib/site.ts |
| `INSTANCE_MODE` | a site | `hub` makes the export build the hub. Set by `archilyzer build hub`. | export/app/lib/mode.ts, common/lib/archive/contract.ts |
| `DISPLAY` | set by `xvfb-run`; for a Connect window, the desktop's | record-live's browser fallback (path B) opens the page HEADED when a display is set — the caller runs it under `xvfb-run -a`, because Rumble's Cloudflare refuses a headless Chromium — and headless otherwise. A Connect window (X, archive.today, a forum) opens on the process's own `DISPLAY` / `WAYLAND_DISPLAY` / `XAUTHORITY` when set, else the user session's (`systemctl --user show-environment`), else a display socket on disk (`/tmp/.X11-unix/X<n>`, `$XDG_RUNTIME_DIR/wayland-<n>`), looked for at each press and handed to that browser only; none found, the press is refused with a sentence. | common/ytdlp/liveSniff.mjs, common/social/headedDisplay.ts |
+| `WAYLAND_DISPLAY` | the desktop's, when the process has one | The Wayland display a Connect window opens on, beside `DISPLAY`: the process's own, else the user session's, else the lowest `$XDG_RUNTIME_DIR/wayland-<n>` socket. Handed to that browser only, never set in the process. | common/social/headedDisplay.ts |
+| `XAUTHORITY` | the desktop's, when the process has one | The X cookie file a Connect window's browser is handed with `DISPLAY` when the process or the user session names one. Its path is never logged (the log says "XAUTHORITY set"). | common/social/headedDisplay.ts |
+| `XDG_RUNTIME_DIR` | `/run/user/<uid>` | Where a Connect window's display search looks for a `wayland-<n>` socket when neither the process nor the user session names a display. | common/social/headedDisplay.ts |
| `BUILD_ARCHIVES` | on | `0` skips archive-zip generation for one build (`--skip-archives`). | common/bin/compose-site.ts, common/bin/build-archives.ts |
| `REPORTS_ALLOW_MISSING_MEDIA` | off | `1` lets a report citation whose evidence media was not prepared through compose (`--allow-missing-media`): its moment page renders without a clip. Off, compose fails with the list. | common/bin/compose-site.ts |
| `ARCHIVES_READONLY` | off | `1` inside a docker-mode build container: materialize archives, never write the shared cache. | common/bin/compose-site.ts |
diff --git a/common/lib/envVars.ts b/common/lib/envVars.ts
@@ -190,6 +190,9 @@ const DECLARED: EnvVarDecl[] = [
{ name: "SITE_ID", audience: "internal", default: "—", readBy: "common/bin/compose-site.ts, export/app/lib/site.ts", doc: "Which site a compose or an export build is for. The build stage (`archilyzer publish build <id>`) sets it for its children; `compose site`, `build site` and `deploy site` fall back to it when no id is given." },
{ name: "INSTANCE_MODE", audience: "internal", default: "a site", readBy: "export/app/lib/mode.ts, common/lib/archive/contract.ts", doc: "`hub` makes the export build the hub. Set by `archilyzer build hub`." },
{ name: "DISPLAY", audience: "internal", default: "set by `xvfb-run`; for a Connect window, the desktop's", readBy: "common/ytdlp/liveSniff.mjs, common/social/headedDisplay.ts", doc: "record-live's browser fallback (path B) opens the page HEADED when a display is set — the caller runs it under `xvfb-run -a`, because Rumble's Cloudflare refuses a headless Chromium — and headless otherwise. A Connect window (X, archive.today, a forum) opens on the process's own `DISPLAY` / `WAYLAND_DISPLAY` / `XAUTHORITY` when set, else the user session's (`systemctl --user show-environment`), else a display socket on disk (`/tmp/.X11-unix/X<n>`, `$XDG_RUNTIME_DIR/wayland-<n>`), looked for at each press and handed to that browser only; none found, the press is refused with a sentence." },
+ { name: "WAYLAND_DISPLAY", audience: "internal", default: "the desktop's, when the process has one", readBy: "common/social/headedDisplay.ts", doc: "The Wayland display a Connect window opens on, beside `DISPLAY`: the process's own, else the user session's, else the lowest `$XDG_RUNTIME_DIR/wayland-<n>` socket. Handed to that browser only, never set in the process." },
+ { name: "XAUTHORITY", audience: "internal", default: "the desktop's, when the process has one", readBy: "common/social/headedDisplay.ts", doc: "The X cookie file a Connect window's browser is handed with `DISPLAY` when the process or the user session names one. Its path is never logged (the log says \"XAUTHORITY set\")." },
+ { name: "XDG_RUNTIME_DIR", audience: "internal", default: "`/run/user/<uid>`", readBy: "common/social/headedDisplay.ts", doc: "Where a Connect window's display search looks for a `wayland-<n>` socket when neither the process nor the user session names a display." },
{ name: "BUILD_ARCHIVES", audience: "internal", default: "on", readBy: "common/bin/compose-site.ts, common/bin/build-archives.ts", doc: "`0` skips archive-zip generation for one build (`--skip-archives`)." },
{ name: "REPORTS_ALLOW_MISSING_MEDIA", audience: "internal", default: "off", readBy: "common/bin/compose-site.ts", doc: "`1` lets a report citation whose evidence media was not prepared through compose (`--allow-missing-media`): its moment page renders without a clip. Off, compose fails with the list." },
{ name: "ARCHIVES_READONLY", audience: "internal", default: "off", readBy: "common/bin/compose-site.ts", doc: "`1` inside a docker-mode build container: materialize archives, never write the shared cache." },
diff --git a/common/social/headedDisplay.ts b/common/social/headedDisplay.ts
@@ -300,7 +300,7 @@ export async function launchHeadedContext(o: {
let launchEnv: Record<string, string> | undefined;
let shown: string;
if (o.chromium.opensNoWindow) {
- shown = "none (this browser opens no window)";
+ shown = "no display (this browser opens no window)";
} else {
const { display, notes } = await resolveHeadedDisplay({ ...o.display, env: base });
if (!display) {