2026-02-28: OpenRouter models[] Overflow in Routing Payload
π΄ Issue
OpenRouter requests failed with:
"'models' array must have 3 items or fewer."
π Root Cause
src/scripts/api.jsbuilt OpenRouter routing payload as[primaryModel, ...fallbackModels].- Primary + three fallbacks produced
models[]length4, exceeding OpenRouter limit (<=3).
β Fix
- Added OpenRouter routing cap and dedupe in
buildApiPayload(...). - Added normalization for model key dedupe (including
:onlinevariants). - Filtered stale fallback IDs against synced model catalog when available.
- Added defensive server-side clamp in
server.pyfor OpenRouter payloads.
π Files Changed
src/scripts/api.jsserver.pydocs/bug-analysis.md
π§ͺ Verification
- Syntax checks passed (
node --check,py_compile). - Live proxy test with 4 routing models returned 200 and no max-items error.
2026-01-23: API Key Management Refactor (Server Proxy)
π΄ Issue
Tree generation broken after moving API keys from config.js to .env.
π Root Cause
Browser JavaScript cannot read .env files. The api.js import of API_KEY from config.js yielded undefined, causing all LLM calls to fail with 401 Unauthorized.
β Fix
Implemented server-side LLM proxy:
server.py: Added/api/llmproxy endpoint that loads keys from.envapi.js: Refactored to POST to proxy instead of direct provider calls- Added
/api/configendpoint for provider availability (no secrets)
π Files Changed
server.py- LLM proxy + config endpointssrc/scripts/api.js- Use proxy, remove config.js import.env.example- New templatesrc/scripts/config.js- Deprecated
π Security
API keys now secure on server, never sent to browser.
2026-01-23: Tree Generation Blocked by CSP
π΄ Issue
Tree generation not working - API calls to GROQ silently failing.
π Root Cause
Content Security Policy (CSP) in index.html was missing https://api.groq.com in connect-src directive.
Browser blocked all fetch requests to GROQ API due to CSP violation:
connect-src https://openrouter.ai https://api.openai.com β Missing GROQ!
β Fix
Added https://api.groq.com and 'self' to CSP connect-src:
connect-src 'self' https://api.groq.com https://openrouter.ai https://api.openai.com https://cdnjs.cloudflare.comπ Files Changed
index.html- CSP meta tag updated
π§ͺ Verification
- Open app at http://localhost:50080 (historically 8080)
- Enter topic and press Enter
- Tree should generate successfully
- Check Network tab - GROQ requests return 200
2026-01-23: Debug Panel UX Improvement
π Change
Converted debug panel from centered overlay modal to right-side slide-in drawer that pushes content.
π Files Changed
src/styles/components.css- Drawer positioning and push animationsrc/scripts/ui.js- Body class management for push effect
β¨ Benefits
- Less intrusive - doesnβt block entire screen
- Content remains partially visible
- Smoother UX with push animation
2026-01-23: Security Configuration Leak (Gitignore Drift)
π΄ Issue
Active API keys and local read-only vault exposed to version tracking.
π Root Cause
- Gitignore Drift: File renames and structural changes caused paths in
.gitignoreto misalign. - The real
.envfile containing active provider API keys and the private vault folder_jamdata-important_READ-ONLY/were not ignored.
β Fix
Overwrote .gitignore with strict ignore definitions including .env, the data vault, stale logs, macOS finder files, and python cache/build outputs.
π Files Changed
.gitignore
π§ͺ Verification
- Checked git status output to confirm that local
.envand vault folders are excluded from tracking.
2026-01-23: Codebase Clutter (Obsolete Artifacts & Cruft)
π΄ Issue
Redundant code files, stale system logs, and macOS filesystem metadata files cluttered the active workspace.
π Root Cause
- Code Residue: Deprecated
config.jsand.config.js.exampleleft behind after the API key to.envmigration for βbackwards compatibilityβ. - OS Metadata: Finder
.DS_Storefiles generated in root,src/, andtree/directories. - Empty Folder Fossil: A blank
tree/directory left as a remnant of a former project layout.
β Fix
Created a dedicated quarantine directory structure (obsolete/{deprecated-code, stale-logs, macos-cruft, misc}) and migrated the obsolete files there. Removed empty folders.
π Files Changed
- Moved
src/scripts/config.jsandsrc/scripts/config.js.exampletoobsolete/deprecated-code/ - Moved
.DS_Storefiles toobsolete/macos-cruft/ - Removed empty folder
tree/
2026-01-23: Log Accumulation (Stale JSONL Logs)
π΄ Issue
Daily debug logs accumulated continuously without rotation, inflating project size.
π Root Cause
The server wrote detailed debug-*.jsonl files every day to logs/ but had no cleanup schedule or rotation policy.
β Fix
Quarantined old logs (debug-2026-01-23.jsonl and debug-2026-02-28.jsonl) to obsolete/stale-logs/ and updated .gitignore to exclude logs/*.jsonl from version control.
π Files Changed
.gitignore- Moved stale logs to
obsolete/stale-logs/
2025-09-18: XSS Vulnerabilities via innerHTML Injections
π΄ Issue
Multiple critical P0 XSS vulnerabilities identified throughout UI rendering modules.
π Root Cause
Unsanitized node titles and details injected directly into the DOM using innerHTML at:
ui.jslines 34, 142, 174, 260index.htmlline 441
This permitted execution of arbitrary malicious scripts embedded in generated or loaded tree JSON structures.
β Fix
Removed all innerHTML injections. Replaced them with safe DOM node creation and textContent assignments, establishing a strict sanitization protocol.
π Files Changed
src/scripts/ui.jsindex.html
2025-09-18: Inline Event Handlers
π΄ Issue
Scattershot inline event handlers exposed the application to DOM injection attacks.
π Root Cause
Over 47+ inline handler attributes (e.g., onclick="window.something()") used in tree.js:222+, ui.js:41+, and index.html:297+.
β Fix
Removed inline attributes entirely and transitioned UI interaction hookups to modular event listener bindings in JS.
π Files Changed
src/scripts/tree.jssrc/scripts/ui.jsindex.html
2025-09-18: Content Security Policy (CSP) Security Theater
π΄ Issue
Content Security Policy was bypassable, negating actual security checks.
π Root Cause
CSP metadata in index.html contained permissive directives (unsafe-inline and unsafe-eval) under script-src which allowed script injections.
β Fix
Tightened CSP policy inside the meta headers by removing the unsafe configuration overrides.
π Files Changed
index.html
2025-09-18: Event Listener Memory Leaks
π΄ Issue
System memory usage climbed continuously by approximately 2MB for every 10 minutes of active use.
π Root Cause
D3 nodes and custom DOM elements added/bound new event listeners recursively during redraw loops without disposing of previous bindings.
β Fix
Implemented dynamic listener disposal lifecycle hooks inside D3 tree viz updates and UI panel removals.
π Files Changed
src/scripts/tree.jssrc/scripts/ui.js
2025-09-18: DOM Thrashing & Unoptimized D3 Rendering
π΄ Issue
Regenerating the tree caused the browser window to lock up for 2 to 4 seconds.
π Root Cause
The tree redraw routine carried out full DOM teardowns and reconstructions rather than leveraging D3βs incremental enter/update/exit selection patterns.
β Fix
Refactored tree renderer to utilize D3 key-based object bindings, enabling smooth transition animations and reusing DOM nodes.
π Files Changed
src/scripts/tree.js
Legacy: D3 NaN Path Rendering Errors
π΄ Issue
Console flooded with path coordinate parse errors:
Error: <path> attribute d: Expected number, "MNaN,NaNCNaN,NaN,..."
π Root Cause
D3 link generator evaluated coordinate values before they were initialized by the layout layout engine, feeding invalid NaN properties to SVG path string rendering.
β Fix
Wrapped link updating paths in validation checks ensuring numeric properties exist before generating SVG drawing instructions.
π Files Changed
src/scripts/tree.js
Legacy: CSP JS Map Block
π΄ Issue
JS Source maps blocked from loading (e.g. Refused to connect to 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js.map').
π Root Cause
CSP connect-src limited fetch calls only to openrouter.ai and api.openai.com, rejecting CDN JS map queries.
β Fix
Expanded CSP meta tag config to permit CDN assets under connect-src.
π Files Changed
index.html
Legacy: Background Script Injection Queue Failures
π΄ Issue
Logs reported: π [UAC-CONTENT][INJECTION_FAILED] Background script failed to queue injection.
π Root Cause
Extension load race condition where content scripts called injection methods before background scripts completed initialization.
β Fix
Implemented retry-and-queue logic inside content scripts to buffer queries until injection availability resolves.
π Files Changed
src/scripts/debugLog.js
Legacy: Export Click Failure
π΄ Issue
Export button click produced no action.
π Root Cause
A registration oversight in UI setup left the trigger click callbacks unbound.
β Fix
Added explicit event listener bindings linking the settings panel export click triggers to export logic functions.
π Files Changed
src/scripts/ui.js