Skip to content

cables.gl PCHI relay — HTTP/WebSocket translation for a browser-sandboxed tool - #10

Merged
vdmo merged 1 commit into
mainfrom
feat/cables-pchi-relay-final
Sep 30, 2026
Merged

vdmo merged 1 commit into
mainfrom
feat/cables-pchi-relay-final

Conversation

@vdmo

@vdmo vdmo commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

Third PCHI integration this session, alongside Resolume (#3) and TiXL (#6, #8). cables.gl (562-star open-source browser-based node/patch tool) runs in a browser sandbox — no raw UDP, which is what the Conductor's control-update path requires. Unlike TiXL's native operators (#8), this needs a relay:

cables (fetch POST)  --HTTP-->  this relay  --raw JSON UDP-->  PCHI Conductor   (control updates)
PCHI Conductor  --WebSocket-->  this relay  --WebSocket-->  cables            (governance telemetry)

The governance-telemetry leg needed zero new protocol work: confirmed from a real official example (cables-gl/websocket-example) that cables already ships a working WebSocket-receive op against a plain ws server. This relay's cables-facing WS server is deliberately that same shape.

Requires #5 on the Conductor for governance telemetry; control updates work regardless.

A real mistake found and fixed along the way

Building this surfaced that the Heartbeat-exclusion fix — originally meant to land in #5 — had never actually made it into main. I'd pushed it as a second commit onto that PR's branch and reported it as included; the merged PR only ever contained the first commit (confirmed via the GitHub API: commitCount: 1). Live-testing this relay reproduced the exact duplicate-DENY bug the fix was supposed to eliminate. Re-landed as #9 (please merge that one too, or first — this PR doesn't depend on it, but the bug it fixes is real and currently live on main).

Test plan

  • Outbound: a real POST /pchi/control, with an explicit OPTIONS preflight check (Access-Control-Request-Method/-Headers, exactly what a browser sends before a JSON POST — not just a bare curl that skips CORS enforcement entirely) — both return the right Access-Control-Allow-* headers, and the actual update reaches the Conductor and is applied.
  • Inbound: a real DENY, broadcast by the Conductor, relayed, and received by a real external WS client with the documented enriched shape.
  • Re-verified after re-landing Fix: heartbeat-exclusion fix never actually made it into main (process mistake, re-landing it) #9's fix: 22s, 4+ relay heartbeat cycles, 1 receipt (not 5).
  • Not tested against real cables.gl — see README for exactly what is and isn't independently confirmed.

🤖 Generated with Claude Code

Third PCHI integration this session, alongside Resolume (#3) and TiXL
(#6, #8). cables.gl (https://github.com/cables-gl/cables, 562-star
open-source browser-based node/patch tool) runs in a browser sandbox,
which can't open the raw UDP socket the Conductor's control-update path
requires — so unlike TiXL's native operators, this needs a relay: HTTP
in (cables can always fetch()) -> raw JSON-over-UDP out to the
Conductor, and the Conductor's real governance-event WebSocket ->
relayed straight through to a WebSocket server cables can connect to
directly.

The governance-telemetry leg needed zero new protocol work: confirmed
from a real official example (cables-gl/websocket-example) that cables
already ships a working WebSocket-receive op against a plain `ws`
server — this relay's cables-facing WS server is deliberately that same
shape, not something invented for this integration.

Requires #5 (WS accept-loop fix) on the Conductor for governance
telemetry; control updates work regardless.

## A real mistake found and fixed along the way

Building this surfaced that the Heartbeat-exclusion fix (originally
meant to land in #5) had never actually made it into main — I'd pushed
it as a second commit onto that PR's branch and reported it as included,
but the merged PR only ever contained the first commit. Live-testing
this relay reproduced the exact duplicate-DENY bug the fix was supposed
to have eliminated. Re-landed as #9, cherry-picked cleanly, re-verified
live against this relay specifically (22s, 4+ heartbeat cycles, 1
receipt instead of 5) before writing this commit.

## Verification

Live, both directions, against a real Conductor:
- Outbound: a real POST (with an Origin header, and an explicit OPTIONS
  preflight check with Access-Control-Request-* headers — not just a
  bare curl a browser's CORS enforcement wouldn't accept) reaches the
  Conductor and is applied.
- Inbound: a real DENY is broadcast by the Conductor, relayed, and
  arrives at a real external WS client with the documented enriched
  shape (flattened gate_state/receipt_id/tool plus the full raw event).

Not tested against real cables.gl itself — the WebSocket-receive shape
is confirmed from a real official example; the HTTP-request op and
message parsing on the cables side are not independently confirmed the
way TiXL's operators were confirmed against real compiled source.
README states this plainly.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@vdmo
vdmo merged commit e957117 into main Sep 30, 2026
1 check passed
@vdmo
vdmo deleted the feat/cables-pchi-relay-final branch September 30, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant