Let a rule read a named set from the test resources - #7
Open
dionmcm wants to merge 1 commit into
Open
Conversation
dionmcm
force-pushed
the
ext/named-set-lookup
branch
from
August 29, 2026 05:41
5dc3066 to
dde3d12
Compare
semantic-tag-hierarchies.txt is loaded as a generic key=value,value,value store, but isSemanticTagCompatibleWithinHierarchy is the only way a rule can read it - and that method extracts a semantic tag from a term before looking it up, so the store is only reachable for values that are semantic tags. This exposes the same store for values that are not, so a rule can be driven by per-edition configuration. The case that prompted it is a set of module ids: an editorial policy that some editions have adopted and others have not cannot be expressed as a semantic tag, and hardcoding either the policy or its exceptions into a rule in common-authoring makes that rule wrong for somebody. Defaulted rather than abstract, so implementations outside this project - the authoring platform's, in particular - keep compiling untouched. The default answers false for every key, meaning "no configuration present", which obliges a rule using it to behave on false exactly as it did before the method existed. NamedSetLookupTest asserts that against an implementation declaring only the methods the interface required before this change. TestDescriptionService implements it too. Without that the rules test rig would always see the default, so a rule driven by a named set could only ever be tested unconfigured - the set would look empty however test-cases.json and the dummy test resources were written. No behaviour change on its own: no rule calls it yet.
dionmcm
force-pushed
the
ext/named-set-lookup
branch
from
August 29, 2026 06:46
dde3d12 to
aa0f9a0
Compare
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.
This change allows for more generalised configuration access for rules.
What
semantic-tag-hierarchies.txtis loaded as a generickey=value,value,valuestore, butisSemanticTagCompatibleWithinHierarchyis the only way a rule can read it. That method extracts a semantic tag from a term before looking it up, so the store is only reachable for values that happen to be semantic tags.Change
DescriptionService.isInNamedSet(setKey, value)exposes the same store for values that are not semantic tags, so a rule can be driven by per-edition configuration.Why
The case that prompted it is a set of module ids. An editorial policy that some editions have adopted and others have not cannot be expressed as a semantic tag, and hardcoding either the policy or its exceptions into a rule in
common-authoringmakes that rule wrong for somebody.Defaulted to the current behaviour. The default answers
falsefor every key, meaning "no configuration present". That obliges a rule using it to behave, onfalse, exactly as it did before the method existed.NamedSetLookupTestasserts this againstTestDescriptionService, which does not override it; that the test compiles at all is half the point.TestDescriptionServiceimplements it as well. OtherwiseRulesTestManualwould always see the interface default, so a rule driven by a named set could only ever be tested in its unconfigured state.test-cases.jsonand the dummy test resources were written to populate this.The rule in the companion PR is testable both ways, silent when its module is listed, firing when it is not.
Scope
No behaviour change on its own — no rule calls it yet. 8 new tests, existing suites unchanged, and the 109 rule directories in
RulesTestManualstill pass.