feat: update document index status model and related components#983
feat: update document index status model and related components#983iziang wants to merge 1 commit into
Conversation
iziang
commented
Jun 24, 2025
- Refactored DocumentIndex to use a simplified status model with new states: pending, creating, active, deleting, deletion_in_progress, and failed.
- Updated related schemas, services, and frontend components to reflect the new status model.
- Removed old desired_state and actual_state fields, streamlining the index lifecycle management.
- Adjusted API responses and documentation to align with the new status definitions.
- Refactored DocumentIndex to use a simplified status model with new states: pending, creating, active, deleting, deletion_in_progress, and failed. - Updated related schemas, services, and frontend components to reflect the new status model. - Removed old desired_state and actual_state fields, streamlining the index lifecycle management. - Adjusted API responses and documentation to align with the new status definitions.
There was a problem hiding this comment.
Bug: Callback Signature Mismatch Causes Runtime Error
The on_index_failed callback in aperag.index.reconciler was updated to expect a singular index_type (string) and a task_context (dictionary) parameter. However, the _handle_index_failure helper method, used by tasks like delete_index_task and implicitly by the update_document_indexes_workflow, still calls on_index_failed with its old signature, passing a list of index_types and omitting task_context. This signature mismatch causes a TypeError at runtime when index operations fail and attempt to invoke the callback, specifically when task_context.get('version') is called on the incorrectly passed error_msg string.
config/celery_tasks.py#L154-L161
Lines 154 to 161 in cb6a92b
aperag/tasks/scheduler.py#L270-L278
ApeRAG/aperag/tasks/scheduler.py
Lines 270 to 278 in cb6a92b
aperag/tasks/scheduler.py#L156-L157
ApeRAG/aperag/tasks/scheduler.py
Lines 156 to 157 in cb6a92b
config/celery_tasks.py#L272-L277
Lines 272 to 277 in cb6a92b
Bug: Celery Task Callbacks Missing Context Parameter
The _handle_index_success and _handle_index_failure methods in config/celery_tasks.py call index_task_callbacks.on_index_created and on_index_failed with an incorrect signature. These callback methods now require a task_context parameter. If invoked, this will cause a TypeError. Specifically, _handle_index_success will pass index_data_json (a string) as task_context, leading to an AttributeError when task_context.get('version') is called.
config/celery_tasks.py#L125-L161
Lines 125 to 161 in cb6a92b
aperag/tasks/scheduler.py#L130-L131
ApeRAG/aperag/tasks/scheduler.py
Lines 130 to 131 in cb6a92b
Bug: TaskScheduler Method Signature Mismatch
The LocalTaskScheduler.schedule_create_index method signature does not match the updated abstract TaskScheduler.schedule_create_index. The abstract method expects (index_types: List[DocumentIndexType], document_id: str, task_context: dict, task_id: str = None), while the LocalTaskScheduler implementation retains the old signature (document_id: str, index_types: List[str], **kwargs). This mismatch will cause a TypeError at runtime.
aperag/tasks/scheduler.py#L37-L54
ApeRAG/aperag/tasks/scheduler.py
Lines 37 to 54 in cb6a92b
BugBot free trial expires on July 22, 2025
You have used $0.00 of your $1.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