Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

workbenchthis machine

forge.json declares the Pi's arm and camera as egress: 100.89.95.68:8101 and :8080 #10

Merged opened this in answer to

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

smith/arm:smith/8-forge-json-declares-the-pi-s-arm-and-cam → main 2 commits fork 3 threads · 3 unresolved

  • Merged. smith/8-forge-json-declares-the-pi-s-arm-and-cam was merged into main as fc94c87.

Review

Sign in to review this change.
3 files changed +32 −1
Software/README.md +8
@@ -177,6 +177,14 @@ or on an address the forge can route to. Don't put it on the open internet:
177177 same host. `ARM_CAMERA_1` and `ARM_CAMERA_2` take full stream URLs
178178 (`http://<host>:8080/stream`) when they live elsewhere.
179179
180 **Egress in `forge.json`.** `forge.json` lists `100.89.95.68:8101` (the arm)
181 and `100.89.95.68:8080` (the camera) under `egress`: the destinations the app
182 may reach on the Pi. The declaration does nothing until a site admin grants
183 the private destinations (trevato/forge#3437). The Pi's address is pinned
184 there, so if the Pi moves, change it in `forge.json` (and in `ARM_SERVER`).
185 The hosted app currently runs `bench/fake-serve.ts`, so nothing uses this
186 egress until `ARM_SERVER` is set.
187
180188 With `ARM_SERVER` unset, the app runs the simulated arm and says
181189 **Simulated**. When it is set but the server doesn't answer `/status` within
182190 1.5 s, the top bar says **Simulated · \<host\> unreachable (why)**, and the
Software/so101/src/manifest.test.ts added +22
@@ -0,0 +1,22 @@
1 import { expect, test } from "bun:test";
2 import { parseRemote } from "./relay.ts";
3
4 const manifest = await Bun.file(new URL("../../../forge.json", import.meta.url)).json();
5 const egress: string[] = manifest.egress;
6
outdated

This restates the literal in forge.json, so it fails only when someone edits the line. Assert something with a reason to fail, such as well-formed host:port entries and ports matching the arm/camera defaults.

7 test("every egress entry is a well-formed host:port", () => {
8 expect(egress.length).toBeGreaterThan(0);
9 for (const entry of egress) {
outdated

app.health is unchanged by this pull, so this test covers nothing new. Remove it.

10 expect(entry).toMatch(/^[\w.-]+:\d{1,5}$/);
11 expect(Number(entry.split(":")[1])).toBeLessThanOrEqual(65535);
12 }
13 expect(new Set(egress).size).toBe(egress.length);
14 });
15
16 test("egress covers the arm and the first camera the relay derives from one host", () => {
17 const [host] = egress[0]!.split(":");
18 const remote = parseRemote({ ARM_SERVER: `ws://${host}:8101` })!;
19 const needed = [remote.host, ...remote.cameras.slice(0, 1).map((c) => new URL(c).host)];
20 for (const target of needed) expect(egress).toContain(target);
21 expect(egress.every((e) => e.startsWith(`${host}:`))).toBe(true);
22 });
forge.json +2 −1
@@ -4,5 +4,6 @@
44 "run": "bun run Software/so101/bench/fake-serve.ts",
55 "test": "bun --cwd Software/so101 test",
66 "health": "/status"
7 }
7 },
8 "egress": ["100.89.95.68:8101", "100.89.95.68:8080"]
89 }

Document this in the README: the addresses are pinned to the Pi, and the declaration is inert until an admin grants it (trevato/forge#3437).

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs