Adoptuj API paczek PBN 0.2 (is_deleted, is_valid_object_id, get_or_download)#603
Open
mpasternak wants to merge 1 commit into
Open
Adoptuj API paczek PBN 0.2 (is_deleted, is_valid_object_id, get_or_download)#603mpasternak wants to merge 1 commit into
mpasternak wants to merge 1 commit into
Conversation
…wnload - 6 modeli PBN (journal, institution, publisher, publication, scientist, conference) używa property `is_deleted` z BasePBNMongoDBModel zamiast magic-stringa `status == "DELETED"` (marker „[❌ USUNIĘTY]" bez zmian) - `check_mongoId` deleguje do `pbn_client.is_valid_object_id` (ta sama semantyka: 24-znakowy hex objectId) - `ensure_publication/person/institution_exists` delegują do `django_pbn_client.get_or_download` z zachowaniem wrappera `zapisz_mongodb` (fetch przed transakcją persystencji) - test blokujący zachowanie markera USUNIĘTY w __str__ 6 modeli Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Co robi ten PR
Trzy niskoryzykowe adopcje API paczek
pbn-client/django-pbn-client0.2 w monolicie BPP, usuwające zduplikowany / magic-stringowy kod przy identycznym zachowaniu:is_deleted(6 modeli) —src/pbn_api/models/{journal,institution,publisher,publication,scientist,conference}.py:if self.status == "DELETED":→if self.is_deleted:(property zBasePBNMongoDBModel). Marker[❌ USUNIĘTY]w__str__bez zmian.check_mongoId→is_valid_object_id—src/pbn_api/validators.pydeleguje dopbn_client.is_valid_object_id(ta sama semantyka: 24-znakowy hex objectId). Publiczna nazwacheck_mongoIdzachowana, import site w autocomplete nietknięty.ensure_*→get_or_download—src/pbn_integrator/utils/mongodb_ops.py: trzy funkcjeensure_{publication,person,institution}_existsdelegują dodjango_pbn_client.get_or_downloadz zachowaniem wrapperazapisz_mongodb(fetch HTTP przed transakcją persystencji).TDD / weryfikacja
src/pbn_api/tests/test_models_deleted_marker.pyblokuje zachowanie markera USUNIĘTY w__str__wszystkich 6 modeli (zielony przed i po refaktorze).DJANGO_BPP_SKIP_DOTENV=1 uv run python src/manage.py check— no issues.pytest src/pbn_api/tests/test_validators.py src/pbn_api/tests/test_models_deleted_marker.py src/pbn_integrator/tests/— 214 passed (w tymtest_mongodb_ops.pyz asercją kształtu wywołaniazapisz_mongodb, bez zmian).ruff check/ruff format --checkna zmienionych plikach — czysto.src/bpp/newsfragments/pbn-adopt-api-02.feature.rst.🤖 Generated with Claude Code