# Open items — what is NOT done (2026-10-07)

Work in this order: **A** (ask the owner) → **D** (fix the review findings, if the owner says yes) → help with **B**
and **C** at deploy time.

> **Updated 2026-10-09:** §H lists what the 10-08 → 10-09 session ([09](09-session-2026-10-08-claude.md)) left open —
> start there: two migrations still have to be applied on `peta_zs_dev`.
>
> **Updated 2026-10-13:** a full code study of the 7 sales-flow pages found ~60 bugs and stale doc lines; what was fixed
> and what still needs the owner is in [10-code-study-and-fixes-2026-10-13.md](10-code-study-and-fixes-2026-10-13.md).
> The two migrations of §H.1 were applied on `peta_zs_dev` (verified 2026-10-11).

---

## A. Questions waiting for the owner's answer

| # | Question | Asked | Notes |
|---|---|---|---|
| A1 | ~~**Fix the 5 confirmed sales-flow review findings and commit again?**~~ | 10-07 | **Done 2026-10-13** (all 05 findings fixed, uncommitted) — see [10](10-code-study-and-fixes-2026-10-13.md). |
| A2 | **Lock the Dashboard PAGES (Sales / Pipeline / Insights / Agents) to super admin too**, or keep only the menu hidden? | 10-06 (twice) | Today only the sidebar entry is `superAdmin: true`; the pages keep their own permission gates. It affects only Dylan (admin). Locking them means future sales accounts lose their own Sales Dashboard. |
| A3 | **Let leaders reassign ANY task**, including ones with no author? | 10-06 | The local production copy has **12 tasks with no author and no assignee**. Only a task's author can change its assignees, so today these can only be deleted (super admin) and re-added. |
| A4 | **Sales-flow chart gaps** — keep as is, or add boxes? | 10-06 | (a) M2 ("让 AI 打给你" for people who unticked the AI call) has no box; it is shown on 6小时内按了吗？. (b) The Project funnel's own pre-webinar automation has no boxes and collapses onto "Project webinar". (c) No box after the stage-3 call task; the lead goes back to "付 project fee 了吗？". (d) A re-registration shows only the latest cycle; earlier boxes are only in the Journey log. (e) A refund keeps "付了" green. (f) The orange "没做到" state, pale-grey "没有记录", and the list chip following the bar were added without asking (see [02 B21](02-decisions.md)). Full list: [04 GAPS](04-sales-flow-chart-path-design.md). |
| A5 | `GUIDELINES.md` §14 still mentions the removed upsell/fork; §15 says "6 product lines" (there are 7). Update? | 10-02 | Never answered. |
| A6 | Role matrix: who is the **sales leader**? What role do the ops accounts (Leejie, Youchen, yongzhi, Support, Celeste) get? A custom "operations" role was suggested. | 10-03 | Open since the plan (§7 "Still open"). |
| A7 | Pay attention `journey_overdue` waits 1 extra day; the Journey board flags overdue at once. Align them? | 10-04 | No answer. |
| A8 | Should sales land directly on My Work after login, instead of the Hub? | 10-03 | Partly done: the Operations landing (`useOperationsLanding`) puts My Work first, so Hub → Operations lands there. The Hub is still the first page. |
| A9 | The Sales flow guide's copy (Chinese) — any wording changes from the sales team? | — | The guide's words are `resources/js/Pages/Manage/MyWork/Partials/salesFlowGuide.js` (`ROUTINE`, `CALL_FORM`, `PAGES`, `TERMS`; `FLOW_CHART` draws only the per-lead map — there is no `STAGES` export any more); the three charts are `salesFlowOperations.js`. |

## B. Owner to-dos in production (page clicks, not code)

After the deploy (section C):

1. **Setting → Lead Distribution → Round Robin** (`/manage/lead-distribution/round-robin`): add people, order and
   repeat them, **switch it on**. While it is off, nothing auto-assigns an account manager and the top-talker switch
   moves nobody.
2. **Events → Funnels → Edit**:
   - Set **Sales flow** = Preview webinar on "Trust Nurturing - Property Investment" and Project webinar on
     "Property Closing".
   - On the Project funnel, set **"Candidates come from"** = the Preview funnel. Locally this was funnel 5 ← 4.
3. **Each Project slot: what it sells.** Funnel → Automation tab → pick the slot → step ③ "webinar 进行中" →
   **Add offer** → Project fee + the project (e.g. ViiA). Production had NO `event_series_offers` rows on 10-03.
   Without them, "Paid?" and the deal↔journey match are guesses.
4. **Messages → Templates → "Sync from Meta"**: the 4 templates were submitted from LOCAL on 10-05, so production
   does not know them yet. Once Meta approves them:
   - `ai_caller_missed_after_v1` (M4) → the funnel Automation tab's "after the session ends" AI-call rule →
     missed-call WhatsApp.
   - `payment_received_v3` → each membership payment link (`/manage/payment-links/…`) → Automation → "When they pay".
   - `webinar_no_show_followup_v1` and `webinar_attended_followup_v1` → two "after the session ends" WhatsApp rules
     (one "没来", one "来了没付钱"). Map `{{1}}` = `{{name}}` and `{{2}}` = `{{event_title}}`.
   - Meta may re-categorise the two follow-ups (and maybe M4) as MARKETING, which limits sends per person.
5. **After-webinar rules** on the Preview and Project slots: the no-show WhatsApp, and an AI call limited to Preview
   attendees with M4 as its missed-call message.
6. **Call questions** on each funnel page: the questions a colleague asks, per call kind. Until written, the AI
   call's own questions are used.
7. **CEO → Reports → "Sales flow board"**: enable it and pick recipients. It is off by default.
8. Raise **`RETELL_DAILY_BUDGET_USD`** enough for the after-webinar AI calls. Optional: `RETELL_CALLS_PER_MINUTE`
   (default 10).
9. Make sure the AI-call profile used by the funnels extracts **`will_attend`** and **`buy_intent`**. Otherwise every
   answered call counts as "not useful" and becomes a call task.
10. Move the sales team from super-admin to a sales role. They keep view-all leads (A13 in
    [02](02-decisions.md)); a migration grants it.

## C. Deploy checklist (production)

Code: branch `dev-shawn`, commit `20e1678cb` (= master `ad0a6aa26` + 1). **No PR has been opened yet.** Deploy runbook:
memory "Production deploy ops" — self-managed Ubuntu `/var/www/html/peta`, `sudo bash scripts/deploy-update.sh`;
NEVER `git pull` first.

**Done by `scripts/deploy-update.sh`:** `php artisan migrate --force` (16 new migrations, listed below),
`config:cache` / `route:cache` / `view:cache`, Horizon + scheduler restart.

**Run by hand ONCE after the deploy, in this order:**

```bash
php artisan leads:rollup-reps --all                      # fills lead_reps; without it the Leads list REP column is EMPTY
php artisan zoom:sync-actual-durations --all --limit=1000  # actual Zoom lengths; --all alone stops at 300 (prod has ~498)
php artisan funnel-journey:advance --dry-run             # optional: see what the sales flow would do, sends nothing
```

- Run `leads:rollup-reps --all` BEFORE the boss switches the Round Robin on: with the list off, nobody is moved.
- If old leads should also follow "who talks most", run it once more AFTER the list is on (estimated ~33 leads moved).

**2026-10-08 clarification — existing leads without an account manager:** the two initialization commands above
do not give unowned historical leads a Round Robin turn. The current code adds a separate, explicit backfill:

```bash
php artisan zoom:sync-actual-durations --all --limit=1000
php artisan leads:rollup-reps --all --keep-managers
php artisan leads:assign-missing-managers         # preview the current enabled list's coverage
php artisan leads:assign-missing-managers --apply # assign only customers whose manager is still empty
```

This order rolls up REP statistics using the refreshed Zoom lengths. `--keep-managers` preserves existing owners
even when Round Robin is enabled. The assignment command also preserves all existing managers, excludes staff
leads, and checks current staff eligibility and group boundaries for every turn. Each assignment records the
normal history, REP, tier/count and activity trail. It is resumable and has no automatic schedule. Review the list
before applying in the intended database; merely enabling Round Robin still only affects future new leads.
Assigning an account manager does not create a phone task or start a customer message/call. Later normal rollups
can still apply the talks-most rule. See the [Leads handbook](../../modules_handbook/manage/leads/readMe.md)
for the command contract. Running this on Shawn's isolated development database does not complete production's
deployment checklist.

**Must ship together:** retiring the Action Items page and the My Work task list are in the same commit. Never
deploy one without the other, or production has no task list.

**Migrations in `20e1678cb`:**

