refactor(catalog): single-source the object-type code set from OBJ_TYPES#511
Merged
Merged
Conversation
149077b to
1215e0d
Compare
The allowed object-type codes were hand-duplicated in the filter menu, default_config.json and the docs. Make OBJ_TYPES the one source: - generate the Type filter menu items from OBJ_TYPES (drops the hardcoded list) - default filter.object_types to list(OBJ_TYPES) instead of a JSON array - order OBJ_TYPES to the filter-menu display order - add a drift-guard test (README codes table + default_config)
1215e0d to
1699210
Compare
Owner
|
Thanks @mrosseel great bit of cleanup here! |
hjoungjoo
pushed a commit
to hjoungjoo/MF_PiFinder
that referenced
this pull request
Jul 2, 2026
…PES (brickbots#511) The allowed object-type codes were hand-duplicated in the filter menu, default_config.json and the docs. Make OBJ_TYPES the one source: - generate the Type filter menu items from OBJ_TYPES (drops the hardcoded list) - default filter.object_types to list(OBJ_TYPES) instead of a JSON array - order OBJ_TYPES to the filter-menu display order - add a drift-guard test (README codes table + default_config)
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.
What
OBJ_TYPES(python/PiFinder/obj_types.py) becomes the single source of truth for the object-type code set, which was hand-duplicated in the filter menu and the docs (and had drifted).ui/menu_structure.py) — the Type filter items are now generated fromOBJ_TYPES(drops the hardcoded list of code/label pairs).obj_types.py— reordered to the filter-menu display order (iteration order only; lookups are unaffected) and documented as the canonical source.tests/test_obj_types_docs.py) — fails if anything drifts out of sync withOBJ_TYPES:default_config.json'sfilter.object_types(the default Type-filter selection) must equal theOBJ_TYPESset, so a newly added type can't be silently off by default;OBJ_TYPES(no-ops where that table isn't present — it ships in the obslist docs PR — and activates once both land onmain).User-facing change
The Type filter menu adopts the same labels already used on the object-detail screen (they previously disagreed):
These msgids already exist and are translated in every locale (they are the detail-screen labels).
Test plan
🤖 Generated with Claude Code