Repository navigation
[ponytail] Web server: delete dead SSE subsystem, route map, graph-queries dedupe #122
Copy link
Copy link
Closed
Labels
ponytailOver-engineering audit cut (2026-09-20)Over-engineering audit cut (2026-09-20)sub-issueChild task of a parent issueChild task of a parent issue
Description
Cut
Server-side half of the visualizer: routing, data queries and the dead SSE subsystem.
Findings
- delete: the whole SSE subsystem. No page opens an
EventSource; all four views poll/api/diffevery 1.5 s (verified withrg EventSourceacross the repo: only a comment inauth-gate.ts, the unit test and a phase-4 plan doc). Dropsrc/interfaces/web/routes/sse.ts,handleGraphEvents, the two/api/eventsroutes,getSseClientCountand thebroadcastUpdate(db)call in the WAL watcher; keep the watcher for its two cache resets (~75 lines). Update the "Real-time SSE updates" lines inCLAUDE.mdandREADME.md. - stdlib: the 138-line
if (pathname === ... || pathname === ...)chain plus seven one-line handler modules that all dowriteHead(200, JSON_HEADERS); end(JSON.stringify(fn(db)))(src/interfaces/web/server.ts:118,routes/graph.ts:17,routes/words.ts:9). AMap<string, (db, url) => unknown>for JSON routes and aMap<string, string>for pre-rendered pages with one generic responder (~100 lines). - delete: route aliases nothing requests:
/api/diff,/depth/api/diff,/depth/api/threshold,/api/dream/status,/api/dream/start,/api/words,/words/api/words,/graph/api/health(verified byrgover everyfetch(,Invoke-*andcurlin the repo). Keep the prefixes the templates call plus/api/healthfor the supervisor probe (~14 lines). Re-verifyscripts/*.ps1andscripts/*.shhealth probes before removing any/healthalias. - shrink:
getGraphDataisgetDepthGraphDataminuslastActive/bridgeScore(src/interfaces/web/data/graph-queries.ts:69). Serve the depth payload everywhere; consumers ignore extra fields andterminal/graph.html.tsalready reads the two fields it never receives (~50 lines). - shrink:
getGraphDiffruns the same six-column SELECT twice with a different predicate (graph-queries.ts:215, ~20 lines). - shrink:
computeOptimalThreshold's fallback re-runs both count queries (graph-queries.ts:190, ~16 lines). - delete:
isDreamRunning(src/interfaces/web/routes/dream.ts:33), zero importers. - yagni:
src/interfaces/web/paths.ts(returnsloadConfig().dbPath),src/interfaces/web/bind.ts(two-key env lookup) andresolveDreamLogPathinroutes/dream.ts:23(identical tosrc/dream/daemon.ts:50, with a contract test asserting the copies agree). Inline the first two, import the daemon's function for the third and delete that contract test (~40 lines).
Verification
npm run build and npm run test:run green before and after. Start the server on a spare port with the real database read-only and curl every route the four page templates and the terminal pages call; every one returns the same status and JSON shape as before (capture before, diff after).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ponytailOver-engineering audit cut (2026-09-20)Over-engineering audit cut (2026-09-20)sub-issueChild task of a parent issueChild task of a parent issue
Activity
devinmlowe commentedon Sep 21, 2026
PR: #131 (branch
ponytail/web-server, origin/main merged in).Tests: main baseline 134 files / 1750 tests → 132 / 1744. Removed:
tests/core/sse-broadcast.test.ts(1),tests/core/server-bind.test.ts(4), and the web-route/web-server cases oftests/contracts/data-paths.test.ts(1; the daemon-resolver cases stay). Build clean.All eight findings implemented; nothing skipped.
/depth/api/graph(unlisted sibling of the two listed/depth/api/*aliases, also unreferenced) went too. Route capture before/after on port 3199 against the real DB is in the PR: every template-called route is byte-identical in status and key shape except/graph/api/graphand/api/graph, which now carry the depth payload'sbridgeScore/lastActive(intended); the ten unrequested aliases return 404.Merge PR #131: delete dead SSE subsystem, route map, graph-queries de…
devinmlowe commentedon Sep 21, 2026
Merged PR #131 into main with --no-ff (commit 549ba8f). Post-merge on main: build clean, 132 test files / 1744 tests passing (was 134 / 1750; the 6 dropped cases covered the deleted SSE, bind and web-path code). Live visualizer on 3001 still runs the previous build; restart it when convenient to pick up the route changes.