# ISIS v2 WS07-005: Temporal Artifact Detection and Frame Consistency QA

## Scope

`WS07-005` implements a dedicated temporal QA pipeline that detects frame-level
temporal artifacts and produces frame consistency scoring for sequence outputs.

## Research and Existing Implementation Alignment

Implementation was built on top of existing temporal continuity primitives:

- Reused `TemporalDriftScorer` in
  `libs/isis/workflows/src/consistency/temporal-drift.ts`.
- Aligned artifact terminology with existing video quality patterns used in
  `libs/isis/ai-video/src/advanced/video-generation-sota.ts` (artifact score,
  temporal coherence framing).

## Deliverables

1. Added temporal QA pipeline module:

- `TemporalQualityQAPipeline`
- `assessTemporalQuality`
- Typed contracts for quality samples, thresholds, weights, findings, and
  aggregate assessments.

2. Implemented temporal artifact detection:

- Flicker detection (histogram drift).
- Ghosting detection.
- Blur pumping detection.
- Motion jitter detection.
- Temporal drift integration as a first-class artifact signal.

3. Implemented consistency scoring:

- Per-pair weighted artifact scoring.
- Aggregate artifact score.
- Frame consistency score.
- Motion consistency score.
- Pass/fail determination based on critical findings + aggregate thresholds.

4. Integrated QA pipeline into continuity orchestration:

- Added `temporalQuality` request support.
- Added `temporalQuality` assessment to orchestration result.
- Emitted temporal QA metrics in parameter overrides.
- Surfaced warning/critical findings via orchestration warnings.

5. Added comprehensive tests:

- Stable sequence pass case.
- Flicker + ghosting detection case.
- Temporal drift fail propagation case.
- Sparse-signal graceful handling.
- Orchestration-level temporal QA integration test.

6. Exported new APIs via package entrypoints:

- `libs/isis/workflows/src/consistency/index.ts`
- `libs/isis/workflows/src/index.ts`

## Verification Commands

```bash
pnpm --filter @isis/workflows exec vitest run src/consistency/temporal-quality-qa.spec.ts src/consistency/temporal-drift.spec.ts src/consistency/orchestration.spec.ts src/templates/keyframe-interpolation-flows.spec.ts src/templates/storyboard-shot-templates.spec.ts src/consistency/sequence-orchestration.spec.ts src/workflows.spec.ts
pnpm --filter @isis/workflows exec tsc -p tsconfig.json --noEmit
node scripts/isis/validate-v2-compliance-gate.mjs
```
