# Task 4 - Explicit Customer and Staff Addresses

## Verdict

**PASS** - independent verifier `st_019fd7e6`.

Candidate baseline digest:
`19ed0e9232e240553b9a96a2e6a33d10f1096be49e5ebafc019287d75984e45c`.

Changed paths:

- `gateway/platforms/telegram_nutrition_addresses.py`
- `gateway/platforms/telegram_room_bootstrap_registration.py`
- `tests/gateway/test_telegram_nutrition_addresses.py`
- `tests/gateway/test_telegram_room_bootstrap_registration.py`

## Failing-first evidence

1. Address module absent:
   `.venv/bin/python -m pytest tests/gateway/test_telegram_nutrition_addresses.py -q`
   failed during collection with `ModuleNotFoundError:
   gateway.platforms.telegram_nutrition_addresses`.
2. Membership readiness API absent:
   the same command failed with missing `AddressReadinessError`.
3. Private registration persisted noncanonical topic `1`:
   the focused registration test failed because expected topic `0` but observed `1`.

## Automated verification

- `scripts/run_tests.sh tests/gateway/test_telegram_nutrition_addresses.py
  tests/gateway/test_telegram_room_bootstrap_registration.py`
  - PASS: `28/28`.
- Ruff on all four changed files:
  - PASS: `All checks passed!`
- BasedPyright on all four changed files:
  - PASS: `0 errors`.
  - New address source/test: `0 warnings`.
  - Existing registration source/test: `127` pre-existing warnings; the task reduced
    the prior observed total of `128` and introduced no new error.
- `git diff --check` on changed paths:
  - PASS.

## Observable behavior

- Customer delivery accepts only private Telegram chat IDs and canonical topic `0`.
- Absent, null, integer `0`, and persisted string `"0"` normalize to integer `0`.
- Group/supergroup/channel or nonzero customer topic fails with Bot-DM migration text.
- Trainer, owner, and operator review addresses retain trusted typed roles.
- Bool/malformed IDs and untrusted `role` metadata fail at the parse boundary.
- Shared-topic legacy data reports both required corrections: move delivery to the
  customer Bot DM and remove the customer from the staff review group.
- Customer membership in a configured staff chat raises typed readiness failure.
- Private registration calls the typed parsers and persists customer/trainer DM topic
  `0`, including the consent route.

Manual driver output included:

```text
DM CustomerPrivateDeliveryAddress(user_id=200, chat_id=200, topic_id=0)
STAFF StaffReviewAddress(role=TRAINER, user_id=201, chat_id=-100123, topic_id=71)
GROUP_REJECTED
MEMBERSHIP_REJECTED
LEGACY_REJECTED
PASS task-4 manual driver
```

## Scope boundary and cleanup

- Task 5 still owns customer-DM onboarding/publication migration.
- Task 6 still owns live activation and membership gate integration.
- No temp files, processes, credentials, customers, gateway runtime, activation, or
  Telegram delivery were created.
- No commit, push, reset, stash, clean, checkout, or restore was used.
