Repository navigation
fix: refuse bool and float item IDs everywhere instead of coercing them #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5b48364
fix: refuse bool and float item IDs everywhere instead of coercing them
minseokpark-CL 03c4e6f
fix: accept NumPy integers as item IDs
minseokpark-CL 9fc0667
fix: refuse a bare string as ids, cap digit strings, and raise on wro…
minseokpark-CL d5e4514
fix: treat ids=None as "nothing to update" again, as on main
minseokpark-CL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 ID 문자열 하나를 넘기면 글자마다 다른 item ID로 읽힙니다
ID 판별 논리는 맞아 보이나,
ids에list대신 ID 문자열 하나를 넘기면(store.delete(doc.id)) 호출한 쪽이 지정하지 않은 행이 지워질 수 있습니다.delete·get_by_ids·update_metadata·update_documents·upsert_documents·add_texts는ids가str인지 확인하지 않고 순회하므로, 문자열의 글자 하나하나가_readable_item_id를 통과하는 item ID가 됩니다.doc.id가"12"이면store.delete(doc.id)는 SDK에item_ids=[1, 2]를 넘겨 item 1과 2를 지우고,get_by_ids("12")도 item 1과 2를 돌려줍니다. b642543에도 있던 동작이지만 이 PR이 막으려는 결과와 같고, README.md:192의 예시 주석e.g. doc.id는doc.id를 그대로 넘기라는 뜻으로 읽힐 수 있습니다.ids를 순회하거나list(ids)로 바꾸기 전에str이나bytes이면TypeError를 내고, README 예시는store.delete([doc.id])로 적는 것을 제안합니다.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞습니다.
9fc0667에서ids가str/bytes/bytearray면 일곱 호출 경로(delete,get_by_ids,update_metadata,update_documents두 모드,upsert_documents,add_texts) 모두TypeError를 내고 SDK 를 부르지 않습니다. 메시지에[doc.id]를 적었고, README 의delete예시도store.delete([doc.id])로 고쳤습니다. tuple·set·generator 는 그대로 받습니다. 테스트:test_ids_must_be_a_list_not_a_bare_string("13","1",b"13",bytearray) 과test_ids_accept_tuples_sets_and_generators.