Changeset 0.28.3.2 (#189)

This commit is contained in:
2026-03-14 16:46:16 +00:00
parent 205a770c74
commit fa6b04434a
66 changed files with 304 additions and 320 deletions

View File

@@ -1,5 +1,114 @@
# Changelog
## [0.28.3.5] — 2026-03-14
### Summary
Frontend decomposition Phase 4: ES module conversion. IIFE wrappers
removed from all 47 JS files, `<script type="module">` applied across
all templates. `sb.js` and vendor libs stay as classic scripts to
guarantee availability before modules execute.
### Changed
#### Phase 4 — IIFE Removal
- Removed `(function() { 'use strict'; ... })();` wrappers from 45
standard-pattern JS files (3 lines per file: open, strict, close).
- Removed `'use strict';` from 2 arrow-IIFE files (`knowledge-ui.js`,
`tools-toggle.js`) — arrow IIFE retained (const binding pattern,
harmless in module scope).
- Removed leftover `'use strict';` from `persona-kb.js` (not caught
by the main script due to blank line before directive).
- Inner IIFEs preserved: `projects-ui.js` (visibility timer),
`ui-primitives.js` (Providers/Roles factory constructors).
- All 48 JS files pass `node --check` syntax validation.
#### Phase 4 — Template Module Conversion
- All `<script src=".../js/*.js">` tags converted to
`<script type="module" src="...">` across 6 template files:
`base.html`, `surfaces/chat.html`, `surfaces/admin.html`,
`surfaces/editor.html`, `surfaces/notes.html`,
`surfaces/settings.html`.
- Classic scripts retained for: `sb.js` (must be globally available
before any module), vendor libs (`marked.min.js`, `purify.min.js`,
`codemirror.bundle.js`), early theme script, `__BASE__`/`__VERSION__`
hydration.
- 3 inline scripts in `base.html` converted to `type="module"`:
`API.loadTokens()`, Theme/appearance init + `handleLogout` fallback,
UserMenu hydration.
- `handleLogout` fallback: added `sb.register('handleLogout', handleLogout)`
since function is now module-scoped (no longer on `window`).
- UserMenu hydration: `handleLogout()``sb.call('handleLogout')`,
`openDebugModal()``sb.call('openDebugModal')`.
- Extension surface `main.js``type="module"`.
- DOMContentLoaded inline scripts in surface templates stay classic
(safe — modules execute before DOMContentLoaded fires).
### Fixed
- CI: frontend test harness (`helpers.js`) now loads `sb.js` into VM
context before other source files. Fixes 55 extension test failures
(`ReferenceError: sb is not defined` at `events.js:334`).
- `extensions.test.js`, `extensions-builtin.test.js`: `loadExtensions()`
prepends `sb.js` load. Result: 219/219 tests pass.
### Not Changed
- `sb.register()`/`sb.ns()` dual-write to `window[name]` stays —
cross-file JS references (`API.listProjects()`, `UI.toast()`) still
go through `window.*`. Removal requires `import`/`export` statements
(Phase 5, future).
- `login.html`, `workflow.html`, `workflow-landing.html` unchanged
(standalone pages, no `sb.js`).
## [0.28.3.3] — 2026-03-14
### Summary
CI fix: frontend test harness missing `sb.js` in VM context. All 55
extension test failures were the same root cause — `events.js` calls
`sb.ns('Events', Events)` but the test VM never loaded `sb.js`.
### Fixed
- `helpers.js`: `loadAppModules()` now loads `sb.js` before `app-state.js`
(defensive — not currently broken but would fail if any passing test
switched to using `loadAppModules` with source files that call `sb.*`).
- `extensions.test.js`: `loadExtensions()` loads `sb.js` before `events.js`.
- `extensions-builtin.test.js`: same fix.
**Result:** 219/219 tests pass (was 164/219).
## [0.28.3.2] — 2026-03-14
### Summary
Frontend decomposition Phase 3b: Go template `onclick``sb.call()`
migration. All server-rendered onclick handlers in templates that load
`sb.js` (via `base.html`) now route through the action registry. This
clears the template gate for Phase 4 (ES module conversion).
### Changed
#### Phase 3b — Go Template onclick → sb.call()
- Converted 72 `onclick="fn(args)"` handlers across 10 Go template
files to use `sb.call('fn', args)` or `sb.callEvent(event, 'fn', args)`.
- Templates converted: `base.html` (10), `surfaces/chat.html` (28),
`surfaces/admin.html` (14), `surfaces/settings.html` (3),
`admin/providers.html` (5), `admin/users.html` (3),
`admin/roles.html` (1), `admin/routing.html` (3),
`admin/teams.html` (4), `admin/settings.html` (1).
- 4 onclick handlers intentionally left unconverted (inline DOM
manipulation or Go template variable in element ID):
- `this.parentElement.style.display='none'` (crash banner dismiss)
- `event.stopPropagation()` (bare container click guard)
- `document.getElementById('settingsTeamAddMember').style.display='none'`
- `document.getElementById('{{.FieldName}}Input').click()`
- 3 standalone pages excluded (no `sb.js`): `login.html`,
`workflow.html`, `workflow-landing.html`.
- Defensive `typeof` guards in `settings.html` onclick handlers
(e.g. `if(typeof UI!=='undefined')UI.saveAppearance?.()`) replaced
with clean `sb.call()` — registry silently logs unresolved actions.
- `sb.js` comments updated: template gate cleared, dual-write removal
deferred to Phase 4 (cross-file JS references still use `window.*`).
## [0.28.3.1] — 2026-03-14
### Summary