# Recent Optimizer notification outcome

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "recent-optimizer-notification-outcome-2026-07-21",
  "problems": [
    {
      "problemId": "recent-optimizer-notification-hides-draft-pr",
      "summary": "A terminal Recent Optimizer notification omits the available Draft PR URL, so a retained needs-work candidate is not discoverable from the result message.",
      "status": "optimized_verified",
      "issueKeys": [],
      "sourceRefs": [],
      "signalTextIncludesAny": ["Draft PR", "pullRequestUrl"],
      "observedThrough": "2026-07-21",
      "effectiveAt": "2026-07-21T06:07:15Z",
      "verifiedAt": "2026-07-21T06:08:08Z",
      "attemptedAction": "Render the Draft PR URL in every terminal optimizer notification that has one and mark needs-work PRs as not ready to merge.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/pull/405"
    },
    {
      "problemId": "recent-optimizer-improvement-count-overlaps-current-outcome",
      "summary": "The notification says that three cases improved next to a two-of-five pass rate without explaining that criterion-level improvements overlap with unmet cases and regressions.",
      "status": "optimized_verified",
      "issueKeys": [],
      "sourceRefs": [],
      "signalTextIncludesAny": ["3 个 case 有改善", "2/5 个 case 达标"],
      "observedThrough": "2026-07-21",
      "effectiveAt": "2026-07-21T06:07:15Z",
      "verifiedAt": "2026-07-21T06:08:08Z",
      "attemptedAction": "Partition current fully-met cases from unmet improvement-only, mixed improvement-and-regression, regression-only, and unchanged outcomes.",
      "evidenceUrl": "https://github.com/tidbcloud/aisupport/issues/375#issuecomment-5030513135"
    }
  ]
}
-->

- Optimization ID: `recent-optimizer-notification-outcome-2026-07-21`
- Owner: auto-oncall-services
- Source type: Recent Optimizer result-message correction
- Source reference: Focus #375 attempt 1 and Draft PR #405

## Bounded problems

1. The result contains a Draft PR URL but the Feishu message omits it.
2. Criterion-level improvement counts overlap with full-case pass and regression
   outcomes, making the effect sentence appear contradictory.

## Implementation and effective status

- Add a Draft PR line whenever `pullRequestUrl` is present; label a
  `draft_pr_needs_work` result as not ready to merge.
- Report fully-met cases first, then partition every remaining case into
  improvement-only, mixed improvement/regression, regression-only, or unchanged.
- Status: deployed and verified in staging.

## Post-change evidence

- Aisupport PR #406 merged as `69f8908b74e99bd806dd0c44210403a92b97fad0`.
- App-delivery PR #75061 updated the staging Deployment and Recent Optimizer
  CronJob to that image.
- At `2026-07-21T06:08:08Z`, the live staging container rendered the Focus #375
  outcome as 2 fully met, 1 unmet with improvement and no regression, and 2
  unmet with both improvement and regression; it also rendered Draft PR #405
  with the needs-work warning. No duplicate Feishu notification was sent.

## Validation plan

- Reproduce the Focus #375 outcome as 2 fully met, 1 unmet with improvement and
  no regression, and 2 unmet with both improvement and regression.
- Verify accepted and needs-work Draft PR notification variants.
- Verify the deployed formatter produces the expected five-line message without
  sending a duplicate notification.

## Unresolved gaps and next action

- The next scheduled or manual optimizer run should confirm the same format in
  the delivered Feishu notification with a newly generated result.
