Skip to content

refactor(config): split HandleWebMessage into one handler per bridge message - #479

Merged
Maxaubert merged 11 commits into
mainfrom
refactor/split-webmessage
Oct 14, 2026
Merged

Maxaubert merged 11 commits into
mainfrom
refactor/split-webmessage

Conversation

@Maxaubert

Copy link
Copy Markdown
Owner

Closes #474

Move-only split of HandleWebMessage (src/config_ui/main.cpp, 200 lines before) into one static handler per bridge message. The dispatch if-chain stays in HandleWebMessage, in the same order, with the same message set, so it is still the authoritative bridge list (CLAUDE.md, doc 09).

Extracted functions (lines in the new src/config_ui/main.cpp)

Function Lines Message
OnReady() 281-287 ready
OnSetConfig(wv, j, type) 288-323 setConfig, setConfigPersist
OnSaveSession(wv) 324-334 saveSession
OnDiscardSession(wv) 335-348 discardSession
OnWindowAction(wv, j) 349-378 window
OnPickExe(wv) 379-402 pickExe
OnOpenIni() 403-410 openIni
OnExportDiagnostics() 411-418 exportDiagnostics
OnCreateProfile(wv, j) 419-449 createProfile
OnDeleteProfile(wv, j) 450-472 deleteProfile

HandleWebMessage is now 38 lines (473-510). Left inline on purpose: getConfig, dirty, switchProfile and openRepo are one or two statements each; a function would add nothing.

Move-only

Each extraction is its own commit, made by a script that cuts the branch body, removes 4 spaces of indent and wraps it in the new function; the branch keeps only the call. Comments travel with their code. The only early returns (setConfig refusing an unsafe key, a failed write) are now returns from OnSetConfig, which is equivalent because nothing runs after the chain. discardSession's IniWriteLock still spans PostConfig.

Checked with a moved-lines diff: sorting the removed and added lines of git diff origin/main with indent stripped, the only differences are the 10 call lines, 10 signatures and 10 closing braces (plus a 2-line header comment and the doc 09 pointer in the last commit). Review with git diff --color-moved --color-moved-ws=allow-indentation-change.

Gates

  • build.bat check: exit 0
  • build.bat test: exit 0 (643/643 test cases)
  • build.bat: exit 0
  • build.bat config (after npm ci): exit 0
  • npx playwright test: 205 passed

Docs: docs/architecture/09-settings-ui.md now says the list is the dispatch chain, with the handlers just above it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH

Maxaubert and others added 11 commits October 14, 2026 01:50
Move-only: the branch body is now OnReady(), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…HandleWebMessage (#474)

Move-only: the branch body is now OnSetConfig(wv, j, type), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
#474)

Move-only: the branch body is now OnSaveSession(wv), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…sage (#474)

Move-only: the branch body is now OnDiscardSession(wv), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Move-only: the branch body is now OnWindowAction(wv, j), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
)

Move-only: the branch body is now OnPickExe(wv), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
)

Move-only: the branch body is now OnOpenIni(), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…Message (#474)

Move-only: the branch body is now OnExportDiagnostics(), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…age (#474)

Move-only: the branch body is now OnCreateProfile(wv, j), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…age (#474)

Move-only: the branch body is now OnDeleteProfile(wv, j), called from the same place in the dispatch chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
@Maxaubert
Maxaubert merged commit f5bcc50 into main Oct 14, 2026
1 check passed
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.

refactor: split HandleWebMessage into one handler per bridge message

1 participant