- `2026_10_03_100001_create_lead_reps_table`
- `2026_10_03_110001_add_actual_duration_to_zoom_meetings`
- `2026_10_04_100001_create_funnel_journeys_tables`
- `2026_10_04_100002_add_funnel_journey_to_lead_action_items`
- `2026_10_04_100003_add_journey_kind_to_event_funnels`
- `2026_10_04_100004_add_handoff_hours_to_event_funnels`
- `2026_10_04_100005_create_lead_action_item_outcomes_table`
- `2026_10_04_100006_add_reminders_muted_to_event_registrations`
- `2026_10_04_100007_add_button_reply_to_funnel_whatsapp`
- `2026_10_05_100001_grant_view_all_leads_to_sales_roles`
- `2026_10_05_100003_add_after_webinar_conditions_to_funnel_rules`
- `2026_10_05_100004_add_candidate_source_to_event_funnels`
- `2026_10_05_100005_add_missed_template_to_funnel_automation_messages`
- `2026_10_05_100006_create_funnel_question_sets_table`
- `2026_10_05_100007_create_funnel_journey_answers_table`
- `2026_10_05_100008_create_lead_rotations_tables`

New scheduled commands (in `app/Console/Kernel.php`):

| Command | How often |
|---|---|
| `leads:rollup-reps` | every 15 min |
| `funnel-journey:advance` | every 5 min |
| `zoom:sync-actual-durations` | every 30 min |

New config: `config/funnel_journey.php`. New env vars (all have defaults): `RETELL_CALLS_PER_MINUTE`.

## D. Code fixes ready to do (if the owner says yes to A1) — *done 2026-10-13, see [10](10-code-study-and-fixes-2026-10-13.md)*

See [05-review-findings-2026-10-07.md](05-review-findings-2026-10-07.md):

- **C1 + C2 first.** They share a root cause: the lead page and the Leads list choose different journeys. Each
  finding comes with a suggested fix and a regression test.
- **Then C3, C4** (low).
- **Re-verify U1–U4** before fixing them.

Tests to run afterwards:

```bash
php -d memory_limit=2G vendor/bin/phpunit -c phpunit.audit.xml tests/Unit/Lead/SalesFlowChartPathTest.php
php -d memory_limit=2G vendor/bin/phpunit -c phpunit.audit.xml tests/Feature/Lead/FunnelJourneyTest.php
npx vitest run resources/js/Pages/Manage/MyWork/Partials/SalesFlowChart.test.js
```

Then update [funnel-journey readMe §6](../../modules_handbook/manage/leads/funnel-journey/readMe.md). §6 does not
yet have a "§6d" step → box table; the design doc ([04](04-sales-flow-chart-path-design.md)) has it, so consider
moving that table into the handbook.

## E. Known bugs NOT fixed (from the 10-02 audit; the owner deferred or never ranked them)

Re-check the code before acting; these were found by reading agents.

- **Engagement:** a reopened deal keeps its cancelled booking, so commission shows as real and counts in estimated
  totals (deferred by the owner).
- **Engagement:** the legacy booking import can restage a live deal and stamps `won_at` = import time.
- **Funnels:**
  - `/register` accepts a paused funnel's uuid (only an already-open form can reach it).
  - `ThankYouController@updatePhone` re-runs the whole welcome (every medium + AI call). *(2026-10-13: fixed for the AI
    call — the re-send keeps the visitor's own AI-call choice and Session; the other welcome media are still re-sent to
    the corrected number, by design.)*
  - `BackfillFunnelAutomationWelcomeAction` finds 0 people on a VSL funnel.
- **Voice:** AMD has been off since `2e2a934ea`, so a voicemail plays the message and is recorded SENT.
- **Distribution:** the salesperson tier scorer stores LAST week's Monday, but `LeadRequestService` reads THIS
  week's, so self-service requests find no tier.
- **Payments:** an unattributed payment resolved later never sends the ON_PAID receipt (the claim is burned as
  `no_lead`). TNG upload-only installs never ingest statement lines. `TngLedger::isRecordable` ignores
  `needs_review`, so the owner's own transfer could be booked as a customer payment.
- **Membership:** no expiry or renewal (`STATUS_EXPIRED` is never written). Deleting a membership does not re-sync
  member roles.
- **Readiness:** sandbox chats count, because the numeric `provider` is compared with `'sandbox'`.
- **Relationship:** over-counts deleted and ignored calls, and Zooms that never happened.
- **Test infra:** `useSalesCoachChat.test.js` (2 tests) still expects the removed `SalesCoachRail`; stale, not caused
  by this work.

The 10-02 full list with file references: memory file `funnel-lead-sales-payment-audit.md`.

## F. Not verified yet

- **Browser-checked:**
  - 10-06: the bar, chart and list pills (with temporary seeded journeys); My Work tabs; the guide flow chart;
    Calendar; the Action Items redirect.
- **NOT browser-checked:**
  - most Phase 2–6 screens: Round Robin page, Journey board tab, Call questions modal, From Preview modal, Time with
    Leads, Lead reps modal;
  - the My Work Done view and "Tasks nobody holds".
