# Yunke — local master integration candidate

Prepared 2026-10-26 on `codex/yunke-master-ready`. This records code integration,
not deployment or live acceptance. At preparation, the original local `dev-chen`
and `master` branches were unchanged and no remote branch had been written.

## Scope

The candidate merges Yunke source `46ef3202638b69e557b27781b4ea184153452b75`
with fetched master `72ee84462a7b595b4a961a2e1c5d044f1169ba8a`. Before integration
there were 71 source-only and 165 master-only commits. Fourteen files conflicted.
Both histories are retained, including master's caller-number settings, AI two-round
funnel entry, manual-call handling, browser test starter and profile-page controls.

Integration corrections:

- Retell placement passes the profile's caller number through the current five-argument
  caller interface and records that same number. A fixed Yunke phone line explicitly
  refuses a per-call caller-number override. Its unsupported cross-call ledger read
  returns an empty page without a vendor request; results still need an explicit binding.
- Routing-only updates include master's dialling settings and retain provider sync.
  AI rounds, payment calls and manual calls retain their own after-call handlers,
  with boolean completion receipts for the Yunke result processor.
- The branch-only `2026_10_25_100000_add_call_window_to_ai_call_profiles.php` is omitted:
  master's guarded `2026_10_13_100001_add_dialling_settings_to_ai_call_profiles.php`
  already owns that column. The duplicate first failed the fresh isolated build.
  No migration already on master was changed.
- Phone correction still sends only the original WhatsApp bonus without replaying AI
  calls; master's session resolver and recorded opt-in context are kept.
- The distribution test uses 10,000 leads at the same 45–55% bounds, avoiding its
  smaller CRC32 cohort depending on an auto-increment profile ID. The assignment
  algorithm and existing assignments are unchanged. A stale phone-panel assertion now
  checks its current single-task wording.

## Verification

- 605 related PHP tests / 6915 assertions: voice, redial, contact suppression,
  funnel/payment, shared WhatsApp flows, AI-round management, phone correction and registration.
- 41 API/unit tests / 368 assertions: lead AI Caller API, offline task adapters,
  result inspector and redaction. Total: **646 tests / 7283 assertions**.
- 24 frontend tests across five directly related component files.
- Client and SSR production builds pass using an existing dependency runtime. No
  dependency manifest or lockfile changed. Static-image warnings remain in the log.
- Changed-file Pint passes for 109 PHP files. Migration constants, suite links and
  test-double signature guards pass. The entire repository test suite was not run.

Tests use a new empty loopback-only test database, synthetic secrets and fake HTTP/queues.
The candidate has no real `.env`. No source/developer `.env`, standing gate, customer
record, task, phone, App session, message transport, media copy or firmware was changed.
Unknown missed/busy reasons remain held; the real reason dictionary stays empty.

## Publication boundary

The owner approved publication only as a `dev-chen` → `master` PR, with no merge or
deployment by this agent. The tested candidate can fast-forward `dev-chen`, retaining
its existing remote history without a force push. Publishing that PR does not enable
Yunke; no-deployment/no-production-write instructions remain in place.
`docs/DEPLOY.md` describes automatic deployment on master pushes, while the inspected
master tree contains only `.github/workflows/tests.yml`; the documentation does not
establish whether external deployment hooks exist or have been disabled. Do not infer
deployment permission from this local merge or from passing offline tests.

Private logs and a release-review draft stay outside Git in the current Yunke evidence
folder. Real acceptance and the original PDF's pilot status are unchanged.

## Mentor deployment hand-off

The subsequent [Yunke console](/docs/modules_handbook/shared/voice-agent/yunke-console.md)
adds browser session configuration, five runtime controls and paused phone-profile
create/edit. After migrations/builds, platform super administrators use Phone Call →
Yunke. Saving pauses automation; explicit enablement is separate. Once saved, this
encrypted database connection supersedes the managed environment gates/credentials.
The console cannot prove real-time phone/USB availability or cancel accepted tasks.

Deployment installs the integration; it does not start calling. The release operator
uses the normal reviewed migration/build/worker/scheduler procedure, then separately
configures the existing App write identity and Web read session for the same company/user.
No credentials are supplied by this PR. A prepared platform phone profile needs App
single-task mode, a market prefix, daily cap and a same-day window, plus the connected,
authenticated phone/box with approved cloud conversation content.

The 2026-11-01 scene extension reuses Retell's rule → profile → registration-variable
assignment and sends bounded scene context in the single recipient's `otherInfo`.
At the owner's request this capability defaults on after the normal config-cache and
worker refresh, without an extra environment entry. `YUNKE_APP_SCENARIOS_ENABLED=false`
is an explicit opt-out. It does not activate a phone profile, change the five saved
runtime controls, supply credentials/allowlisted recipients or create tasks on deployment.
App mode, cloud echo and actual spoken scene adoption remain separate acceptance evidence;
see [scene tracing and limitations](/docs/modules_handbook/shared/voice-agent/yunke-scenarios.md).

The independent write, Web read, result/watch and aftermath gates must be deliberately
configured for the intended stage; profile status and funnel routing also control use.
Do not enable every flag at once or treat local pause as cancellation of accepted phone
tasks. Recording copy stays separately off. See [profile setup](/docs/modules_handbook/shared/voice-agent/yunke-profiles.md),
[caller](/docs/modules_handbook/shared/voice-agent/yunke-app-caller.md),
[result watch](/docs/modules_handbook/shared/voice-agent/yunke-watch.md) and
[medium webinar flow](/docs/modules_handbook/shared/voice-agent/medium-webinar.md).
Connected-call task/result processing has real owner-sample evidence; unknown missed/busy
reason codes remain held until their actual vendor contract is verified.

## 2026-11-01 PR update

The scene extension starts from remote dev-chen `bf49f9dbc`, preserving the later dedicated
funnel-lane and evidence commits, and integrates master `95035f155` without rewriting either
history. The sole text conflict was the shared voice-agent handbook: both Yunke's durable
effects/contact-refusal explanation and master's AI-call task extraction are retained.

On the integrated tree, **551 PHP tests / 6893 assertions**, **8 console component tests**,
client/SSR production builds, Pint for **132 PR PHP files**, migration constants, suite links
and test-double signatures pass. The first broad run's recording-link assertion failed
because the ignored local PHPUnit config used localhost; matching the committed test host
fixed the environment without a product change. One existing PHPUnit config deprecation
remains. Tests use an isolated loopback database and synthetic transports; the entire
repository suite and live scene adoption were not run. Updating PR #232 is not a merge,
deployment or permission to execute another live call.
