Skip to content

refactor: port reference checks, compile-input attachment and semantic completion to the native extension - #1095

Merged
kvlonge merged 14 commits into
mainfrom
feat/p1-batch5
Oct 13, 2026
Merged

kvlonge merged 14 commits into
mainfrom
feat/p1-batch5

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Why

Phase 1 of the Rust-hosted SQLBuild port (CHI-589): move compiler stages from Python into the native extension and delete the Python they replace.

Changes

  • Native explicit-reference facts, resource SQL diagnostics, scope-index errors, the semantic help catalogue, relation remedies and model-schema scope usages.
  • Native compile-input attachment; the compiler/compiled_project Python package and compile/_helpers/attachment are deleted.
  • Native semantic completion stage (type recovery, metadata checks, completion) and model analysis session.
  • Unreachable located reference-scan path removed from Python.
  • New fast Cargo profile and make fast-native for incremental local rebuilds (13s vs 137s for a one-line change); CI and wheels still use release.
  • Movable Python: 130,215 → 125,499 lines.

Intentional differences: _VisibleModelDeclarations is now VisibleModelDeclarations; misuse-only inputs can raise different exception types; e2e seam key renamed to complete_semantic_project.

Verification

  • Compiler differential: 371 projects as expected, goldens unchanged.
  • Byte-identical compile output (cold and one-model edit) against the previous main on a generated 1k-model project and a large private project.
  • 5,868 focused compiler, CLI and rule-engine tests; make check-ci; public-repository hygiene scan.
  • Worker-side native vs Python call comparisons for each ported function.

Production only extracts references without an origin from Python (typed macro arguments); located scan errors and P012 locations are produced by the native model, function and hook loops. The Python origin mapping, its SqlReferenceOrigin/SqlReferenceSourceMap models and the refs.native wrapper are deleted; their located cases stay covered by the Rust locating tests and the E2E reference-error suites.
The explicit-reference report and the planner's audit-gate and hook-read edges read models, sources, seeds, functions, audits and Python hooks straight from the project views in Rust, and the report is built as Python's compile models natively. Python keeps only the user-code owners (functions, loader definitions and their literal SQL). The JSON request builders and response decoding are deleted.
The audit, SQL test and SQL hook SQL checks read their inputs from the project views and build the CompilerDiagnostic results in Rust; get_resource_sql_diagnostics is a one-call wrapper.
…ogue natively

The compile driver reports each error-severity scope finding through the diagnostic collector from Rust, with the same key and CompilerDiagnostic Python built; diagnostics/scope.py is deleted. semantic_help_catalogue reads the native catalogue the diagnostics already use, replacing the duplicated Python table. model_schema_enum_declarations had no caller, and context_templates' expand_config_templates and build_run_context_values were single-use pass-throughs.
…atively

The runtime relation guard and the planner's old-name checks call the same native remedy and P008 old-name message the compile-time explicit-reference check uses; the Python duplicates are deleted.
The compile usages read schema declarations and the resolver's schema and enum records from Python objects in Rust, report S006 through the collector and build the UsageRecords; the named_declarations package is deleted and its caller uses the native function directly.
Compile-input attachment runs in native bindings: effective config, target and
cache context, the declaration scope, the model input loop with its class
dictionary, resource and check attachment, and the compiled record and update
helpers. The Python attachment and compiled_project modules are removed; the
compile driver and callers use the native functions. The inspection of user
Python resources for missing-description diagnostics stays in Python.
@kvlonge
kvlonge enabled auto-merge (squash) October 13, 2026 03:51
@kvlonge
kvlonge merged commit 6a91517 into main Oct 13, 2026
40 checks passed
@kvlonge
kvlonge deleted the feat/p1-batch5 branch October 13, 2026 04:20
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