Skip to content

refactor(housepanel-push): extract dropClientsForHost helper from duplicated client-removal loops [2032503602] - #39

Merged
pstuart merged 1 commit into
masterfrom
repo-prompt/HousePanel-09112032503602
Sep 11, 2026
Merged

refactor(housepanel-push): extract dropClientsForHost helper from duplicated client-removal loops [2032503602]#39
pstuart merged 1 commit into
masterfrom
repo-prompt/HousePanel-09112032503602

Conversation

@pstuart

@pstuart pstuart commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

Automated repository workflow run 20260909T112032503602Z-HousePanel from master @ d030a9be745b3679b29e8f0f941add0c65691f23.

Issues fixed

Adds: bounded repository improvement (no coder-confirmed closing keywords)

Issues investigated

  • none (untracked bounded work)

Bare #N refs above are investigation context only — they do not close issues. Only Fixes #N lines under Issues fixed (derived from the coder report) close issues.

Workflow

  • Spark lightning: code and GitHub issue/PR investigation
  • Spark coder: implementation and safe simplification pass
  • Fresh Spark lightning: independent code review (including issue-claim checks)
  • Runner verification: final tests passed: bun --cwd /Users/bot/Development/.scan-worktrees/HousePanel/housepanel-push run test
  • Head SHA: 134e2a0d7104d41e5ce2a21aa4c09e77e6c96ca0

Coder report

Everything looks clean. The two call sites are in place, the helper is well-defined and commented, and the module exports are unchanged (the helper is internal, not part of the public API, which is correct since it's an internal implementation detail).

Issues-Addressed

  • Adds: consolidate duplicate client-removal loops in housepanel-push.js — two identical 8-line while loops that iterate clients and splice out entries matching a host's remoteAddress were merged into a single dropClientsForHost(host) helper.

Changes-Made

  • housepanel-push/housepanel-push.js:85-100 — added dropClientsForHost(host) helper that walks the clients array and splices out every entry whose socket.remoteAddress matches host, returning the removal count.
  • housepanel-push/housepanel-push.js:344-346 — in the wsServer.on('request') handler (new-connection path), replaced the inline while loop with dropClientsForHost(host).
  • housepanel-push/housepanel-push.js:366-368 — in the connection.on('close') handler (disconnect path), replaced the identical inline while loop with dropClientsForHost(host).

Simplification-Pass

  • Applied: extracted the duplicated loop into one named function; removed the now-unused oldhost local variable from both sites; the helper returns a removal count that callers may ignore (avoids forcing it on them).
  • Deferred: none. No other changes in this file were in scope; the fixTrack PHP/JS cross-language "duplication" was noted but is not consolidable (different runtimes), and the rest of the file showed no further safe, bounded consolidation.

Verification

  • cd housepanel-push && node -c housepanel-push.jsSYNTAX OK
  • cd housepanel-push && node housepanel-push.smoke.jsALL BEHAVIORAL ASSERTIONS PASSED (exit 0; same output as the pre-change baseline, including the expected "SKIP HTTP-level route tests" line because express/body-parser are not installed in this worktree)

Remaining-Risks

  • none

Suggested-Commit-Title

refactor(housepanel-push): extract dropClientsForHost helper from duplicated client-removal loops

Independent review

{"passed": true, "summary": "Consolidates duplicate client-removal loops into single dropClientsForHost helper; both call sites updated; syntax and behavioral assertions pass"}

@pstuart
pstuart marked this pull request as ready for review September 11, 2026 15:10
@pstuart
pstuart merged commit d123ad4 into master Sep 11, 2026
@pstuart
pstuart deleted the repo-prompt/HousePanel-09112032503602 branch September 11, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant