Why are there Four Patches for Pro Activation in Wand-Enhancer?
Wand-Enhancer applies four distinct patches—covering three service methods and one Redux reducer—to ensure Pro subscription status persists through every possible account update pathway in the electron-based Wand client.
Wand-Enhancer is an enhancement layer for the Wand trainer application that maintains premium feature access even when the underlying client refreshes account data. Because the original Wand codebase can clear subscription flags during routine operations like language changes or brand-experience updates, the enhancer implements a defense-in-depth strategy across multiple architectural layers. Understanding why four separate patches for Pro activation are necessary requires examining how Wand handles account state across its service layer and client-side store.
The Four Patches Explained
The Wand client updates account information through three distinct HTTP endpoints and one central state-management reducer. To guarantee Pro status survives all of these pathways, Wand-Enhancer targets each entry point with a specific injection or wrapping logic.
1. getUserAccount Service Method
The getUserAccount service method serves as the primary source of account data in Wand. The patch wraps the resolved JSON response to ensure account.subscription is always injected with a valid object: {period:"yearly",state:"active"}.
Without this patch, the returned payload would lack the Pro flag immediately upon fetching user data, causing the UI to revert to free-tier limitations. According to the source analysis in AGENTS.md, this is the first line of defense in the activation chain.
2. setAccountWandBrandExperience Service Method
The setAccountWandBrandExperience service method handles updates when users modify their brand-experience preferences. The patch applies the same subscription injection as the first, ensuring that any brand-experience updates preserve the Pro subscription field.
This method can rewrite the entire account object after a brand change, which would otherwise drop the Pro flag and trigger a downgrade. The patch intercepts the response before it reaches the store.
3. setAccountLanguage Service Method
The setAccountLanguage service method was originally missed in earlier implementations, causing Pro status to be lost when users changed the UI language. The patch wraps this response to inject the active subscription object.
Language switches trigger a server call that refreshes and rewrites the account payload. This third patch guarantees that Pro persists even during seemingly unrelated localization updates.
4. ACTION_SET_ACCOUNT Reducer
The fourth patch modifies the ACTION_SET_ACCOUNT Redux reducer to ensure any subsequent store updates retain the Pro subscription flag. This covers background refreshes, push notifications, or profile edits that bypass the patched service methods.
Even if a patched service method is circumvented or a direct store dispatch occurs, the reducer-level patch acts as a final safety net, maintaining the subscription state in the client-side state management layer.
Defense-in-Depth Architecture
The need for four separate patches stems from Wand’s multiple entry points for account updates. The first three targets—getUserAccount, setAccountWandBrandExperience, and setAccountLanguage—represent distinct HTTP endpoints that return the account payload. The fourth secures the client-side state management layer against indirect updates.
If any single patch were omitted, a user could lose Pro status after specific operations: a language change would trigger the third pathway, a brand update would trigger the second, and background syncs would exploit the unpatched reducer. Together, these patches form a comprehensive defense-in-depth strategy that prevents accidental downgrade to the free tier regardless of which code path updates the account.
Implementation in the Codebase
The activation logic is orchestrated through the EPatchType.ActivatePro enum and applied in the configuration pipeline.
In PatchConfig.cs, the patch type is defined:
// PatchConfig.cs - Enum definition
public enum EPatchType
{
ActivatePro,
// ... other patch types
}
The EnhancerConfig.cs file adds ActivatePro to the pipeline and applies the four underlying patches:
// Inside EnhancerConfig.cs
if (patchTypes.Contains(EPatchType.ActivatePro))
{
// Apply the four service/reducer patches:
// 1. getUserAccount injection
// 2. setAccountWandBrandExperience wrapping
// 3. setAccountLanguage wrapping
// 4. ACTION_SET_ACCOUNT reducer modification
}
The detailed rationale and technical specifications for each patch are documented in AGENTS.md, which maps the specific injection points to their corresponding service methods and reducer actions.
Summary
- Four distinct entry points exist for account updates in Wand: three HTTP service methods and one Redux reducer.
- Service patches target
getUserAccount,setAccountWandBrandExperience, andsetAccountLanguageto inject active subscription data into their responses. - Reducer patch modifies
ACTION_SET_ACCOUNTto preserve Pro status during background refreshes and store updates that bypass services. - Defense-in-depth requires all four patches; removing any creates a vulnerability where specific user actions (language changes, brand updates) could strip Pro activation.
- Configuration is managed through
EPatchType.ActivateProinPatchConfig.csand applied viaEnhancerConfig.cs.
Frequently Asked Questions
What happens if I only apply three of the four patches?
If any patch is omitted, Pro status will be vulnerable to specific update pathways. For example, skipping the setAccountLanguage patch causes Pro activation to be lost when the user changes the interface language. Skipping the reducer patch leaves the account susceptible to downgrades from background refreshes or push notifications that update the store directly without calling the patched service methods.
Where is the ActivatePro patch type defined?
The ActivatePro patch type is defined as an enum value in PatchConfig.cs located at WandEnhancer/Models/PatchConfig.cs. This file contains the EPatchType enumeration that flags which enhancement modules should be loaded during initialization.
Does patching these methods affect normal account functionality?
No. The patches perform non-destructive injection operations that only modify the subscription field in the account payload. They preserve all other account data including user profile information, progress tracking, and settings while ensuring the Pro flag remains active.
Why is the reducer patched separately from the service methods?
The Redux reducer processes ACTION_SET_ACCOUNT dispatches that may originate from sources other than the three patched HTTP endpoints, such as background synchronization, push notifications, or third-party integrations. Patching only the service methods would leave the store vulnerable to account updates that bypass the network layer entirely, making the fourth patch essential for complete coverage.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →