# Auto Analysis Worker Business Gates

## Current Design

- Poller searches Jira by created cursor and already filters Done issues.
- Before this change, poller also applied Q&A gate and auto coverage gate.
- Worker applied the L1 oncaller gate, then created the live analysis workspace and wrote an internal Jira comment.
- Poller skips did not create jobs, so they had no worker completion notification path.

## Risks

- Business skips in the poller are invisible to worker job APIs and Feishu notifications.
- Q&A gate overlaps with scenario classification and can incorrectly hide tickets before the worker has enough context to report a business decision.
- If L1 oncaller gate runs after scenario classification, non-L1 tickets can spend worker CPU on a business classifier they should never reach.

## Target Contract

- Poller only performs non-business automation control:
  - Jira Done filtering through JQL and snapshot status.
  - created cursor and overlap handling.
  - minimum issue age wait window.
  - duplicate initial-job suppression.
  - enqueue.
- Done gate exists only in the poller path.
- Worker business gates run in this order:
  1. L1 oncaller gate.
  2. Auto Coverage Gate.
  3. Live analysis and Jira internal comment write.
- Scenario classifier is internal to Auto Coverage Gate, not a standalone poller gate.
- Auto coverage skips are marked as worker job `skipped` outcomes and use the existing notification path.
- `oncaller_not_confirmed_l1` remains notification-suppressed.

## Implementation Steps

- Remove Q&A gate runtime config and poller usage.
- Add a worker Auto Coverage Gate wrapper that classifies scenario internally.
- Remove Done gate from worker.
- Update poller tests to assert enqueue-before-business-gates behavior.
- Add worker tests for auto coverage skip before live analysis/Jira writes with notification.
- Remove obsolete Q&A gate envs from app-delivery staging ConfigMap and README.

## Verification Checklist

- `npm test`
- `npm run build`
- Confirm no runtime usage remains for `evaluateQaGate`, `qaGate`, or Q&A gate envs.
- If deploying, verify live pod env, logs for poller enqueue and worker gate skips, DB job states, and Feishu notification behavior.
