# Simplify Daily Report

## Current Design

The database and Jira determine jobs, feedback, answer pairs, and comparison
eligibility. Codex generates narrative and optimization JSON. The backend
renders the report, persists the generation artifact, publishes an optional
daily GitHub issue, and finally sends Feishu.

## Risks

- Job rows are not automatically unique tickets.
- `auto_coverage_disabled` alone cannot explain why a ticket was skipped.
- Old report artifacts are immutable and will keep their old generated shape.
- GitHub-before-Feishu retry and idempotency must remain unchanged.

## Target Contract

- Lead with unique ticket total and how many were automatically handled.
  `job.status=succeeded` only means the analysis pipeline completed; automatic
  oncall requires both `status=succeeded` and the latest successful run's
  `decision=internal_only`. A `human_required` run is not automatically handled.
- Jobs stopped by the L1 oncaller gate with `oncaller_not_confirmed_l1` are
  outside the auto-oncall scope. Exclude them before computing the ticket total,
  numerator, denominator, blocker categories, and Details.
- Classify automatic-coverage skips from the canonical `auto_coverage_gate`
  details, in this exclusive order: operation request, non-Wetech OP
  diagnostic, high-risk human handoff, missing context. Do not infer categories
  from Codex prose. Unsupported coverage remains unclassified for now.
- Keep an unclassified count for old or unmatched data so totals remain honest.
- Details list automatically handled tickets and at most one or two sentences
  of AI-versus-human analysis. Attach the daily GitHub issue only when present.
- Reading and rendering reports do not mutate job, gate, run, or Jira state.

## Implementation Steps

1. Join persisted auto-coverage gate details into report-window jobs.
2. Add deterministic unique-ticket and blocker-category statistics.
3. Replace the verbose report frame with the compact overview and Details.
4. Tighten the Codex comparison prompt and renderer to short comparisons.
5. Update local contract and runtime integration tests.

## Verification Checklist

- Mixed handled/skipped/failed and duplicate-job counts are deterministic.
- The three blocker categories are mutually exclusive and correctly ordered.
- Missing legacy gate details are unclassified, not guessed.
- Empty comparisons and no-issue reports remain compact.
- Created/existing GitHub issue URLs render; delivery retry behavior is intact.
- TypeScript build and Node test suite pass locally before deployment.

## Non-goals

- No poller, worker gate, Jira-write, schedule, deployment, or production change.
- No fallback classification from free-form error or generated prose.
- No regeneration of already-ready report artifacts.
