Only accept the cookie values written by the toggle action - #8
Open
loevgaard wants to merge 1 commit into
Open
Conversation
Casting the cookie to bool meant every non-empty value except '0' was read as 'display with VAT', so a stray or hand edited cookie like 'false' silently turned VAT display on. Match '1' and '0' explicitly and throw NoVatContextException for anything else. The composite context then falls through to the next context, which ends at the configured default, instead of interpreting an arbitrary value. Claude-Session: https://claude.ai/code/session_01P9NzuVPQGvaVR97HZFq98a
15 tasks
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.
CookieBasedVatContextdid(bool) $cookie, so every non-empty value except'0'meant "display with VAT" — including'false', which reads as the exact opposite of what it does.The toggle action only ever writes
'1'or'0', so this matches those two explicitly and throwsNoVatContextExceptionfor anything else. That is the meaningful part: a value the plugin did not write is now "no context", so the composite context falls through to the next context (ending at the configureddisplay_with_vatdefault) instead of interpreting whatever happened to be in the cookie.Tests cover
'','false','true'and an arbitrary string. The two existing tests were renamed from..._is_truthy/..._is_falsyto..._is_one/..._is_zerosince truthiness is no longer what is being tested.Addresses the third bug in #5.
https://claude.ai/code/session_01P9NzuVPQGvaVR97HZFq98a