refactor(housepanel-push): extract dropClientsForHost helper from duplicated client-removal loops [2032503602] - #39
Merged
Conversation
…licated client-removal loops [2032503602]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Automated repository workflow run
20260909T112032503602Z-HousePanelfrommaster@d030a9be745b3679b29e8f0f941add0c65691f23.Issues fixed
Adds: bounded repository improvement (no coder-confirmed closing keywords)
Issues investigated
Bare
#Nrefs above are investigation context only — they do not close issues. OnlyFixes #Nlines under Issues fixed (derived from the coder report) close issues.Workflow
lightning: code and GitHub issue/PR investigationcoder: implementation and safe simplification passlightning: independent code review (including issue-claim checks)134e2a0d7104d41e5ce2a21aa4c09e77e6c96ca0Coder 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 iterateclientsand splice out entries matching a host'sremoteAddresswere merged into a singledropClientsForHost(host)helper.Changes-Made
housepanel-push/housepanel-push.js:85-100— addeddropClientsForHost(host)helper that walks theclientsarray and splices out every entry whosesocket.remoteAddressmatcheshost, returning the removal count.housepanel-push/housepanel-push.js:344-346— in thewsServer.on('request')handler (new-connection path), replaced the inline while loop withdropClientsForHost(host).housepanel-push/housepanel-push.js:366-368— in theconnection.on('close')handler (disconnect path), replaced the identical inline while loop withdropClientsForHost(host).Simplification-Pass
oldhostlocal variable from both sites; the helper returns a removal count that callers may ignore (avoids forcing it on them).fixTrackPHP/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.js—SYNTAX OKcd housepanel-push && node housepanel-push.smoke.js—ALL 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
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"}