Skip to content

Commit 5e89ff8

Browse files
rustyconoverclaude
andcommitted
fix: MetaWorker relays catalog_table_create's created flag; pin vgi 1aecd15
- MetaWorker.catalog_table_create returned None instead of the routed worker's TableCreateResponse, so every CREATE TABLE through the multi-catalog fixture worker failed protocol 3.3 result validation (catalog_contents_ddl.test, view_aliases.test). Unit test added. - tests: typed schema field lists / tuple positional args (mypy tests/). - ci: integration VGI_REF -> vgi 1aecd15 (protocol 3.3 write path). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 365707e commit 5e89ff8

6 files changed

Lines changed: 38 additions & 21 deletions

File tree

‎.github/workflows/integration.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ concurrency:
2727
env:
2828
# The test suite and native Actions artifact must come from this exact ref.
2929
# The downloader verifies its provenance against the checked-out commit.
30-
VGI_REF: 423f76fde64d95b10ae83c60835e729bcf7d772c
30+
VGI_REF: 1aecd154e1471a38d72b3e6dc270daa1b1bc9b81
3131
VGI_NATIVE_RUNNER_BRANCH: v2.0
3232
# CI is not a user: its ATTACHes should not land in Query.Farm's adoption data.
3333
# The vgi extension fires a telemetry event per successful ATTACH, and this

‎CHANGELOG.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Part of `vgi.v3` / `3.3.0` (the version string does not change again).
1616
`CatalogInterface.table_create` may return `False` when `on_conflict` is `IGNORE` and the table already
1717
existed; `True` or `None` (the old return) means it was created. The extension uses it so
1818
`CREATE TABLE IF NOT EXISTS ... AS SELECT` no longer appends into an existing table.
19-
`Client.table_create` returns the flag.
19+
`Client.table_create` returns the flag. `MetaWorker` (several catalogs in one process) relays the routed
20+
worker's reply instead of dropping it.
2021
- **The write-options batch carries only `result_mode`.** DuckDB rewrites every `INSERT ... ON CONFLICT` /
2122
`INSERT OR REPLACE` into a MERGE before the catalog sees it, so `on_conflict` / `on_conflict_columns` were only
2223
ever `"throw"` / `[]`. `WriteOptions.on_conflict` and `WriteOptions.on_conflict_columns` remain as deprecated

‎tests/catalog/test_protocol_33_writes.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ def test_worker_rejects_non_bool_create_result(monkeypatch: pytest.MonkeyPatch)
116116
instance.catalog_table_create(_create_request())
117117

118118

119+
@pytest.mark.parametrize("created", [True, False])
120+
def test_meta_worker_relays_created(monkeypatch: pytest.MonkeyPatch, created: bool) -> None:
121+
"""The multi-catalog host returns the routed child's reply (it used to drop it)."""
122+
child = SimpleNamespace(catalog_table_create=lambda request: TableCreateResponse(created=created))
123+
meta = object.__new__(MetaWorker)
124+
monkeypatch.setattr(meta, "_worker_for_attach", lambda envelope, method_name="?": child)
125+
assert meta.catalog_table_create(_create_request()) == TableCreateResponse(created=created)
126+
127+
119128
def test_table_create_response_round_trips() -> None:
120129
for value in (True, False):
121130
response = TableCreateResponse(created=value)

‎tests/catalog/test_simple_writable_ctas.py‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@
2424
from vgi.client.client import Client
2525

2626
_WORKER = f"{sys.executable} -m vgi._test_fixtures.simple_writable"
27-
_COLUMNS = pa.schema(
28-
[
29-
("i", pa.int32()),
30-
("b", pa.int64()),
31-
("v", pa.string()),
32-
("d", pa.float64()),
33-
("f", pa.bool_()),
34-
]
35-
)
27+
_COLUMN_FIELDS: list[pa.Field[Any]] = [
28+
pa.field("i", pa.int32()),
29+
pa.field("b", pa.int64()),
30+
pa.field("v", pa.string()),
31+
pa.field("d", pa.float64()),
32+
pa.field("f", pa.bool_()),
33+
]
34+
_COLUMNS = pa.schema(_COLUMN_FIELDS)
3635

3736

