boot splash
CI / test (push) Failing after 5m0s

This commit is contained in:
Raven Scott
2026-04-03 01:45:43 -04:00
parent eca209b663
commit 4c8d50b1c9
4 changed files with 243 additions and 68 deletions
+16 -16
View File
@@ -43,7 +43,7 @@ bare-operating-system/
│ ├── kernel/ # Vendored for Pear (sync from repo kernel/)
│ └── lib/
│ └── paths.js
└── bare-os-booter/ # Boots from peers or local seed
└── bare-os-booter/ # Boots from swarm peers only (TTY splash + timeout)
├── package.json
├── index.js
├── test.js
@@ -326,25 +326,24 @@ Pear-safe path resolution (same idea as Holepunch [pear-rti](https://github.com/
- Sets `disk.os` with stub `searchLocal` ([]) and `execRpc` (`''`).
- `runKernelFromSource(b4a.toString(initSource), ctx)`.
**`bootFromPeers(disk, store, swarm)`**
**`boot-splash.js`** — TTY splash (disabled when `stdout` is not a TTY or `BARE_OS_NO_SPLASH=1`): full-screen clear, Braille spinner, elapsed boot timer, progress bar vs `BARE_OS_BOOT_TIMEOUT_MS` (default 60s), rotating title color, status lines. `prepareForKernel()` clears again and shows the cursor before the fish shell.
**`bootFromPeers(disk, store, swarm, splash)`**
- `disk.read(0)``parseMbr`.
- For each key: `Hyperdrive(store, driveKey)`, `ready()`, replicate on all `disk.peers` mux streams, join drive discovery, `findingPeers` + `swarm.flush`, poll up to 30×200ms for `/boot/init.js`.
- On success: `initPersonalDrive`, `executeKernel`.
**`bootLocal(disk, store, swarm)`**
- `Corestore(defaultLocalSeedCorestorePath(...))`, `Hyperdrive(seedStore)` (same store as seeders default layout).
- Poll for `/boot/init.js`, then `initPersonalDrive`, `executeKernel`.
- On success: `initPersonalDrive`, `splash.prepareForKernel()`, `executeKernel`.
**`main()`**
- `resolveStdio()``createBootSplash`, `splash.start()` (initial clear).
- `Corestore(bootStorePath())`, `Hyperswarm`, `SwarmDisk`, join `topicKey()`.
- Wait loop: 500ms steps until `disk.peers.size > 0` or `BARE_OS_PEER_WAIT_MS` (default 8000).
- If peers: `bootFromPeers`; else `bootLocal`.
- **`finally`**: close `personalDrive`, `disk.drive`, `swarm.destroy()`, `store.close()` (each in try/catch).
- Wait until `disk.peers.size > 0` or **`BARE_OS_BOOT_TIMEOUT_MS`** elapses (default **60000**). There is **no local seed fallback**; without peers, boot fails.
- `Promise.race` between `bootFromPeers` and the remaining time within the same deadline so the whole network boot finishes within the limit.
- **`finally`**: `swarm.destroy()` first, then close drives and `store` (each in try/catch).
- **`exitHostProcess`**: `Bare.exit` or `process.exit`.
**Entry**: `main().catch(safetyCatch)`.
**Entry**: `main().catch()`.
### 12.4 [packages/bare-os-booter/lib/swarm-disk.js](packages/bare-os-booter/lib/swarm-disk.js)
@@ -455,10 +454,11 @@ sequenceDiagram
| ---------------------- | ------- | --------------------------------------------------------------------- |
| `BARE_OS_KERNEL_ROOT` | Seeder | Absolute path to kernel tree (default: `repo/kernel`) |
| `BARE_OS_SEED_STORE` | Seeder | Corestore directory (default: `repo/data/corestore-seeder`) |
| `BARE_OS_BOOT_STORE` | Booter | Corestore for boot side (default: `repo/data/corestore-booter`) |
| `BARE_OS_LOCAL_SEED` | Booter | Corestore path for local boot (default: `repo/data/corestore-seeder`) |
| `BARE_OS_PEER_WAIT_MS` | Booter | Max ms to wait for ≥1 peer before local boot (default `8000`) |
| `BARE_OS_SKIP_REPL` | Booter | If `1`, readline returns null — non-interactive exit |
| `BARE_OS_BOOT_STORE` | Booter | Corestore for boot side (default: `repo/data/corestore-booter`) |
| `BARE_OS_BOOT_TIMEOUT_MS` | Booter | Wall-clock budget for peer wait + network boot (default `60000`) |
| `BARE_OS_NO_SPLASH` | Booter | If `1`, skip TTY splash (plain logs / non-TTY behavior unchanged) |
| `BARE_OS_LOCAL_SEED` | paths | Overrides local seed path helper (`defaultLocalSeedCorestorePath`); booter does not local-boot |
| `BARE_OS_SKIP_REPL` | Booter | If `1`, readline returns null — non-interactive exit |
---