Before: openTerminal() never closed the previous WebSocket. After A→B→A,
two WS connections to session A both wrote to _term → double keystroke echoes.
Rapid switches triggered a CONNECTING-state send error and reconnect loop.
After: openTerminal() nulls _currentSession, clears reconnect timer, and
closes _ws before opening a new connection. connect() event handlers now
capture the WS instance in a local const and check 'ws !== _ws' on entry
so stale connections silently ignore all events.
Tests: three new regression tests verify:
- openTerminal() calls close() on the previous WS (Bug 1)
- stale open handler does not send on new WS after switch (Bug 2)
- stale close handler does not schedule reconnect after switch (Bug 2)
Three-part consistency defect identified in code review:
1. HTML: Four sidebar elements missing CSS class attributes so all CSS
rules targeting .session-sidebar, .sidebar-toggle-btn,
.sidebar-collapse-btn, and .sidebar-list applied to zero elements.
Added class= attributes to all four.
2. JS: initSidebar(), toggleSidebar(), and bindSidebarClickAway() called
$('sidebar') and $('collapse-btn') — neither ID exists in the DOM.
Corrected to $('session-sidebar') and $('sidebar-collapse-btn').
3. Tests: initSidebar/toggleSidebar mocks matched the wrong IDs, masking
the defect. Updated all six mock conditions to match corrected IDs.
4. Coverage gap: test_html_element_classes did not verify new sidebar
elements carry CSS classes. Added four entries for session-sidebar,
sidebar-toggle-btn, sidebar-collapse-btn, and sidebar-list — these
entries would have caught Defect 1 on Task 1's test run.
All 136 JS + 167 Python tests pass. Zero regressions.
Added renderSidebar(sessions, _viewingSession) call in pollSessions function after renderGrid(sessions) and before handleBellTransitions(prev, sessions), so sidebar updates on every poll tick alongside dashboard grid. Added test verifying sidebar-list innerHTML is set during pollSessions in fullscreen mode.
🤖 Generated with Amplifier
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
- .tile-bell: inline-flex badge (min-width:16px height:16px) so it's a
circle for single digits, pill for '9+'; was display:inline so
width/height were ignored → oval shape
- .tile-bell color: #0D1117 (dark on amber) — was inheriting muted gray
from .tile-meta, making count illegible
- formatTimestamp(null): return '' instead of em-dash '—' which rendered
as a confusing glyph in the tile meta area
Previously the <pre> snapshot floated to the top of .tile-body — when
content overflowed, the oldest lines showed and newest were clipped.
Now .tile-body pre is position:absolute;bottom:0 so overflow clips
from the top and the lower-left corner (newest content) is always shown.