From 920bb5ae9d4324fb07ea6bf0610bd2e4cec03d7f Mon Sep 17 00:00:00 2001 From: d1rshan Date: Tue, 24 Mar 2026 17:17:50 +0530 Subject: [PATCH 1/3] fix(config): block monkey with live text stats --- .../__tests__/root/config-metadata.spec.ts | 13 ++++++++ frontend/__tests__/root/config.spec.ts | 22 +++++++++++++ frontend/src/ts/config/metadata.ts | 31 +++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/frontend/__tests__/root/config-metadata.spec.ts b/frontend/__tests__/root/config-metadata.spec.ts index d8db8f348d75..ea60ec416152 100644 --- a/frontend/__tests__/root/config-metadata.spec.ts +++ b/frontend/__tests__/root/config-metadata.spec.ts @@ -163,6 +163,19 @@ describe("ConfigMeta", () => { { value: false, given: { tapeMode: "word" } }, { value: true, given: { tapeMode: "word" }, fail: true }, ], + monkey: [ + { value: false, given: { liveSpeedStyle: "text" } }, + { value: true, given: { liveSpeedStyle: "text" }, fail: true }, + { value: true, given: { liveAccStyle: "text" }, fail: true }, + ], + liveSpeedStyle: [ + { value: "mini", given: { monkey: true } }, + { value: "text", given: { monkey: true }, fail: true }, + ], + liveAccStyle: [ + { value: "mini", given: { monkey: true } }, + { value: "text", given: { monkey: true }, fail: true }, + ], }; it.for( diff --git a/frontend/__tests__/root/config.spec.ts b/frontend/__tests__/root/config.spec.ts index d8c881e5588f..fd3572b135b2 100644 --- a/frontend/__tests__/root/config.spec.ts +++ b/frontend/__tests__/root/config.spec.ts @@ -109,6 +109,28 @@ describe("Config", () => { expect(Config.setConfig("showAllLines", true)).toBe(false); }); + it("shows a notice when monkey conflicts with live text stats", () => { + //GIVEN + replaceConfig({ liveSpeedStyle: "text", monkey: false }); + + //WHEN / THEN + expect(Config.setConfig("monkey", true)).toBe(false); + expect(notificationAddMock).toHaveBeenCalledWith( + "Monkey can't be enabled while live speed or live accuracy is set to text.", + ); + }); + + it("shows a notice when live speed text conflicts with monkey", () => { + //GIVEN + replaceConfig({ monkey: true, liveSpeedStyle: "off" }); + + //WHEN / THEN + expect(Config.setConfig("liveSpeedStyle", "text")).toBe(false); + expect(notificationAddMock).toHaveBeenCalledWith( + "Live speed can't be set to text while monkey is enabled.", + ); + }); + it("should use overrideValue", () => { //WHEN Config.setConfig("customLayoutfluid", ["3l", "ABNT2", "3l"]); diff --git a/frontend/src/ts/config/metadata.ts b/frontend/src/ts/config/metadata.ts index 4a5f62f5c2a6..42af987f528b 100644 --- a/frontend/src/ts/config/metadata.ts +++ b/frontend/src/ts/config/metadata.ts @@ -532,12 +532,30 @@ export const configMetadata: ConfigMetadataObject = { displayString: "live speed style", changeRequiresRestart: false, group: "appearance", + isBlocked: ({ value, currentConfig }) => { + if (value === "text" && currentConfig.monkey) { + showNoticeNotification( + "Live speed can't be set to text while monkey is enabled.", + ); + return true; + } + return false; + }, }, liveAccStyle: { icon: "fa-tachometer-alt", displayString: "live accuracy style", changeRequiresRestart: false, group: "appearance", + isBlocked: ({ value, currentConfig }) => { + if (value === "text" && currentConfig.monkey) { + showNoticeNotification( + "Live accuracy can't be set to text while monkey is enabled.", + ); + return true; + } + return false; + }, }, liveBurstStyle: { icon: "fa-tachometer-alt", @@ -873,6 +891,19 @@ export const configMetadata: ConfigMetadataObject = { displayString: "monkey", changeRequiresRestart: false, group: "hidden", + isBlocked: ({ value, currentConfig }) => { + if ( + value && + (currentConfig.liveSpeedStyle === "text" || + currentConfig.liveAccStyle === "text") + ) { + showNoticeNotification( + "Monkey can't be enabled while live speed or live accuracy is set to text.", + ); + return true; + } + return false; + }, }, monkeyPowerLevel: { icon: "fa-egg", From 84c5cde17d1a0a66d20c50810e5b1528572e92e2 Mon Sep 17 00:00:00 2001 From: d1rshan Date: Tue, 7 Apr 2026 18:32:39 +0530 Subject: [PATCH 2/3] fix(config): auto-resolve monkey live stats conflicts --- .../__tests__/root/config-metadata.spec.ts | 49 +++++++++++++++--- frontend/__tests__/root/config.spec.ts | 44 ++++++++++++---- frontend/src/ts/config/metadata.ts | 50 +++++++++---------- 3 files changed, 100 insertions(+), 43 deletions(-) diff --git a/frontend/__tests__/root/config-metadata.spec.ts b/frontend/__tests__/root/config-metadata.spec.ts index ea60ec416152..4c220d844d88 100644 --- a/frontend/__tests__/root/config-metadata.spec.ts +++ b/frontend/__tests__/root/config-metadata.spec.ts @@ -163,18 +163,14 @@ describe("ConfigMeta", () => { { value: false, given: { tapeMode: "word" } }, { value: true, given: { tapeMode: "word" }, fail: true }, ], - monkey: [ - { value: false, given: { liveSpeedStyle: "text" } }, - { value: true, given: { liveSpeedStyle: "text" }, fail: true }, - { value: true, given: { liveAccStyle: "text" }, fail: true }, - ], + monkey: [{ value: false, given: { liveSpeedStyle: "text" } }], liveSpeedStyle: [ { value: "mini", given: { monkey: true } }, - { value: "text", given: { monkey: true }, fail: true }, + { value: "text", given: { monkey: true } }, ], liveAccStyle: [ { value: "mini", given: { monkey: true } }, - { value: "text", given: { monkey: true }, fail: true }, + { value: "text", given: { monkey: true } }, ], }; @@ -257,6 +253,45 @@ describe("ConfigMeta", () => { expected: { freedomMode: false, stopOnError: "off" }, }, ], + monkey: [ + { + value: false, + given: { liveSpeedStyle: "text", liveAccStyle: "text" }, + expected: { + liveSpeedStyle: "text", + liveAccStyle: "text", + }, + }, + { + value: true, + given: { liveSpeedStyle: "text", liveAccStyle: "text" }, + expected: { liveSpeedStyle: "off", liveAccStyle: "off" }, + }, + ], + liveSpeedStyle: [ + { + value: "mini", + given: { monkey: true }, + expected: { monkey: true }, + }, + { + value: "text", + given: { monkey: true }, + expected: { monkey: false }, + }, + ], + liveAccStyle: [ + { + value: "mini", + given: { monkey: true }, + expected: { monkey: true }, + }, + { + value: "text", + given: { monkey: true }, + expected: { monkey: false }, + }, + ], tapeMode: [ { value: "off", diff --git a/frontend/__tests__/root/config.spec.ts b/frontend/__tests__/root/config.spec.ts index fd3572b135b2..718541da964f 100644 --- a/frontend/__tests__/root/config.spec.ts +++ b/frontend/__tests__/root/config.spec.ts @@ -109,26 +109,48 @@ describe("Config", () => { expect(Config.setConfig("showAllLines", true)).toBe(false); }); - it("shows a notice when monkey conflicts with live text stats", () => { + it("disables live text stats when enabling monkey", () => { //GIVEN - replaceConfig({ liveSpeedStyle: "text", monkey: false }); + replaceConfig({ + liveSpeedStyle: "text", + liveAccStyle: "text", + monkey: false, + }); //WHEN / THEN - expect(Config.setConfig("monkey", true)).toBe(false); - expect(notificationAddMock).toHaveBeenCalledWith( - "Monkey can't be enabled while live speed or live accuracy is set to text.", - ); + expect(Config.setConfig("monkey", true)).toBe(true); + expect(getConfig()).toMatchObject({ + monkey: true, + liveSpeedStyle: "off", + liveAccStyle: "off", + }); + expect(notificationAddMock).not.toHaveBeenCalled(); }); - it("shows a notice when live speed text conflicts with monkey", () => { + it("disables monkey when enabling live speed text", () => { //GIVEN replaceConfig({ monkey: true, liveSpeedStyle: "off" }); //WHEN / THEN - expect(Config.setConfig("liveSpeedStyle", "text")).toBe(false); - expect(notificationAddMock).toHaveBeenCalledWith( - "Live speed can't be set to text while monkey is enabled.", - ); + expect(Config.setConfig("liveSpeedStyle", "text")).toBe(true); + expect(getConfig()).toMatchObject({ + monkey: false, + liveSpeedStyle: "text", + }); + expect(notificationAddMock).not.toHaveBeenCalled(); + }); + + it("disables monkey when enabling live accuracy text", () => { + //GIVEN + replaceConfig({ monkey: true, liveAccStyle: "off" }); + + //WHEN / THEN + expect(Config.setConfig("liveAccStyle", "text")).toBe(true); + expect(getConfig()).toMatchObject({ + monkey: false, + liveAccStyle: "text", + }); + expect(notificationAddMock).not.toHaveBeenCalled(); }); it("should use overrideValue", () => { diff --git a/frontend/src/ts/config/metadata.ts b/frontend/src/ts/config/metadata.ts index 3ccfa5a08ba8..2cca6ad8ec3e 100644 --- a/frontend/src/ts/config/metadata.ts +++ b/frontend/src/ts/config/metadata.ts @@ -620,14 +620,13 @@ export const configMetadata: ConfigMetadataObject = { displayString: "live speed style", changeRequiresRestart: false, group: "appearance", - isBlocked: ({ value, currentConfig }) => { - if (value === "text" && currentConfig.monkey) { - showNoticeNotification( - "Live speed can't be set to text while monkey is enabled.", - ); - return true; + overrideConfig: ({ value }) => { + if (value === "text") { + return { + monkey: false, + }; } - return false; + return {}; }, }, liveAccStyle: { @@ -636,14 +635,13 @@ export const configMetadata: ConfigMetadataObject = { displayString: "live accuracy style", changeRequiresRestart: false, group: "appearance", - isBlocked: ({ value, currentConfig }) => { - if (value === "text" && currentConfig.monkey) { - showNoticeNotification( - "Live accuracy can't be set to text while monkey is enabled.", - ); - return true; + overrideConfig: ({ value }) => { + if (value === "text") { + return { + monkey: false, + }; } - return false; + return {}; }, }, liveBurstStyle: { @@ -1023,18 +1021,20 @@ export const configMetadata: ConfigMetadataObject = { displayString: "monkey", changeRequiresRestart: false, group: "hidden", - isBlocked: ({ value, currentConfig }) => { - if ( - value && - (currentConfig.liveSpeedStyle === "text" || - currentConfig.liveAccStyle === "text") - ) { - showNoticeNotification( - "Monkey can't be enabled while live speed or live accuracy is set to text.", - ); - return true; + overrideConfig: ({ value, currentConfig }) => { + if (value) { + return { + liveSpeedStyle: + currentConfig.liveSpeedStyle === "text" + ? "off" + : currentConfig.liveSpeedStyle, + liveAccStyle: + currentConfig.liveAccStyle === "text" + ? "off" + : currentConfig.liveAccStyle, + }; } - return false; + return {}; }, }, monkeyPowerLevel: { From 72f96239f6f279b0a262b969d1f6f36e735537b3 Mon Sep 17 00:00:00 2001 From: d1rshan Date: Wed, 8 Apr 2026 16:13:02 +0530 Subject: [PATCH 3/3] update to mini --- frontend/__tests__/root/config-metadata.spec.ts | 2 +- frontend/__tests__/root/config.spec.ts | 4 ++-- frontend/src/ts/config/metadata.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/__tests__/root/config-metadata.spec.ts b/frontend/__tests__/root/config-metadata.spec.ts index 4c220d844d88..ac227685de5d 100644 --- a/frontend/__tests__/root/config-metadata.spec.ts +++ b/frontend/__tests__/root/config-metadata.spec.ts @@ -265,7 +265,7 @@ describe("ConfigMeta", () => { { value: true, given: { liveSpeedStyle: "text", liveAccStyle: "text" }, - expected: { liveSpeedStyle: "off", liveAccStyle: "off" }, + expected: { liveSpeedStyle: "mini", liveAccStyle: "mini" }, }, ], liveSpeedStyle: [ diff --git a/frontend/__tests__/root/config.spec.ts b/frontend/__tests__/root/config.spec.ts index 718541da964f..40e3ced07ee2 100644 --- a/frontend/__tests__/root/config.spec.ts +++ b/frontend/__tests__/root/config.spec.ts @@ -121,8 +121,8 @@ describe("Config", () => { expect(Config.setConfig("monkey", true)).toBe(true); expect(getConfig()).toMatchObject({ monkey: true, - liveSpeedStyle: "off", - liveAccStyle: "off", + liveSpeedStyle: "mini", + liveAccStyle: "mini", }); expect(notificationAddMock).not.toHaveBeenCalled(); }); diff --git a/frontend/src/ts/config/metadata.ts b/frontend/src/ts/config/metadata.ts index 2cca6ad8ec3e..dc4815ae5b3f 100644 --- a/frontend/src/ts/config/metadata.ts +++ b/frontend/src/ts/config/metadata.ts @@ -1026,11 +1026,11 @@ export const configMetadata: ConfigMetadataObject = { return { liveSpeedStyle: currentConfig.liveSpeedStyle === "text" - ? "off" + ? "mini" : currentConfig.liveSpeedStyle, liveAccStyle: currentConfig.liveAccStyle === "text" - ? "off" + ? "mini" : currentConfig.liveAccStyle, }; }