fix(ego-lint): check ALL schema IDs for settings-schema match#154
Open
fix(ego-lint): check ALL schema IDs for settings-schema match#154
Conversation
When gschema.xml contains multiple <schema> elements (e.g. a main schema plus a .keybindings sub-schema), the previous code extracted only the first <schema id=...> attribute. If a sub-schema appeared first (as in PaperWM, where org.gnome.shell.extensions.paperwm.keybindings precedes the main org.gnome.shell.extensions.paperwm schema), schema/id-matches and schema/filename-convention both produced false-positive FAILs even though the correct schema was present. Changes: - Extract all schema IDs via new extract_all_schema_ids() helper - Refactor extract_schema_id() to use it (single-schema case unchanged) - Add schema_id_in_file() to test membership across all <schema> elements - schema/id-matches: pass if settings-schema is found in ANY schema element - schema/filename-convention: use settings-schema as the reference ID when settings-schema is defined in metadata.json (not the first schema found) - Add multi-schema@test fixture reproducing the PaperWM layout - Add 4 assertions to run-tests.sh covering the new behaviour Fixes false-positive FAILs on PaperWM and any extension that uses sub-schemas (keybindings, overrides, etc.) in a single gschema.xml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
When
gschema.xmlcontains multiple<schema>elements (e.g. a main schema plus a.keybindingssub-schema), the previous code extracted only the first<schema id=...>attribute. If a sub-schema appeared first — as in PaperWM, whereorg.gnome.shell.extensions.paperwm.keybindingsprecedes the mainorg.gnome.shell.extensions.paperwmschema —schema/id-matchesandschema/filename-conventionboth produced false-positive FAILs even though the correct schema was present.Root Cause
extract_schema_id()used| head -1, so it always returned the first<schema id=...>attribute regardless of order. Theschema/id-matchescheck then compared that first ID againstsettings-schema, and theschema/filename-conventioncheck expected the file to be named after that first ID.Fix
extract_all_schema_ids()— returns all<schema id=...>values from a fileextract_schema_id()to use it (single-schema case is unchanged)schema_id_in_file(file, id)— returns 0 if the target ID is in any schema elementschema/id-matches: pass ifsettings-schemais found in any<schema>element (not just the first)schema/filename-convention: whensettings-schemais defined inmetadata.json, use it as the reference ID for the expected filename (instead of the first schema found)Test Coverage
multi-schema@testfixture reproduces the PaperWM layout:.keybindingssub-schema appears first, main schema secondAffected Extensions
gschema.xmlwith sub-schemas (keybindings, overrides, etc.)🤖 Generated with Claude Code