# 6400 HTH migration This repository was created with `git subtree split --prefix=host` from the Host-bearing `origin/dev` history. Split tip: `cf5fa387f273ec1a8254d2d7f8ed3bf131865122`. It is not a copy presented as preserved history. The existing door-percent API remains migration/Legacy code. The 6400 path imports the generated target/ACK/snapshot contract and exposes `set_target`, `stop`, `get_snapshot`, `capture_snapshot`, and Identification-only `run_stimulus` through the existing gRPC-over-UDS service boundary. Only `hthd` opens a serial path. Lab and notebooks must use the Python SDK. Hardware, COM, and real UART validation are NOT RUN. ## Runtime boundary Use one of the strict example configurations: - `deploy/examples/hthd.6400-mock.yaml` - `deploy/examples/hthd.6400-replay.yaml` - `deploy/examples/hthd.6400-serial.yaml` `product: 6400-front-rear-v1` selects the autonomous thermal path without enabling the Legacy poller, lease, SET_ALL heartbeat, or Host watchdog. `thermal.firmware_profile` is `production`/`6400-control` or `identification`/`6400-identification`. Production firmware and the production mock reject stimulus. The daemon holds one global transaction lock. SET_TARGET waits for wire ACK `0x81`, GET_SNAPSHOT waits for response `0x82`, and Identification stimulus waits for ACK `0x83`. A successful command result means the CPLD committed the command; it never means that the requested temperature was reached. The observe and control services remain on different UDS endpoints: ```text observe socket: ThermalObserveService.GetSnapshot / CaptureSnapshot control socket: ThermalControlService.SetTarget / Stop / RunStimulus ``` The snapshot response preserves the exact generated 193-byte wire payload in `raw_payload` and also exposes decoded fields. Offsets and command values come from `contracts/6400`; do not duplicate them in clients. ## CLI examples with the mock backend Start `hthd` with the mock example, then run: ```bash hthctl --observe-sock /tmp/hth-6400-mock/observe.sock --device prod2u-6400-0 thermal-snapshot hthctl --observe-sock /tmp/hth-6400-mock/observe.sock --control-sock /tmp/hth-6400-mock/control.sock --device prod2u-6400-0 --target 65 set-target hthctl --observe-sock /tmp/hth-6400-mock/observe.sock --control-sock /tmp/hth-6400-mock/control.sock --device prod2u-6400-0 stop hth-capture --thermal --observe-sock /tmp/hth-6400-mock/observe.sock --device prod2u-6400-0 --out /tmp/hth-6400-capture --duration 10s --period 200ms ``` Thermal capture writes length-prefixed `raw-frames.bin`, `thermal-snapshots.jsonl`, `run.json`, and `checksums.sha256` without opening serial itself. `run-stimulus` requires an explicit JSON file containing `duration_seconds`, exactly 24 `ptc_duty` values, four `front_fan_duty` values, and four `rear_fan_duty` values. It is valid only with Identification firmware. The CLI still requires `--i-understand-this-is-real-hardware` for any mutating command when `ListDevices` reports a serial backend; this flag does not authorize this repository's tests to touch hardware. ## Python SDK The Legacy five-symbol top-level facade remains unchanged. Import the 6400 client explicitly: ```python from hth_sdk.thermal import connect_thermal with connect_thermal( device_id="prod2u-6400-0", observe_socket="/tmp/hth-6400-mock/observe.sock", control_socket="/tmp/hth-6400-mock/control.sock", ) as hth: hth.set_target(65) snapshot = hth.capture_snapshot() assert len(snapshot.payload) == 193 hth.stop() ``` The SDK uses synchronous gRPC over UDS and contains no serial open path. ## Replay format Replay is strict JSONL. Each nonblank line contains exactly one JSON object and exactly one of: ```json {"payload_hex":""} {"error":"crc"} {"error":"timeout"} ``` Unknown fields, trailing JSON values, unknown error names, malformed hex, and wrong payload lengths are rejected when the backend opens. Replay is observe-only; target, stop, and stimulus return failed-precondition through gRPC.