Repository navigation
Description
Summary
A field.<T> that pulls its value from another field via origin.passthrough can declare a different <T> than its source and codegen accepts it silently. The projected field should be type-identical to its source unless an explicit transform attribute converts it. Add a validation-phase check that fails (or warns) when a passthrough field's declared type ≠ the source field's type and no transform is declared.
Motivating case
A downstream adopter migrated UUID columns from field.string { dbColumnType: uuid } to field.uuid. The source entity field was flipped correctly, but two view projections kept projecting it as field.string:
# source entity — migrated
- field.uuid: { name: currentLocationId }
# view projection — NOT migrated, silently accepted
- field.string:
name: currentLocationId
children: [ { origin.passthrough: { from: "acme::engine::GameCharacter.currentLocationId" } } ]The generated view surfaces String? while the source is UUID?, which forces hand-written ?.toString() bridge code in the repositories and leaves the field String-typed end-to-end — the exact inconsistency the migration set out to remove. Nothing catches it: it's not a raw dbColumnType, so a dbColumnType-based lint can't see it; codegen just emits the declared (wrong) type; and it compiles + runs fine, so it's invisible until someone reads the generated view.
Proposed check
During validation (candidate home: ValidationPhase / Verify, alongside the existing projection handling in ProjectionMetaObject), for every field carrying an origin.passthrough child:
- Resolve the
from:reference to the source field. - If the passthrough field's own type (
field.<T>, including array-ness / nullability shape) differs from the source field's type, fail with a clear message naming both sides — e.g.view field 'currentLocationId' (field.string) does not match its passthrough source GameCharacter.currentLocationId (field.uuid); declare field.uuid or add an explicit transform. - Escape hatch: skip the check when the field declares an explicit transform attr that changes the type (this is the natural home for the transform concept in origin.expression: computed projection columns (post-1.0, additive) #159's
origin.expression— a computed/converting projection is allowed to differ). Absent a transform, identical types are the invariant.
Why framework-level
A per-adopter CI lint can catch the raw field.string { dbColumnType: uuid } idiom, but it cannot see through origin.passthrough to know the projected type diverged from its source — the metadata model is the only place that knows both ends of the passthrough. This is a metamodel invariant ("a passthrough is type-preserving unless transformed"), so it belongs in the loader/verify, not in each adopter.
Related
- origin.expression: computed projection columns (post-1.0, additive) #159
origin.expression: computed projection columns— the transform/escape-hatch side of this same surface. The type-equality check here is the default;origin.expression(or a transform attr) is the sanctioned way to opt out of it. - FR-024 — Entity surfaces: object.projection + universal field-extends + declared API #10 (FR-024) / FR-021 — api metadata + contract projections #7 (FR-021) — projection / contract-projection metamodel work this fits under.
Activity
dmealing commentedon Jul 8, 2026
Decision (design finalized 2026-07-08)
Implementing this, with three refinements to the spec above — grounded in the existing code:
1. It's one universal invariant, not a new subsystem. A narrow version of this check already exists:
ERR_PARAMETER_REF_PASSTHROUGH_TYPE_MISMATCH(validate-source-parameter-ref.ts) already doesparamField.subType !== targetField.subType— but only for FR-015 stored-proc@parameterRefvalue-objects, so it can't see aobject.projectionview field (the motivating case). Rather than add a second overlapping check, generalize it: oneERR_PASSTHROUGH_TYPE_MISMATCHin the origin-paths validation pass (next to the existing_checkExtendsOriginAgreement, where@fromalready resolves to the source field node) covering projection / entity / value fields alike, and retire the narrowERR_PARAMETER_REF_PASSTHROUGH_TYPE_MISMATCH(repointing its conformance fixture). Single invariant, no gaps.2. Match
subType+ array-ness; NOT nullability. Auuidprojected asstring, or a scalar projected as an array, is always a bug. But a view over an outer join legitimately widens aNOT NULLsource column to nullable — requiring nullability-identical would false-positive on valid projections and threaten the repo's >15%-false-positive kill bar. So: fail onsubTypeorisArraydivergence; leave nullability alone.3. Escape hatch is a new
@convertboolean attr ONorigin.passthrough— NOT blocked on #159. The spec above tied the opt-out toorigin.expression(#159), which is post-1.0 and unbuilt. Instead add@convert: truedirectly onorigin.passthrough: an acknowledgement that the type deliberately differs, which suppresses the error. It does not generate a cast — the value flows through as today and the adopter owns any coercion. Real type-converting projections remain #159/origin.expression's job; a passthrough-only check naturally ignores that subtype when it lands. This unblocks #185 from unbuilt work while giving a sanctioned, honest opt-out.Hard fail (not warn): deterministic structural equality on resolved nodes with nullability excluded ⇒ ~empty false-positive set; matches its siblings (
ERR_EXTENDS_ORIGIN_MISMATCH,ERR_ORIGIN_CARDINALITY).Cross-port: TS reference first (fixtures-first), then Python / C# / Java / Kotlin, gated by a new
fixtures/conformance/fixture +registry-conformance(the@convertattr). Breaking on upgrade for adopters with a divergent passthrough (the point — it's a latent bug; the error names both sides + the fix). CHANGELOG breaking note.feat(metamodel): origin.passthrough is type-preserving unless @convert (
chore(release): 0.15.17 (npm) / 0.15.10 (PyPI) / 0.15.8 (NuGet) / 7.7…
dmealing commentedon Jul 13, 2026
Fixed and shipped in 0.15.17 (npm) / PyPI 0.15.10 / NuGet 0.15.8 / Maven 7.7.8.
origin.passthroughis now type-preserving: a passthrough field whose declared type differs from its@fromsource fails to load withERR_PASSTHROUGH_TYPE_MISMATCH, with@convert: trueas the explicit opt-out. Registered in all five ports and cross-port registry-conformance gated. See the 0.15.17 CHANGELOG entry.feat(#195): per-capability origin validation (TS reference)
feat(#195): Java per-capability origin validation + native typing (cr…
feat(#195): C# per-capability origin validation + native typing (cros…
docs(roadmap): record the #210 ruling and its two blocking preludes