Metadata-Version: 2.4
Name: livingproof-health
Version: 1.5.4
Summary: Robot wellness and health observation CLI plugin for Living Proof Labs.
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: click==8.5.1
Requires-Dist: livingproof-common>=1.0.51
Requires-Dist: lz4==4.4.5
Requires-Dist: mcap==1.3.0
Requires-Dist: zstandard==0.25.0
Description-Content-Type: text/markdown

# livingproof-health

Robot wellness and time-indexed health observation plugin for Living Proof Labs.

Try the [offline recorded-replay → scenario demonstration](examples/recorded-replay/README.md)
for portable JSON, exact seeks, a local HTML viewer and a comparison of recorded
height results. The retained G1 viewer was [independently checked in Chromium over
loopback HTTP](https://github.com/Living-Proof-Labs/livingproof-health/pull/12#issuecomment-7057966037).

## Status

The first slice provides time-only health snapshots, an optional recorded base-pose
adapter, deterministic MCAP-to-JSON replay and seek, and explicit scenario height
expectations. See [the contract, fixture provenance, and parity limits](docs/health-snapshots.md).
The [differential evidence harness](docs/parity-evidence.md) compares the actual
pinned scenario evaluator with MCAP-to-Health, including expected disagreements.
[Original recorder evidence](docs/original-recording.md) adds a genuine paired G1
simulation recording, separately from the derived trace fixture.
The [diagnostic sidecar](docs/diagnostic-sidecar.md) measures callback coverage
and exposes a one-step position freshness gap without changing the producer.
The [time-limit experiment](docs/time-limit-evidence.md) empirically confirms
a final integration state with no callback.
Existing validators remain in place: sampled pose does not establish whole-trial
parity or hardware health.

See [bounded MCAP input and output](docs/bounded-replay.md) for default resource
limits, configurable ceilings and atomic `replay --output` behavior. Run the full
suite with `task dev:verify`; adversarial input tests require constrained Docker.

## Design boundaries

- **Time is the only universal assumption.** Individual observations are optional,
  and missing data is never treated as healthy data.
- **No external stack requirements.** The package and command-line plugin work
  without ROS, Foxglove, or paid services, and do not require any particular
  robot or telemetry field.
- **Observations stay separate from policy.** Recorded observations do not
  imply scenario verdicts, universal health thresholds, or safety certification.

## Command-line discovery and usage

`livingproof-health` registers two entry points in `pyproject.toml`:

- Standalone script: `livingproof-health`
- Host plugin under `livingproof.capability.commands`: `health`, invoked as
  `livingproof capability health`

From the prepared development environment (`task setup` first):

```sh
uv run --locked --no-sync livingproof-health --help
uv run --locked --no-sync livingproof-health replay tests/fixtures/simulation-pose.mcap > health.json
uv run --locked --no-sync livingproof-health seek health.json --time-ns 4440000000
uv run --locked --no-sync livingproof-health assess health.json --minimum-m 0.75 --frame-id world
```

The last command returns FAIL (exit 1): the minimum recorded base height is
`0.7464 m`. Equality passes when the configured minimum is `0.7464`.
The same commands are available under `livingproof capability health` when the
host is installed. This is a development fixture path; no image is released yet
(see #4 below). The [fixture documentation](docs/health-snapshots.md) explains why
these results cover recorded samples only. All defined JSON timestamps use decimal
strings so ordinary JavaScript preserves epoch nanoseconds; see the
[lossless wire contract](docs/health-snapshots.md#lossless-timestamps-across-python-and-javascript). Invoking the group without a command
exits 1 and directs the user to help.

## Development setup and verification

### Prepared environment (Python 3.12, uv, Task 3.54.0, and Node.js)

The installed package requires Python `>=3.11`. Development/tests require Python
`>=3.12` because the test-only scenario evaluator requires it (Docker uses `3.12.12`).
The prepared environment also needs
[uv](https://docs.astral.sh/uv/), [Task](https://taskfile.dev) `3.54.0`, and Node.js
22 or later for the JavaScript timestamp regression (Docker and CI pin `22.23.5`).
Node is a development-only dependency; installed Health commands require no JavaScript runtime.

```sh
task setup
task check
# Full tests, including bounded adversarial cases:
task dev:verify
```

- `task setup` runs `uv sync --locked --no-python-downloads`.
- `task check` runs locked Ruff lint and formatting checks.
- `task test` runs locked pytest inside the constrained container and writes `artifacts/tests.xml`.
- `task verify` runs `task check` followed by `task test`.

### Docker and development container

From a host with Docker and Docker Compose (builds the `development` target
from `Dockerfile` with Python `3.12.12`, `uv` `0.12.23`, Task `3.54.0`, and
Node.js `22.23.5`):

```sh
task dev:build
task dev:verify
```

`task dev:verify` explicitly enables the online installed-host integration test
inside Compose; it requires access to the checksum-pinned GitHub releases and
package index. No host environment-variable forwarding is required.

To open an interactive shell inside the development container:

```sh
task dev:shell
```

Inside the resource-constrained Compose/development container (including the updated
`.devcontainer/devcontainer.json`), run `task setup` and `timeout 300 task verify`
directly without nested Docker. Adversarial workers verify the actual cgroup limit.

### Isolated wheel and host plugin verification

`tests/test_host_integration.py` builds a wheel of `livingproof-health`, installs
it alongside the GitHub release wheel for `livingproof` and the PyPI
release of `livingproof-common` from `uv.lock` in a clean virtual environment,
checks dependency consistency with `uv pip check`, and exercises lightweight discovery, `--help`,
`--version`, bash completion, the no-command response, and replay/seek/assessment through the installed package.

Inside that constrained container, run online with the checksum-pinned GitHub host wheel and PyPI dependencies:

```sh
LIVINGPROOF_NETWORK=1 task verify
```

Or offline with the checksum-verified host wheel in a local directory and a warmed
uv cache:

```sh
LIVINGPROOF_WHEEL_DIR=/path/to/wheels task verify
```

Continuous integration builds the local development image on both
`ubuntu-24.04` (`amd64`) and `ubuntu-24.04-arm` (`arm64`), runs the full suite in
constrained Docker, retains per-case resource measurements with JUnit, and checks
workflows with `actionlint`. No adversarial case runs directly on the host.

Test reporting fails verification for missing, malformed, empty, or inconsistent
JUnit evidence and for failed check publication. Each suite must declare its
test count; declared test/failure/error/skip totals must match its cases. Fork
PRs explicitly disable check publication where write permissions are unavailable;
the job summary and retained JUnit artifact remain the evidence for those runs.

### Deferred infrastructure adoption

The development image has not been published. CI builds it locally on the Ubuntu runners,
and the development container builds the local Dockerfile.
[Issue #4](https://github.com/Living-Proof-Labs/livingproof-health/issues/4) tracks
image publication and migration of CI/development containers to a shared
multi-architecture digest.

The generated manual and GitHub Pages adoption are not complete.
[Issue #5](https://github.com/Living-Proof-Labs/livingproof-health/issues/5) tracks
generation, scoped deployment authorization, and live verification before adding
a README start-here link. Bootstrap #2 makes no settings or deployment changes.

## License

[Apache-2.0](LICENSE).
