Skip to content

Report runtime conditions of every ::object-id a block selects - #43

Merged
biodranik merged 1 commit into
masterfrom
ab/runtime-conditions-all-object-ids
Aug 20, 2026
Merged

biodranik merged 1 commit into
masterfrom
ab/runtime-conditions-all-object-ids

Conversation

@biodranik

Copy link
Copy Markdown
Member

Follow-up to #41.

What

updateStyles() applies a declaration block to each ::object-id its selector group
matches, 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.

testChains() has no callers left afterwards, so it is dropped; its tests point at
testChainsAll(), or straight at Rule.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 new test_runtime_conditions
    fails against master.
  • ruff check --target-version=py39 — clean.
  • integration-tests/full_drules_gen.py against the main repo's data/ (default, outdoors,
    vehicle; light and dark): the .bin/.txt files and the side files (types.txt,
    classificator.txt, visibility.txt, colors.txt, patterns.txt, priorities) are
    byte-identical to master's output. Generation time unchanged (~11.1 s either way).

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>
@biodranik
biodranik requested review from strump and vng August 19, 2026 22:54
@biodranik
biodranik merged commit aaf822e into master Aug 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants