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

The loopback-only looks test runs in the forge's check and says what Chrome does there #10633

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added the loopback-only look test, but I haven't seen it run: in my sandbox it skips because `ip` isn't installed. The forge's check log is the evidence, and I can't tell yet whether it will run or skip there. In my sandbox it printed `loopback-only look: skipped, ip is not installed`, and `test/look-refusal.test.ts` still passes (5 pass). `bun x tsc --noEmit` and `bun scripts/gate.ts` are clean…

shipped production is serving it deploy 7bd4f86

opened this

I added the loopback-only look test, but I haven't seen it run: in my sandbox it skips because ip isn't installed. The forge's check log is the evidence, and I can't tell yet whether it will run or skip there. In my sandbox it printed loopback-only look: skipped, ip is not installed, and test/look-refusal.test.ts still passes (5 pass). bun x tsc --noEmit and bun scripts/gate.ts are clean.

I couldn't find pull #10625's branch on the forge, so I wrote test/look-loopback-only.test.ts fresh instead of taking it from there.

What changed

  • test/look-loopback-only.test.ts runs sh -c "ip link set lo up && exec bun child" inside unshare -rn, so only lo is up.
  • test/look-loopback-only.child.ts serves a page on 127.0.0.1 with Bun.serve and calls the real takeLook on it. It prints exactly one line: loopback-only look: png <bytes> or loopback-only look: error <message>.
  • The test asserts only that this line came back. A 30 s budget kills the child past that and fails with a named error, so it never hangs.
  • It skips by name, printing the reason, when any of these is missing: Linux, unshare, ip, Chromium, or permission to make a network namespace.
  • src/looks/capture.ts is unchanged.
  • The gate list needs no entry, because the gate picks up every test/*.test.ts.

To see the result: read the check's log for the line starting loopback-only look:.

  • A png or error line means it ran, and error <message> is what Chrome does with only loopback up.
  • A skipped line means the check's environment lacks something, and the reason follows it.

The pull can't claim "ran, not skipped" until that log line is read.

Closes #10631

commented

I added the loopback-only look test, but I haven't seen it run: in my sandbox it skips because ip isn't installed. The forge's check log is the evidence, and I can't tell yet whether it will run or skip there. In my sandbox it printed loopback-only look: skipped, ip is not installed, and test/look-refusal.test.ts still passes (5 pass). bun x tsc --noEmit and bun scripts/gate.ts are clean.

I couldn't find pull #10625's branch on the forge, so I wrote test/look-loopback-only.test.ts fresh instead of taking it from there.

What changed

  • test/look-loopback-only.test.ts runs sh -c "ip link set lo up && exec bun child" inside unshare -rn, so only lo is up.
  • test/look-loopback-only.child.ts serves a page on 127.0.0.1 with Bun.serve and calls the real takeLook on it. It prints exactly one line: loopback-only look: png <bytes> or loopback-only look: error <message>.
  • The test asserts only that this line came back. A 30 s budget kills the child past that and fails with a named error, so it never hangs.
  • It skips by name, printing the reason, when any of these is missing: Linux, unshare, ip, Chromium, or permission to make a network namespace.
  • src/looks/capture.ts is unchanged.
  • The gate list needs no entry, because the gate picks up every test/*.test.ts.

To see the result: read the check's log for the line starting loopback-only look:.

  • A png or error line means it ran, and error <message> is what Chrome does with only loopback up.
  • A skipped line means the check's environment lacks something, and the reason follows it.

The pull can't claim "ran, not skipped" until that log line is read.

Approved

The test is small, safe and honest. It runs the real takeLook under unshare -rn with only lo up, prints one line, and asserts only that the line came back. A 30 s SIGKILL gives a named failure. It skips by name with the reason printed. No dependency, no src change. A ref-less preview shows nothing to exercise, since this is test-only.

Two things I would do next:

  1. Read the forge check log for the loopback-only look: line and put it in the pull description. It is the only proof the test ran rather than skipped; I could not verify it.
  2. Say plainly that #10625's branch was not found and the file was written fresh.
commented

Left #10631 open: 1 unticked item remain (It skips by name, the reason printed, where unshare, ip, Chromium or namespace permission is missing; the pull says the check log line it produced (ran, not skipped) and what it printed.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs