fix(osmsg/handlers.py): --length silently produced no output unless the same key was also passed to --tags - #58
Merged
kshitijrajsharma merged 1 commit intoAug 24, 2026
Conversation
--length keys were only tracked if the same key was also passed to --tags; now the tracked-key set is the union of both.
kshitijrajsharma
approved these changes
Aug 24, 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.
The bug
In the default mode (no
--all, no--keys),ChangefileHandler._accumulatedecided which tag keys to record stats for by checkingcfg["additional_tags"](i.e.--tags) only.--lengthis documented as its own independent flag, but the code never consultedcfg["length"]when building that list. As a result, any key passed to--lengththat wasn't also repeated in--tagsnever got aTagValueStatwritten for it — no error, no warning, just an empty/zero result.The fix
Track the union of
--tagsand--lengthkeys instead of just--tags.The tracked keys are computed once in
__init__asself._tracked_keys, rather than re-readingcfg["additional_tags"]for every element.Before
highway_len_mcomes back as0for every row.ChangefileHandlernever accumulated anything forhighwaybecause--lengthdoesn't feed intoadditional_tags.After
The same command now correctly reports the summed length of created
highway=*ways.--lengthworks independently and also correctly picks up keys that are in--lengthbut not in--tagswhen both are passed together.For example:
Previously,
highwaywas silently dropped because only keys from--tagswere tracked. It is now correctly included.