diff --git a/docs/reference/g14.md b/docs/reference/g14.md index 2a727cce..6198ac1b 100644 --- a/docs/reference/g14.md +++ b/docs/reference/g14.md @@ -144,6 +144,30 @@ The recovery is auditable: the original `git show` patch and the `cherry-pick` S These three surfaces must be combined for closeout. A passing `web:check` does not prove the running browser, and a passing runtime status does not prove the new selector exists. Document the explicit `grep`/curl evidence in the issue closeout comment so the CLI gap is auditable. Adding a v0.2 layout smoke is a follow-up and must not block the current fix. +### v0.2 Cloud Web Button/JS Sync Rule (HWLAB #748) + +When a `v0.2` Cloud Web fix removes a button from `index.html` or a field from the `el` literal in `web/hwlab-cloud-web/app.ts`, every `el..addEventListener(...)` (or `.requestSubmit()` / `.showModal()` / etc.) binding must be removed from the matching `init*` function in the same commit. The static `web:check` does not catch this orphan listener class because the TypeScript build is `Bun.build` transpile-only (no `tsc --noEmit`), and the runtime crash only surfaces as `Cannot read properties of undefined (reading 'addEventListener')` on first init. The minimal closeout checks for the v0.2 lane are: + +```bash +# 1. Web assets rebuild and the orphan is gone from the dist +trans G14:/root/hwlab-v02/.worktree/ script -- 'cd web/hwlab-cloud-web && bun run build' +trans G14:/root/hwlab-v02/.worktree/ script -- "grep -c '' web/hwlab-cloud-web/dist/app.js" # must be 0 +trans G14:/root/hwlab-v02/.worktree/ script -- "grep -c 'id=\"\"' web/hwlab-cloud-web/index.html" # must be 0 + +# 2. Live 19666/19667 confirms the deployed bundle is the new build +curl -fsS http://74.48.78.17:19666/ | grep -c '' # must be 0 +curl -fsS http://74.48.78.17:19666/app.js | grep -c '' # must be 0 +bun scripts/cli.ts hwlab g14 control-plane status --lane v02 # webAssets.checks.appJsOk = true, sourceCommit = merge commit +``` + +While the PR is open, the author can also run a one-liner to surface any orphan `el..addEventListener` whose field is not declared in the `el` literal of `app.ts`: + +```bash +trans G14:/root/hwlab-v02/.worktree/ script -- 'awk "/^const el = /,/^};/" web/hwlab-cloud-web/app.ts | tr -d "," | awk "{print \$1}" | grep -E "^[a-zA-Z]" | sort -u > /tmp/el-fields.txt; grep -nEo "el\\.([A-Za-z_$][A-Za-z0-9_$]*)\\.addEventListener" web/hwlab-cloud-web/*.ts | while read m; do field=$(echo "$m" | sed -E "s/.*el\\.([A-Za-z_$][A-Za-z0-9_$]*)\\.addEventListener.*/\\1/"); if ! grep -q "^$field$" /tmp/el-fields.txt; then echo "ORPHAN: el.$field.addEventListener"; fi; done' +``` + +Document the explicit `grep` / curl evidence in the issue closeout comment. Tightening the `el` literal with proper TypeScript types is tracked separately and must not be done as part of a runtime fix PR. + ## Node-Local VPN Proxy G14 has a node-local VPN/proxy stack for infrastructure bootstrap and recovery downloads: