# Dev1 `el` Runtime Failure

Audience: AI coding agents first.

- **ID:** IPZ-DEV1-EL-2026-08-14
- **Status:** DONE
- **Worker:** none
- **Outcome:** Restore international-press-zone admin UI on dev1 by removing root cause of `el is not defined`, adding regression coverage, pushing default branch, and deploying through established dev1 path.
- **Task IDs:** none
- **Source request:** 2026-08-14 owner request: “`el not defined` plugin is broken on dev1 since the last deployment. find root cause, fix it, push deploy”.
- **Acceptance criteria:**
  1. Capture exact failing built asset/source mapping and introducing change.
  2. Reproduce failure deterministically outside dev1; do not smoke-test dev1.
  3. Add regression test that fails before fix and passes after.
  4. Apply minimal source fix; rebuild committed admin assets.
  5. Pass project release gates without ignored warnings.
  6. Commit, push, and deploy through established dev1 mechanism.
  7. Verify deployed artifact/version without executing app smoke tests against dev1.
- **Preserved WIP/ref/path:** Fresh `origin/master` worktree `/home/user/Projects/Press.zone/wordpress/wp-content/.worktrees/fix-dev1-el-not-defined`, branch `wt/fix-dev1-el-not-defined`, base `bbb3e872a3039aceb3907a6e0d211992276f2d89`. Shared checkout WIP remains untouched.
- **Constraints:** Follow `.claude/agents/expert.md`; root-cause first; source controls generated assets; no dev1 tests/smokes; dev1 deploy only because owner explicitly requested it; no unrelated cleanup.

## Execution

1. Capture production error evidence and inspect last deployed frontend changes.
2. Trace undefined identifier from built bundle to source and identify introducing commit.
3. Compare with working DOM-helper usage; state and minimally test one hypothesis.
4. Add failing regression coverage; apply single source fix.
5. Build and run designated release gates once after all repairs.
6. Independent review; address every finding/signal.
7. Commit, push default branch per repository landing rules, deploy dev1 through canonical path.
8. Verify deployed files/release identity without dev1 smoke traffic.

## Current Receipt

