Apply a declaration block to every ::object-id it selects - #41
Merged
Merged
Conversation
biodranik
force-pushed
the
ab/object-id-per-block
branch
from
August 15, 2026 07:51
efc3b28 to
95aaaf1
Compare
updateStyles() took the first rule testChains() matched and applied the
whole declaration block to that single ::object-id, so in a selector
group that mixes layers only the first one was ever styled:
node|z16-[addr:housenumber][addr:street],
node|z16-[addr:housenumber][addr:street]::int_name,
{text: none;}
muted ::default and left ::int_name rendered. The surviving layer then
owns the caption drule, so libkomwm asks for a priority of
`<type>::int_name`, which no style defines, and generation fails with
"ERROR: priority is not set". Which selector wins is positional, so
reordering the group only moves the hole. This is what the
/* ToDo text: none; doesn't work here .. */
comment in the main repo's vehicle style has been working around.
Match each distinct ::object-id of the group instead. Output is
byte-identical for all four style families of the main repo (default,
outdoors, cycling, vehicle; light and dark), and the block above now
produces exactly what the ::* workaround does.
test_update_styles_by_class pinned the old behaviour ("This class is
ignored by StyleChooser"); it now asserts that both selected classes
are styled.
Signed-off-by: Alexander Borsuk <me@alex.bio>
biodranik
force-pushed
the
ab/object-id-per-block
branch
from
August 16, 2026 14:54
95aaaf1 to
f2446d1
Compare
This was referenced Aug 16, 2026
Merged
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.
Problem
updateStyles()took the first ruletestChains()matched and applied the whole declaration block to that single::object-id. In a selector group that mixes layers, only the first one was ever styled:::defaultgetstext: none,::int_namekeepstext: int_name. The surviving layer then owns the caption drule, solibkomwmlooks up a priority for<type>::int_name— which no style defines — and generation dies withERROR: priority is not set for caption building-address::int_name.Which selector wins is purely positional: putting
::int_namefirst suppresses that one and leaves::defaultrendered, so reordering the group only moves the hole.This is what the
comment in the main repo's
data/styles/vehicle/include/Basemap_label.mapcsshas been working around; addingtext: noneto that block reproduces the same failure.Fix
testChainsAll()returns the first matching rule for each distinct::object-idin the group, andupdateStyles()applies the block to each.testChains()is untouched, soget_runtime_conditions()and the existing test call sites are unaffected.Blast radius
22 of 3268 declaration blocks in the main repo mix object-ids (11 in
default/Roads.mapcss::cycleline, 8 inoutdoors/Roads.mapcss, 2::bridgeblack/::bridgewhite, 1 the vehicle ToDo). Regenerating everything throughgenerate_drules.sh:Byte-identical for all four families, light and dark. And the housenumber block above now produces exactly what the
::*workaround does — samedrules_cycling.bin, 0 errors.Testing
python -m unittest discover -s testspasses 57/57.test_update_styles_by_classpinned the old behaviour (its own comment read# This class is ignored by StyleChooser) and now asserts both selected classes are styled.Note: CI on this branch is red for an unrelated reason — see #40, which restores it.
Unlocked follow-up
The vehicle ToDo can be resolved in the main repo once this is pinned.
Generated with LLM assistance.