Skip to content

Commit de8c7be

Browse files
committed
fix: align CI and task-status handling with final 1.39 semantics (#2098)
The CI pin 1.39.0-rc.0-b41225e was a stale mid-review build of core #12252 that emitted an IN_PROGRESS task status which never shipped; pin 1.39.0-rc.1 instead. Parse the task status tolerantly — known values map to InvertedIndexTaskStatus, unknown values pass through as plain strings, since the spec declares the field an open-vocabulary string — and pin that with a mock test. Upgrade the coupled-tokenization test to the final join contract: an identical re-PUT while the task is in flight returns 202 with the existing taskId and STARTED, verified live against 1.39.0-rc.1 (post-completion re-PUT stays 200 NO_OP).
1 parent 490d81b commit de8c7be

5 files changed

Lines changed: 45 additions & 4 deletions

File tree

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ env:
2929
WEAVIATE_135: 1.35.18
3030
WEAVIATE_136: 1.36.12
3131
WEAVIATE_137: 1.37.5-e0fe0d5.amd64
32-
WEAVIATE_139: 1.39.0-rc.0-b41225e.amd64
32+
WEAVIATE_139: 1.39.0-rc.1
3333

3434
jobs:
3535
lint-and-format:

integration/test_collection_config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2824,6 +2824,16 @@ def test_property_reindex_coupled_tokenization_change(
28242824
assert task.status == InvertedIndexTaskStatus.STARTED
28252825
assert task.task_id is not None
28262826

2827+
# join contract: an identical re-PUT while the task is in flight returns the EXISTING task
2828+
join = collection.config.update_property_index(
2829+
"name", InvertedIndexType.SEARCHABLE, tokenization=Tokenization.FIELD
2830+
)
2831+
if join.status == InvertedIndexTaskStatus.STARTED:
2832+
assert join.task_id == task.task_id
2833+
else:
2834+
# the task already finalized; a re-PUT of matching configuration is a no-op
2835+
assert join.status == InvertedIndexTaskStatus.NO_OP
2836+
28272837
prop = next(p for p in collection.config.get_property_indexes().properties if p.name == "name")
28282838
searchable = next(i for i in prop.indexes if i.type == "searchable")
28292839
filterable = next(i for i in prop.indexes if i.type == "filterable")
@@ -2837,7 +2847,7 @@ def test_property_reindex_coupled_tokenization_change(
28372847
# the task already finalized before the first poll
28382848
assert searchable.tokenization == Tokenization.FIELD
28392849

2840-
# poll the status endpoint (via the wait path of a NO_OP upsert) until the migration is done
2850+
# poll the status endpoint (joining the in-flight task via the wait path) until done
28412851
status = collection.config.update_property_index(
28422852
"name",
28432853
InvertedIndexType.SEARCHABLE,

mock_tests/test_property_reindex.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,25 @@ def test_update_property_index_wait_for_completion(
134134
weaviate_139_mock.check_assertions()
135135

136136

137+
def test_update_property_index_tolerant_task_status(
138+
weaviate_139_mock: HTTPServer, client_139: weaviate.WeaviateClient
139+
) -> None:
140+
"""Unknown task statuses pass through as raw strings (the spec declares the field open-vocabulary)."""
141+
weaviate_139_mock.expect_request(
142+
f"{SCHEMA_PATH}/properties/name/index/searchable",
143+
method="PUT",
144+
json={"tokenization": "word"},
145+
).respond_with_json({"taskId": TASK_ID, "status": "SOMETHING_NEW"}, status=202)
146+
147+
task = client_139.collections.use(COLLECTION).config.update_property_index(
148+
"name", InvertedIndexType.SEARCHABLE, tokenization=Tokenization.WORD
149+
)
150+
assert task.task_id == TASK_ID
151+
assert task.status == "SOMETHING_NEW"
152+
assert not isinstance(task.status, InvertedIndexTaskStatus)
153+
weaviate_139_mock.check_assertions()
154+
155+
137156
def test_update_property_index_bare_str_tenant(
138157
weaviate_139_mock: HTTPServer, client_139: weaviate.WeaviateClient
139158
) -> None:

weaviate/collections/classes/config.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2307,8 +2307,14 @@ class InvertedIndexState(str, BaseEnum):
23072307

23082308
@dataclass
23092309
class _InvertedIndexTask(_ConfigBase):
2310+
"""A submitted property index task.
2311+
2312+
Known `status` values parse to `InvertedIndexTaskStatus`; unknown server values pass
2313+
through as plain strings, since the spec declares the field open-vocabulary.
2314+
"""
2315+
23102316
task_id: Optional[str]
2311-
status: InvertedIndexTaskStatus
2317+
status: Union[InvertedIndexTaskStatus, str]
23122318

23132319

23142320
InvertedIndexTask = _InvertedIndexTask

weaviate/collections/classes/config_methods.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,15 @@ def _references_from_config(schema: Dict[str, Any]) -> List[_ReferenceProperty]:
568568

569569

570570
def _inverted_index_task_from_json(response: Dict[str, Any]) -> _InvertedIndexTask:
571+
raw_status = response["status"]
572+
try:
573+
status: Union[InvertedIndexTaskStatus, str] = InvertedIndexTaskStatus(raw_status)
574+
except ValueError:
575+
# the spec declares the field open-vocabulary; pass unknown values through
576+
status = raw_status
571577
return _InvertedIndexTask(
572578
task_id=response.get("taskId"),
573-
status=InvertedIndexTaskStatus(response["status"]),
579+
status=status,
574580
)
575581

576582

0 commit comments

Comments
 (0)