<!-- LEGACY_READ -->
<!--
// LEGACY TABLE WARNING:
// product_fitment is deprecated and must not be used for
// fitment evaluation, confidence scoring, or reconciliation.
// Use fitment_resolved instead.
-->
# Phase 4 Contract (Authoritative)

## Purpose
Phase 4 defines the deterministic fitment resolution layer. It consumes Phase 3
evidence and emits a single authoritative tuple per vehicle into
`fitment_resolved`.

## Scope Definition
Phase 4 exists to:
- Read from `fitment_evidence`.
- Apply deterministic weighting and confidence rules.
- Emit one resolved row per vehicle tuple.
- Enable admin and ops tooling.

## Hard Invariants (Non-Negotiable)
Phase 4 code must not:
- Modify Phase 1–3 code.
- Import Phase 3 runtime or bootstraps.
- Write to `product_fitment` or `product_fitment_raw`.
- Execute synchronously during fitment resolution.
- Introduce nondeterminism or GPT.

Any violation requires explicit Phase 5 scope approval.

## Allowed Capabilities
### 1. Precomputed Augmentation (Read-Only at Runtime)
Phase 4 may generate and store:
- Resolved fitment rows (`fitment_resolved`).
- Confidence metadata and audit annotations.

### 2. Admin & Ops Tooling
Phase 4 may include:
- Admin dashboards.
- Annotation UIs.
- Override proposal workflows.
- Backfill and enrichment jobs.
- Reporting and diagnostics.

All admin actions operate only on Phase 4 tables.

### 3. AI Usage (Strictly Non-Decisioning)
AI (GPT) is permitted only for:
- Summarization.
- Classification.
- Pattern detection.
- Analyst assistance.

AI must never:
- Execute in runtime.
- Influence resolver logic.

## Data Architecture
### Authoritative (Read-Only)
- `fitment_evidence`

### Phase 4 Tables
- `fitment_resolved`
- `product_fitment_confidence`
- `product_fitment_exclusions`
- `product_fitment_annotations`
- `product_fitment_overrides_audit`
 - `fitment_overrides` (Phase 5, read-only)

Phase 4 tables are:
- Namespaced.
- Additive.
- Deterministic.

## Runtime Contract (Reaffirmed)
- Phase 3 emits evidence only.
- Phase 4 resolves evidence into a single tuple per vehicle.
- Phase 5 overrides take precedence and set `override_flag = 1`.

## Enforcement
- All Phase 4 PHP files must begin with:
  `⚠️ PHASE 4 — NOT RUNTIME SAFE`
- Phase 4 code must live under `fitment/phase4/`.
- Static validation is mandatory.
- CI enforcement is required.

## Exit Criteria (Phase 4 Complete)
- Phase 4 scaffold implemented.
- Static guardrails enforced locally and in CI.
- Phase 3 untouched.
- Phase 4 reconciliation implemented.
- Documentation complete.
