Skip to content

Feature/use-call-number-type-fallback#991

Merged
btravisebsco merged 20 commits intomainfrom
feature/use-call-number-type-fallback
Feb 16, 2026
Merged

Feature/use-call-number-type-fallback#991
btravisebsco merged 20 commits intomainfrom
feature/use-call-number-type-fallback

Conversation

@btravisebsco
Copy link
Contributor

Purpose

Fixes #988
Fixes #989
Fixes #990

Changes Made in this PR

  • CSV holdings and item transformers now honor the defaultCallNumberTypeName parameter of their task configurations if call number types are not explicitly mapped and a call number part value is not empty
  • Remove unnecessary async with context manager invocation for self.folio_client on InventoryBatchPoster
  • Refactor logging to use module-level loggers and RichConsole log handler to let them play nicely with folio_data_import tasks

Code Review Specifics

  • Need eyes on the logic for Call Number Type fallback (should we only populate when there's an actual call number mapped, or also when a prefix or suffix is?
  • Take a look at the new logging docs in docs/source

Task Checklist

  • Ran nox -rs safety.
  • Ran pre-commit run --all-files
  • Tests cover new or modified code.
  • Ran test suite: nox -rs tests
  • Code runs and outputs default usage info: cd src; poetry run python3 -m folio_migration_tools -h
  • Documentation updated

Warning Checklist

  • New dependencies added
  • Includes breaking changes

How to Verify

Open Questions

Learn Anything Cool?

- Replaced direct logging calls with a logger instance in multiple migration task files.
- Updated logging setup to utilize a centralized logging configuration for consistency.
- Ensured that all logging messages are routed through the new logger for better management and formatting.
- Improved error handling and logging in various methods to enhance traceability during migration processes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses three related migration-tool behaviors: (1) applying a configured default call number type when call number parts are present but no type was mapped, (2) fixing InventoryBatchPoster upsert failures by removing an unnecessary async with self.folio_client, and (3) refactoring logging to centralized Rich-based configuration that cooperates with folio_data_import progress output.

Changes:

  • Add default call number type fallback logic to holdings/items mapping when no explicit call number type is mapped.
  • Introduce centralized logging configuration (logging_config.py) and convert many modules to module-level loggers.
  • Adjust InventoryBatchPoster async lifecycle and update docs/tests accordingly.

Reviewed changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/test_migration_report.py Updates log capture strategy to work with module-level loggers/propagation.
tests/test_logging_config.py Adds tests for the new centralized logging setup and filters.
tests/test_legacy_loan.py Updates expectations around legacy loan date parsing fallbacks.
tests/test_items_mapper.py Adds tests for item default call number type fallback behavior.
tests/test_holdings_mapper.py Adds tests for holdings default call number type fallback behavior.
src/folio_migration_tools/transaction_migration/legacy_request.py Switches to module-level logger usage.
src/folio_migration_tools/transaction_migration/legacy_loan.py Uses module-level logger; adjusts parse-error date defaults to start/end of day.
src/folio_migration_tools/task_configuration.py Minor import consolidation.
src/folio_migration_tools/migration_tasks/user_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/user_importer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/reserves_migrator.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/requests_migrator.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/organization_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/orders_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/migration_task_base.py Routes task logging setup through centralized logging_config.
src/folio_migration_tools/migration_tasks/marc_import.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/manual_fee_fines_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/loans_migrator.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/items_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/inventory_batch_poster.py Removes async with self.folio_client to fix upsert flow; switches to module-level logger.
src/folio_migration_tools/migration_tasks/holdings_marc_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/holdings_csv_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/courses_migrator.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/bibs_transformer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/migration_tasks/batch_poster.py Switches from root logging calls to module-level logger (unicode error handling path touched).
src/folio_migration_tools/migration_tasks/init.py Minor import ordering cleanup.
src/folio_migration_tools/migration_report.py Uses module-level logger for report logging.
src/folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/marc_rules_transformation/rules_mapper_bibs.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/marc_rules_transformation/rules_mapper_base.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/marc_rules_transformation/marc_reader_wrapper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/marc_rules_transformation/marc_file_processor.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/marc_rules_transformation/hrid_handler.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/marc_rules_transformation/holdings_statementsparser.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/marc_rules_transformation/conditions.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/mapping_file_transformation/user_mapper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/mapping_file_transformation/ref_data_mapping.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/mapping_file_transformation/organization_mapper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/mapping_file_transformation/order_mapper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/mapping_file_transformation/notes_mapper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py Adds call-number helpers (has_call_number_parts, get_call_number_type_id_by_name) and logging refactor.
src/folio_migration_tools/mapping_file_transformation/manual_fee_fines_mapper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/mapping_file_transformation/item_mapper.py Implements default call number type fallback for items.
src/folio_migration_tools/mapping_file_transformation/holdings_mapper.py Implements default call number type fallback for holdings.
src/folio_migration_tools/mapping_file_transformation/courses_mapper.py Minor import cleanup.
src/folio_migration_tools/mapper_base.py Switches some error logging to module-level logger.
src/folio_migration_tools/logging_config.py New centralized Rich-based logging configuration module.
src/folio_migration_tools/holdings_helper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/folder_structure.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/extradata_writer.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/custom_exceptions.py Minor import formatting change.
src/folio_migration_tools/circulation_helper.py Switches from root logging calls to module-level logger.
src/folio_migration_tools/main.py Initializes centralized logging early and switches exception logging to module-level logger.
noxfile.py Removes unused import.
docs/source/reference_data_mapping.md Removes now-deleted circulation mapping doc link.
docs/source/mapping_files_circulation.md Deletes obsolete/empty circulation mapping doc stub.
docs/source/logging.md Adds documentation for new logging behavior and file outputs.
docs/source/index.md Adds new logging doc to the docs index and removes circulation doc entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@FOLIO-FSE FOLIO-FSE deleted a comment from codecov bot Feb 13, 2026
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 73.70151% with 400 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.04%. Comparing base (5865678) to head (ad2ee92).
⚠️ Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
..._migration_tools/migration_tasks/loans_migrator.py 10.00% 54 Missing ⚠️
...io_migration_tools/migration_tasks/batch_poster.py 15.51% 49 Missing ⚠️
..._tools/migration_tasks/holdings_csv_transformer.py 3.70% 26 Missing ⚠️
...gration_tools/migration_tasks/requests_migrator.py 14.81% 23 Missing ⚠️
...ation_tools/migration_tasks/migration_task_base.py 41.66% 20 Missing and 1 partial ⚠️
...igration_tools/migration_tasks/user_transformer.py 17.39% 19 Missing ⚠️
...gration_tools/migration_tasks/items_transformer.py 14.28% 18 Missing ⚠️
src/folio_migration_tools/circulation_helper.py 29.16% 17 Missing ⚠️
...gration_tools/migration_tasks/reserves_migrator.py 16.66% 15 Missing ⚠️
..._tools/migration_tasks/organization_transformer.py 17.64% 14 Missing ⚠️
... and 25 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #991      +/-   ##
==========================================
+ Coverage   78.37%   80.04%   +1.66%     
==========================================
  Files         113      116       +3     
  Lines       15381    16136     +755     
  Branches     1819     1876      +57     
==========================================
+ Hits        12055    12916     +861     
+ Misses       2982     2871     -111     
- Partials      344      349       +5     
Flag Coverage Δ
unittests 80.04% <73.70%> (+1.66%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

@btravisebsco btravisebsco merged commit 777e432 into main Feb 16, 2026
4 of 5 checks passed
@btravisebsco btravisebsco deleted the feature/use-call-number-type-fallback branch February 16, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants