Repository navigation
Generate ABI 3 codecs for external model mappings - #48
Conversation
|
Thanks—this addresses the missing ABI 3 codec generation reported in #47 and keeps the codecs in the integration assembly, which is what we need for the MVVM split. Reviewing this against SandwichTradingDevOps/StackWich#1060, two additional capabilities would let us consume our existing neutral chart contracts directly:
I ran the interop suite at |
|
The update at I also compiled an integration probe using the actual contracts assembly and API/policy manifests from SandwichTradingDevOps/StackWich#1060, mapping all 13 chart models to their existing neutral CLR contracts. This exposed one remaining compatibility gap: optional TypeScript properties currently require Examples from the real manifests:
With Could external model policy explicitly support ordinary CLR properties for these optional members, without requiring the contracts assembly to reference WebScene? The policy should define the semantics rather than implicitly discard the absent/null distinction: for example, always emit the property on writes, and explicitly choose whether an absent property on reads is rejected or mapped to null/a configured default. Existing Regression coverage using these production shapes would be useful: optional nullable scalar, optional non-nullable scalar, optional nullable external object, and a record-struct array containing such a member. Please cover absent versus explicit null/value on reads, the selected write semantics, and retention of the direct-write/no-boxing allocation behavior. Alternatively, we can tighten our application-owned TypeScript declarations if we verify these fields are always present, but that is an application contract change rather than a drop-in external mapping. We want to keep WebScene-specific optional wrappers out of the neutral contracts assembly. |
External model type mappings currently generate signatures that compile but fall back to JSON invocation, which NativeJavaScriptInvoker rejects. This change generates ABI 3 readers and writers in the integration assembly for compatible external classes, structs, and records, so the contracts assembly needs no WebScene or backend dependency.
longandlong?properties for TypeScriptnumberand nullable number. Both directions enforce the JavaScript safe-integer interval ±(2^53 − 1). Reads reject fractional/non-finite values, and writes reject integers outside the safe interval; invalid conversions throwOverflowExceptioninstead of rounding or truncating.optionalPropertiespolicies for neutral CLR contracts: always emit on writes, and reject absent/undefined reads or substitute null/a configured scalar default. Explicit null follows the declared value type. Unconfigured fields retainJavaScriptOptional<T>semantics.JavaScriptObjectReferencerather than an abstract adapter; callers release each returned handle. Callback registration is unchanged.propertyMappings, and read through constructors or writable/init properties. Struct readers prefer a matching constructor.WEBSCENEJS004with an actionable reason for unsupported contracts, including recursive graphs, ref structs, generics, index signatures, and incompatible properties or constructors. OptionalJavaScriptOptional<long>property conversion remains unsupported.Validation: all 104 interop tests pass, including separate-assembly contracts through NativeJavaScriptInvoker with an in-memory ABI 3 transport, the ChartHost array/void pattern, the requested TradingViewBar record struct with a renamed long timestamp, nullable structs, numeric boundaries and invalid reads/writes, byte-for-byte equivalence with generated DTO codecs, pooled-write allocation checks, optional scalar/object read semantics (absent, undefined, null, and value), preservation of wrapper behavior, and struct arrays with optional volume members. An isolated probe with all 13 actual chart contracts and the unchanged API manifest compiles with zero warnings/errors after adding explicit optional-property policies; all three bridge getters use ABI 3. The policy schema parses successfully and
git diff --checkpasses.Fixes #47.