DDR-0029: E27 api_link Transport Asymmetry (Unframed Outbound, Framed Encrypted Inbound)

Status: Accepted
Date: 2025-01-xx

Context
-------
During E27 panel linking, the api_link exchange exhibits asymmetric transport behavior:

- The client sends api_link as unframed, clear JSON
- The panel responds with a framed, encrypted schema-0 message

This behavior was verified empirically against live E27 hardware, confirmed via Node-RED reference flows, and validated by pytest-based unit tests.

Earlier assumptions that api_link was framed bidirectionally resulted in protocol failures.

Decision
--------
The implementation SHALL:

- Send api_link requests:
  - Unframed
  - Clear JSON
  - Over the raw TCP stream

- Receive api_link responses:
  - Framed using E27 framing rules
  - Encrypted using schema-0
  - Containing link-level credentials (link key and link HMAC)

This asymmetry is intentional protocol design and MUST be preserved.

Consequences
------------
- Session logic must explicitly switch transport modes across the api_link boundary
- Framing must be enabled before decrypting the api_link response
- Session state machines must tolerate a framed response immediately following an unframed request
- Refactors must not "normalize" api_link framing behavior

Related
-------
- ADR-010x (E27 crypto and session semantics)
- DDR-0024 (Session lifecycle states)
- DDR-0030 (Key lifetime separation)
- Tests: test_e27_session.py, test_e27_roundtrip.py