- 2026-08-14: Fetched `origin/master`; existing isolated worktree is clean and exactly at `origin/master` (`bbb3e872a3039aceb3907a6e0d211992276f2d89`).
- 2026-08-14: Loaded debugging, frontend JavaScript, expert-agent, and live-environment operating rules.
- 2026-08-14: Initial source scan found `el(...)` calls in `admin/src/pages/translate-posts.js`; root cause not yet established.
- 2026-08-14: Canonical delivery confirmed: land with `.claude/scripts/ship.sh`, build and verify distribution with `tools/build-distribution.mjs`, then deploy with `tools/deploy-dev1.mjs`. Deployment controller verifies installed version, active state, and byte-for-byte SHA-256 identity for packaged admin assets; no separate dev1 smoke is permitted.
- 2026-08-14: Strongest durable current deployment receipt is release `1e8c9a677d21052acd031c18548588c4d1a943a3`, version `0.9.47`; no later dev1 receipt exists. Current `origin/master` is newer and MUST NOT be assumed deployed.
- 2026-08-14: Automated security review flagged three generated `tools/tmp/.ctx-mode-*/script.sh` files referencing an external `/tmp` preload and pre-existing `tools/wip-preserve.py` manifest handling. These files are outside this incident’s change set and unrelated to browser runtime `el`; do not bundle unrelated security-tool refactoring into the emergency fix. Generated temporary scripts MUST NOT be committed or shipped. The independent pre-ship diff review remains required.
- 2026-08-14: Root cause proven at commit `137f906c3b566c3373648b9308dbecb71033a841`: `admin/src/main.js` stopped importing `el` but retained an unused `el(...)` wrapper call. Production webpack emitted that call bare, causing `ReferenceError: el is not defined`. `translate-posts.js` imports and scopes `el` correctly and is not faulty.
- 2026-08-14: Regression test failed before repair with `main.js calls el() without importing it`, then passed after removing the unused wrapper and now-unused `AppFrame` import. Focused ESLint and production webpack build passed without warnings in the implementation worktree. Exact source, test, and generated bundle changes transferred to delivery worktree.
- 2026-08-14: Independent review rejected first fix as incomplete: `renderAppShell()` still calls unresolved `Sidebar` and accesses `this.appFrame` without initialization. Existing helper-import test cannot catch complete shell initialization failure. Returned to root-cause investigation before landing; nothing committed or deployed.
- 2026-08-14: Full root cause confirmed: commit `137f906c3` partially migrated `renderAppShell()` to `AppFrame`, leaving bare `el`, nonexistent `Sidebar`, and pre-initialization `this.appFrame` reads. Complete minimal repair restores `AppFrame`, mounts it before reading elements, and removes obsolete wrapper/sidebar paths.
- 2026-08-14: Strong regression coverage passes 2/2; focused ESLint and clean production webpack build pass; generated bundle contains zero bare `el` and zero bare `Sidebar` calls. Rebuild legitimately changed `admin/dist/js/main.js` and `runtime.js`.
- 2026-08-14: Independent revised-diff review confirmed both critical defects fixed. Review finding that regression test was outside canonical gate was repaired by adding it to `tools/admin-gate.sh` focused/full modes.
- 2026-08-14: Canonical full admin gate passed: lint clean, production webpack compile successful, shell regressions 2/2, Vitest 36 files and 574 tests passed. Logged error/warn lines are intentional test fixtures exercising error states and rollback behavior, not gate warnings.
- 2026-08-14: Fix commit `abe261aafbf7039846654b542f2afc5335b0820f` landed to `origin/master` through auto-lander as `396078c932e875aa526b29be4392cc391f4fd03f`. Lander’s required gates passed. Post-land optional live-report refresh failed because its external collector module path was absent; landing itself completed successfully.
- 2026-08-14: Distribution builder bumped `0.9.47` to `0.9.48`, built and locally verified 183 runtime files / 156 PHP files, runtime SHA-256 `4ab84e97811698c67d514b2fb2f3c769610420b2ad38dc03513605b0f2cae4a2`.
- 2026-08-14: Canonical dev1 deploy authenticated, replaced existing installation without deactivation, confirmed international-press-zone `0.9.48` active, and byte-verified every packaged admin asset including `main.js` and `runtime.js`. No application smoke/test request ran against dev1.
- 2026-08-14: Release commit `1031eacda4aa1c78119cfa9a3810a89c5d30b6e5` passed PHPCS/PHPStan and landed through auto-lander as `37e78a7b6`. Same optional live-report refresh failure occurred after successful landing; no release or deploy impact.
- 2026-08-14: **Acceptance failure:** owner screenshot after `0.9.48` deployment still shows blank admin page and visible `el is not defined` error. Byte identity proved packaged files reached dev1 but did NOT prove runtime correctness or that every loaded chunk was checked for unresolved globals. Previous DONE status was incorrect; incident reopened.
- 2026-08-14: Fresh `origin/master` worktree `/home/user/Projects/Press.zone/wordpress/wp-content/.worktrees/fix-dev1-el-runtime-v2`, branch `wt/fix-dev1-el-runtime-v2`, base `7d5d6f47b`. Preserve shared checkout WIP.
- 2026-08-14: Error boundary traced: `handleRoute()` catches lazy import/page render failures and passes `error.message` to centered `ErrorState`. Screenshot therefore does NOT match original pre-shell `el` failure; it proves a route module/render path or mixed cached asset still throws `el`.
- 2026-08-14: Current runtime references 15 lazy chunks and all exist in distribution. Manifest lists entrypoints only; runtime maps lazy chunks. Existing deployment check proves archive/deployed byte identity, not browser cache coherence or route execution. Non-hashed `main.js` and `runtime.js` permit mixed-release caching and remain a leading hypothesis pending emitted-chunk proof.
- 2026-08-14: Whole-history scan covered 209 emitted chunk variants. Only old `main.js` emitted by merge `c91d696ae` from broken source `137f906c3` contains unresolved `el`. Current source and every current lazy chunk are clean; no second code defect exists.
- 2026-08-14: Root cause proven: broken and fixed entry bundles shared URL `main.js?ver=0.9.48`, so browser/CDN cache could keep executing broken bytes after server byte verification passed. Minimal fix versions every enqueued script by first 12 hex characters of that file’s SHA-256 content hash. Regression RED expected content hash but received plugin version; GREEN 2 PHPUnit tests / 5 assertions. Whole-bundle DOM-helper regression 2/2, JS lint, PHP syntax, webpack, and diff checks passed; clean rebuild changed no assets.
- 2026-08-14: Repository-wide PHPCS reports 1,187 existing errors and 50 warnings across legacy files; this broad baseline is pre-existing and not a focused incident-gate signal. Changed-file PHPCS/PHPStan and canonical gates remain required before landing.
- 2026-08-14: Independent review blocked first cache fix as incomplete. `Translation/MetaBox.php` editor scripts still use `IPZ_VERSION`; stable `vendor.js` remains unversioned by content; `AssetLoader` can partially enqueue before hash failure. These preserve mixed-release risk. Fix MUST cover every JavaScript enqueue path and fail atomically before enqueue.

- 2026-08-14: Executable MetaBox leading-slash test now invokes real private enqueue path and proves normalized URLs, SHA-256 versions, runtime→common→editor dependency order, complete expected enqueue, and zero-enqueue atomic failure on missing asset. Final focused receipts: MetaBox pass; cache/vendor 4/4; distribution 4/4; PHP syntax and diff checks pass; hashed vendor staged/tracked.

- 2026-08-14: Canonical admin gate completed dependency audit, JS lint, and production build cleanly, then stopped fail-closed before Vitest because remote gate dispatch rejected an opaque wrapper (`local_only:opaque-wrapper`, exit 97). This is a harness dispatch blocker, not a test failure. Existing current-tree focused receipts remain green; landing gate supplied final canonical test receipt.
- 2026-08-14: Complete repair covers SPA/editor CSS+JS content versions, hashed async vendor filename, atomic pre-resolution, normalized editor records, exact runtime/distribution inventory, and executable failure/normalization regressions. Exact changed-file PHPCS and PHPStan pass cleanly. Fix commit `c83bb7536245475471866954b134aaa247228a1d` landed through auto-lander as `47c457232`; landing gates passed.
- 2026-08-14: Distribution `0.9.49` built from clean landed source: 187 runtime files, 160 PHP files, runtime SHA-256 `e19f61451ccadc15acb573f06a6514781d324048200b193b1a5ec236072e6669`.
- 2026-08-14: Canonical dev1 deployment replaced active `0.9.48` without deactivation, confirmed `0.9.49` active, and byte-verified every packaged admin asset including `main.js`, `runtime.js`, and `vendor.05144ac2.js`. No application smoke/test request ran against dev1.
- 2026-08-14: Release commit `bf4d316b0ae1ed5753062713740fd2cb1cc42405` passed PHPCS/PHPStan and landed through auto-lander as `8e5dc3fb0`. Optional post-land live-report refresh still fails because external collector module is absent; no land/deploy impact.

## Next Executable Action

None. Corrected release is active on dev1 with cache-coherent asset URLs and deployed byte identity verified.
