Add support for selected entities and redirects in add-data workflow - #132
Conversation
- Introduced `selected_entities` and `selected_redirects` parameters in relevant functions and methods across the pipeline, workflow, and tasks modules. - Enhanced entity assignment logic to prioritize selected entities. - Updated tests to validate the new functionality and ensure correct behavior with selected entities and redirects.
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughChangesAdd-data selection and redirects
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant add_data_task
participant add_data_workflow
participant fetch_add_data_response
participant RedirectHelpers
Client->>add_data_task: Submit excluded_references and selected_redirects
add_data_task->>add_data_workflow: Forward selection parameters
add_data_workflow->>fetch_add_data_response: Request selection-aware response
fetch_add_data_response->>RedirectHelpers: Build and merge old-entity redirects
RedirectHelpers-->>fetch_add_data_response: Return redirect rows
fetch_add_data_response-->>add_data_workflow: Return pipeline summary
add_data_workflow-->>add_data_task: Return add-data response
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
request-processor/src/application/core/pipeline.py (1)
82-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove unused
selected_entity_ids.
selected_entity_idsis computed here but never referenced afterwards in_create_old_entity_redirects- the exclusion is already enforced viaentity_by_reference, which is built from the sameselected_new_entities. Flake8 flags this as F841.🧹 Proposed fix
selected_new_entities = _filter_selected_entities(new_entities, excluded_references) - selected_entity_ids = { - str(entity.get("entity", "")).strip() for entity in selected_new_entities - } old_entity_rows = []🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@request-processor/src/application/core/pipeline.py` around lines 82 - 85, Remove the unused selected_entity_ids computation from _create_old_entity_redirects, leaving selected_new_entities and the existing entity_by_reference-based exclusion logic unchanged.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@request-processor/src/application/core/pipeline.py`:
- Around line 82-85: Remove the unused selected_entity_ids computation from
_create_old_entity_redirects, leaving selected_new_entities and the existing
entity_by_reference-based exclusion logic unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 905c7db7-7f44-4b74-9a4a-1b9aba82edcb
📒 Files selected for processing (7)
request-processor/src/application/core/pipeline.pyrequest-processor/src/application/core/workflow.pyrequest-processor/src/tasks.pyrequest-processor/tests/unit/src/application/core/test_pipeline.pyrequest-processor/tests/unit/src/application/core/test_workflow.pyrequest-processor/tests/unit/src/test_tasks.pyrequest_model/schemas.py
🚧 Files skipped from review as they are similar to previous changes (1)
- request-processor/tests/unit/src/test_tasks.py
What type of PR is this? (check all applicable)
Description
Adds selected entity handling to the add-data pipeline. Selected entities are prioritised for entity number assignment,
new-entitiesreports only selected rows, andall-entitiesreports the full set of newly assigned rows.Also adds old-entity redirect generation from selected redirects and duplicate candidates. Complete duplicate matches and single matches above 85% are automatically redirected, with duplicate evidence included in
old-entity.notes.Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Run the focused pipeline tests:
cd request-processor ./venv/bin/python -m pytest tests/unit/src/application/core/test_pipeline.py::test_fetch_add_data_response_includes_selected_old_entity_redirects tests/unit/src/application/core/test_pipeline.py::test_create_old_entity_redirects_from_selected_redirects tests/unit/src/application/core/test_pipeline.py::test_create_auto_old_entity_redirects_for_complete_matches tests/unit/src/application/core/test_pipeline.py::test_create_auto_old_entity_redirects_for_single_matches_above_85_percent tests/unit/src/application/core/test_pipeline.py::test_create_auto_old_entity_redirects_ignores_existing_redirects_and_unselected_entities -qRun formatting check:
cd request-processor ./venv/bin/python -m black --check src/application/core/pipeline.py tests/unit/src/application/core/test_pipeline.pyAdded/updated tests?
[optional] Are there any post deployment tasks we need to perform?
None.
[optional] Are there any dependencies on other PRs or Work?
None known.
Summary by CodeRabbit