Repository navigation
fix(snowflake): match every recorded Snowflake receipt and re-record syntax coverage - #231
Merged
Merged
Conversation
…cases Snowflake receipts now cover the cases whose SQL the list-item walk fix corrected: the optional first item before a continuation, and the elided group that drops its parenthesis. The marks follow the settled cases.
… forms VALUES and three network and packages policy forms were read in full again after their list-item cases were corrected and re-recorded. All four are approved; DEFINE NETWORK POLICY stays unreviewed because its tree does not record the DEFINE keyword. The baseline is re-recorded.
… run without privileges A statement that must not take effect can be run, with no setup, by a role that holds no privilege, so Snowflake parses it and then refuses it at authorization or name resolution. The importer records such a row with an empty setup and `no_effect = "probe_role"`, and refuses it unless its phase is a refusal after parsing; one that ran is never a receipt. The checker lets that receipt stand for its case whatever setup the case names, since no setup changes whether Snowflake parses a statement, and names any other no-effect receipt as a format problem.
…erated cases by their receipts - Add an omission audit to the Snowflake obligations build: a catalogued form with a grammar and no obligations fails the build; retired aliases and fragments are listed. - Derive obligations for number tokens, quoted fill classes, mixed-case quoted names, template alternatives, options-only alternatives, lower-case keyword values and empty list items. - Let agreeing receipts decide a generated accept or reject case, and keep minimal boundary rows. - Refresh the Snowflake catalogue and its sources.
…ep what was written - Build structured create-object trees for the opaque CREATE and DEFINE kinds (agent, AI function, pipe with its COPY body, listing, model, notebook and others), with the DEFINE flag, optional WITH, TEMP versus TEMPORARY as written, task names as qualified names and SNOWFLAKE..<class> instances. - Add named data types with precision and scale, stage references, GET/LIST/REMOVE and COPY trees, MERGE actions, RETURNS TABLE column quoting, and the class-method call `!method(args)` in a projection. - Match receipts on accept or reject for ALTER, SHOW, sequence, external table, application package, notification integration and constraint forms. - Split the stage models and ALTER TABLE parsing into their own modules.
…t run without privileges No privilege or setup changes whether Snowflake parses a statement, so a probe-role row now counts when Snowflake refused it after parsing or with its syntax-error class: errno 1003 with "SQL compilation error: syntax error ... unexpected". A parser or parse error with another errno, an unsupported feature and a runtime error stay refused. The checker admits the same two phases for a no-effect receipt and names any other as a format problem. A probe-role row also needs its run's audit to hold the end proof of the probe role's grants, written only after the end walk of the roles the probe inherits matched the start; a run whose end proof failed yields no probe receipt.
…mitting empty names Snowflake's parser rejects UNDROP <kind> IDENTIFIER ( <bare word> ) at the top level with a syntax error, while the documented system-generated id, IDENTIFIER( <number> ), is accepted for DATABASE, NOTEBOOK, SCHEMA, SNAPSHOT and TABLE. Statements inside a Snowflake Scripting block are left alone, since a variable may stand there. Trees no longer carry an empty name standing in for an unwritten one: - a table reference written through IDENTIFIER( ) omits its name; - EXECUTE JOB SERVICE and EXECUTE INFERENCE JOB give a null object name; - ALTER DYNAMIC TABLE ... SET TAG = <value> gives a null tag name; - a bare ALTER RESOURCE MONITOR omits its empty action. The UNDROP readings in the syntax limits now name both IDENTIFIER forms, and the regenerated DDL obligations follow them.
…t-parse semantic error Snowflake reports a session without a current database (errno 90105, SQLSTATE 22000) only after the statement parsed, as the syntax limits already record. The receipt classifier now gives it the semantic_error phase, and a classifier case pins it.
The pinned evidence adds the receipts of the latest runner and definition-file batches, including UNDROP by system-generated id and the provisioned-throughput cases, all of which failed before execution. The marks follow the regenerated cases.
…their cases and parse trees
…ttle, and disagreements the parser now resolves The pinned receipts give a phase to 521 obligations recorded as not submitted, and the rebuilt cases no longer cite a few entries whose obligations were renumbered or withdrawn. 107 recorded disagreements now agree with the parser.
…fter their receipts and trees changed
…er any setup A statement run by the probe role has no setup, so its receipt carries the empty setup's hash. The syntax checker already admits such a receipt for any setup when Snowflake parsed the statement or refused it with its syntax error, but the case builder only settled a case from receipts recorded under the case's own setup. Observed cases whose only receipts came from the probe role therefore never settled and stayed awaiting observation. The builder now treats those probe-role receipts the way the checker does: they settle a case under any setup, and they count against any receipt recorded under the case's setup, so receipts that disagree still settle nothing.
…from probe-role receipts The pinned evidence settles 81 DDL and security cases from receipts the probe role recorded, and their marks follow. UNDROP DATABASE, SNAPSHOT and TABLE by a bare word inside IDENTIFIER( ), and the provisioned throughput cases that put a bare word or a wrong kind where a string or number belongs, now carry the outcome Snowflake recorded instead of waiting for one.
UNSET lists of applications, databases, Streamlit apps and Openflow objects, COPY = ( ... ) on tables and dynamic tables, a function's PACKAGES, the columns of a described TABLE argument, MERGE INSERT columns and values, a policy's arguments, and an interactive warehouse's TABLES accepted a comma with nothing after it. Their receipts show Snowflake refuses each one as a syntax error, while the same lists with an item after every comma still parse. An interactive warehouse's TABLES list also needs at least one table, as its receipt shows; an empty table COPY list stays accepted. The masking policy receipt this resolves leaves the disagreement list.
Snowflake refuses a TAG list, with or without WITH, on CREATE OR ALTER SECRET and DEFINE SECRET as a syntax error for every secret type, while the same statements without tags parse and CREATE SECRET keeps its tags. The parser now refuses the tag list on those two forms.
…GED ACCOUNT Snowflake parses DROP ACCOUNT <name> [ GRACE_PERIOD_IN_DAYS = <number> ] and DROP MANAGED ACCOUNT <name>, refusing them only after parsing when the role lacks the privilege, but the parser refused both kinds outright. Both are now object drops; the grace period is kept as a property of the drop, and a string, a missing number, a reserved word or a missing name stays refused, as their receipts show. DropObject gains an optional property list, left out of the tree when empty, so every other dialect's drops serialize as before.
…E as trees The three CREATE OPENFLOW kinds were kept as raw text, so the parser accepted shapes Snowflake refuses: a connector without IN RUNTIME or FROM, a bare word or string where a runtime, deployment or role name belongs, and a trailing comma in a runtime's integrations. A structured parser now reads each kind's head and documented properties, as all 153 recorded receipts for these statements show: the runtime or deployment and the connector's definition or stage location are operands, a node or deployment type is a keyword, and the integrations stay one list, which may be empty.
Snowflake refuses a bare word, or no value, as an agent's live version SPECIFICATION, as the profile of ADD SCORING PROFILE on a Cortex search service, and as REPLICATION_SCHEDULE on CREATE FAILOVER GROUP and CREATE REPLICATION GROUP. The parser now requires a string in each place.
Snowflake refuses CREATE OR REPLACE WAREHOUSE IF NOT EXISTS and CREATE OR REPLACE INTERACTIVE WAREHOUSE IF NOT EXISTS as syntax errors, while other kinds such as CONTACT still parse with both clauses. The parser now refuses the combination for these two kinds only.
Snowflake parses CREATE ONLINE FEATURE TABLE without WAREHOUSE and only rejects it after parsing. The parser no longer requires the property.
Snowflake parses ALTER SHARE ... SET ACCOUNTS = '<string>' with a single string, while a string after an account name and a trailing comma are still syntax errors. The parser now takes one string as the whole value.
… and trees changed, and re-record the baseline The 94 forms held back only by a stale or missing review were read in full again against their documentation page, obligations, cases, parse trees and the newly pinned receipts. 35 are approved; the rest stay unreviewed for tree, grammar or coverage findings the receipts did not settle. The baseline is re-recorded against the current catalogue, so obligations renumbered by the regenerated walk are counted by their new ids.
… rows The Snowflake catalogue build read a committed catalogue file as a plain row, so the type checker could not iterate its form and definition tables. The reader now returns the tables of rows that TOML gives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Snowflake receipts showed the parser disagreeing with Snowflake on 139 recorded statements, some kinds were still kept as opaque text, and many forms waited on receipts or reviews. This train fixes every contradiction, one commit per cause, and re-records coverage.
Changes
Verification
syntax-coverage diff: 0 contradicted receipts, 0 unlisted, 0 disagreements added, 0 forms lost."source":""when there is no AS or CLONE clause. A follow-up PR fixes it and re-judges the affected forms.make check-cipasses on the final head.