fix: comma-separated --schema/--exclude_schema silently matched nothing - #12
Merged
Conversation
--schema public,reporting was documented as supported but the raw comma-joined string was passed straight through to schemainspect's filter_schema(), which compares it for exact equality against each object's schema name -- "public,reporting" never equals "public" or "reporting", so the diff was always empty with no error. Single-schema and no-schema calls were never affected. Adds parse_schema_arg()/filter_inspector_schemas() in migra/util.py (the latter reuses schemainspect's own PROPS list rather than a hardcoded copy, so it can't drift out of sync) and _get_inspector() in migra/migra.py, wired into all 5 of Migration's inspector-construction call sites. Single/no-schema calls pass straight through to the original get_inspector() unchanged; only 2+ comma-separated names take the new post-filter path. New tests each include a third, unlisted schema in the fixture data to prove real filtering rather than "happens to work with one schema", and exercise both the CLI path and Migration.apply() directly. Co-Authored-By: Claude Sonnet 5 <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.
Summary
--schema public,reportingwas documented in the README as supported ("Multiple schemas (comma-separated)"), but the raw comma-joined string was passed straight through toschemainspect'sfilter_schema(), which compares it for exact equality against each object's schema name —"public,reporting"never equals"public"or"reporting", so the diff was silently empty with no error. Single-schema (--schema public) and no-schema calls were never affected — this only broke 2+ comma-separated names.parse_schema_arg()/filter_inspector_schemas()inmigra/util.py.filter_inspector_schemas()reuses schemainspect's ownPROPSlist (the same one itsfilter_schema()iterates over) instead of hardcoding a second copy, so it can't silently drift out of sync as schemainspect adds new object types._get_inspector()inmigra/migra.py, used at all 5 ofMigration's inspector-construction call sites (__init__x2,inspect_from(),inspect_target(),apply()). Single-schema/no-schema calls are passed straight through to the originalget_inspector()unchanged — zero behavior change there; only 2+ comma-separated names take the new post-filter path.Test plan
test_migra.py:test_multischema,test_multischema_whitespace_tolerant(surrounding whitespace in the comma list),test_exclude_multischema— each fixture (tests/FIXTURES/multischema/,tests/FIXTURES/exclude_multischema/) includes a third, unlisted schema so the assertions prove real filtering (expected cross-schema changes present, third-schema changes absent), not just "happens to work with one schema"run()) andMigration.apply()directly, viado_fixture_test's existing two-phase structure🤖 Generated with Claude Code