# Wetech Canonical Target Alias Handoff

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "wetech-target-alias-handoff-2026-08-10",
  "problems": [
    {
      "problemId": "wetech-canonical-target-alias-rejected-by-runner",
      "summary": "Wetech readiness can resolve a customer alias successfully but return a canonical cluster name containing a space, which the runner rejects before the provider batch starts.",
      "status": "candidate",
      "issueKeys": ["APID-29232"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/APID-29232#problem:wetech-canonical-target-alias-rejected"
      ],
      "signalTextIncludesAny": [
        "diagnostic_wetech_readiness_target_invalid",
        "canonical cluster alias contains spaces",
        "valid Wetech target rejected before batch"
      ],
      "observedThrough": "2026-08-10",
      "effectiveAt": null,
      "verifiedAt": null,
      "attemptedAction": "Accept a bounded printable canonical cluster alias from the deterministic Wetech readiness helper while continuing to reject delimiter and control characters, then preserve that exact alias in the runner-owned target reference.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/tree/main/auto-oncall-services/docs/opts/2026-08-10-wetech-target-alias-handoff.md"
    }
  ]
}
-->

- Optimization ID: `wetech-target-alias-handoff-2026-08-10`
- Owner: auto-oncall-services runner
- Source reference: `APID-29232` staging replay
  `f2830456-9404-44e0-a231-7415ad66b310`
- Implementation status: local candidate
- Effective status: `candidate`

## Bounded problem

The ticket and scenario router supplied `nowallet`. The Wetech inventory
correctly normalized that input to canonical alias `No wallet`, and readiness
returned `status=ok`, region `asia-prod`, and cluster `No wallet`. The runner
then rejected the canonical cluster because its local target-part validator
allowed only ASCII letters, digits, dot, underscore, and hyphen. The resulting
`diagnostic_wetech_readiness_target_invalid` therefore described a runner
handoff validation failure, not an authentication or datasource failure.

This record owns only that canonical target handoff. It does not change target
selection, provider authentication, datasource mapping, query planning,
provider batch behavior, Jira publication, or Focus lifecycle.

## Candidate change

- Trim and bound deterministic helper target parts by UTF-8 byte length.
- Reject empty values, the colon used by the target-reference framing, and
  control characters.
- Preserve legal spaces and other printable alias characters returned by the
  helper.
- Add a contract test for `nowallet` resolving to `No wallet`.

## Verification evidence

The focused readiness tests prove both sides of the boundary: `nowallet`
preserves helper-returned canonical alias `No wallet`, while an alias containing
the target-reference `:` delimiter remains a bounded failure. TypeScript build
and the complete local suite pass with 713 tests. This is implementation
evidence only; the candidate is not yet available to the auto-oncall runtime.

## Unresolved gaps

- The candidate is not deployed.
- `APID-29232` has not completed a post-change provider batch.
- No Jira comment has been changed.

## Next validation action

Run the full local suite. After a separately authorized staging rollout,
replay `APID-29232` and verify readiness preserves `No wallet`, the runner-owned
batch starts, and the existing Jira internal comment is refreshed only with
explicit write authorization.
