Fix the Store search suggestion undo, which never worked - #78
Merged
Merged
Conversation
The undo removes the Everyone deny rule that disabling puts on each user's store.db, then deletes the file. The rule check wrapped a try statement in plain parentheses, which Windows PowerShell parses as a call to a command named try. It threw on every undo, so the deny rule stayed and deleting the file was refused with access denied: the feature could not be reverted. Use a subexpression, which accepts statements. Test-StoreSearchSuggestions.ps1 runs disable and undo against a real file and fails on the old code with the same access-denied error. Add two checks over every script Winnow loads: no PowerShell keyword may be invoked as a command, and every call must resolve to a Winnow function, a cmdlet or alias, or a listed external program. The second found this bug; nothing else in the codebase calls a missing command.
This was referenced Sep 24, 2026
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.
Undoing
DisableStoreSearchSuggestionsfailed on every run.EnableStoreSearchSuggestionsfiltered the ACL with(try { ... } catch { $false }); inside plain parentheses Windows PowerShell parsestryas a command name, so the filter threw "The term 'try' is not recognized" as soon as it reached the Everyone deny rule the apply had added. The rule was never removed, andRemove-Itemonstore.dbwas then refused with access denied, so the undo threw. Fix:$(try ...), which accepts statements (verified on PS 5.1).Found by a new static check
A call-graph scan of all 97 scripts Winnow loads (2,382 command calls) resolved every call except this one. Two checks now run in
Test-SafetyGuards:winget, DISM, reg, netsh, takeown, icacls, powercfg, bcdedit), so a new shell-out has to be added deliberately.Tests
Tests/Unit/Test-StoreSearchSuggestions.ps1(wired into CI): disable then undo against a real temp file; asserts no ACL warning and the file removed.takeown/icaclsare mocked.StoreSearchSuggestions.ps1:163. With the fix: pass.Tests\Unit209 passed / 0 failed, standalone rebuilt, every unit file wired intotest.yml.