Repository navigation
Extract shared compiler crates: weft-model, weft-expr, weft-backend, weft-postgresql-emit - #70
Merged
Merged
Conversation
Move UMF document preparation, name and identity resolution, logical types, descriptors, exact literals, exact instants, bounded JSON and diagnostics out of weft-core into a new crate, weft-model 0.1.0 (own semver; README states its public surface). weft-core depends on it and re-exports it under the old module paths, so backends, runtime, Python and WASM compile unchanged. - Catalog admission flags become an explicit Admission profile (prepare_with, admit, admission); documents are read via documents(). - LogicalType is generic over a FamilySet. weft profiles keep the closed four-family Family, so weft-sql 0.1-0.3 cannot represent timestamps or floats. ScalarFamily adds UMF timestamp (exact UTC instants) and float (finite binary64 tokens) for opt-in callers (field_as, *_as descriptors); Admission::nullable_fields types absent-allowed Fields as nullable. - Exact decimal coefficient arithmetic moves to weft_model::exact. - Tooling: workspace member, both module-boundary policies, a generator for the boundary inventory (scripts/module-boundaries-update.ts), a shared-crate version check in check-release-version.py run by CI, the UMF canary job tests weft-model, architecture table and CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ate-selection New crate weft-expr 0.1.0 (own semver; README states its public surface), depending only on weft-model: - operand: Field<F> and Value<F> (moved from application_ir; wire shapes unchanged). - compare: CompareOp (eq ne lt le gt ge) with the typing rule (same domain, no ordering on booleans) and weft-sql 0.3's ComparisonOperator (moved from arithmetic_plan). - arithmetic: exact Domain/Expression/Kind, Domain::of_field and token_domain (moved from arithmetic_resolve; resolve() stays with the weft-sql parser). - selection: the weft.update-selection/1 predicate format (CONTRACT-009): a pre-order walk with caller domain checks, encode, comparisons, first-use dependencies and connective splicing. The mutation frontend builds selections with it; inspect_selection and the PostgreSQL mutation lowering decode with it instead of two hand-written walks. Refusal messages are unchanged. weft-core re-exports the moved types under their old paths. weft-postgresql depends on weft-expr directly. Tooling: workspace member, both boundary policies and the regenerated inventory, shared-crate release check, architecture table, CONTRACT-009 note, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
security_literals (CoreLiteral checks against a UMF Field's facets, widths, ranges, allowed values, examples and defaults) and the field-domain normalizer from security_ontology move to weft_model::core_literal. weft_core::security_literals and security_ontology::domain re-export them; diagnostic codes (WFT-SECURITY-LITERAL, WFT-SECURITY-ONTOLOGY) are unchanged. Adds weft-model unit tests, README row, inventory and CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New crate weft-backend 0.1.0 (own semver; README states its surface), depending only on weft-model: - manifest: Manifest, profiles, capabilities, obligations and structural validation; accepted interface versions and language/IR pairs come from the frontend's ManifestRules. - boundary: Frontend (typed program, selection, binding reader, preflight, catalog admission), Backend<F> with an associated Artifact returned by emit, TargetArtifact (merges obligations, checks itself), NoArtifact for backends that emit nothing, the checked compile pipeline, Registry<F, A>. - sql: the SQL Emission carrier (parameter slots, columns, representations, carriers, decoders, NativeMetadata) as one artifact type. weft_core::backend becomes weft's frontend (WeftPlans: plans, 0.2.x manifest rules, Truss binding reader, capability preflights, emission checks) and keeps its Backend trait, Context, Registry, Compilation and type paths, so every backend implementation compiles unchanged. Check order, refusal codes and the Compilation wire shape are unchanged. Tooling: workspace member, both boundary policies, inventory, shared-crate release check, architecture table, CONTRACT-002 note, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New crate weft-postgresql-emit 0.1.0 (own semver; README states its surface), depending on weft-model and weft-backend: quoted identifiers (Identifier, qualified), numbered parameter slots (Parameters, CatalogDomain, now with slots() and set_origin()), standard and escape string literals, typed casts with the C collation (typed, cast_type, collate_c; timestamptz and float8 for opt-in families), and exact result decoders (decoder, decoder_for). weft-postgresql re-exports Identifier, qualified, Parameters and CatalogDomain, and its Truss runtime, candidate and mutation lowerings call the shared cast, literal and decoder helpers instead of five duplicated copies. Emitted SQL is unchanged (generated fixtures do not drift). The Truss storage layout stays in weft-postgresql. Tooling: workspace member, both boundary policies, inventory, shared-crate release check, architecture table, CONTRACT-002 note, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ScalarDecoder gains utc-instant (YYYY-MM-DDTHH:MM:SS.ffffffZ) for the opt-in timestamp family and ieee754-binary64-hex (the binary64 bit pattern) for float, with ScalarDecoder::exact picking a family's decoder. Emission, Column and Representation take a family-set parameter defaulting to Family, so weft's emissions cannot carry these columns; Emission<ScalarFamily> can. SqlChecks is generic over the same parameter. weft-postgresql-emit: decoder_for returns a decoder for every family, and decodable projects an expression to its decoder's text (to_char in UTC, encode(float8send(..), 'hex')). Experimental: unit tests only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 16, 2026
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.
Splits weft's UMF model, expression and backend layers into crates another compiler can depend on. Fireweed (a queue data plane) is the first such caller: its compiler will use UMF for its schemas and lower a typed IR to PostgreSQL, SQLite and Turso.
New crates
Each crate starts at 0.1.0, is versioned separately from weft, and has a README that states its public surface.
weft-modelcore_literalfield-domain checksweft-exprweft.update-selection/1predicate format (CONTRACT-009)weft-backendFrontend,Backend<F>with an associatedArtifact,NoArtifact, the compile pipeline,Registry, the SQLEmissioncarrierweft-postgresql-emitWhat stays the same for weft
weft-corere-exports the moved items under their old module paths. Backends, runtime, Python and WASM compile without edits.weft_core::backendbecomes weft's frontend and keeps itsBackendtrait,Context,Registry,Compilationand type paths. Check order, refusal codes, diagnostic codes and theCompilationwire shape are unchanged.weft-postgresqlnow calls the shared cast, literal and decoder helpers instead of five copies of them. The Truss storage layout stays inweft-postgresql.Familystill types every weft profile, so weft-sql 0.1–0.3 can't represent timestamps or floats.Opt-in additions (experimental)
ScalarFamilyadds UMF timestamp (exact UTC instants) and float (finite binary64). Callers reach it throughfield_asand the*_asdescriptors.Admission::nullable_fieldstypes fields that may be absent as nullable.timestamptzandfloat8casts for those families.utc-instantfor timestamps andieee754-binary64-hexfor floats.Emission,ColumnandRepresentationtake a family-set parameter that defaults toFamily, so weft's own emissions can't carry these columns.These additions have unit tests only, and no weft frontend uses them yet.
Tooling and CI
scripts/module-boundaries-update.ts). They are added to the architecture table and CHANGELOG.check-release-version.py --shared-crateschecks the shared crates' versions and now runs in the checks job (.github/workflows/ci.yml).weft-model.Verification (local)
cargo test --workspace --locked: 1,136 tests passed.🤖 Generated with Claude Code