# Dormant targeted raw-size-bounded Site Content source lookup

Audience: AI coding agents first.

- **Plan ID:** `IPZ-SITE-CONTENT-BOUNDED-SOURCE-LOOKUP-2026-08-14`
- **Task:** `#88 / SC-LOOKUP-01`
- **Status:** IDLE
- **Outcome:** Add one dormant direct Site Content source lookup seam that enforces a raw byte cap before parsing and returns canonical catalog entities without changing catalog snapshots or runtime behavior.
- **Source request:** Implement and verify Task #88 against current `origin/master`, including published Tasks #87, #89, and #90, without contacting WordPress or application network targets. Coordinator correction: preserve the Task #88 candidate, reconcile safely, rerun every specified gate, address all in-scope findings, and maintain one local commit for independent review without publication. Correctness-review amendment: guard every API-dependent post lookup and normalization call, including current-blog and stylesheet resolution, so throwables return the existing bounded `site_content_source_unavailable` error with reason `lookup_failed`; add focused regressions for both API failures.
- **Preserved WIP/ref/path:** Preserve the Task #84 draft worktree at `/home/user/Projects/Press.zone/wordpress/wp-content/.claude/worktrees/ipz-site-content-resource-handler`; do not modify, reset, delete, or depend on its unpublished contents. Work only in `/home/user/Projects/Press.zone/wordpress/wp-content/.claude/worktrees/agent-a8b578133cd53f05f`, based on `origin/master` at `ea5dff2a2`.
- **Exact allowed paths:**
  - `plugins/international-press-zone/includes/SiteContent/class-sitecontentcatalog.php`
  - `plugins/international-press-zone/tests/Unit/SiteContent/SiteContentCatalogTest.php`
  - `plugins/international-press-zone/tests/Fixtures/SiteContentFunctions.php` only if required
  - `plugins/international-press-zone/docs/plans/2026-08-14-site-content-bounded-source-lookup.md`
  - `plugins/international-press-zone/docs/plans/INDEX.md`
  - `docs/plans/INDEX.md`
- **Acceptance criteria:** Add exactly `public function lookup_source(SiteEntityIdentity $identity, int $max_source_bytes): array|\WP_Error`; reject invalid caps and noncanonical post keys before lookups; perform exactly one direct lookup for each valid supported type; never enumerate posts/templates; enforce the raw `strlen()` cap before every parser, codec, reason, or entity-normalization call; reuse catalog normalization and eligibility after the bound; return canonical entity shape or stable bounded `site_content_*` errors, including `site_content_payload_too_large` with status 413; catch every API-dependent lookup and normalization throwable, including current-blog and stylesheet resolution, without exposing details and return `site_content_source_unavailable` with status 503 and reason `lookup_failed`; cover all requested failure and success paths; preserve all existing catalog snapshots and adapter behavior byte-for-byte.
- **Constraints:** Frozen scope only; no handlers, routes, hooks, jobs, UI, registration, activation, WordPress request, config, baseline, tooling, dependency, repository/schema, DTO, adapter, or unrelated edits. Do not delegate, invoke skills, run external models, commit, or publish. Address every in-scope warning and error.
- **Dormancy:** The new public seam has no production consumer or registration and must remain unreachable from live runtime paths.
- **Rollback:** Revert only the allowed catalog, test/fixture, plan, and index changes; no persisted state or runtime registration exists.
- **Blocker limit:** Stop after one implementation/review cycle or 45 minutes, whichever comes first, and record the exact blocker and remaining action.
- **Execution steps:** Register this plan; inspect current catalog, identities, codecs, fixtures, tests, error conventions, and adapter tests; add failure-first tests; implement the bounded direct lookup; run all requested focused and static gates; prove dormancy and inspect the bounded diff; update the receipt.
- **Current receipt:** IDLE and controller-ready after the correctness-review amendment. `lookup_post_source()` now catches current-blog resolution failures before key matching and catches post normalization/stylesheet failures before return; both produce only `site_content_source_unavailable` with status 503, reason `lookup_failed`, and the bounded entity type. Focused regressions assert complete error data, zero post lookup on blog-ID failure, and one direct post lookup before stylesheet failure. Catalog PHPUnit passes `14 tests, 153 assertions`; adapter PHPUnit passes `14 tests, 53 assertions`; syntax is clean on all four changed PHP files; direct uncached and candidate-aware PHPCS are clean on all four; focused production PHPStan reports `[OK] No errors`; `git diff --check` is clean. Production search still finds `lookup_source` only in `class-sitecontentcatalog.php`, with no hook, route, job, enqueue, UI, consumer, registration, or runtime activation. No remote access or publication occurred.
- **Next executable action:** Independent re-review of the amended local Task #88 commit, followed by controller publication if approved.
