Report runtime conditions of every ::object-id a block selects - #43
Merged
Merged
Conversation
updateStyles() now applies a declaration block to each ::object-id its
selector group matches (testChainsAll), but get_runtime_conditions()
still used testChains() and reported only the first matching chain's
conditions. libkomwm builds one drule variant per reported condition
set, so for a group that mixes object-ids *and* per-chain runtime
conditions the second object-id's variant was never enumerated and
applyStylesTo()'s filter_by_runtime_conditions check silently dropped
its styles:
node|z4-[place=city][population>=1000],
node|z4-[place=city][population>=500]::int_name,
{text: name;}
reported conditions -> ['population>=1000']
resulting styles -> ['::default'] # ::int_name lost
Collect the conditions of all matched object-ids instead, so the two
functions agree on what a block selects. Latent so far: no style in the
main repo mixes object-ids with per-chain runtime conditions, and the
generated drules of all four style families stay byte-identical.
testChains() has no callers left; drop it and point its tests at
testChainsAll(), or straight at Rule.test() where the chooser has a
single chain.
Signed-off-by: Alexander Borsuk <me@alex.bio>
strump
approved these changes
Aug 20, 2026
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.
Follow-up to #41.
What
updateStyles()applies a declaration block to each::object-idits selector groupmatches, but
get_runtime_conditions()still usedtestChains()and reported only thefirst matching chain's conditions.
libkomwmbuilds one drule variant per reportedcondition set, so for a group that mixes object-ids and per-chain runtime conditions the
second object-id's variant was never enumerated, and
applyStylesTo()'sfilter_by_runtime_conditionscheck silently dropped its styles:Collect the conditions of all matched object-ids instead, so the two functions agree on
what a block selects.
testChains()has no callers left afterwards, so it is dropped; its tests point attestChainsAll(), or straight atRule.test()where the chooser has a single chain.Impact
Latent so far — no style in the main repo mixes object-ids with per-chain runtime
conditions inside one block, so the generated drules do not change.
Testing
python3 -m unittest discover -s tests— 57 tests pass; the newtest_runtime_conditionsfails against master.
ruff check --target-version=py39— clean.integration-tests/full_drules_gen.pyagainst the main repo'sdata/(default, outdoors,vehicle; light and dark): the
.bin/.txtfiles and the side files (types.txt,classificator.txt,visibility.txt,colors.txt,patterns.txt, priorities) arebyte-identical to master's output. Generation time unchanged (~11.1 s either way).