Skip to content

Commit 3a27fed

Browse files
rustyconoverclaude
andcommitted
fix(ci): satisfy mypy/ruff/pydoclint/docs gates for copy-from/to + secrets
The copy-from/to + scope/type-aware-secrets batch landed with several quality gates red: - mypy: ProcessParams/InitParams.secrets were typed as a plain dict, so the fixtures' params.secrets.of_type()/for_scope_of_type() calls failed [attr-defined]; they are ResolvedSecrets at runtime. Type the field as ResolvedSecrets, parameterize ResolvedSecrets(dict[str, dict[str, Any]]), and construct the empty-secrets ProcessParams with ResolvedSecrets(). - ruff B905: add strict=True to zip(*rows) in the example_lines COPY-FROM reader (rows are pre-validated to ncols). - pydoclint DOC601/603: document BindRequest.copy_from / copy_to. - docs --strict: export CopyFromFormatInfo from vgi.catalog so the CopyFromFormatsResponse cross-reference resolves. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 847cf87 commit 3a27fed

5 files changed

Lines changed: 20 additions & 13 deletions

File tree

vgi/_test_fixtures/copy_from.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def read(
9191

9292
# Column-major string arrays, NULL where the cell equals null_string,
9393
# then cast each column to the target type (DuckDB inserts no cast).
94-
columns = list(zip(*rows)) if rows else [() for _ in range(ncols)]
94+
columns = list(zip(*rows, strict=True)) if rows else [() for _ in range(ncols)]
9595
arrays = []
9696
for idx, field in enumerate(expected_schema):
9797
raw = [None if v == options.null_string else v for v in columns[idx]]

vgi/catalog/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
CatalogInterface,
1616
CatalogObject,
1717
CatalogSchemaObject,
18+
CopyFromFormatInfo,
1819
FunctionInfo,
1920
FunctionType,
2021
IndexConstraintType,
@@ -67,6 +68,7 @@
6768
"TableInfo",
6869
"ViewInfo",
6970
"FunctionInfo",
71+
"CopyFromFormatInfo",
7072
"ScanBranch",
7173
"ScanBranchesResult",
7274
"ScanFunctionResult",

vgi/protocol.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ class BindRequest(ArrowSerializableDataclass):
196196
accessor), not at on_bind.
197197
at_value: Value of the time-travel ``AT`` clause for this scan; ``None`` when
198198
the scan has no AT clause. See ``at_unit`` for the inline-bind caveat.
199+
copy_from: The ``COPY ... FROM`` context (source format + path); ``None``
200+
unless this bind/init opens a COPY-FROM scan.
201+
copy_to: The ``COPY ... TO`` context (destination format + path); ``None``
202+
unless this bind/init opens a COPY-TO sink.
199203
"""
200204

201205
function_name: str

vgi/table_function.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def _secret_scalar_str(v: Any) -> str:
300300
return "" if py is None else str(py)
301301

302302

303-
class ResolvedSecrets(dict):
303+
class ResolvedSecrets(dict[str, dict[str, Any]]):
304304
"""Resolved secrets keyed by secret name, with type- and scope-aware lookup.
305305
306306
A plain ``dict`` (so ``secrets[name]`` and ``secrets.get(name)`` still work)
@@ -514,7 +514,7 @@ class InitParams[TArgs]:
514514
output_schema: pa.Schema
515515

516516
settings: dict[str, pa.Scalar[Any]]
517-
secrets: dict[str, dict[str, pa.Scalar[Any]]]
517+
secrets: ResolvedSecrets
518518

519519
storage: BoundStorage
520520
auth_context: AuthContext = AuthContext.anonymous()
@@ -569,7 +569,7 @@ class ProcessParams[TArgs]:
569569
output_schema: pa.Schema
570570

571571
settings: dict[str, pa.Scalar[Any]]
572-
secrets: dict[str, dict[str, pa.Scalar[Any]]]
572+
secrets: ResolvedSecrets
573573

574574
storage: BoundStorage
575575
auth_context: AuthContext = AuthContext.anonymous()

vgi/worker.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class MyWorker(Worker):
146146
)
147147
from vgi.table_function import (
148148
ProcessParams,
149+
ResolvedSecrets,
149150
SecretsAccessor,
150151
TableCardinality,
151152
TableFunctionBase,
@@ -2407,7 +2408,7 @@ def aggregate_update(
24072408
init_response=None,
24082409
output_schema=pa.schema([]),
24092410
settings={},
2410-
secrets={},
2411+
secrets=ResolvedSecrets(),
24112412
storage=storage,
24122413
auth_context=ctx.auth,
24132414
)
@@ -2513,7 +2514,7 @@ def aggregate_combine(
25132514
init_response=None,
25142515
output_schema=pa.schema([]),
25152516
settings={},
2516-
secrets={},
2517+
secrets=ResolvedSecrets(),
25172518
storage=storage,
25182519
auth_context=ctx.auth,
25192520
)
@@ -2576,7 +2577,7 @@ def aggregate_finalize(
25762577
init_response=None,
25772578
output_schema=request.output_schema,
25782579
settings={},
2579-
secrets={},
2580+
secrets=ResolvedSecrets(),
25802581
storage=storage,
25812582
auth_context=ctx.auth,
25822583
)
@@ -2815,7 +2816,7 @@ def aggregate_window_init(
28152816
init_response=None,
28162817
output_schema=request.output_schema,
28172818
settings={},
2818-
secrets={},
2819+
secrets=ResolvedSecrets(),
28192820
storage=storage,
28202821
auth_context=ctx.auth,
28212822
)
@@ -2912,7 +2913,7 @@ def aggregate_window(
29122913
init_response=None,
29132914
output_schema=output_schema,
29142915
settings={},
2915-
secrets={},
2916+
secrets=ResolvedSecrets(),
29162917
storage=storage,
29172918
auth_context=ctx.auth,
29182919
)
@@ -3027,7 +3028,7 @@ def aggregate_window_batch(
30273028
init_response=None,
30283029
output_schema=output_schema,
30293030
settings={},
3030-
secrets={},
3031+
secrets=ResolvedSecrets(),
30313032
storage=storage,
30323033
auth_context=ctx.auth,
30333034
)
@@ -3121,7 +3122,7 @@ def aggregate_streaming_open(
31213122
init_response=None,
31223123
output_schema=request.output_schema,
31233124
settings=_batch_to_scalar_dict(request.settings),
3124-
secrets={},
3125+
secrets=ResolvedSecrets(),
31253126
storage=storage,
31263127
auth_context=ctx.auth,
31273128
)
@@ -3187,7 +3188,7 @@ def aggregate_streaming_chunk(
31873188
init_response=None,
31883189
output_schema=session.output_schema,
31893190
settings={},
3190-
secrets={},
3191+
secrets=ResolvedSecrets(),
31913192
storage=storage,
31923193
auth_context=ctx.auth,
31933194
)
@@ -3280,7 +3281,7 @@ def aggregate_streaming_close(
32803281
init_response=None,
32813282
output_schema=session.output_schema,
32823283
settings={},
3283-
secrets={},
3284+
secrets=ResolvedSecrets(),
32843285
storage=storage,
32853286
auth_context=ctx.auth,
32863287
)

0 commit comments

Comments
 (0)