Skip to content

fix(settings): harden settings and configuration file handling after schema refactoring - #134

Merged
rcmdnk merged 5 commits into
masterfrom
fix/schema-settings-hardening
Aug 25, 2026
Merged

fix(settings): harden settings and configuration file handling after schema refactoring#134
rcmdnk merged 5 commits into
masterfrom
fix/schema-settings-hardening

Conversation

@rcmdnk

@rcmdnk rcmdnk commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Follow-up to #133, addressing the remaining review feedback (including Copilot comments) on the schema-driven settings.

Changes

  • Recover from invalid configuration values at startup. Invalid INI values (wrong booleans, out-of-choice/range values, applications set in both VimShiftEnter and VimCtrlEnter) used to throw an uncaught error in Initialize() and abort startup, leaving vim_ahk effectively disabled. Values are now normalized with a per-key fallback to the default, exclusive-group conflicts are repaired deterministically, and a single warning dialog lists what was corrected. OK/Apply in the settings GUI keep the strict validation.
  • Strict boolean validation. Booleans accept only 0/1 instead of treating any non-empty value as true.
  • Keep only non-default values in the configuration file. WriteIni() deletes keys equal to the default, so future default updates (e.g. new applications in VimShiftEnter) reach users who have saved settings. The startup rewrite migrates configuration files written by older versions, which stored every setting. Import treats a missing key as the default value accordingly.
  • Application group panel robustness. A selection-change event without a valid selection no longer throws, and WantTab is removed from the group editor so Tab moves focus.
  • Cleanups. Empty application groups are not registered (no WinActive() queries on group names that were never created); unused SetConfDefault() is removed.
  • Docs. README documents the 10 application behavior groups, the Application group dropdown, and the new configuration file behavior.
  • CI. New workflow validates vim.ahk with AutoHotkey v2 /validate on pull requests and pushes to master (the existing build workflow runs only on tags).

User-facing impact

  • A broken configuration file can no longer prevent vim_ahk from starting; it is corrected with a warning instead.
  • Upgrades now update default application lists for users who have saved settings, as long as they have not customized those lists.
  • Settings changed via GUI/INI behave as before; the GUI still rejects invalid input with an error dialog.

Relates to #133.

rcmdnk added 5 commits August 25, 2026 01:40
Invalid INI values (wrong booleans, out-of-choice or out-of-range
values, applications set in both VimShiftEnter and VimCtrlEnter) used
to throw an uncaught error in Initialize() and abort the startup.

- Normalize values with per-key fallback to the default at startup,
  collecting warnings shown once after setup. OK/Apply in the GUI keep
  the strict validation.
- Repair exclusive-group conflicts at startup by keeping an item in the
  first setting it appears in.
- Validate booleans strictly (0/1 only) instead of treating any
  non-empty value as true.
- Rewrite the configuration file after recovery to persist corrected
  values, guarded so a read-only file cannot break startup.
- Do not register application groups without any rule so that
  IsConfiguredGroup() does not query group names that were never
  created.
- Remove unused SetConfDefault().
Write only values which differ from the default and delete keys equal
to the default, so that default value updates (e.g. new applications in
VimShiftEnter) reach users who have saved their settings. The startup
rewrite added in the previous commit migrates files written by older
versions, which stored every setting.

Seed the import staging map with the default values accordingly, so a
key missing from an imported file means the default value. Keep the
file itself even if all values are default, for Export.
Ignore a group selection change without a valid selection instead of
throwing in the event handler, and remove WantTab from the group editor
so that Tab moves the focus instead of inserting a tab character.
Validate vim.ahk with AutoHotkey v2 /validate on pull requests and
pushes to master. The existing build workflow runs only on tags, so
syntax errors were not caught before merging.
@rcmdnk
rcmdnk merged commit 47c50f2 into master Aug 25, 2026
2 checks passed
@rcmdnk
rcmdnk deleted the fix/schema-settings-hardening branch August 25, 2026 01:30
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