# DualCoach Task 8 Evidence

## Verdict

PASS — one final check-in and one recoverable `generation_pending` job now share a
durable prepared/committed journal boundary. Crash, duplicate, malformed, stale, and
zero-delivery behavior is independently verified.

## Reused behavior and exact gap

Reused:

- canonical check-in event persistence and deduplication;
- Task 7 generation state machine, digest chaining, locks, and atomic replacement;
- separation between generation, approval, and explicit customer delivery.

Confirmed gap:

- final check-in persistence previously preceded `draft-requests.json`;
- `generation_pending` was created only when a worker claimed the request;
- a crash between those writes could leave a finalized check-in without a recoverable
  generation job.

Rejected extras:

- worker redesign;
- speculative abstraction;
- convenience or customer-facing feature work;
- future scaffolding;
- unrelated refactoring or whole-file type-debt cleanup.

## Failing-first and implementation receipt

Executor `st_019fe1fc` added the deterministic post-finalization request-write crash test
first. Baseline failed with no generation history where one `generation_pending` record
was required.

Minimal owning-seam delta:

- `gateway/platforms/nutrition_coaching.py`
  - typed prepared/committed finalization journal;
  - fail-before-finalization when journal preparation fails;
  - restart reconciliation to exactly one request and pending generation record;
  - idempotent duplicate and stale/malformed fail-closed behavior;
  - exact callback/customer and journal-record type narrowing.
- `tests/gateway/test_nutrition_coaching.py`
  - deterministic pre/post-commit crash, restart, malformed journal, cancellation,
    duplicate, and zero-delivery coverage.

## Acceptance evidence

- Crash before commit: no finalized event, request, generation record, journal residue,
  provider work, or delivery.
- Crash after finalization: restart reconciles `prepared -> committed`, persists one
  request, and records exactly one `generation_pending` state.
- Duplicate finalization and stale replay: rejected; request and journal bytes remain
  unchanged; no second job.
- Prepared-but-unfinalized restart: no request or generation job.
- Malformed journal: recovery and replay fail closed.
- Customer delivery and provider generation remain zero.

## Candidate identity

Authoritative 67-path candidate manifest:

- `.omo/evidence/dualcoach-candidate-manifest.json`
  SHA-256 `4d78662bfb4b48ed0b9d2f6f4d875a6dc49e1a2e1ebfadfda6ddc7d193226a2d`
- `.omo/evidence/dualcoach-candidate-manifest.md`
  SHA-256 `b1f0e4edb4dab8fc6d173505e105fc9a8a2b2a246cfad6047ffa255bc64221b2`
- Candidate digest:
  `c849dffdcf2570eb051d62d6f8bca32bac8d3d22924c49910ae0aa6e3d672550`
- Algorithm: paths sorted by UTF-8 bytes; append path bytes, NUL, exact file bytes,
  NUL; SHA-256 over the concatenation.
- `gateway/platforms/nutrition_coaching.py`:
  `3f1536e98ae0b669f9e67f0e01a7c6c9269b329e9f225b43b736a6a753904adf`
- `tests/gateway/test_nutrition_coaching.py`:
  `9c68739ad36a0614024b069e836e31ce31b95dbd857e48b481a00c7a5d457ca8`

JSON stored digest, Markdown header, Markdown verification digest, and independently
recomputed live digest are identical. No stale prior digest remains.

## Automated verification

Independent verifier `st_019fe206`: CONFIRMED.

- Task 8-owned `ty` intersections: 0.
- Former journal and customer narrowing findings: closed.
- Focused atomicity/no-provider tests: PASS.
- Full focused regression receipts include 122 nutrition tests, 114 Telegram physique
  tests, and 37 Task 7 hardening tests.
- Ruff: PASS.
- `py_compile`: PASS.
- `git diff --check`: PASS.
- New Task 8 delta contains no `Any`, cast, ignore, or suppression.
- Remaining whole-file diagnostics are unrelated pre-existing debt.

## Real-surface and adversarial verification

Independent manual QA `st_019fe207` and reviewers `st_019fe208`: CONFIRMED.

- Actual imported coordinator used with isolated no-network state.
- Post-finalization injected failure recovered on restart to one pending job.
- Duplicate replay was rejected with stable bytes.
- Missing/customer-null callback failed closed.
- Malformed and stale journal paths made no request, generation, provider, or delivery
  side effect.
- Provider calls: 0.
- Customer deliveries: 0.
- Temporary probe roots were discarded.

## Cleanup and non-touch

- No commit, push, reset, stash, clean, release activation, network/provider/Telegram
  call, customer activation, or customer delivery.
- Runtime journal/job artifacts retained after QA: 0.
- Temporary Task 8 files retained: 0.
- Unrelated dirty files, including `bluebubbles.py`, were preserved.

