Add ObjectRepository and state machine unit tests#131
Open
code2tan wants to merge 2 commits into
Open
Conversation
added 2 commits
June 24, 2026 15:51
- Introduce `ObjectRepository` class to consolidate SQL operations for `objects`, `object_tasks`, `connector_jobs`, and `connectors` tables. - Add comprehensive unit tests for the state machine, covering task and job transitions, as well as various repository operations.
- Update `ObjectRepository` constructor to accept `meta` and `cfg` instead of `engine`. - Adjust method calls to use `self._cfg` for configuration values.
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.
Overview
Lands engine redesign: introduces
ObjectRepositoryto consolidate SQL operations for theobjects/object_tasks/connector_jobs/connectorstables out ofengine.pyinto a dedicatedrepository layer, and unifies task/job state transitions through a centralized state machine guard.
Key Changes
Added
ObjectRepository(engine/components/object_repository.py, ~667 lines)engine.py.TaskStatus/JobStatus/ConnectorStatusenums and_TASK_TRANSITIONS/_JOB_TRANSITIONStransition tables to centrally guard state machine legality.advance_taskis now the single entry point for advancing state, preventing illegal transitions.Slimmed down
engine.py(543 lines changed, -431 / +112 net)self.objects.*delegation.Added unit tests
tests/test_engine_object_repo.py(~613 lines)won == 0orphan cleanup, and concurrent claim.Invariant
Preserves the core invariant: a chunk exists in Milvus iff a committed
objectsrow points at it (directory summaries are the deliberate exception). The finalize/cleanup paths preserve this invariantvia the repository layer.
Testing
uv run --extra dev pytest: all passing (including the new ObjectRepository / state machine unit tests).ruff format --check+ruff check: clean.