Repository navigation
feat(native): parse declaration files natively behind the preview engine - #1014
Merged
Merged
Conversation
Add native listing, reading and parsing for enum, constant, model schema, audit, SQL hook, SQL function, seed and macro files, in Python's discovery order, with a deferred outcome for inputs only Python can judge and a session that retains each collection and its layout for later stages.
…ehind the preview engine Add the preview-tier DECLARATION_FILES stage. Each declaration collection is read once per pass through a retained native discovery session; Python builds the records, normalises constant values and parses schema columns, and re-runs its own parser for any file native rejects or defers, raising NativeStageMismatchError when the outcomes differ. Default engines are unchanged.
Discovery decoded raw-name markers across whole failure messages, so a NUL authored in a header key (for example a model's descri\0ption) was rewritten under every engine. Layout failures now show each listed path as it is displayed when the message is built, and the binding passes message text through untouched.
Document that a missing session means readers use the Python objects, and drop the session from the inputs each Rule fix pass lints.
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
Model, source, test and scenario files already have native discovery. The remaining declaration inputs still went through the Python parsers, so later Rust stages had no native view of enums, constants, schemas, audits, hooks, SQL functions, seeds and macros.
Changes
sqlbuild-discoverylists, reads and parses enum, constant, model schema, audit, SQL hook, SQL function, seed and macro files in Python's discovery order, in parallel. Files whose outcome depends on Python-only semantics are deferred, such as a non-ASCII bare word or a file name that is not UTF-8.NativeDiscoverySession(PyO3). It reads each collection and the declaration layout once per pass and retains them for later native stages. It is attached toDiscoveredProjectInputswithcompare=False.Nonemeans readers use the Python objects. The session is dropped before render-reuse pickling, from stage captures, and from inputs that Rule fixes edit.DECLARATION_FILES. Python still builds the records, normalises constant values and parses schema columns. A file that native rejects or defers is re-parsed by Python, and a differing outcome raisesNativeStageMismatchError.descri\0ptioncorrupted the error. Only listed path names are escaped now.Verification
make compiler-differential(163/163 identical),make compiler-differential-shipped(157/157), dense 3k andtests/e2e/scripts/compiler_differential.make test,make check-ci, andcargo test --workspace --all-features, clippy and fmt.