filter orphan keys from generated browser choices json#752
Merged
Conversation
BROWSER_CHOICES is dumped to both browser-choices.json (Vuetify list) and browser-map.json (raw map), but each format is consumed selectively by the frontend. Add per-file include-key frozensets in codex/choices/browser.py and look them up from choices_to_json.py so the generator skips keys the frontend never reads. Removed orphans: - browser-choices.json: IDENTIFIER_SOURCES (frontend uses map form) - browser-map.json: BOOKMARK_FILTER, VUETIFY_NULL_CODE, SETTINGS_GROUP (frontend uses Vuetify form) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
240e381 to
cf703e3
Compare
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.
Summary
BROWSER_CHOICESis dumped to bothbrowser-choices.json(Vuetify list) andbrowser-map.json(raw map), but the frontend consumes only one format per key. Add per-file include-key frozensets incodex/choices/browser.pyand havechoices_to_json.pylook them up to skip orphan keys at generation time.BROWSER_CHOICESnow requires also listing it in at least one of the two include-sets, otherwise it'll be emitted nowhere — surfaces future orphans early.Orphans excluded from JSON output
browser-choices.jsondrops:IDENTIFIER_SOURCES— frontend imports the raw-map form frombrowser-map.jsononlyVIEW_MODE— frontend toggle uses string literals, never reads the choices mapTABLE_COVER_SIZE— single-value placeholder, no frontend UI consumes the choices mapbrowser-map.jsondrops:BOOKMARK_FILTER,VUETIFY_NULL_CODE,SETTINGS_GROUP— frontend uses the Vuetify-list form frombrowser-choices.jsonCOVER_ORDER_BY_KEYS,EXTRA_SORT_UNSUPPORTED_KEYS— frontend reads them viaBROWSER_CHOICES.Xfrombrowser-choices.jsonVIEW_MODE,TABLE_COVER_SIZE— same as aboveThe Python source consts (
BROWSER_VIEW_MODE_CHOICES,BROWSER_TABLE_COVER_SIZE_CHOICES) are still used by the backend (models, serializers) so they stay inbrowser.py— only their JSON exposure is removed.Coverage notes
All other generated files (
admin-flag-choices,admin-status-titles,admin-jobs,browser-defaults,browser-table-*,reader-*,search-map,websocket-messages) had every top-level key consumed — either statically or as a dynamic lookup table — so no other files needed filtering. Every public Python const incodex/choices/*.pyis consumed by either the JSON generator or other backend modules.Test plan
./bin/build-choices.shregenerates with the expected key setsmake fix— no changesmake test— 218 Python + 55 frontend tests pass🤖 Generated with Claude Code