test(indexing): cross-modality ModalityWorker.derive+sync contract supplement#1730
Merged
Merged
Conversation
…pplement Per @earayu2 / @不穷 msg=981ae30d standby task: supplement the existing per-modality acceptance tests in ``test_t1_2_graph.py`` / ``test_t1_3_vector_fulltext.py`` / ``test_t1_4_summary_vision.py`` with **cross-modality contract tests** that exercise invariants the spec promises across all 5 modalities. Per @不穷 msg=0d35f537 scope decision: this lands as a follow-up PR (NOT into the current Wave 3 PR #1729). The branch is based on ``origin/main`` and verified passing against the pre-Wave-3 codebase; no Wave 3 dependency. Coverage added (11 tests): 1. **§C.7 reschedule contract** (2 tests): summary + vision ``derive()`` with a missing upstream source returns ``DeriveResult(derived_artifact_path="")`` (the empty-string signal the orchestrator interprets as "derive incomplete, leave PENDING for next reconciler cycle"). Vector + fulltext are pass-through and covered by existing per-modality "no-op on missing chunks" tests. 2. **N-call replay convergence** (4 tests, parametrized across vector/fulltext/summary/vision): 5 consecutive ``sync()`` calls produce a backend state byte-equivalent to a single sync (extends existing 2-call tests under arbitrary retry storms — §D.4). 3. **Cross-document parse_version isolation** (4 tests, same params): ``sync()`` of doc-A's ``(doc_a, parse_version)`` slot must NOT touch doc-B's backend state. Locks the §D.1 DELETE scope: ``WHERE document_id=A AND parse_version=V`` only. Uses two distinct doc bodies because the parser's content-hashed ``chunk_id`` would otherwise collide cross-doc — fixture limitation, not a production-code invariant violation; called out in the test docstring. 4. **All-5-modality enum discriminator** (1 test): each ``ModalityWorker`` subclass binds the class-level ``modality`` attribute to the matching ``Modality`` enum value (orchestrator route key — a misbind would silently mis-route work). Graph modality is intentionally NOT in the parametric sweeps because ``test_t1_2_graph.py`` already covers the §D.3 lineage semantic exhaustively (D3.6 5-step scenario + Nebula race + byte-equivalent re-sync + tenant_scope_key propagation). The all-5-modality enum test is the only graph touch here. Local gates: - pytest tests/unit_test/indexing/test_modality_worker_contract.py → 11 passed - ruff check + format --check clean Co-Authored-By: Claude Opus 4.7 <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.
Summary
Per @earayu2 / @不穷 standby task (msg=981ae30d) — supplement the existing per-modality acceptance tests in
test_t1_2_graph.py/test_t1_3_vector_fulltext.py/test_t1_4_summary_vision.pywith cross-modality contract tests that exercise invariants the spec promises across all 5 modalities.Disjoint with PR #1729 (Wave 3 hard-cut) — this branch is based on
origin/mainand verified passing against the pre-Wave-3 codebase. Per PM msg=ca69198a: open in parallel, no merge dependency on Wave 3.Coverage (11 tests, +456 LOC, 1 new file)
§C.7 reschedule contract (2 tests): summary + vision
derive()with a missing upstream source returnsDeriveResult(derived_artifact_path="")(the empty-string signal the orchestrator interprets as "derive incomplete, leave PENDING for next reconciler cycle"). Vector + fulltext are pass-through and covered by existing per-modality "no-op on missing chunks" tests.N-call replay convergence (4 tests, parametrized vector/fulltext/summary/vision): 5 consecutive
sync()calls produce a backend state byte-equivalent to a single sync — extends existing 2-call tests under arbitrary retry storms (§D.4).Cross-document parse_version isolation (4 tests, parametrized):
sync()of doc-A's(doc_a, parse_version)slot must NOT touch doc-B's backend state. Locks the §D.1 DELETE scope:WHERE document_id=A AND parse_version=Vonly. Uses two distinct doc bodies because the parser's content-hashedchunk_idwould otherwise collide cross-doc (fixture limitation, not production-code invariant violation; called out in test docstring).All-5-modality enum discriminator (1 test): each
ModalityWorkersubclass binds the class-levelmodalityattribute to the matchingModalityenum value — orchestrator route key, a misbind would silently mis-route work.Graph modality is intentionally NOT in the parametric sweeps because
test_t1_2_graph.pyalready covers the §D.3 lineage semantic exhaustively (D3.6 5-step scenario + Nebula race + byte-equivalent re-sync + tenant_scope_key propagation). The all-5-modality enum test is the only graph touch here.Test plan
🤖 Generated with Claude Code