- No journey exists in production yet, so the new journey features have never seen real data.
- The Retell pacer and the after-webinar AI calls have never placed a real call. HARD RULE: never trigger a real
  send or call without the owner asking for that specific send.

## G. Housekeeping

- Test DB `petav3_audit_testing` + `phpunit.audit.xml` (tracked in git) are what this session's tests used. Never run
  two phpunit processes on it at once (deadlocks). The first run after migration changes rebuilds it (~4–5 min).
- The session scratchpad held a full backup of the pre-commit working tree and the proof scripts. It is temporary
  and gone after this session. GitHub Desktop's dropped stash commit `888002831` is an unreachable git object and
  will disappear on `git gc`. Neither is needed any more: the work is in `20e1678cb`.
- The claude.ai sales-guide artifact (`BBYHPxMjUrrxjXjtjrYQfu`) is retired; the owner said it is not needed.

## H. Left open by the 10-08 → 10-09 session ([09](09-session-2026-10-08-claude.md))

1. **Apply the two new migrations to `peta_zs_dev` — Shawn, by hand.** The agent's auto mode blocked `migrate`.
   Confirm the target first (`grep -E '^(DB_HOST|DB_PORT|DB_DATABASE|DB_USERNAME)=' .env` must show `peta_zs_dev` /
   `peta_zs`), then run exactly:

   ```bash
   php artisan migrate --force --path=database/migrations/2026_10_08_190000_add_closing_decision_to_lead_action_item_outcomes.php
   php artisan migrate --force --path=database/migrations/2026_10_08_191000_allow_funnel_journey_answers_without_journey.php
   ```

   Master's pending `2026_10_07_100001_one_deal_per_unit_on_engagements` was deliberately left untouched — do not
   replace these with a bare `php artisan migrate`.
   (`php artisan migrate:status` on 2026-10-09: `190000`, `191000` and `2026_10_07_100001` Pending;
   `2026_10_08_150000_add_handoff_context_to_lead_action_items` already Ran.) Production needs all three 2026-10-08 sales-flow migrations
   (`150000` handoff_context, `190000`, `191000`) plus `config:cache` (`FUNNEL_RECONTACT_AFTER_DAYS`, default 30).
2. **Stale committed tests from Codex's earlier slot-operations redesign** still fail and are not caused by the
   sales-flow work: `tests/Feature/Event/RegistrationActivityTest.php` (4), `tests/Feature/Manage/MarketingRoleTest.php`
   (2), `tests/Feature/Event/FunnelAutomationTest.php` (6); `RegistrationRemovalTest` needs the `pdo_sqlite` PHP
   extension on the VM. **Owner question** behind one of them: does a second Slot registration in a funnel the person
   is already registered for count as a **new Meta conversion**?
   (`RegistrationActivityTest::test_a_second_slot_in_a_known_funnel_is_not_reported_as_a_new_funnel_registration`.)
3. **The per-lead Journey-tab chart** still uses the old `FLOW_CHART` renderer (`SalesFlowChart.vue` +
   `SalesFlowChartPath`), not the owner's image renderer the company and funnel charts use. Moving it needs a
   journey → image-box mapping in `SalesFlowChartPath` and its unit test.
4. **Slot configuration gaps** from [08 §Per-Slot configuration](08-workflow-readiness-audit-2026-10-08.md#per-slot-configuration)
   are unchanged: no Bridge WhatsApp groups, no after-webinar WhatsApp / AI rules, no 15-minute no-show AI rule,
   incomplete R1 schedules, Stage 2 Slots without Project offers (`EventSeriesOffer`), literal dates in reused
   reminder rules, AI profiles missing extraction fields.
5. ~~My Work → Assigned tasks: no "Log the call" button on sales-flow tasks~~ — fixed 2026-10-09 (`Index.vue` shows
   it for `outcome_url`). *(Superseded the same day: sales-flow tasks are no longer listed on that tab — now "Action
   Item" — they live only in Sales steps and close with Record contact.)*
6. ~~Closing board marked Booked as done; Stage 2 Human Call box counted after-Project-webinar calls~~ — fixed
   2026-10-09 (Booked stays to do with Record contact; a pending call after the Project webinar now sits in Stage 3's
   attended / no-show box; boxes that span several My Work queues open the whole stage). *(2026-10-13: My Work ignores
   `rstage`, so those links opened All steps; they now open the box's first step — see [10](10-code-study-and-fixes-2026-10-13.md).)*
7. Not yet exercised with real data: `peta_zs_dev` has no `funnel_journeys` rows, so every automation box counts 0
   and no hand-off task has been recorded end-to-end in a browser. The live rosters take 10–40 s to build.
