Rust + KID pivot — Plan 8a: activate ALL / ANY / ExclusiveGroup#46
Merged
Rust + KID pivot — Plan 8a: activate ALL / ANY / ExclusiveGroup#46
Conversation
Pure mora-kid work — no mora-esp binary-format changes. Activates ALL + ANY filter buckets (AST already captures them from Plan 6), parses + enforces ExclusiveGroup with per-form tracking, DistributorStats gains rejected_by_exclusive_group counter. 7 tasks across 6 phases. Preserves scope — trait predicates wait for Plan 8b's mora-esp extensions.
Sixth counter on DistributorStats tracking skipped emissions due to ExclusiveGroup enforcement. AddAssign impl + existing test updated. Plan 8a's distributor populates this counter.
Holds name + unresolved member references + source location. Plan 8a Task 4 extends the INI parser to produce these alongside KidRules; Task 6 resolves + enforces in the distributor.
evaluate() now enforces the ALL bucket (every + sub-group, every ref within, must match) before MATCH/NOT checks. New evaluate_with_any() layers ANY substring check on top — requires item_editor_id + kw_edid_map which only the distributor pre-builds. Unit test for parser grouping; semantic tests land in tests/filter_activation.rs.
INI parser now returns ParsedIni { rules, exclusive_groups } so
ExclusiveGroup lines are captured instead of silently skipped.
KidDistributor gains with_exclusive_groups() builder + per-form
applied-group tracking — when a keyword is in one or more exclusive
groups and another member of those groups has already been applied
to the form, the emission is skipped and stats.rejected_by_exclusive_group
increments.
Filter evaluator: ALL (+) bucket activation + new evaluate_with_any
that layers ANY (*) substring match against item editor-ID + its
keyword editor-IDs. Distributor pre-builds kw_edid_map once per run
so per-candidate checks are O(candidates * substrings * keywords)
with constant-time lookups.
Downstream callers (pipeline::compile + mora-cli compile.rs) updated
for the new ini::parse_file signature.
5 tests against synthetic ESPs: - all_filter_requires_every_ref_to_match - any_filter_substring_matches_editor_id - any_filter_substring_matches_keyword_editor_id - exclusive_group_prevents_second_application - exclusive_group_independent_per_form Exercises Plan 8a's filter activations end-to-end.
Whitespace normalization across new filter_activation.rs + edits in filter.rs / distributor.rs. No functional changes.
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
Activates three KID features that Plan 6 parsed but left dormant in the evaluator/distributor:
+prefix) — every ref across every+-joined group must match. AST already captured these; this PR activates the evaluator branch.*prefix) — case-insensitive substring match against the item's editor-ID and its keyword editor-IDs. Newevaluate_with_any()extendsevaluate()with the kw_edid_map context that only the distributor can build.ParsedIni { rules, exclusive_groups }soExclusiveGroup = Name|kw1,kw2,...lines are captured. Distributor tracks per-form applied-group state; skips emitting a keyword if another member of its exclusive group has already been applied to the same form.DistributorStatsgainsrejected_by_exclusive_group.Downstream callers (
pipeline::compile,mora-cli/src/compile.rs) updated for the newini::parse_filesignature.Test plan
cargo test --workspace— 181 tests (174 prior + 7 new: 5 integration + 1 parser + 1 bucket count)cargo clippy --all-targets -- -D warningscleancargo fmt --checkcleancargo xwin check --target x86_64-pc-windows-msvc --workspacecleanScope discipline
DistributorStatsgains a field in mora-core; everything else is mora-kid internal..nif) — both need mora-esp extensions.-prefix (NOT-in-group) parsed as regular member with debug log — KID's NOT semantics are subtle and rarely used.What still blocks full KID parity on Weapon + Armor
Next up
Plan 8b — mora-esp record extensions + trait predicate activation.