Align Parser return-type hints with actual UniqueList returns#632
Open
collerek wants to merge 1 commit into
Open
Align Parser return-type hints with actual UniqueList returns#632collerek wants to merge 1 commit into
collerek wants to merge 1 commit into
Conversation
Properties like `columns`, `tables`, `with_names`, `subqueries_names`, and `columns_aliases_names` were annotated as `list[str]` but actually returned `UniqueList`, which silently deduplicates on append. The mismatch surprised callers who wrote tests against `list` semantics and got dedup behavior at runtime. Updates the annotations (and matching extractor signatures in `TableExtractor.extract`, `NestedResolver.extract_cte_names`, `NestedResolver.extract_subqueries`) to declare `UniqueList`, so the public contract reflects what the code has always done. Resolves #291. Co-Authored-By: Claude <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
Parserproperties (columns,tables,with_names,subqueries_names,columns_aliases_names) were annotated aslist[str]but actually returnUniqueList, which silently deduplicates onappend. Callers writing tests againstlistsemantics could be surprised by the dedup behavior.TableExtractor.extract,NestedResolver.extract_cte_names,NestedResolver.extract_subqueries) so the contract is end-to-end honest about what the code has always done.UniqueList; only the annotations and:rtype:docstrings were misleading.Resolves #291.
Test plan
poetry run pytest -vv --cov=sql_metadata --cov-report=term-missing— 271 passed, 100% coveragepoetry run mypy sql_metadata— cleanpoetry run ruff check sql_metadata— clean🤖 Generated with Claude Code