HERMES-GIELIE/static
nesquena-hermes 12becd1f4b fix(chat): rename _inflightStateLimits() to _getInflightStateLimits() to fix v0.51.117 collision
Closes #2771.

v0.51.117 (PR #2766) introduced a top-level function _inflightStateLimits()
in static/ui.js that collided with the window._inflightStateLimits config
object set in static/boot.js. Because top-level function declarations in
classic (non-module) scripts attach to window, boot.js's assignment
overwrote the function reference, and every later _inflightStateLimits()
call threw TypeError. _compactInflightState() runs on every send(), so
no new chat session could be created — v0.51.117 is effectively unusable.

Reported by @jahilldev, with multiple users (@isma3iloiso, @theDanielJLewis,
@JHVenn) confirming the bug or reverting to v0.51.116.

Fix: rename the function to _getInflightStateLimits() — the window-attached
config key stays under its original name (unchanged for any downstream
code that reads it). Updates all 4 call sites in static/ui.js.

Tests:

  - Update tests/test_inflight_storage_quota.py — the existing test
    asserted 'function _inflightStateLimits()' in UI_JS as a positive
    presence check, which certified the bug. Now asserts the renamed
    function name is present AND the old colliding name is absent AND
    no stale call sites remain.
  - Add tests/test_window_function_collision.py — generalized regression
    that scans every static JS file for top-level function declarations
    whose name also appears as the target of 'window.X = {...}' or
    'window.X = <number>'. This is the exact shape that broke #2715
    (_pinnedSessionsLimit in v0.51.106) and #2771. Test fails with a
    precise diagnostic naming the file and symbol if the bug class
    returns. Confirmed test FAILS on current master (unfixed) and PASSES
    on this branch.

Verified end-to-end against the live browser before commit:
  - typeof window._inflightStateLimits === 'object' (config preserved)
  - typeof window._getInflightStateLimits === 'function'
  - _getInflightStateLimits() returns the limits object
  - saveInflightState() persists to localStorage without throwing

Full pytest suite: 6308 passed, 6 skipped, 3 xpassed, 8 subtests passed.
Opus advisor: SHIP.
2026-05-22 23:17:00 +00:00
..
vendor
apple-touch-icon.png
boot.js fix: make in-flight recovery storage quota-safe 2026-05-22 19:49:20 +00:00
commands.js fix: honour skin value in theme command 2026-05-20 00:09:06 +00:00
favicon-32.png
favicon-192.png
favicon-512.png
favicon-512.svg
favicon.ico
favicon.svg
i18n.js feat: add per-skill enable/disable toggle in Skills panel 2026-05-22 19:43:00 +00:00
icons.js Stage 382: PR #2500 (with whitespace polish on panels.js + ARCHITECTURE.md) 2026-05-18 03:45:02 +00:00
index.html Polish: chevron icon toggle + fix collapsed-card edge clip 2026-05-22 18:14:48 +00:00
login.js Fix login health probe credentials 2026-05-12 20:09:54 +08:00
manifest.json feat: add browser offline recovery and PWA cache hardening 2026-05-08 21:16:17 +00:00
messages.js Polish: chevron icon toggle + fix collapsed-card edge clip 2026-05-22 18:14:48 +00:00
onboarding.js docs: clarify Anthropic auth choices in onboarding 2026-05-06 06:26:43 +00:00
panels.js feat: add per-skill enable/disable toggle in Skills panel 2026-05-22 19:43:00 +00:00
sessions.js Fix composer model picker opening lag 2026-05-22 16:58:55 +00:00
style.css feat: add per-skill enable/disable toggle in Skills panel 2026-05-22 19:43:00 +00:00
sw.js fix: reduce browser storage pressure 2026-05-16 08:44:04 -07:00
terminal.js
ui.js fix(chat): rename _inflightStateLimits() to _getInflightStateLimits() to fix v0.51.117 collision 2026-05-22 23:17:00 +00:00
workspace.js fix: time out hung browser api requests 2026-05-20 02:41:00 +08:00