fix(backend): the realtime transport is wss-only; the RPM requires the CA #4
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/fleet-tls-piece-4-sailfish"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fix(backend): the realtime transport is wss-only; the RPM requires the CA
Piece 4 (final piece) of the fleet TLS-only transport design —
docs/superpowers/specs/2026-10-14-fleet-tls-only-design.md(root repo). Theplan this implements:
docs/superpowers/plans/2026-10-14-fleet-tls-piece-4-sailfish-enforcement.md.The defect (shared by three repos)
TLS material was optional and its absence silently degraded the realtime
transport to plaintext
ws://. In this repo,qml/py/backend.pyresolved a CAas argument →
STARFLEET_CA_BUNDLE→qml/py/starfleet-ca.pem, and when allthree missed it set
ssl=Noneand dialledws://. On 2026-10-14 that failuremode cost a debugging session: the attached ESP32 died at the WebSocket upgrade
because the server served
wss://while the client spoke plaintext, and aplaintext upgrade into a TLS listener is closed with zero bytes.
What changes
The client is wss-only (
qml/py/backend.py). The CA is resolved once, beforeany connection attempt. A CA that resolves to nothing is a hard connect error
naming
STARFLEET_CA_BUNDLE; a CA that is unreadable or unloadable still abortsexactly as before.
schemeis deleted — the URL is now awss://literal andssl_ctxis always a realSSLContextby the time the loop runs, so there is nobranch left that can produce
ws://orssl=None, including on the automaticreconnect.
A blank error is now an error (
_describe_connect_error). Pointing thisclient at a plaintext server raises
ConnectionResetError()with no arguments,whose
str()is empty — the UI would have shown a silent failure. The messagefalls back to the exception's type name.
The test suite stops relying on the plaintext default. One module-scoped
autouse fixture gives every backend test a single ephemeral throwaway CA minted
with
openssl, and the real-server fixtures now serve TLS from a leaf signed byit — the design's "ephemeral, in-test self-signed certificate", never the shared
dev set. The test asserting the old plaintext behaviour was inverted, not
deleted. Two tests were added for the cases the design's invariant implies:
a plaintext server with a CA configured, and a CA path that is a directory.
The package step requires the CA (
src/src.pro). The install wasexists()-guarded, so an RPM built withoutqml/py/starfleet-ca.pemshipped anapp that aborts on first connect. A missing CA is now a qmake
error()namingthe path.
tests/test_packaging.pypins that structurally, because qmake and theSailfish SDK are not runnable on the host — it is a complement to the SDK build,
never the enforcement.
Dev runs use the shared dev set, either via
STARFLEET_CA_BUNDLE=$HOME/dev/starfleet/.dev-trust/ca.pemor by copying it to
qml/py/starfleet-ca.pembefore packaging (the dev set'sserver.pem/server.keyare what thecomputerserver serves).Verification
opensslis now needed by most of the suite (it was already needed by the twohandshake tests);
AGENTS.mdsays so.Whole-branch review by a fresh reviewer: no Critical, no Important; it
re-ran the changed tests against the pre-change tree in a throwaway copy and
confirmed the Review Focus tests genuinely go red on regression. Four Minor
findings were deferred, not fixed (see the PR discussion / the executor ledger).
Notes
esp32 enforcement (#17) →
computerenforcement (#19/#20) → sailfish.qml/py/starfleet-ca.pemstays gitignored and is never committed.main— this repo has nodevel.