# Task 3 evidence — append-only check-in CLI

## Scope

- Implemented only under `/home/cube/.hermes/profiles/physique-coach/workspace/checkin_cli`.
- Runtime data remains profile-local at `/home/cube/.hermes/profiles/physique-coach/data`.
- Historical source Markdown was read only; imported events contain only source path, SHA-256, range label, and stable `D+` heading anchor. No source body was copied.

## TDD evidence

1. Red: `python3 -m pytest -q` before implementation exited 2 with `ModuleNotFoundError: No module named 'checkin_cli'`.
2. Green: `python3 -m pytest -q` after implementation: `8 passed in 0.03s`.

## Executed scenarios

| Scenario | Command surface | Observed result |
| --- | --- | --- |
| Valid check-in | `record` with weight 70.2 kg, sleep 7.5 h, calories 2400 kcal | `recorded`; one eligible current-state value |
| Malformed weight | `record` with `체중 7O kg` | `needs_clarification`; no trend value |
| Negative/missing intake | parametrized pytest inputs | `needs_clarification`; no trend value |
| Duplicate Telegram message | same `message_id` submitted twice | `duplicate`; event count remained one |
| Correction | `record --supersedes <event_id>` | original excluded; corrected 70.0 kg is the sole current value |
| Urgent safety | `record` with `가슴 통증` | `urgent_safety`, `chest_pain` flag, no trend value |
| Private raw archive | `stat` after CLI invocation | raw payload directory `700`; payload files `600` |
| History provenance | `import-history` for the three supplied files | 28, 77, and 52 immutable provenance events appended; manifest artifacts are `600` |

## Commands run

```text
cd /home/cube/.hermes/profiles/physique-coach/workspace/checkin_cli
python3 -m pytest -q
python3 -m checkin_cli.cli --home <temporary-700-directory> record ...
python3 -m checkin_cli.cli --home /home/cube/.hermes/profiles/physique-coach/data import-history --source <each supplied D1-D123 source> --range-label <range>
```

The final test run passed: `8 passed in 0.03s`.

## Contract-regression repair

The profile's canonical `contracts/checkin-event.schema.json` was added as a regression oracle.

1. Red: `python3 -m pytest -q` reported four expected failures: emitted-event schema violations and absent unknown/self/cyclic `supersedes` rejection.
2. Green: `python3 -m pytest -q` passed `12 passed in 0.05s` after canonical serialization and reference validation.
3. Existing profile-local `data/events.jsonl` was mechanically migrated from the earlier task-local shape to canonical schema records without copying historical source bodies. Independent validator result: `events=157 schema_errors=0`.

The regression suite now validates every emitted event with `jsonschema.Draft202012Validator`, and has explicit unknown, deterministic self-reference, and pre-existing graph-cycle rejection cases.