3837
@pytest.fixture
@@ -61,14 +60,14 @@ def _insert(client: Client, name: str, rows: list[dict[str, Any]], schema: pa.Sc
6160
function_name="simple_writable_insert",
6261
schema_path=["main"],
6362
input=iter([pa.RecordBatch.from_pylist(rows, schema=schema)]),
64-
arguments=Arguments(positional=[pa.scalar(name)], named={"write_options": pa.scalar(options)}),
63+
arguments=Arguments(positional=(pa.scalar(name),), named={"write_options": pa.scalar(options)}),
6564
)
6665
return [row for b in out for row in b.to_pylist()]
6766

6867

6968
def _scan(client: Client, name: str) -> list[dict[str, Any]]:
7069
out = client.table_function(
71-
function_name="simple_writable_scan", schema_path=["main"], arguments=Arguments(positional=[pa.scalar(name)])
70+
function_name="simple_writable_scan", schema_path=["main"], arguments=Arguments(positional=(pa.scalar(name),))
7271
)
7372
return [row for b in out for row in b.to_pylist()]
7473

‎tests/conformance/test_writable_tx.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,12 @@ def test_scan_function_listing(connect: Any) -> None:
224224
assert isinstance(_table(client, "items_scan"), list)
225225

226226

227-
_ITEMS_IN = pa.schema([("id", pa.int32()), ("name", pa.string()), ("qty", pa.int64())])
227+
_ITEMS_IN_FIELDS: list[pa.Field[Any]] = [
228+
pa.field("id", pa.int32()),
229+
pa.field("name", pa.string()),
230+
pa.field("qty", pa.int64()),
231+
]
232+
_ITEMS_IN = pa.schema(_ITEMS_IN_FIELDS)
228233
_ROWID_IN = pa.schema([("rowid", pa.int64())])
229234

230235

@@ -266,13 +271,14 @@ def test_insert_validates_each_batch_before_applying(connect: Any, token: str) -
266271
assert _write(client, "items_insert", [[{"id": 6, "name": "f", "qty": 6}]], _ITEMS_IN, "changes") == [
267272
{"old": None, "new": {"id": 6, "name": "f", "qty": 6}}
268273
]
269-
for rows, message in [
274+
refused: list[tuple[list[dict[str, Any]], str]] = [
270275
([{"id": 7, "name": "g", "qty": 1}, {"id": 1, "name": "dup", "qty": 1}], "txfix: duplicate id 1"),
271276
([{"id": 7, "name": "g", "qty": 1}, {"id": 7, "name": "g2", "qty": 1}], "txfix: duplicate id 7"),
272277
([{"id": 7, "name": None, "qty": 1}], "txfix: name required"),
273278
([{"id": None, "name": "g", "qty": 1}], "txfix: id required"),
274279
([{"id": 7, "name": "g", "qty": -1}], "txfix: qty must be >= 0"),
275-
]:
280+
]
281+
for rows, message in refused:
276282
with pytest.raises(Exception, match=message):
277283
_write(client, "items_insert", [rows], _ITEMS_IN, "count")
278284
# A failing batch applied nothing (id 7 is not there).

‎vgi/meta_worker.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
CatalogsResponse,
4949
InitRequest,
5050
ProcessState,
51+
TableCreateRequest,
52+
TableCreateResponse,
5153
)
5254
from vgi.schema_path import schema_path_display, schema_path_key
5355
from vgi.worker import Worker
@@ -453,11 +455,11 @@ def catalog_drop(self, name: str) -> None:
453455

454456
# ========== Request-object methods (attach_opaque_data inside request) ==========
455457

456-
def catalog_table_create(self, request: Any) -> None:
457-
"""Create a table — dispatch via attach_opaque_data in request."""
458-
self._worker_for_attach(request.attach_opaque_data, method_name="catalog_table_create").catalog_table_create(
459-
request
460-
)
458+
def catalog_table_create(self, request: TableCreateRequest) -> TableCreateResponse:
459+
"""Create a table — dispatch via attach_opaque_data in request; relay created."""
460+
return self._worker_for_attach(
461+
request.attach_opaque_data, method_name="catalog_table_create"
462+
).catalog_table_create(request)
461463

462464
def catalog_table_constraints_apply(self, request: ConstraintsApplyRequest) -> ConstraintSnapshot:
463465
"""Route by the sealed attachment; the selected child owns unwrapping."""

0 commit comments

Comments
 (0)