# AIFQ Site Review internals

v1.11 introduces explicit seams in the former monolithic plugin class while preserving the stable v1.10.2 product behavior.

Current boundaries:

- `AIFQ_SR_Site_Collector` — reads current WordPress/site facts; no evaluation or persistence.
- `AIFQ_SR_Evaluation_Pipeline` — preserves the checks → extension filter → finalization sequence.
- `AIFQ_SR_Review_Repository` — owns existing review/reviewed-state persistence only; this is not Evidence Memory.
- `AIFQ_SR_Review_Normalizer` — read compatibility for old/current saved review records; old title-derived identity is resolved here without rewriting historic storage.
- `AIFQ_SR_Reviewed_Findings_Service` — application logic for the existing reviewed/resurfacing feature; presentation remains read-only.
- `AIFQ_SR_Finding_Catalog` — stable built-in finding/check identity plus canonical `setup`, `security`, `reliability`, `performance` category mapping. New built-in records use explicit keys; title mapping is legacy-read compatibility only.
- `AIFQ_SR_Copy_Builder` — builds the copyable review summary and developer/host handoff text.
- `AIFQ_SR_Snapshot_Builder` — builds the small canonical state anchor for future Evidence comparison. It deliberately does not persist the full Site Collector output.
  In v1.11, plugin/theme existence and version state remain grounded directly in the local filesystem rather than WordPress metadata caches. Filesystem read failure now invalidates the Evidence snapshot instead of being interpreted as absence/removal; the last trustworthy anchor is preserved.
  The scheme-independent site identity remains unchanged so HTTPS termination differences between browser, cron and WP-CLI cannot create a false foreign-site boundary; legacy v1 HTTP/HTTPS identities remain accepted during migration.
- `AIFQ_SR_Memory_Schema` — owns per-site Memory schema version, history boundary and the two local custom tables.
- `AIFQ_SR_Evidence_Repository` — append-only Evidence/relation persistence, Evidence shape validation, bounded FIFO retention and relation integrity.
- `AIFQ_SR_Memory_Identity` — canonical state serialization plus idempotency/identifier helpers.
- `AIFQ_SR_Memory_Manager` — fail-soft initialization of a trustworthy first snapshot/history boundary; it never backfills historic review records.
- `AIFQ_SR_Observed_Event_Recorder` — whitelisted WordPress lifecycle hooks → immutable Observed Evidence. Exact entities stay exact; generic upgrader operations never infer a target.
  For plugin/theme updates, `post_update_version_verified=true` is only set after reading the target version directly from the updated file on disk.
- `AIFQ_SR_Snapshot_Differ` — compares two canonical state anchors and emits concrete Detected transitions with an interval, never an invented event timestamp.
- `AIFQ_SR_Evidence_Correlator` — applies the frozen uniqueness/entity/transition rules to create `exact_match` or `generic_operation_context` relations conservatively.
- `AIFQ_SR_Memory_Processor` — after a successful Site Review, persists Detected Evidence, correlates it and advances the comparison anchor fail-soft.

Compatibility rules in v1.11:

- Existing `aifq_sr_last_scan`, `aifq_sr_previous_scan` and `aifq_sr_reviewed_findings` storage remain valid and separate from Evidence Memory.
- Old saved findings without `key`/`category_id` are normalized when read; they are not destructively migrated.
- New built-in findings, suggestions and passed checks persist explicit keys and canonical category IDs.
- Display titles remain presentation copy and must not define new finding identity.
- Memory starts at the first trustworthy v1.11 snapshot. Old reviews are not converted to Evidence.
- Memory storage is site-scoped (`$wpdb->prefix`) and bounded to 250 technical Evidence records.
- Deactivation preserves Memory; uninstall removes AIFQ-owned Memory storage.
- Optional Memory failures must not break the established current Review/Evaluation path.

Not included in v1.11:

- Evidence-driven `Since your last review` presentation.
- Decision Memory.
- Timeline/activity-log UI (intentionally out of scope).
