mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-06-04 16:31:23 +00:00
f72b1bd2ca
## What
Delete the unconditional
`localStorage.setItem('channels-show-encrypted', 'true')` call (+
misleading "#1034 PR1: sectioned sidebar" comment) at
`public/channels.js:783-786`. The sectioned-sidebar grouping the comment
referenced was never implemented; in practice the call was
force-flipping the encrypted-visibility gate on every init so an
operator could never turn it off.
## Root cause
`channels.js` init ran:
```js
var showEncrypted = true;
try { localStorage.setItem('channels-show-encrypted', 'true'); } catch (e) {}
```
unconditionally on every load. The `loadChannels()` reader at line ~1563
(`localStorage.getItem('channels-show-encrypted') === 'true'`) then sent
`includeEncrypted=true` on the `/api/channels` call, so the server
returned all 246 encrypted placeholder channels alongside the 19 real
ones — 265 rows flooding the sidebar with no UI control to suppress.
Verified via CDP on staging:
- `localStorage['channels-show-encrypted']` was always `"true"` after
page load.
- `GET /api/channels` → **19** entries (default — encrypted excluded).
- `GET /api/channels?includeEncrypted=true` → **265** entries (246
encrypted).
- Manually `removeItem('channels-show-encrypted')` + reload → list
dropped to 19.
Confirmed the force-set was the only gate driving the flood.
## TDD
- RED commit `a71cecbc` — `test-issue-1409-no-encrypted-flood.js`
source-greps `public/channels.js` for the forbidden literal
`setItem('channels-show-encrypted', 'true')`. Asserts no match. Fails on
master.
- GREEN commit `14281b63` — delete the 2 lines + rewrite comment. Test
passes.
Tests:
```
$ node test-issue-1409-no-encrypted-flood.js
Issue #1409 — no force-enable of channels-show-encrypted
✅ channels.js does NOT unconditionally setItem(channels-show-encrypted, true)
✅ channels.js still reads channels-show-encrypted (toggle gate preserved)
2 passed, 0 failed
```
## Manual verification
- After fix, default `localStorage.getItem('channels-show-encrypted')`
is `null` on first load.
- `loadChannels()` reader returns `false`, so `includeEncrypted` is
omitted from the API call → server returns the 19 real channels only.
- Existing reader is preserved, so a future user-facing toggle that
writes the flag will continue to work.
## Out of scope (follow-ups)
- "Show encrypted" header toggle UI — issue acceptance criteria mentions
it as optional; not added here.
- Sectioned-sidebar grouping of encrypted channels (#1034 PR1 design) —
separate issue.
- Cap/collapse behavior when toggle is ON — separate issue.
Fixes #1409
---------
Co-authored-by: openclaw-bot <bot@openclaw.local>
36 lines
1.3 KiB
Bash
Executable File
36 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Run all tests with coverage
|
|
set -e
|
|
|
|
echo "═══════════════════════════════════════"
|
|
echo " CoreScope — Test Suite"
|
|
echo "═══════════════════════════════════════"
|
|
echo ""
|
|
|
|
# Unit tests (deterministic, fast)
|
|
echo "── Unit Tests ──"
|
|
node test-packet-filter.js
|
|
node test-packet-filter-ux.js
|
|
node test-aging.js
|
|
node test-frontend-helpers.js
|
|
node test-url-state.js
|
|
node test-perf-go-runtime.js
|
|
node test-channel-psk-ux.js
|
|
node test-channel-sidebar-layout.js
|
|
node test-channel-fluid-layout.js
|
|
node test-channel-modal-ux.js
|
|
node test-channel-decrypt-insecure-context.js
|
|
node test-channel-qr.js
|
|
node test-channel-qr-wiring.js
|
|
node test-channel-issue-1087.js
|
|
node test-issue-1409-no-encrypted-flood.js
|
|
node test-analytics-channels-integration.js
|
|
node test-observers-headings.js
|
|
node test-marker-outline-weight.js
|
|
node test-traces.js
|
|
|
|
echo ""
|
|
echo "═══════════════════════════════════════"
|
|
echo " All tests passed"
|
|
echo "═══════════════════════════════════════"
|