kaos-tabular 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kaos_tabular-0.1.0a1/.gitignore +11 -0
- kaos_tabular-0.1.0a1/CHANGELOG.md +367 -0
- kaos_tabular-0.1.0a1/LICENSE +201 -0
- kaos_tabular-0.1.0a1/NOTICE +8 -0
- kaos_tabular-0.1.0a1/PKG-INFO +298 -0
- kaos_tabular-0.1.0a1/README.md +264 -0
- kaos_tabular-0.1.0a1/kaos_tabular/__init__.py +19 -0
- kaos_tabular-0.1.0a1/kaos_tabular/__main__.py +5 -0
- kaos_tabular-0.1.0a1/kaos_tabular/_session.py +122 -0
- kaos_tabular-0.1.0a1/kaos_tabular/_version.py +1 -0
- kaos_tabular-0.1.0a1/kaos_tabular/cli.py +287 -0
- kaos_tabular-0.1.0a1/kaos_tabular/engine.py +1369 -0
- kaos_tabular-0.1.0a1/kaos_tabular/errors.py +25 -0
- kaos_tabular-0.1.0a1/kaos_tabular/py.typed +0 -0
- kaos_tabular-0.1.0a1/kaos_tabular/readers.py +102 -0
- kaos_tabular-0.1.0a1/kaos_tabular/serve.py +63 -0
- kaos_tabular-0.1.0a1/kaos_tabular/tools.py +1560 -0
- kaos_tabular-0.1.0a1/pyproject.toml +161 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `kaos-tabular` are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0a1] — 2026-05-08
|
|
11
|
+
|
|
12
|
+
### Added (structured shape tools + did-you-mean error suggestions)
|
|
13
|
+
|
|
14
|
+
A second pre-tag pass reconsidered the "tools earn their weight when
|
|
15
|
+
SQL is genuinely awkward" framing. The framing held for `pivot`,
|
|
16
|
+
`unpivot`, `join`, and `correlation`, but was too narrow for the
|
|
17
|
+
`GROUP BY` / `WHERE` / `ORDER BY ... LIMIT` trio: agents write that
|
|
18
|
+
SQL correctly, yes, but typed wrappers buy validation at the boundary,
|
|
19
|
+
structured-event audit (the call shows up in `engine.history()` as
|
|
20
|
+
`aggregate:<table>` instead of an opaque `query:` string), and
|
|
21
|
+
dialect-insulation if the engine ever grows a non-DuckDB backend.
|
|
22
|
+
|
|
23
|
+
Three new MCP tools (14 → 17) and matching public engine methods:
|
|
24
|
+
|
|
25
|
+
- **`kaos-tabular-aggregate`** + **`engine.aggregate(table, *, aggregates,
|
|
26
|
+
group_by=None, where=None, having=None, order_by=None, limit=None,
|
|
27
|
+
target=None)`**. Composed `GROUP BY`. `aggregates` is a list of
|
|
28
|
+
`(func, column[, alias])` tuples; `func` ∈ `{sum, avg, min, max,
|
|
29
|
+
count, count_distinct, median, stddev, variance, first, last}`.
|
|
30
|
+
Validates the table, every column, and every aggregate function
|
|
31
|
+
*before* SQL is generated, with did-you-mean suggestions on a miss.
|
|
32
|
+
`where` / `having` remain opaque DuckDB SQL fragments (predicate
|
|
33
|
+
shapes are unbounded). `order_by` items must reference either a
|
|
34
|
+
group_by column or an explicit aggregate alias; bare aggregate
|
|
35
|
+
expressions in `ORDER BY` are rejected at the wrapper.
|
|
36
|
+
- **`kaos-tabular-filter`** + **`engine.filter(table, *, where,
|
|
37
|
+
limit=None, target=None)`**. Typed `SELECT * WHERE`. The table is
|
|
38
|
+
validated; `where` is opaque DuckDB SQL. Useful when the caller
|
|
39
|
+
wants the call to show up in the structured history log under
|
|
40
|
+
`filter:<table>` instead of inside an opaque `query:` event.
|
|
41
|
+
- **`kaos-tabular-top-k`** + **`engine.top_k(table, *, by, n=10,
|
|
42
|
+
ascending=False, target=None)`**. `ORDER BY ... LIMIT N`. Defaults
|
|
43
|
+
to descending so "top N by units" reads naturally; pass
|
|
44
|
+
`ascending=True` for bottom-N.
|
|
45
|
+
|
|
46
|
+
### Added (did-you-mean suggestions across the engine)
|
|
47
|
+
|
|
48
|
+
Every error path that mentions a missing table or column now carries
|
|
49
|
+
a `Did you mean '<closest match>'?` suggestion using
|
|
50
|
+
`difflib.get_close_matches` with a 0.6 cutoff. The cutoff is high
|
|
51
|
+
enough to avoid spurious matches on short identifiers (`id` / `ip`)
|
|
52
|
+
but low enough to forgive single-character typos on typical 6+
|
|
53
|
+
character column names.
|
|
54
|
+
|
|
55
|
+
The mechanism is wired into `describe_table`, `sample`, `count`,
|
|
56
|
+
`find_duplicates`, `correlation`, `join` (both sides + `on=`),
|
|
57
|
+
`pivot`, `unpivot`, `export_table`, and the three new structured
|
|
58
|
+
shape methods (`aggregate`, `filter`, `top_k`). The aggregate
|
|
59
|
+
function whitelist also gets did-you-mean against the supported
|
|
60
|
+
function names. Module-level `_suggestions` and
|
|
61
|
+
`_did_you_mean_fragment` helpers are unit-tested in isolation against
|
|
62
|
+
the cutoff edge-cases (empty universe, no near-match, plural form);
|
|
63
|
+
the `TestExistingErrorPathsRetrofit` class pins the retrofit so a
|
|
64
|
+
future refactor can't silently drop suggestions from the older
|
|
65
|
+
analytical surfaces.
|
|
66
|
+
|
|
67
|
+
Test count: 216 → 276 unit tests (60 new in
|
|
68
|
+
`tests/unit/test_structured_ops.py`); coverage stays above the 70%
|
|
69
|
+
`fail_under` floor.
|
|
70
|
+
|
|
71
|
+
Quick benchmark (100k-row CSV, 5 distinct group keys): structured
|
|
72
|
+
`aggregate` runs 7.5 ms median vs. 3.4 ms for the equivalent raw
|
|
73
|
+
`execute` — ~4 ms validation overhead from two `information_schema`
|
|
74
|
+
lookups per call. The overhead is constant regardless of data size,
|
|
75
|
+
acceptable for interactive agent use; throughput-bound batch loops
|
|
76
|
+
should reach for `kaos-tabular-query` instead.
|
|
77
|
+
|
|
78
|
+
### Fixed (post-release-review pass before tag)
|
|
79
|
+
|
|
80
|
+
External review found gaps the audit-01 sweep missed; all addressed
|
|
81
|
+
before tagging:
|
|
82
|
+
|
|
83
|
+
- **#1 P0: SQLite table-name SQL injection in `_register_sqlite`.**
|
|
84
|
+
`src_table` values from `sqlite_master` were interpolated raw into
|
|
85
|
+
the next `sqlite_scan('{path}', '{src_table}')` call. A crafted
|
|
86
|
+
SQLite file with a hostile table name could escape the literal and
|
|
87
|
+
execute injected DuckDB SQL. New module-level `_q_lit` helper
|
|
88
|
+
performs the standard `'` → `''` escape; both the path and the
|
|
89
|
+
`src_table` now flow through it. Adversarial test in
|
|
90
|
+
`tests/unit/test_sqlite_register.py::test_register_sqlite_hostile_table_name_does_not_inject`.
|
|
91
|
+
- **#2 P0: `save()` path SQL injection.** `EXPORT DATABASE '{p}'`
|
|
92
|
+
pasted the caller-supplied path directly. `save("'; ATTACH ...; --")`
|
|
93
|
+
could break out of the literal. Same `_q_lit` mitigation.
|
|
94
|
+
`export_table` (added in this release) was already correct but is
|
|
95
|
+
now consolidated onto `_q_lit` for consistency. Adversarial tests
|
|
96
|
+
in `tests/unit/test_path_injection.py`.
|
|
97
|
+
- **#3 P0: `duckdb` minimum lifted from `>=1.0` to `>=1.4.2`.** 1.0.0
|
|
98
|
+
has no cp313 wheel; 1.1.1 was the first cp313 release; 1.4.2 was
|
|
99
|
+
the first cp314 release. Since we support both 3.13 and 3.14, the
|
|
100
|
+
floor must clear both — pre-1.4.2 made the lowest-direct CI job
|
|
101
|
+
build duckdb from source on cp314, which is why min-deps took
|
|
102
|
+
20+ minutes.
|
|
103
|
+
- **#4 P0: MCP tool annotations now match real behaviour.** Pre-fix,
|
|
104
|
+
every tool used `_TABULAR_ANNOTATIONS` with `openWorldHint=False`,
|
|
105
|
+
including ones that genuinely reach the filesystem
|
|
106
|
+
(`Register` / `Query` / `ReadFile`); `ExportTool` used
|
|
107
|
+
`_TABULAR_WRITE_ANNOTATIONS` with `destructiveHint=False` despite
|
|
108
|
+
writing/overwriting files. Split into three classes:
|
|
109
|
+
`_TABULAR_READ_ANNOTATIONS` (closed-world catalog reads — `List` /
|
|
110
|
+
`Describe` / `Sample` / `Count`), `_TABULAR_OPEN_READ_ANNOTATIONS`
|
|
111
|
+
(open-world filesystem reads — `Register` / `Query` / `ReadFile`),
|
|
112
|
+
`_TABULAR_WRITE_ANNOTATIONS` (open-world destructive writes —
|
|
113
|
+
`Export`, now `destructiveHint=True`). Agents make auto-approval
|
|
114
|
+
decisions on these flags; getting them right is the largest
|
|
115
|
+
actual safety improvement in this commit.
|
|
116
|
+
- **#5 P1: `_ENGINES` cache bounded with LRU + close-on-evict.**
|
|
117
|
+
Pre-fix, the per-session engine cache was an unbounded `dict`;
|
|
118
|
+
long-running streamable-HTTP servers leaked DuckDB connections
|
|
119
|
+
forever. Now an `OrderedDict` capped at
|
|
120
|
+
`_ENGINES_MAX_SESSIONS = 64`; the oldest engine is closed on
|
|
121
|
+
insert past capacity. TODO: replace with proper kaos-mcp
|
|
122
|
+
per-session lifecycle hook at 0.1.0a2. Coverage in
|
|
123
|
+
`tests/unit/test_session_engines.py`.
|
|
124
|
+
- **#6 P1: stale integration assertion fixed.**
|
|
125
|
+
`tests/integration/test_mcp_tabular_pipeline.py` asserted the
|
|
126
|
+
pre-KTAB-007 error string `"Cannot infer format"`. Updated to the
|
|
127
|
+
current `"Cannot infer export format"`. CI doesn't gate the
|
|
128
|
+
integration tier today; raised as a separate platform tracker.
|
|
129
|
+
- **#7 P1: SECURITY.md scope rewritten for kaos-tabular.** The
|
|
130
|
+
template carried over from kaos-mcp listed LLM/program-execution/
|
|
131
|
+
cache/provider concerns that don't apply here. New scope names:
|
|
132
|
+
the DuckDB SQL boundary, file registration paths, export/write
|
|
133
|
+
paths, MCP tool surface, the SQLite extension network fetch, the
|
|
134
|
+
transitive dep supply chain.
|
|
135
|
+
|
|
136
|
+
### Added (post-Kelvin-comparison surface expansion)
|
|
137
|
+
|
|
138
|
+
A pre-tag review against the legacy ``kelvin_tabular`` package
|
|
139
|
+
(roughly 60 MCP tools across inspection / manipulation / statistics /
|
|
140
|
+
quality / transformation categories) found that most of those tools
|
|
141
|
+
were SELECT one-liners that don't earn their weight when the agent
|
|
142
|
+
already has free-form SQL. The ones that *do* earn their weight are
|
|
143
|
+
the SQL-is-genuinely-awkward cases — joins where column ambiguity
|
|
144
|
+
catches agents writing `JOIN ON l.x = r.x` by hand, the
|
|
145
|
+
``PIVOT`` / ``UNPIVOT`` syntax, long-form correlation matrices,
|
|
146
|
+
provenance tracing — and those are the six we ported. The package
|
|
147
|
+
explicitly does NOT ship Kelvin's full tree; SQL is the expression
|
|
148
|
+
layer for everything else.
|
|
149
|
+
|
|
150
|
+
Six new MCP tools (8 → 14) and matching public engine methods:
|
|
151
|
+
|
|
152
|
+
- **``kaos-tabular-history``** + **``engine.history(*, last_n=20)``**
|
|
153
|
+
+ ``EngineEvent`` exported on the public surface. Returns the
|
|
154
|
+
recent register / query / drop events for the session — provenance
|
|
155
|
+
for agents tracing back what's been loaded.
|
|
156
|
+
- **``kaos-tabular-find-duplicates``** + **``engine.find_duplicates(table, *, columns=None)``**.
|
|
157
|
+
Returns rows that share their key with at least one other row,
|
|
158
|
+
via DuckDB ``QUALIFY COUNT(*) OVER (PARTITION BY …) > 1``. Default
|
|
159
|
+
``columns=None`` uses every column (full-row duplicate detection).
|
|
160
|
+
- **``kaos-tabular-correlation``** + **``engine.correlation(table, *, columns=None)``**.
|
|
161
|
+
Pairwise Pearson correlation between numeric columns, returned as
|
|
162
|
+
long-form ``(col_a, col_b, corr)`` rows. Default auto-selects
|
|
163
|
+
every numeric column from the catalog.
|
|
164
|
+
- **``kaos-tabular-join``** + **``engine.join(left, right, *, on, how="inner", target=None)``**.
|
|
165
|
+
Wraps DuckDB's ``USING (col)`` clause so the join key appears
|
|
166
|
+
once in the result. ``how`` ∈ ``{inner, left, right, outer, semi,
|
|
167
|
+
anti, cross}``; ``target`` materializes via
|
|
168
|
+
``CREATE OR REPLACE TABLE`` and registers.
|
|
169
|
+
- **``kaos-tabular-pivot``** + **``engine.pivot(table, *, on, using,
|
|
170
|
+
aggregate="sum", group_by=None, target=None)``**. Wraps DuckDB
|
|
171
|
+
``PIVOT``. ``aggregate`` ∈ ``{sum, avg, min, max, count, first}``.
|
|
172
|
+
- **``kaos-tabular-unpivot``** + **``engine.unpivot(table, *, columns,
|
|
173
|
+
name_column="variable", value_column="value", target=None)``**.
|
|
174
|
+
Wraps DuckDB ``UNPIVOT``.
|
|
175
|
+
|
|
176
|
+
Each tool declares its own per-tool ``ToolAnnotations`` literal
|
|
177
|
+
(closed-world for catalog-only ops, open-world for arbitrary SQL,
|
|
178
|
+
destructive-write for ``export``). Engine methods emit 3-part
|
|
179
|
+
errors via ``EngineError`` and the MCP layer forwards them through
|
|
180
|
+
``ToolResult.create_error``. New unit-test file
|
|
181
|
+
``tests/unit/test_analytical_methods.py`` covers all five engine
|
|
182
|
+
methods + their tool wrappers — 27 tests, including round-trips
|
|
183
|
+
(pivot then unpivot), edge cases (empty columns list, missing
|
|
184
|
+
column, invalid ``how``), and tool-side error translation.
|
|
185
|
+
|
|
186
|
+
Test count: 189 → 216 unit tests; coverage stays at ~75% above
|
|
187
|
+
the 70% ``fail_under`` floor.
|
|
188
|
+
|
|
189
|
+
### Refactored (post-review code-quality pass)
|
|
190
|
+
|
|
191
|
+
A self-review against `docs/python/{boundaries,modules,errors,
|
|
192
|
+
dry-abstraction}.md` flagged five items worth addressing before tag.
|
|
193
|
+
All landed; none change the public API:
|
|
194
|
+
|
|
195
|
+
- **Item 3: `_ENGINES` global → `EngineRegistry` class.** New
|
|
196
|
+
module `kaos_tabular/_session.py` owning the bounded LRU.
|
|
197
|
+
`EngineRegistry(max_sessions=..., engine_factory=...)` lets tests
|
|
198
|
+
build isolated registries and inject a `_CountingEngine` factory
|
|
199
|
+
to spy on `close()` without monkey-patching module state. The
|
|
200
|
+
process singleton `SESSION_REGISTRY` keeps live MCP-session
|
|
201
|
+
behaviour identical. `tools._get_engine` is now a thin async
|
|
202
|
+
wrapper that delegates to the registry (with the same
|
|
203
|
+
`context is None` ephemeral-engine policy).
|
|
204
|
+
- **Item 4: `cast(Literal[...], fmt)` → typed inference helpers.**
|
|
205
|
+
New `_coerce_export_format(value: Any) -> ExportFormat | None`
|
|
206
|
+
and `_infer_export_format_from_extension(ext: str) -> ExportFormat | None`
|
|
207
|
+
return literal types directly so ty sees the narrow without a
|
|
208
|
+
`cast`. ExportTool's `execute` gets simpler too.
|
|
209
|
+
- **Item 5: brittle eviction test → `_CountingEngine` subclass.**
|
|
210
|
+
Replaced the `engine.close = lambda: ...` monkey-patch with a
|
|
211
|
+
real `TabularEngine` subclass that bumps a counter. Bonus:
|
|
212
|
+
asserts the evicted engine's DuckDB connection actually raises
|
|
213
|
+
`duckdb.ConnectionException` post-eviction.
|
|
214
|
+
- **Item 6: focused `_q_lit` unit tests.** New
|
|
215
|
+
`tests/unit/test_engine_helpers.py` pins six properties + a
|
|
216
|
+
parametrized 7-input round-trip through real DuckDB
|
|
217
|
+
(`SELECT {_q_lit(s)}` → `s`). The adversarial tests still cover
|
|
218
|
+
the engine-end-to-end path; this catches contract drift before it
|
|
219
|
+
reaches them.
|
|
220
|
+
- **Item 7: shared annotation constants → per-tool literals.**
|
|
221
|
+
Removed `_TABULAR_READ_ANNOTATIONS` / `_TABULAR_OPEN_READ_ANNOTATIONS`
|
|
222
|
+
/ `_TABULAR_WRITE_ANNOTATIONS`. Each of the 8 tools now declares
|
|
223
|
+
its own `ToolAnnotations(...)` literal in its `metadata` property,
|
|
224
|
+
matching the kaos-reference / kaos-citations pattern. Eliminates
|
|
225
|
+
the misclassification-via-shared-constant risk that motivated
|
|
226
|
+
review #4 in the first place.
|
|
227
|
+
|
|
228
|
+
Tests: 173 → **189** unit tests, 32 integration tests still green,
|
|
229
|
+
coverage 75% → 73% (more code under coverage tracking; gate still
|
|
230
|
+
above the 70% floor).
|
|
231
|
+
|
|
232
|
+
### Deferred to next release (tracked, not blocking 0.1.0a1)
|
|
233
|
+
|
|
234
|
+
- Make `INSTALL sqlite` / `LOAD sqlite` opt-in via a settings flag
|
|
235
|
+
(post-release-review #8). Currently the actionable error path is
|
|
236
|
+
in place (KTAB-010); making the network fetch opt-in is a real
|
|
237
|
+
API change worth doing in a settled release.
|
|
238
|
+
- Include `SECURITY.md` in the sdist (post-release-review #9). Cheap
|
|
239
|
+
to do at the cross-package level alongside other sdist policy.
|
|
240
|
+
- Pin GitHub Actions and gitleaks Docker image references to SHAs
|
|
241
|
+
for stronger supply-chain posture (post-release-review #10). Best
|
|
242
|
+
done as a platform-wide sweep across all kaos-* repos at once.
|
|
243
|
+
|
|
244
|
+
## [0.1.0a1-original] — superseded entries below
|
|
245
|
+
|
|
246
|
+
The remainder of this entry documents the pre-review release
|
|
247
|
+
preparation; left intact so the audit-01 / OSS Phase A trail is
|
|
248
|
+
preserved.
|
|
249
|
+
|
|
250
|
+
First public alpha. DuckDB-powered tabular data engine with 8 MCP
|
|
251
|
+
tools for register / query / describe / list / sample / count /
|
|
252
|
+
export / read-file workflows. Closes every finding in
|
|
253
|
+
`docs/audit-01/kaos-tabular.md` (KTAB-001..KTAB-010).
|
|
254
|
+
|
|
255
|
+
### Removed (dep minimization)
|
|
256
|
+
|
|
257
|
+
- **`polars` dropped from required dependencies.** A pre-release
|
|
258
|
+
audit confirmed nothing in `kaos_tabular` source or tests imports
|
|
259
|
+
polars; the DuckDB bridge in `kaos-content` doesn't need it
|
|
260
|
+
either (the polars bridge lives behind kaos-content's own
|
|
261
|
+
`[polars]` extra, which kaos-tabular never pulled). Result: the
|
|
262
|
+
resolved tree shrinks 56 → 54 packages and the install no longer
|
|
263
|
+
fetches the polars + polars-runtime-32 native binaries (~30 MB
|
|
264
|
+
combined). The `polars` keyword and the README polars mentions
|
|
265
|
+
are also dropped.
|
|
266
|
+
|
|
267
|
+
### Compliance
|
|
268
|
+
|
|
269
|
+
- **License audit (50 distinct deps in the resolved tree).** Every
|
|
270
|
+
inbound license is on the `docs/oss/10-licensing-legal/dep-license-policy.md`
|
|
271
|
+
allowlist: MIT, Apache-2.0, BSD-2/3-Clause, ISC, MPL-2.0 (certifi,
|
|
272
|
+
weak-copyleft permitted), PSF-2.0 (typing-extensions). Zero
|
|
273
|
+
matches against the denylist (GPL family, AGPL family,
|
|
274
|
+
Commons-Clause, SSPL, BUSL, anyone else's proprietary). Audit
|
|
275
|
+
evidence: `uv tree --no-dedupe` × per-PyPI license metadata.
|
|
276
|
+
|
|
277
|
+
### Added
|
|
278
|
+
|
|
279
|
+
- **`LICENSE`, `NOTICE`, `CHANGELOG.md`** seeded for the public release.
|
|
280
|
+
License flips from `LicenseRef-Proprietary` to Apache-2.0 via PEP 639
|
|
281
|
+
(`license = "Apache-2.0"`, `license-files = ["LICENSE", "NOTICE"]`).
|
|
282
|
+
`License ::` classifier removed (PEP 639 supersedes).
|
|
283
|
+
|
|
284
|
+
- **`TabularEngine.export_table(table_name, output_path, format=...)`**
|
|
285
|
+
— public engine method that owns DuckDB COPY, format mapping, and
|
|
286
|
+
path quoting. ExportTool MCP and `kaos-tabular export` CLI now call
|
|
287
|
+
it instead of reaching into `engine._con` and importing the private
|
|
288
|
+
`kaos_content.bridges.duckdb._quote_ident`. Closes audit-01 KTAB-003.
|
|
289
|
+
|
|
290
|
+
- **`docs/security.md`** — canonical statement of the trust contract
|
|
291
|
+
(DuckDB is in-process; SQL has filesystem access matching the running
|
|
292
|
+
process; deployments wanting stricter isolation should run
|
|
293
|
+
kaos-tabular in a constrained working directory or container; the
|
|
294
|
+
strict-isolation alternative is `kaos_content.bridges.duckdb.create_safe_connection`,
|
|
295
|
+
which cannot register files). Closes audit-01 KTAB-001 alongside the
|
|
296
|
+
description honesty fix.
|
|
297
|
+
|
|
298
|
+
- **`kaos_tabular/py.typed`** marker so the `Typing :: Typed` classifier
|
|
299
|
+
is honored by downstream type checkers. Closes audit-01 KTAB-004.
|
|
300
|
+
|
|
301
|
+
- **`benchmark` pytest marker** registered in `pyproject.toml`. Wall-
|
|
302
|
+
clock performance tests relocated from `tests/unit/test_adversarial.py`
|
|
303
|
+
→ `tests/benchmarks/test_engine_perf.py`. Bounded unit gates can now
|
|
304
|
+
exclude them with `-m "not benchmark"`. Closes audit-01 KTAB-006.
|
|
305
|
+
|
|
306
|
+
- **`tests/unit/test_sqlite_register.py`** — positive (real SQLite
|
|
307
|
+
fixture) and negative (forced INSTALL/LOAD failure) coverage for the
|
|
308
|
+
new SQLite registration error path. Closes audit-01 KTAB-010.
|
|
309
|
+
|
|
310
|
+
- **`tests/unit/test_serve.py`** — argparse + import-error coverage for
|
|
311
|
+
`kaos_tabular.serve.main`, lifting `serve.py` from 0% to ~55% and
|
|
312
|
+
total coverage from 63% (audit baseline) to 73%.
|
|
313
|
+
|
|
314
|
+
- **`fail_under = 70` coverage gate** in
|
|
315
|
+
`[tool.coverage.report]`. Locks the new floor against regression.
|
|
316
|
+
Closes audit-01 KTAB-005.
|
|
317
|
+
|
|
318
|
+
### Changed
|
|
319
|
+
|
|
320
|
+
- **`QueryTool.metadata.description` is now honest** about the trust
|
|
321
|
+
contract: "Execute arbitrary DuckDB SQL against the session's
|
|
322
|
+
in-process engine ... SQL has filesystem access matching the running
|
|
323
|
+
process — for stricter isolation, run kaos-tabular in a constrained
|
|
324
|
+
working directory or container." Previously the description claimed
|
|
325
|
+
"queries against registered tables" while the engine accepted
|
|
326
|
+
arbitrary DuckDB SQL including `read_csv_auto('...')`. Closes
|
|
327
|
+
audit-01 KTAB-001.
|
|
328
|
+
|
|
329
|
+
- **`_register_sqlite` now raises `RegistrationError` with a 3-part
|
|
330
|
+
message** when DuckDB's `INSTALL sqlite` / `LOAD sqlite` fails. The
|
|
331
|
+
message names the install command, the offline workaround
|
|
332
|
+
(pre-bundled extension), and the fallback (export tables to CSV /
|
|
333
|
+
Parquet first). Closes audit-01 KTAB-010.
|
|
334
|
+
|
|
335
|
+
- **MCP error messages standardized to the what / how-to-fix /
|
|
336
|
+
alternative-tool shape** across `tools.py`. The audit explicitly
|
|
337
|
+
flagged the sample (`tools.py:359`) and read-file (`tools.py:489`)
|
|
338
|
+
errors as incomplete; both rewritten plus the file-not-found, no-
|
|
339
|
+
tables-registered, and register-failed paths. Closes audit-01
|
|
340
|
+
KTAB-007.
|
|
341
|
+
|
|
342
|
+
- **Stale comment in `tests/unit/test_tools.py`** removed. The module
|
|
343
|
+
docstring claimed "Several tools have a bug where _get_engine(context)
|
|
344
|
+
is called without await" — current source awaits correctly. Closes
|
|
345
|
+
audit-01 KTAB-009.
|
|
346
|
+
|
|
347
|
+
### Removed
|
|
348
|
+
|
|
349
|
+
- **`[xlsx]` extra and `_register_xlsx` method dropped.** Both
|
|
350
|
+
introduced an undocumented sideways
|
|
351
|
+
`kaos-tabular -> kaos-office` extraction-module dependency that the
|
|
352
|
+
architecture DAG explicitly forbids. Callers wanting XLSX support
|
|
353
|
+
parse the file with `kaos_office.parse_xlsx(path)` (in kaos-office,
|
|
354
|
+
which is the right home for OPC reading) and pass each `Table` to
|
|
355
|
+
`engine.register_table(table, name=...)` (already public). The
|
|
356
|
+
workspace dependency on `kaos-office` is removed; `[tool.uv.sources]`
|
|
357
|
+
drops the kaos-office editable entry. Closes audit-01 KTAB-002.
|
|
358
|
+
|
|
359
|
+
### Notes (audit findings already resolved)
|
|
360
|
+
|
|
361
|
+
- **KTAB-008** — `kaos_tabular/__init__.py` `__all__` is already
|
|
362
|
+
alphabetically sorted under Python's default ordering (uppercase <
|
|
363
|
+
underscore < lowercase per ASCII). No change needed; documented here
|
|
364
|
+
as verified against `sorted()`.
|
|
365
|
+
|
|
366
|
+
[Unreleased]: https://github.com/273v/kaos-tabular/compare/v0.1.0a1...HEAD
|
|
367
|
+
[0.1.0a1]: https://github.com/273v/kaos-tabular/releases/tag/v0.1.0a1
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 273 Ventures LLC
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
kaos-tabular
|
|
2
|
+
Copyright 2026 273 Ventures LLC.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at 273 Ventures LLC
|
|
5
|
+
(https://273ventures.com).
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0. See the LICENSE file
|
|
8
|
+
distributed with this software for the full text of the license.
|