Skip to content

Commit beb63f4

Browse files
RJK134claude
andauthored
docs: refresh current-state to Phase 47 (KI-031 resolved) (#267)
- CLAUDE.md: add the Phase 47 bullet (KI-031 24h-window wired), bump phase history 0–46 → 0–47, and move KI-031 out of the active range (resolved). - docs/BUILD_PLAN.md: add the Phase 47 entry. - .claude/memory.md: 2026-06-17 note — KI-031 delivered; no pure-code backlog items remain (rest is external-only or recommended-against). Docs only; no code or schema. Final merge left to Richard / Freddie. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3931e8d commit beb63f4

3 files changed

Lines changed: 42 additions & 1 deletion

File tree

.claude/memory.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Append discoveries as you find them. Read this file at session start. Keep
44
entries short: date, what, why.
55

6+
## 2026-06-17 — Phase 47 KI-031: WhatsApp 24h-window confirmation check (#266, merged)
7+
8+
- Delivered the last code-deliverable backlog item. `confirmation.service.ts` `shouldUseTemplate()` was DEMO-only (`TODO(prod)` → free text always). Now in production it queries the most-recent INBOUND WhatsApp `EnquiryMessage` for the enquiry → approved template when ≥24h old or absent, free text only inside the window; demo unchanged; no-enquiry → template. Pure `requiresTemplate(lastInboundAt, now)` helper exported + unit-tested (exact-24h boundary) + an outside-window behaviour test; suite 2,835→2,839. Dormant until the live Meta path is on, but logic is correct + tested. KI-031 resolved.
9+
- Backlog after this: NO pure-code items left. Remaining = external-only (Meta verify / n8n host / Vetup API — not code, runbooks exist) + invoicing tail (multi-currency/recurring = recommended against for a single-CHF practice; refunds-of-received-money = deliberate Phase 41 exclusion, build only on explicit request).
10+
611
## 2026-06-16 — Phase 46 KI-016 O: intake→completion e2e ("demo spine") (branch `feature/46-intake-completion-e2e`)
712

813
- TEST/CI/DOCS only — zero product/runtime code changed; the spine was already correctly wired and now `__tests__/e2e/intake-to-completion.test.ts` proves it against a real DB. Gate green (lint/tc/prisma/2835 unit/build) + e2e 2 tests pass, idempotent across 3 reruns.

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Primary repo: `RJK134/Equismile`
1414
- **Auth:** email + password (Auth.js Credentials, JWT); persona cards = active `Staff` rows with a `passwordHash`, so prod must be migrated + seeded or there are no logins. Temp password `EquiSmile2026!` (re-seeding resets it). Five credential logins: Kathelijne (admin/practitioner), Natacha + Margaux (vets, fr) and Patrick Vangele + Richard Knapp (system admins, en).
1515
- **Phase 45 (feature wave, #260) merged to `main`:** vet geolocation opt-in (KI-016 L — server-authoritative route origin + 30-min staleness), customer stable self-update (D-1 — vet pre-confirm-gated `StableUpdateRequest``/admin/stable-updates`, the app's only customer-initiated write), §16 correction-learning (vet draft edits → few-shot examples), and a `/reports` total-billed fix (exclude DRAFT/SUPERSEDED/CANCELLED). Additive migration `20260613120000_phase45_feature_wave`. Built via parallel git-worktree agents + an adversarial multi-agent review; two low findings accepted (KI-029 dedupe race, KI-030 correction-example language scoping).
1616
- **Phase 46 (#263) merged to `main`:** **KI-016 O** — a real-database **intake→completion e2e test** (the "demo spine") driving the actual services end-to-end (intake → triage → route proposal → vet approval → booking → confirmation → completion → follow-up regeneration) plus the URGENT/automation-hold exclusion path; confirmed the pipeline connects with **no integration bug**. Isolated `vitest.e2e.config.ts` (excluded from the mocked unit suite, gated by `RUN_DB_E2E`) + an additive CI `e2e` Postgres-service job; demo script `docs/PHASE_46_KI_016_O_DEMO_WALKTHROUGH.md`. No product-code/schema change. New **KI-031** (confirmation 24h-window check DEMO-only/`TODO(prod)`, Meta-gated). Rebuilt with clean history from the closed #261 to clear a GitGuardian flag on an ephemeral CI service-container password.
17-
- Phase history 0–46: `docs/BUILD_PLAN.md`. Active issues/caveats: `docs/KNOWN_ISSUES.md` (KI-013…KI-031; KI-008/KI-015/KI-017 resolved in the 41–44 wave; KI-016 L closed in Phase 45; KI-016 O closed + KI-031 logged in Phase 46). MVP scope: `docs/SCOPE_CLARIFICATIONS.md`. Contract `docs/CONTRACT_DRAFT_v3.md` (FH-ES-2026-005); costs `docs/RUNNING_COSTS.md`; support `docs/SUPPORT_MODEL.md`.
17+
- **Phase 47 (#266) merged to `main`:** **KI-031 resolved** — the confirmation service's `shouldUseTemplate()` now honours WhatsApp's 24-hour customer-service window in production (queries the most-recent INBOUND WhatsApp `EnquiryMessage` for the enquiry; approved template when ≥24h old or absent, free text only inside the window; demo mode unchanged). Decision extracted into a pure, unit-tested `requiresTemplate(lastInboundAt, now)` helper + an outside-window behaviour test (unit suite +4). Dormant until the live Meta path is enabled, but the logic is now correct + tested. No schema change.
18+
- Phase history 0–47: `docs/BUILD_PLAN.md`. Active issues/caveats: `docs/KNOWN_ISSUES.md` (KI-013…KI-030; KI-008/KI-015/KI-017 resolved in the 41–44 wave; KI-016 L closed in Phase 45; KI-016 O closed in Phase 46; KI-031 logged in Phase 46 and resolved in Phase 47). MVP scope: `docs/SCOPE_CLARIFICATIONS.md`. Contract `docs/CONTRACT_DRAFT_v3.md` (FH-ES-2026-005); costs `docs/RUNNING_COSTS.md`; support `docs/SUPPORT_MODEL.md`.
1819
- **CI — self-built BugBot now WORKS.** The repo "BugBot PR Review" GitHub Action (`anthropics/claude-code-action`) used to fail red with "Invalid API key"; the `ANTHROPIC_API_KEY` repo secret was set 2026-06-12 and it now reviews green end-to-end (verified live on #249 and the Phase 41–44 PRs). The substantive AI review remains the hosted **Cursor Bugbot** (`cursor[bot]`) — treat its Medium+ findings as real and fix before merge. Real merge gates: `check` (typecheck/lint/test/build), `docker`, `security`, GitGuardian. See KI-026/KI-027.
1920
- **Latest session handover (2026-06-13):** `docs/HANDOVER_2026-06-13.md` — full state after the Phase 41–44 wave, the chosen next build (feature-wave deferral backlog), external blockers, env gotchas, and a copy-paste prompt for the next chat instance. (Prior: `docs/HANDOVER_2026-06-12.md`.)
2021

docs/BUILD_PLAN.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# EquiSmile Build Plan
22

3+
## Phase 47 — KI-031: WhatsApp 24h-window confirmation template check (2026-06-17)
4+
5+
### Why
6+
7+
KI-031 (logged in Phase 46): `confirmation.service.ts` `shouldUseTemplate()` was
8+
**DEMO-only** — in production it fell through to free text unconditionally (a
9+
`TODO(prod)`), which Meta rejects outside the 24-hour customer-service window. The
10+
last code-deliverable backlog item; closes the loose end so a live WhatsApp send
11+
behaves correctly the day Meta verification lands.
12+
13+
### Scope & deliverables (one PR, #266)
14+
15+
- `shouldUseTemplate(enquiryId)` (production path) queries the most-recent
16+
**INBOUND WhatsApp** `EnquiryMessage` for the enquiry and uses the approved
17+
template when it is **≥24h old or absent**; free text only within the window.
18+
Demo mode still always templates; a confirmation with no linked enquiry →
19+
template (no conversation to anchor the window to).
20+
- Decision extracted into a pure `requiresTemplate(lastInboundAt, now)` helper,
21+
unit-tested incl. the exact-24h boundary, plus a confirmation behaviour test
22+
asserting the outside-window path calls `sendTemplateMessage` (not free text).
23+
- **No schema change.** One service + its test + `KNOWN_ISSUES` (KI-031 →
24+
resolved-with-notes).
25+
26+
### Status
27+
28+
Still **dormant until the live Meta WhatsApp path is enabled** (externally
29+
blocked on Meta business verification) — but the logic is now correct and tested
30+
rather than a TODO.
31+
32+
### Verification
33+
34+
Five-check gate green (lint / typecheck / prisma validate / build); unit suite
35+
**2,835 → 2,839 (+4)**. All real gates + GitGuardian + Cursor Bugbot green on
36+
#266.
37+
338
## Phase 46 — KI-016 O: intake→completion e2e ("demo spine") (2026-06-16)
439

540
### Why

0 commit comments

Comments
 (0)