package: preload drops payloadDir from the boot bridge — packaged founding refuses with 'payload is not carried ("")' despite a complete carried payload #491

Closed
opened 2026-08-12 19:32:56 +00:00 by ben · 1 comment
Owner

Symptom (live, #471's install proof, 2026-08-12 — second defect of the proof)

Fresh .deb install (post-#490 chmod), founding's private path refused at the VM stand-up:

founding: stand up the local VM guest: vm: the private-path payload is not carried —
missing NixOS guest base image (""); the operator-app install bundles the pinned QEMU +
per-arch NixOS base image (ADR 0110), ...

Yet the install's payload is complete and readable: /opt/OurCloud/resources/payload/ carries agent, control-plane, dashboard, nixos-guest.qcow2 (2.1 GiB, 0644), pinned qemu-img + qemu-system-x86_64, gateway-cache. The empty ("") is the tell: the helper resolved with no OURCLOUD_PAYLOAD_DIR at all, not a wrong one.

Cause — the preload drops payloadDir at the IPC hand-off

The chain is wired at every hop except one:

  • electron-main.ts resolves it (payloadDirPath() → resourcesPath/payload) and includes it in the ourcloud:boot-info reply (line ~237).
  • boot-info.ts declares payloadDir?: string on the bridge type.
  • production.ts passes bridge.payloadDir into bootPackagedApp.
  • stdioBridge.ts exports launch.payloadDir as OURCLOUD_PAYLOAD_DIR (line 80).

But electron-preload.ts — which receives the boot-info over ipcRenderer.sendSync and rebuilds window.__OURCLOUD__ field by field — has a local BootInfo interface without payloadDir, and its object literal copies only helperBin/stateDir/currentVersion/dev/channelSource. So bridge.payloadDir is undefined in the renderer, the if (launch.payloadDir) guard skips the export, and the untagged helper (#295: OURCLOUD_PAYLOAD_DIR is the ONLY production resolution) fails loud with the empty path.

Why #463's open smoke missed it: the packaged-open proof stops at the operator home; the dropped field only bites at founding's stand-up. The field-by-field literal is the trap — main can grow the bridge and the preload silently narrows it.

Fix

  1. Add payloadDir?: string to the preload's BootInfo and copy it into the window.__OURCLOUD__ literal (2 lines).
  2. Pin it where it broke: extend the packaged-open smoke (package-open.smoke.spec.ts) to assert window.__OURCLOUD__.payloadDir is set and ends with resources/payload when the extracted package carries one — sandbox-provable, and it turns the bridge hand-off into a contract the smoke owns. Consider asserting the other bridge fields the same way while there (the same narrowing trap holds for every future field).
  3. Worth a look for the same class: dev/channelSource made it, but any field main sends that the preload does not copy is silently dead — a comment on the literal naming the trap, or a spread of the IPC payload for the data fields, whichever fits the hardening-split direction noted in the preload header.

Workaround (live now, evidence on #471)

OURCLOUD_PAYLOAD_DIR=/opt/OurCloud/resources/payload ourcloud — stdioBridge inherits the parent env (#255), so the launch-env var reaches the helper. The zero-manual-steps criterion on #471 stays unmet until this lands.

Acceptance

  • Preload carries payloadDir; packaged-open smoke asserts the bridge field from the extracted artifact.
  • A rebuilt .deb (scripts/package-app.sh) founds past the VM stand-up gate with zero env overrides (the live re-proof rides #471).
## Symptom (live, #471's install proof, 2026-08-12 — second defect of the proof) Fresh `.deb` install (post-#490 chmod), founding's private path refused at the VM stand-up: ``` founding: stand up the local VM guest: vm: the private-path payload is not carried — missing NixOS guest base image (""); the operator-app install bundles the pinned QEMU + per-arch NixOS base image (ADR 0110), ... ``` Yet the install's payload is complete and readable: `/opt/OurCloud/resources/payload/` carries agent, control-plane, dashboard, `nixos-guest.qcow2` (2.1 GiB, 0644), pinned qemu-img + qemu-system-x86_64, gateway-cache. The empty `("")` is the tell: the helper resolved with **no `OURCLOUD_PAYLOAD_DIR` at all**, not a wrong one. ## Cause — the preload drops `payloadDir` at the IPC hand-off The chain is wired at every hop except one: - `electron-main.ts` resolves it (`payloadDirPath()` → `resourcesPath/payload`) and includes it in the `ourcloud:boot-info` reply (line ~237). - `boot-info.ts` declares `payloadDir?: string` on the bridge type. - `production.ts` passes `bridge.payloadDir` into `bootPackagedApp`. - `stdioBridge.ts` exports `launch.payloadDir` as `OURCLOUD_PAYLOAD_DIR` (line 80). But **`electron-preload.ts`** — which receives the boot-info over `ipcRenderer.sendSync` and rebuilds `window.__OURCLOUD__` field by field — has a local `BootInfo` interface *without* `payloadDir`, and its object literal copies only `helperBin`/`stateDir`/`currentVersion`/`dev`/`channelSource`. So `bridge.payloadDir` is `undefined` in the renderer, the `if (launch.payloadDir)` guard skips the export, and the untagged helper (#295: `OURCLOUD_PAYLOAD_DIR` is the ONLY production resolution) fails loud with the empty path. Why #463's open smoke missed it: the packaged-open proof stops at the operator home; the dropped field only bites at founding's stand-up. The field-by-field literal is the trap — main can grow the bridge and the preload silently narrows it. ## Fix 1. Add `payloadDir?: string` to the preload's `BootInfo` and copy it into the `window.__OURCLOUD__` literal (2 lines). 2. **Pin it where it broke**: extend the packaged-open smoke (`package-open.smoke.spec.ts`) to assert `window.__OURCLOUD__.payloadDir` is set and ends with `resources/payload` when the extracted package carries one — sandbox-provable, and it turns the bridge hand-off into a contract the smoke owns. Consider asserting the other bridge fields the same way while there (the same narrowing trap holds for every future field). 3. Worth a look for the same class: `dev`/`channelSource` made it, but any field main sends that the preload does not copy is silently dead — a comment on the literal naming the trap, or a spread of the IPC payload for the data fields, whichever fits the hardening-split direction noted in the preload header. ## Workaround (live now, evidence on #471) `OURCLOUD_PAYLOAD_DIR=/opt/OurCloud/resources/payload ourcloud` — `stdioBridge` inherits the parent env (#255), so the launch-env var reaches the helper. The zero-manual-steps criterion on #471 stays unmet until this lands. ## Acceptance - [ ] Preload carries `payloadDir`; packaged-open smoke asserts the bridge field from the extracted artifact. - [ ] A rebuilt `.deb` (`scripts/package-app.sh`) founds past the VM stand-up gate with zero env overrides (the live re-proof rides #471).
Author
Owner

close-report for #491 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 491,
  "status": "success",
  "commits": [
    "ae5fa36"
  ],
  "changed_files": [
    "STATUS.md",
    "app/src-electron/electron-preload.ts",
    "app/tests/e2e/package-open.smoke.spec.ts"
  ],
  "tests": [
    {
      "command": "vue-tsc -p tsconfig.json (pnpm build, includes src + tests)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Preload carries payloadDir; packaged-open smoke asserts the bridge field from the extracted artifact": "electron-preload.ts adds payloadDir?: string to BootInfo and copies info.payloadDir into the window.__OURCLOUD__ literal (commit ae5fa36); package-open.smoke.spec.ts new step evaluates window.__OURCLOUD__ from the packaged page and asserts payloadDir matches /resources\\/payload$/ plus helperBin/stateDir/currentVersion are set",
    "A rebuilt .deb founds past the VM stand-up gate with zero env overrides (live re-proof rides #471)": "root cause removed: the preload no longer narrows payloadDir to undefined, so production.ts's export guard passes OURCLOUD_PAYLOAD_DIR through to the helper (#295). Live re-proof is #471's install gate, not runnable in-sandbox (no KVM/real payload); the packaged-open smoke pins the bridge hand-off as the sandbox-provable contract"
  },
  "summary": "The Electron preload now carries payloadDir across the boot bridge and the packaged-open smoke asserts the bridge fields from the extracted artifact.",
  "blockers": []
}
**close-report** for #491 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 491, "status": "success", "commits": [ "ae5fa36" ], "changed_files": [ "STATUS.md", "app/src-electron/electron-preload.ts", "app/tests/e2e/package-open.smoke.spec.ts" ], "tests": [ { "command": "vue-tsc -p tsconfig.json (pnpm build, includes src + tests)", "exit_code": 0 } ], "criteria": { "Preload carries payloadDir; packaged-open smoke asserts the bridge field from the extracted artifact": "electron-preload.ts adds payloadDir?: string to BootInfo and copies info.payloadDir into the window.__OURCLOUD__ literal (commit ae5fa36); package-open.smoke.spec.ts new step evaluates window.__OURCLOUD__ from the packaged page and asserts payloadDir matches /resources\\/payload$/ plus helperBin/stateDir/currentVersion are set", "A rebuilt .deb founds past the VM stand-up gate with zero env overrides (live re-proof rides #471)": "root cause removed: the preload no longer narrows payloadDir to undefined, so production.ts's export guard passes OURCLOUD_PAYLOAD_DIR through to the helper (#295). Live re-proof is #471's install gate, not runnable in-sandbox (no KVM/real payload); the packaged-open smoke pins the bridge hand-off as the sandbox-provable contract" }, "summary": "The Electron preload now carries payloadDir across the boot bridge and the packaged-open smoke asserts the bridge fields from the extracted artifact.", "blockers": [] } ``` </details>
ben closed this issue 2026-08-12 19:38:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#491
No description provided.