Skip to content

chore(syntax-receipts): place errno 1002 syntax error messages as syntax - #195

Closed
kvlonge wants to merge 2 commits into
mainfrom
fix/import-syntax-errno-1002
Closed

kvlonge wants to merge 2 commits into
mainfrom
fix/import-syntax-errno-1002

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Why

The receipt importer refused every row with errno 1002 as having no established phase. Snowflake's parser raises 1002 for some malformed statements, and the message itself says so: ALTER WAREHOUSE … ADD TABLES and DROP TABLES with no table list return errno 1002, SQLSTATE 42601, "syntax error line At least one table name is required for ADD TABLES operations at position {1} unexpected '{2}'." Two captured rows are unimported because of this.

Changes

  • fix(syntax-receipts): errno 1002 is a syntax_error when its message starts with syntax error (any case, any SQLSTATE).

  • fix(syntax-receipts): every other errno 1002 is refused, including one under the SQL compilation error prefix (formerly semantic) or inside an uncaught exception (formerly runtime), so a parser error can't be published under another phase. No published receipt has errno 1002 in either form.

  • The docs list the 1002 rule on its own, in the order the code applies it. Classify tests cover the syntax message, another message, the compilation prefix and the uncaught exception.

  • Re-importing the existing runs with this importer places exactly the two ADD/DROP TABLES rows as syntax errors and changes nothing else. Nothing is re-recorded. The six earlier errno 1002 receipts were already published as syntax errors.

Verification

  • uv run pytest tests/unit/scripts/syntax_receipts/: 80 passed; each new test fails when its rule is reverted.
  • ruff check and ruff format --check on the touched paths.

Errno 1002 (SQLSTATE 42601) was refused as having no established phase.
Snowflake raises it from the parser for some malformed statements, with a
message that itself starts with "syntax error", such as ALTER WAREHOUSE ...
ADD TABLES with no table list: "syntax error line At least one table name
is required for ADD TABLES operations ...". Errno 1002 is now a syntax
error only when its message starts with "syntax error"; any other 1002
message stays refused.
Errno 1002 under the SQL compilation error prefix was placed as semantic,
and inside an uncaught exception as runtime. As a parser errno, either
could be a syntax error published under the wrong phase, so both are now
refused, the same way 1003 inside an uncaught exception is. The docs list
the 1002 rule on its own and say it reads the message in any case and
ignores SQLSTATE.
@kvlonge kvlonge changed the title fix(syntax-receipts): place errno 1002 syntax error messages as syntax chore(syntax-receipts): place errno 1002 syntax error messages as syntax Nov 12, 2026

kvlonge commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Replaced by #197: the same change, rebased onto 0.7.0 with both commit subjects as chore(syntax-receipts): so the rebase merge queue doesn't cut an empty release. Opened as a new PR rather than force-pushing this branch.

@kvlonge kvlonge closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant