Repository navigation
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
@ArdaTkn, could you rebase this branch onto the latest |
0a9a8b2 to
4b60a04
Compare
|
@SkyeAv Rebased onto latest |
SkyeAv
left a comment
There was a problem hiding this comment.
Thanks for the contribution, @ArdaTkn! The integration and tests look good overall. I found a few edge cases worth addressing before merging:
- Query safety:
src/tablassert/lib.py:1016-1031allows write queries containingorder by. I confirmed thatDELETE ... RETURNING * -- order bydeleted rows. Could we open SQLite read-only, reject writes with an authorizer, and add regression tests? src/tablassert/lib.py:1016: the substring check rejects validORDER\nBYand accepts comment-only or subquery-only matches. A top-level clause check would be more reliable.src/tablassert/lib.py:1031: duplicate result names crash non-empty queries and collapse empty schemas. Using positional names when constructing the frame should avoid this.src/tablassert/lib.py:1027: missing databases are silently created.mode=roand explicit connection cleanup would help here too.src/tablassert/lib.py:1024: invalid table names currently use the wrong error code.docs/configuration/table.md:262-268: the SQL example has a few leftover NDJSON lines, creating duplicate YAML keys.
The table identifier validation looks safe against injection; the raw query path needs similar protection. CI passes, but these cases are not covered yet. Thanks again!
|
Addressed all review items in
Local gates re-run and passing: |
4b60a04 to
ba353f8
Compare
ba353f8 to
6a12a4e
Compare
SkyeAv
left a comment
There was a problem hiding this comment.
Thanks, @ArdaTkn! The previous fixes look good, and CI is green. Two small items remain:
- Recursive CTEs:
src/tablassert/lib.py:1087rejects valid read-only recursive CTEs becausesqlite3.SQLITE_RECURSIVEis not allowlisted. I confirmed that SQLite executes the query directly, whilelib.sqlraisessql-query-not-read-only. Please allow this action and add a regression test. - Docs:
docs/configuration/table.md:252markstableas required, but exactly one oftable/queryis required, so either may be omitted. Please mark both optional while retaining the exactly-one explanation.
Once those are addressed, this should be ready to merge.
Summary
Closes #263 — SQLite-first, per the issue's "Questions for Reviewers" (stdlib
sqlite3, zero new dependencies; multi-engineconnectionstrings left as a documented follow-up rather than shipping connectorx blind).kind: sqlwithlocalcarrying the SQLite database file (same as the file kinds) plus exactly one oftable/query, enforced in the model (sql-table-and-query-conflict).tablescans asSELECT * FROM "table" ORDER BY rowid; aquerymust carry its ownORDER BY— a missing one fails fast withsql-query-needs-order-byso row indices androw:<N>StudyResult ids stay reproducible across runs.tableidentifier is validated as a plain name (alnum + underscore, no leading digit) before quoted interpolation, so config-injected SQL cannot break out of the identifier position.column_1..in result order per the reader contract; a zero-row result keeps its column schema (unlike schemaless NDJSON, a SQL cursor always knows its columns).urlstays the declared provenance list, format-validated only, never fetched.Changes
Files.SQLenum member +SQLsource model in theSection.sourceunionlib.sqlreader (stdlibsqlite3), dispatch inTcode._source_ops, runcache op-cost entrydocs/configuration/table.md+ docs source-of-truth bindingLocal gate
ruff check/ruff format --check: cleanpyright: 0 errors;vulture/deptry: cleanmain(two macOS errno-mapping tests +test_real_repo_files_round_trip, covered by your follow-up issue)mkdocs build --strict: clean