Repository navigation
refactor: consolidate the duplication from the repo review (DRY) (#470) - #473
Merged
Merged
Conversation
… compiles WindConfig (#470) The app and uiaccess targets differed only in /DWIND_UIACCESS and the manifest; they now share one compile/link block. check compiles src\config_ui\main.cpp into its own object folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…470) RLog, ULog and DiagLog formatted each line twice (vsnprintf, then wind::Log). They are now macros over wind::Log, so no call site changes. render_engine and upscale_pass share CompileHlsl (hlsl_compile.h) with their own flags; a failed render shader now logs the compiler text too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
#470) - config_path.h: cached ExeDir() and UserDataDir() replace the GetModuleFileNameW and %LOCALAPPDATA%\Wind copies in Wind, WindTray (AppDir) and WindConfig; session.keep and running.model use UserDataDir. - ini_edit.h: one pure TrimWs replaces five trim helpers. - uiaccess_token.h: ProcessHasUiAccess() is the one token read (startup gate, transform engine). - mpo.h: ReadOverlayTestMode() is the one OverlayTestMode read; DetectMpoDisabled uses it. - tray_ipc.h: kInstanceMutexName, kQuitEventName and kIniWriteMutexName; the NSIS and PowerShell copies point there. - profiles.h: kUiOnlyKeys is the one list behind IsGlobalProfileKey, MakeLiveText and StripUiOnlyKeys. tests/fixtures/global_keys.txt pins it and the UI's GLOBAL_KEYS together. - profile_switch.h: SwitchProfile, LaunchWindExe, RevertModelAfterFailedRelaunch and the session.keep helpers, shared by the tray profile switch, the Settings switch and the tray engine pick. The tray switch now also writes session.keep before a relaunch, as Settings did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…inst the numbers (#470) tools/version.ps1 defines Get-WindVersion. release.ps1, installer_check.ps1 and the release and alpha workflows dot-source it instead of carrying their own regex block. tests/test_version.cpp fails when WIND_VERSION_STR drifts from WIND_VER_MAJOR.MINOR.PATCH (the .rc files need the literal, so it is not stringized). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…and ini helpers (#470) The local Set-Knobs / Set-Mode / Restart-Wind copies rewrote the ini in place and assumed Wind quit within a fixed 2 s. They now use Update-IniKnobs (sanity check, atomic replace), Restart-WindClean and Stop-Wind (wait for the clean exit), keeping the same settle time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…es, tested against themes.css (#470) ThemeBackground hand-copied the four --bg colours. It now reads the generated flyout palette's menu colour (same values), and tests/test_flyout_palettes.cpp checks each one against that theme's --bg in ui/src/design/themes.css, so the two generators cannot drift apart unnoticed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…elpers (#470) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Maxaubert
force-pushed
the
refactor/review-dry
branch
from
October 13, 2026 23:30
625b72b to
047165c
Compare
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.
Closes #470
Consolidates the duplication the 2026-10-13 repo review found (section "DRY and duplication" and related). Refactors only; each finding was re-checked against current
mainfirst.What changed
%LOCALAPPDATA%\Wind: cachedwind::ExeDir()andwind::UserDataDir()inconfig_path.hreplace the copies inResolveIniPath,ResolveLogDir,main.cpp, WindTray (AppDir/g_appDirremoved), WindConfig (ExeDir, the WebView2 folder) andSessionKeepPath/RunningModelPath.wind::TrimWsinini_edit.hreplaces the five copies (config, ini_edit, profiles, tray_items, flyout_tools).ProcessHasUiAccess()in the new Win32 headeruiaccess_token.h(with the banned-probe note), used by the Refuse to run without UIAccess, with a message that says how to fix it #460 start gate and the transform engine.ReadOverlayTestMode()inmpo.his the oneOverlayTestModeread (it keepsKEY_WOW64_64KEYand the type check).MpoDisabledInRegistryandDetectMpoDisableduse it, and the startup log still shows the raw value.kInstanceMutexName,kQuitEventNameandkIniWriteMutexNamesit next to the tray constants intray_ipc.h, and all three binaries use them.installer/app.nsh,tools/testenv/lib.ps1,tools/gpu_ab.ps1andtools/zoom_response_ab.ps1keep their literals, each with a comment pointing to the header.kUiOnlyKeysinprofiles.his now the only C++ list.IsGlobalProfileKey,MakeLiveText,StripUiOnlyKeysand the test all loop over it. A new fixture,tests/fixtures/global_keys.txt, is checked from both sides: by a doctest againstkUiOnlyKeys + profile, and by a new node test against the UI'sGLOBAL_KEYS(it runs undernpm run test:rules).src/profile_switch.hnow holdsSwitchProfile,LaunchWindExe,RevertModelAfterFailedRelaunchandWriteSessionKeep/ClearSessionKeep. The tray switch, the Settings switch and the tray engine pick share them, and each surface keeps only its own messages and logs.RLog,ULogandDiagLogare now one-line macros overwind::Log, so no call site changes and lines are no longer formatted twice.CompileHlsl(hlsl_compile.h) is the oneD3DCompilewrapper; each caller keeps its own flags.:core_exe <define> <manifest>subroutine builds Wind.exe for both the app and uiaccess targets.checknow also compilessrc\config_ui\main.cpp(into its own object folder).tools/version.ps1(Get-WindVersion) is dot-sourced byrelease.ps1,installer_check.ps1and both workflows. The alpha and release workflows were changed together. A newtests/test_version.cppchecksWIND_VERSION_STRagainst the three numbers. It is a test and not a stringize, because the.rcfiles consume the literal.sweep.ps1,shimmer_ab.ps1andab_acryl.ps1now use lib.ps1'sUpdate-IniKnobs,Restart-WindCleanandStop-Windinstead of their own in-place ini rewrite and fixed 2 s quit. The settle time is unchanged.ThemeBackgroundnow reads the generatedkPalettes[i].dark.menuinstead of four hand-copied colours (same values). A new doctest checks each palette's menu colour against that theme's--bginui/src/design/themes.css. ThekUiPalettesvskPalettesid test already existed.flyout_icons.his left hand-copied: the review says to generate it only if the icon set grows.Docs: CLAUDE.md (the "add new UI-only keys" rule, the
checktarget) and chapters 01, 02, 05, 08, 09 and 11 now point at the new helpers.Behaviour notes (intended, minor)
session.keepbefore a relaunch, as Settings already did; the copies had drifted. After a switch the session equals the profile, so the next start comes out the same either way.LOCALAPPDATAis unset (in practice it never is),session.keepandrunning.modelnow fall back to%TEMP%\Windlike the ini, logs and WebView2 folder, where before they used.\Wind.Verified
build.bat check: exit 0, now including WindConfig's host.build.bat test: exit 0, 632/632 test cases, 98195/98195 assertions. That includes the new fixture, version and themes.css tests.build.bat(Wind.exe + WindTray.exe): exit 0.build.bat uiaccess: exit 0, and the embedded manifest readsuiAccess="true"("false"for the plain build).npm ci+build.bat config: exit 0.npm run test:rules: 2/2 pass (keybind rules plus the new global keys test).npx playwright test: 205 passed.build.bat installer: exit 0, all 63 installer checks OK. The install smoke test was skipped because the shell is not elevated.WindUA.exewas produced the wayrelease.ps1does it (uiaccess build renamed), without runningrelease.ps1.. tools/version.ps1; Get-WindVersionprints0.29.3, which matchessrc/version.handWIND_VERSION_STR. All touched.ps1files parse, and both workflow YAMLs load.🤖 Generated with Claude Code
https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH