Skip to content

Open-ends: JS no-undef guard (catches a docks crash bug) + colour-undo condition wait#3

Merged
asuramaya merged 3 commits into
mainfrom
open-ends-hardening
Jun 19, 2026
Merged

Open-ends: JS no-undef guard (catches a docks crash bug) + colour-undo condition wait#3
asuramaya merged 3 commits into
mainfrom
open-ends-hardening

Conversation

@asuramaya

Copy link
Copy Markdown
Owner

Attacking the open ends after the audit merge. Two of four done; the JS guard is the win.

JS undefined-name guard (#36) — found a real crash bug

Mirrors the Python tests/test_imports.py for the frontend: eslint no-undef over src/, run via a pinned npx eslint@8.57.1 so the repo stays build-free (no package.json/node_modules). node --check (already in CI) only checks syntax; this catches the missing-import ReferenceError class the app.js/editor.js splits keep introducing.

On its first run it flagged 3 names in docks.js (the #25 extraction), all unwired:

  • cycleBg — the ◧ "Cycle background" header button called it directly but it wasn't imported → clicking it threw ReferenceError (real crash).
  • renderJobsPaneltypeof-guarded, so the Jobs panel was silently skipped on every renderPanels() refresh.
  • processorRelevanttypeof-guarded → always fell back to true, defeating Processor auto-shelving.

Fixed by injecting all three through the createDocks factory (like renderProcessorPanel/renderLibrary). Wired the guard into ci.yml.

Colour-undo coalesce → condition wait (#37)

Converted the last two long e2e sleeps (360/320ms) that outlasted app.js's 280ms coalesce-commit debounce to settle(page, "()=>!editor._coalescing") — a self-verifying signal that can't drop the undo entry.

Not done (deliberate)

  • #38 e2e per-section execution isolation: a substantial restructure of the 2900-line main() for marginal benefit (faster --only); not worth risking the green suite — left for a focused effort.
  • #39 auto-routing UI: a feature track that needs a design plan first, not a blind attack.

Verified: e2e 371/371, test_imports/smoke/capabilities green, eslint guard clean.

asuramaya and others added 3 commits June 19, 2026 16:53
…it regressions)

docks.js referenced three names the #25 extraction from app.js never wired in
(found by the new JS no-undef guard):

- cycleBg — the ◧ "Cycle background" panel-header button called cycleBg("output")
  directly, but it's exported from viewport.js and wasn't in scope → clicking it
  threw ReferenceError. REAL crash.
- renderJobsPanel — guarded by `typeof ... === "function"`, so no crash, but it was
  undefined in docks scope → the Jobs panel was silently skipped on every
  renderPanels() refresh.
- processorRelevant — same typeof guard → silently fell back to `true`, so the
  Processor panel was always treated as context-relevant (auto-shelving defeated).

All three are app-wired runtime deps, so inject them through the createDocks
factory like renderProcessorPanel/renderLibrary already are (app.js has all three
in scope at the call site). e2e stays 371/371.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The JS twin of tests/test_imports.py. node --check (already in CI) only checks
syntax; this catches an identifier used but neither imported, declared, nor a
browser global — the missing-import ReferenceError class the app.js/editor.js
splits keep introducing (showContextMenu, and now cycleBg/renderJobsPanel/
processorRelevant). Runs eslint's no-undef over src/ via a pinned `npx eslint@8.57.1`
so the repo stays build-free (no package.json / node_modules); tests/eslintrc.json
holds the browser-module config + a modern-globals allowlist. Wired into ci.yml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…sleep

The two remaining long colour sleeps (360ms in pick_color, 320ms after the
fill/stroke swap) outlasted app.js's 280ms debounce that commits the coalesced
"Colour" undo entry (editor.commitCoalesce → clears editor._coalescing) before
the panel closes. editor._coalescing is set true synchronously by the colour-apply,
so settle(page, "()=>!editor._coalescing") waits for the real commit and can't
return early and drop the entry. e2e still 371/371 (undo-coalesce checks pass).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@asuramaya asuramaya merged commit 074035e into main Jun 19, 2026
1 check passed
@asuramaya asuramaya deleted the open-ends-hardening branch July 13, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant