Feat: Remove popups when configs.xml or presets.xml have invalid values. Just notify on configs.xml#10
Conversation
Replace blocking MessageBox in tagDefaultValue with a non-blocking Notification, gated on a new warn flag. loadConfigFile passes warn=true so a missing tag in configs.xml still surfaces; configMatchesPreset passes warn=false since tag gaps in presets are expected during the match check and should not interrupt the player. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe FSMPM.psc script was updated to add an optional Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Source/Scripts/FSMPM.psc (1)
473-506: 🧹 Nitpick | 🔵 TrivialLGTM — clean, minimal change that correctly threads
warnthrough totagDefaultValue.Signature additions use optional params (backward-compatible), the notification message accurately attributes the source to
configs.xml(only reachable withwarn=truefromloadConfigFile), andbLastTagFoundsemantics are preserved soconfigMatchesPresetstill detects mismatches silently.One minor consideration (non-blocking): if
configs.xmlis severely out-of-date/corrupt, up to 23 corner notifications could be emitted in quick succession fromloadConfigFile. SincestoreConfigAndSmpReset()immediately rewrites the file afterwards, you could consider aggregating into a single notification (e.g., collect missing tag names inloadConfigFileand emit one summary). Fine to leave as-is given the rarity of the scenario.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Source/Scripts/FSMPM.psc` around lines 473 - 506, The change is fine as-is: getTagValue now threads the optional warn flag through to tagDefaultValue so missing tags log a notification; keep this behavior. If you want to address the non-blocking concern, modify loadConfigFile to collect missing tag names instead of calling tagDefaultValue(warn=true) for each missing tag and emit a single aggregated Debug.Notification after parsing (use getTagValue/tagDefaultValue to detect missing tags but suppress per-tag notifications), then let storeConfigAndSmpReset continue to rewrite the file as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@Source/Scripts/FSMPM.psc`:
- Around line 473-506: The change is fine as-is: getTagValue now threads the
optional warn flag through to tagDefaultValue so missing tags log a
notification; keep this behavior. If you want to address the non-blocking
concern, modify loadConfigFile to collect missing tag names instead of calling
tagDefaultValue(warn=true) for each missing tag and emit a single aggregated
Debug.Notification after parsing (use getTagValue/tagDefaultValue to detect
missing tags but suppress per-tag notifications), then let
storeConfigAndSmpReset continue to rewrite the file as before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0fe31de2-d4b2-45fd-90a7-6dae6280d689
📒 Files selected for processing (3)
Scripts/FSMPM.pexScripts/FSMPMPlayerScript.pexSource/Scripts/FSMPM.psc
Summary
Replace blocking
Debug.MessageBoxintagDefaultValuewith a non-blockingDebug.Notification, gated on a newwarnflag threaded throughgetTagValue.loadConfigFile→warn=true: missing tag inconfigs.xmlstill surfaces (corner notification), sincestoreConfigAndSmpResetwill rewrite the file with defaults anyway.configMatchesPreset→warn=false: silent. A preset lacking a tag (or being absent entirely) is a normal mismatch signal, not a user-facing error.Motivation
On startup with only
configs.xmlpresent (no preset XMLs, or presets from an older FSMP version missing newer tags), the MCM fired a blocking popup per missing tag — e.g. "This tag isn't set in the loading file: logLevel". The popup was triggered by the preset-match path, where a miss is expected behavior, not an error.Changes
Source/Scripts/FSMPM.pscgetTagValue(..., bool warn = false)— new param, forwarded totagDefaultValue.tagDefaultValue(tag, bool warn = false)— notification instead of message box, only whenwarnis true.loadConfigFilepassestrue,configMatchesPresetpassesfalse.Test plan
FSMPM.psc.configs.xmlpresent and no preset XMLs — no popup on load.configs.xmlmanually — corner notification appears naming the tag and default;storeConfigAndSmpResetwrites the tag back.AI Notice
Summary by CodeRabbit