Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(windows): if kmshell is "silent" don't start a Keyman update #13330

Open
wants to merge 2 commits into
base: beta
Choose a base branch
from

Conversation

rc-swag
Copy link
Contributor

@rc-swag rc-swag commented Feb 24, 2025

Don't start an install of Keyman Update if the user has not been notified.

This also refactors some of the code into a single helper function which is only called once. However, it visually helps follow the logic.

I also changed in this PR was the removal of a background update check in the actualy Keyman Start function. This is superfluous.
It also makes the testing of this PR watching the state machine changes easier to observe.

Fixes: #13329

User Testing

We need to test that if Keyman is in Waiting Restart and kmshell is started with a -s switch for silent mode that we don't install.

We need to test that if Keyman is in states preceding Waiting Restart and kmshell is started with a -s switch for a silent mode that the handlekmshell event is passed to the state machine

TEST_WAITINGRESTART_KMSHELL_KEYMAN_HAS_NOT_RUN_SILENT_MODE:

Install Keyman attached is the PR

  1. Open the Keyman Configuration dialog.
  2. In the Options tag uncheck start with Windows
  3. In the Options tab under General, check "Automatically check for updates and download"
  4. Close the configuration
  5. Close Keyman if it is running.
  6. Logout and then back into Windows
  7. Navigate to the "Update" tab.
  8. Open Regedit WinR type regedit
  9. Go to the current user key update state found at (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
  10. If required set the state back to usIdle
  11. Go to the key Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Desktop and delete last update check time. This needs to be done otherwise it will stay in usIdle for 7 days.
  12. Open Windows Explorer at "C:\Users"yourusername"\AppData\Local\Keyman\UpdateCache" folder.
  13. Delete cache.json, any *.kmp and *.exe files.
  14. Close Keyman and Keyman Configuration if open
  15. Open a command prompt (kbd>WinR type cmd)
  16. Change to the directory where kmshell is installed (cd "c:\Program Files (x86)\Keyman\Keyman Desktop")
  17. Type kmshell.exe -c
  18. In the Regedit window.
  19. Verified that the "update state" has advanced to usUpdateAvailable, then usDownloading, and finally usWatingRestart press F5 to refresh.
  20. Close Keyman Configuration
  21. At the command prompt again type kmshell.exe -s
  22. In the Regedit window.
  23. Verified that the "update state" does not advance past usWatingRestart
  24. That a Keyman installation does not start.

TEST_UPDATE_KMSHELL_KEYMAN_HAS_NOT_RUN_SILENT_MODE:

Install Keyman attached is the PR

  1. Open the Keyman Configuration dialog.
  2. In the Options tag uncheck start with Windows
  3. In the Options tab under General, check "Automatically check for updates and download"
  4. Close Configuration and Keyman if it is Running.
  5. Logout and then back into Windows
  6. Navigate to the "Update" tab.
  7. Open Regedit WinR type regedit
  8. Go to the current user key update state found at (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
  9. Set the state back to usUpdateAvailable
  10. Open Windows Explorer at "C:\Users"yourusername"\AppData\Local\Keyman\UpdateCache" folder.
  11. Delete cache.json, any *.kmp and *.exe files.
  12. Close Keyman and Keyman Configuration if open
  13. Open a command prompt (kbd>WinR type cmd)
  14. Change to the directory where kmshell is installed (cd "c:\Program Files (x86)\Keyman\Keyman Desktop")
  15. Type kmshell.exe -s
  16. In the Regedit window.
  17. Verified that the "update state" has advanced to usUpdateAvailable, then usDownloading, and finally usWatingRestart press F5 to refresh.
  18. In the Regedit window.
  19. Verified that the "update state" does not advance past usWatingRestart
  20. That a Keyman installation does not start.

Don't start an install of a Keyman Update if the user has not been
notified.

Fixes: #13329
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-missing User tests have not yet been defined for the PR labels Feb 24, 2025
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Feb 24, 2025

User Test Results

Test specification and instructions

  • TEST_WAITINGRESTART_KMSHELL_KEYMAN_HAS_NOT_RUN_SILENT_MODE (PASSED) (notes)
  • TEST_UPDATE_KMSHELL_KEYMAN_HAS_NOT_RUN_SILENT_MODE (PASSED) (notes)

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot bot added this to the B18S2 milestone Feb 24, 2025
@keymanapp-test-bot keymanapp-test-bot bot added user-test-required User tests have not been completed and removed user-test-missing User tests have not yet been defined for the PR labels Feb 24, 2025
There is no need for the keyman startup function to do a background
check. It will be done by kmshell, as well as the timer in the keyman
form.
@rc-swag rc-swag self-assigned this Feb 25, 2025
@rc-swag rc-swag marked this pull request as ready for review February 25, 2025 22:56
@dinakaranr
Copy link

Test Results

I tested this issue with the attached KeymanDeveloper"18.0.199-beta-test-13330" build(27/02/2025) on Windows 10 and 11. Here I am sharing my observation.

  • TEST_WAITINGRESTART_KMSHELL_KEYMAN_HAS_NOT_RUN_SILENT_MODE (Passed):
  1. Open the Keyman Configuration dialog.
  2. In the Options tag uncheck start with Windows
  3. In the Options tab under General, check "Automatically check for updates and download"
  4. Close the configuration
  5. Close Keyman if it is running.
  6. Logout and then back into Windows
  7. Navigate to the "Update" tab.
  8. Open Regedit WinR type regedit
  9. Go to the current user key update state found at (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
  10. If required set the state back to usIdle
  11. Go to the key Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Desktop and delete last update check time. This needs to be done otherwise it will stay in usIdle for 7 days.
  12. Open Windows Explorer at "C:\Users"yourusername"\AppData\Local\Keyman\UpdateCache" folder.
  13. Delete cache.json, any *.kmp and *.exe files.
  14. Close Keyman and Keyman Configuration if open
  15. Open a command prompt (kbd>WinR type cmd)
  16. Change to the directory where kmshell is installed (cd "c:\Program Files (x86)\Keyman\Keyman Desktop")
  17. Type kmshell.exe -c
  18. In the Regedit window.
  19. Verified that the "update state" has advanced to usUpdateAvailable, then usDownloading, and finally usWatingRestart press F5 to refresh.
  20. Close Keyman Configuration
  21. At the command prompt again type kmshell.exe -s
  22. In the Regedit window.
  23. Verified that the "update state" does not advance past usWatingRestart
  24. That a Keyman installation does not start.
  25. Verified that the "update state" stayed at "usWatingRestart"
  • TEST_UPDATE_KMSHELL_KEYMAN_HAS_NOT_RUN_SILENT_MODE (Passed):
  1. Open the Keyman Configuration dialog.
  2. In the Options tag uncheck start with Windows
  3. In the Options tab under General, check "Automatically check for updates and download"
  4. Close Configuration and Keyman if it is Running.
  5. Logout and then back into Windows
  6. Navigate to the "Update" tab.
  7. Open Regedit WinR type regedit
  8. Go to the current user key update state found at (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
  9. Set the state back to usUpdateAvailable
  10. Open Windows Explorer at "C:\Users"yourusername"\AppData\Local\Keyman\UpdateCache" folder.
  11. Delete cache.json, any *.kmp and *.exe files.
  12. Close Keyman and Keyman Configuration if open
  13. Open a command prompt (kbd>WinR type cmd)
  14. Change to the directory where kmshell is installed (cd "c:\Program Files (x86)\Keyman\Keyman Desktop")
  15. Type kmshell.exe -s
  16. In the Regedit window.
  17. Verified that the "update state" has advanced to usUpdateAvailable, then usDownloading, and finally usWatingRestart press F5 to refresh.
  18. In the Regedit window.
  19. Verified that the "update state" does not advance past usWatingRestart
  20. That a Keyman installation does not start.
  21. Verified that the "update state" changed to "usIdle"
    It works well. Thank you.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants