# Daily Report JSM Comment Time Fix

## Current Design

- Live automatic analysis builds its input from Jira Issue API
  `fields.comment.comments[]`; this path reads string `created` values and is
  outside this change.
- Daily report answer pairing and `/ao` feedback collection currently share the
  paginated JSM request-comment reader.
- The live JSM response represents comment creation time as
  `created.iso8601`, while the adapter currently expects
  `createdDate.iso8601` or a string `created`. This normalizes every live JSM
  comment time to `null`, so report pairing skips real human replies.
- Ready report artifacts and sent channel deliveries are immutable during
  ordinary retries. Reprocessing an already delivered period therefore needs
  an explicit, bounded operational reset.

## Risks

- Broadening the change into the Jira Issue API could alter live analysis
  input or replay timing.
- Treating `updated` as creation time could move edited comments within the
  conversation and pair them with the wrong AI run.
- Resetting report state without preserving the old artifact could lose the
  before/after audit trail or duplicate GitHub/Feishu delivery.
- A rerun before the fixed image is live would reproduce the bad artifact.

## Target Contract

- A report-only JSM request-comment adapter reads canonical
  `created.iso8601`; the feedback reader remains unchanged in this scoped fix.
- Existing `createdDate.iso8601` and string `created` inputs remain read-only
  compatibility paths for existing fixtures or proxy shapes; no new fallback
  source is introduced.
- Comment ordering and report-window membership use creation time only.
- Jira Issue API parsing, automatic-analysis input, and `/ao` feedback
  collection remain unchanged.
- The canonical live JSM time shape must not normalize to a missing time and
  thereby become false evidence that no human replied.
- The two most recent staging daily periods are regenerated only after the
  fixed pod is verified. Their old generation and delivery records are
  captured before reset, and the rerun results are compared explicitly.

## Implementation Steps

1. Add a real JSM `created: { iso8601 }` fixture and assert normalized time.
2. Add report-only time normalization without changing the feedback consumer.
3. Run typecheck and the complete local test suite.
4. Open and merge the repository PR; wait for the existing staging delivery
   workflow and verify the live image/pod.
5. Snapshot, reset, and regenerate the latest two staging daily artifacts with
   channel behavior explicitly controlled to avoid accidental duplicate sinks.
6. Verify generation JSON, report counters, logs, and the delivered Feishu
   reports, then provide before/after comparisons.

## Verification Checklist

- [ ] Real JSM object-shaped creation time is parsed.
- [ ] Existing string/legacy compatibility fixtures remain green.
- [ ] Automatic-analysis Jira Issue API files are unchanged.
- [ ] `npm run typecheck` passes.
- [ ] `npm test` passes.
- [ ] Staging Deployment uses the merged image and is ready.
- [ ] Previous two daily artifacts/deliveries are backed up before reset.
- [ ] Both periods regenerate with real human replies where present.
- [ ] DB artifact, pod logs, and Feishu body agree.
- [ ] Prod configuration and state are unchanged.

## Non-Goals

- No shared Jira timestamp abstraction.
- No Jira Issue API or live-analysis input changes.
- No `/ao` feedback ordering or stored timestamp changes.
- No author-role, visibility, AI-answer, prompt, report renderer, or production
  automation changes.
- No production deployment or report rerun.
