Fix Force Generator faction ruleset bugs - #348
Merged
Merged
Conversation
Sweep for predicate/assertion errors in faction_rules XML that the engine treated as silent no-ops or caused infinite loops during force generation. - CHH/CLAN.GC: replace ifYearBetween (8 sites) with documented ifDateBetween. The engine never honored the ifYearBetween alias, so ProtoMek attachments fired anachronistically (CHH/CLAN.GC clusters got ProtoMeks at year 2900). - CHH/CLAN.GC/CSL: change ifRating="strike" and ifRole="strike" (46 sites) to ifFlags="strike". "strike" is a flag, not a rating/role, so the cavalry-cluster weighting never fired. - CHH/CLAN.GC/CSL: change ifRole="testTrinary" (9 sites) to ifFlags="testTrinary". Same flag-vs-role mix-up. - CHH/CLAN.GC/CSL: change ifFlags="adHoc" (9 sites) to "adhoc" — case mismatch with the canonical lowercase form set elsewhere. - FS: change <role ifRole="lct"> to ifFlags="lct" — LCT is a flag everywhere else in FS.xml. - CHH/CLAN.GC: add missing + prefix to flags="mekTankStar" (2 sites) so the flag is added rather than wiping the inherited flag set. - CHH/CLAN.GC/CSA/CSL: change role="-testTrinary" (31 sites) to flags="-testTrinary" in <changeEschelon> options. This is the most important fix — without it the testTrinary flag was never cleared after the changeEschelon fired, causing an infinite loop in Ruleset.buildForceTree for CHH AeroSpaceFighter Trinaries (observed: 7.5M iterations producing a 1 GB log file). - formationRulesetSchema.xsd: keep the ifYearBetween attribute declaration but mark it as a deprecated alias kept for backwards compatibility. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HammerGS
added a commit
that referenced
this pull request
May 13, 2026
Pulled locally to support the Force Generator integration work in mekhq feat/force-generator-company-generation. Fixes ratgen rulesets for CHH / CLAN.GC / CSA / CSL / FS and adds a schema entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Sweep of faction ruleset XML files (
data/forcegenerator/faction_rules/) for predicate/assertion errors that the Force Generator engine silently ignored or that caused infinite generation loops.Paired with the engine-side fixes in megamek#fix-force-generator-errors.
Itemized Fixes
ifYearBetweenis not a recognized predicate; never matched, so the option always "passed" the date filterifDateBetween(ProtoMek attachments now correctly gated to year ≥ 3060)ifRating="strike"andifRole="strike"—strikeis a flag, not a rating/role, so cavalry-cluster weighting never firedifFlags="strike"ifRole="testTrinary"— same flag-vs-role mix-up on<changeEschelon>predicatesifFlags="testTrinary"ifFlags="adHoc"— case mismatch (canonical form is lowercaseadhoc)ifFlags="adhoc"<role ifRole="lct">— LCT is consistently a flag elsewhere in FS.xmlifFlags="lct"flags="mekTankStar"missing+prefix — wipes inherited flags rather than addingflags="+mekTankStar"role="-testTrinary"in<changeEschelon>options — tried to remove from roles whentestTrinaryis a flag. After fix #3 made the changeEschelon predicate match, this no-op caused thetestTrinaryflag to never clear, producing an infinite loop inRuleset.buildForceTreewhen generating CHH/CLAN.GC/CSL AeroSpaceFighter Trinariesflags="-testTrinary"ifYearBetweendeclared in schema but never implemented in JavaImpact
🤖 Generated with Claude Code