fix(flows): auto-pick free ports in flow-11, auto-load .env in lib.sh#371
fix(flows): auto-pick free ports in flow-11, auto-load .env in lib.sh#371
Conversation
- `flows/lib.sh`: source `.env` (if present at `OBOL_ROOT`) with `set -a`, so `REMOTE_SIGNER_PRIVATE_KEY` and any `FLOW*_PORT` / `FLOW*_URL` overrides can be persisted per-checkout instead of re-exported every invocation. Existing shell exports win. - `flows/lib.sh`: promote `is_port_listening`, `require_ports_free`, `pick_free_port` to shared helpers. - `flows/flow-11-dual-stack.sh`: default all 8 Alice/Bob ingress ports to `pick_free_port` instead of `80/8080/443/8443` and `9080/9180/9443/9543`. Explicit `FLOW11_*_PORT` env vars still win. Drop the duplicate helper bodies (now in `lib.sh`). This eliminates the "guess non-conflicting ports" step when running dual-stack alongside another cluster on the same machine.
Flow-11 dual-stack — full green on the first try with auto-picked portsRan Auto-picked ports (no env overrides, no FLOW11_*_PORT set):
Zero collision with the already-running cluster on the canonical ports. This is the first time I've run dual-stack without manually computing non-conflicting port numbers. Result: 42/42 steps passed. Notable real on-chain evidence from the run:
Caveat: Kicked off one false-start first runOn the very first invocation the docker.io mirror had never pulled `cloudflare/cloudflared` before. The hard-coded 30 s rollout timeout in `internal/tunnel/tunnel.go:203` fired, `obol sell http` silently skipped the ERC-8004 registration step (because it's nested inside the tunnel-success branch in `cmd/obol/sell.go:711-733`), and flow-11 hit `FAIL: [18] Alice: ServiceOffer Ready`. Killed that run, deleted the dead cluster, and rerun — the second run hit the now-cached `cloudflared` image and everything flowed. Filing this as a separate follow-up PR since it's orthogonal to auto-ports. /cc |
Summary
Two related quality-of-life fixes for the flow-test suite:
Why
Running flow-11 alongside another cluster on the same machine used to require manually picking and exporting 4–8 non-colliding ports, and Claude Code ended up guessing them every time. With auto-pick, dual-stack runs just work without planning. The `.env` auto-load is a natural complement: pin a specific port once for reproducibility without re-exporting it every session.
Behavior
Test plan