Repository navigation
fix(grpc): derive Symbol type facts from Feature::type and report reference subsetting - #2040
Merged
Merged
Conversation
…erence subsetting TypeInfo gains types, the derived KerML Feature::type the metamodel evaluator answers (the derivation GetElementProperties type is completed from), beside the written typing declared/resolved_id keep. Specialization.kind reports ::> and include as references. SymbolInfo, TypeInfo and the client Symbol docs name the element_properties property each overlapping field summarises. The Python, TypeScript and Julia generators take a feature's type from the derived types and walk specializations only as a fallback. Fixes #2007 Fixes #2021 Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This was referenced Nov 7, 2026
A referencing feature named like its target (ref part q ::> q inside the owner of q) reported itself as the target: specializationsOf resolved the written name from the feature's own scope. The references edge now takes its target from semantics.Model.ReferencedFeature, which resolves outside the referencing feature as the metamodel does. Co-Authored-By: jason.han <hanhuijun@gmail.com>
… semantic model symbolfacts read Feature::type through a metamodel.Evaluator, which linked the reflective layer into sysml-core and put its wasm over the size budget. The derivation the evaluator used (featureTypes, completeFeatureTypeInputs, completeRelationships) moves into semantics.Model as ReflectiveFeatureTypes, FeatureTypeInputsComplete and GeneralizationsResolve; the evaluator and symbolfacts both call it, so the two surfaces still answer alike. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
6 tasks done
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.
What and why
A symbol's
type_inforeported only the feature's own written: T, so a feature typed through subsetting (part pSub :> q), reference subsetting (ref part pRef ::> q) or redefinition (attribute :>> a = 3.5) reported no type whileGetElementPropertiestypeanswered one, andspecializationsdropped reference subsetting altogether (relationshipKindNamereturned""forast.RelReferences). The Symbol surface now answers from the same semantic derivation the element form is completed from, and the overlapping Symbol fields say what they summarise.TypeInfo.types(new,repeated TypeRef, wire-compatible) is KerMLFeature::typeas the semantic model derives it for the reflective layer —semantics.Model.ReflectiveFeatureTypes, the derivationmetamodel.EvaluatoranswersFeature::typefrom (moved there from the evaluator'sfeatureTypes/completeFeatureTypeInputs/completeRelationships, which now delegate to it, sosymbolfactsdoes not link the evaluator intosysml-coreand its wasm size budget holds) — most specific first with redundant supertypes removed:pSub -> T,pRef -> T,pBoth : V :> q -> V, T,SubOwner::q :>> q -> T,tuned::a :>> a = 3.5 -> ScalarValues::Real.declared,resolved_idandresolved_kindkeep their meaning, the typing as written.Specialization.kindreports::>andincludeasreferences, with the target taken fromsemantics.Model.ReferencedFeature(which resolves outside the referencing feature, soref part q ::> qnames the outerq, not itself); the proto comment and every client that enumerates kinds list it.SymbolInfofield docs (proto) and the Python, Go, TypeScript, Java, Rust and JuliaSymboldocs say whatkind(declaration keyword, not the metaclass),metadata["direction"](written direction; derivedFeature::directioniselement_properties'direction),type_info(Feature::type) andspecializations(Type::ownedSpecialization, written edges only) summarise.TypeFacts.types/TypeRefadded to Python, Go (TypeInfo.Types), TypeScript, Java (Symbol.TypeFactsgains atypescomponent), Rust and Julia; the core JSON surface gainsJTypeInfo.Types._with_inherited_factsworkaround is kept but no longer the primary path — a feature that names no type takesTypeFacts.types[0](_derived_type); the walk over specializations remains only as the fallback for a service that predatestypes, and still supplies the inherited multiplicity, which the service does not derive. The TypeScript and Julia generators mirror this, and all three countreferencesamong the generalization kinds they follow.Fixes #2007
Fixes #2021
Out of scope, as agreed on #2021: the action-kind (pattern 1) and subject (pattern 4) disagreements belong to #2008/#2009.
One gap found while verifying:
GetElementPropertiestypeforpBoth : V :> qanswersVonly, notV, T—completeDerived(internal/translate/export/api_json_derived.go) keeps the graph's statedsysml:type(the written typing) and runs theFeature::typederivation only when nothing is stated. The Symbol surface answersV, Tas the specification and the pilot do; the agreement test asserts equality where the element form is derived and containment forpBoth. The RPC-side gap is resolved through #2042, which movesGetElementPropertiesonto the same evaluator derivation; the exporter is not touched here.Specification basis
KerML v1.1 Beta 2 §8.3.3.3
deriveFeatureType: a feature'stypeis the union of its typings' types and the types of the features it subsets (reference subsetting and redefinition being subsetting), with redundant supertypes removed. Moves theGetSymbolrow ofdocs/project/spec-compliance/08-grpc-service-layer.md(derivedtypes,references, the summary/element_propertiesdocumentation).How it was verified
internal/frontend/symbolfacts/typeinfo_test.goandinternal/frontend/grpc/derivedtypes_test.goover the six cases of A feature's type leaves out the types it gets through subsetting and redefinition, and reference subsetting (::>) is not reported at all #2007: written typing, derived types,references, and agreement withGetElementProperties.tests/grpcconformance: fivesymbol_type_*cases; the harness gainsexpected_type_infoandexpected_specializations.tests/test_symbol.py::TestSymbolTypeFacts,tests/test_generate.py::test_collect_definitions_takes_the_type_the_service_derives; TypeScriptgenerate.test.tsderived-type case; JavaModelExamplesTestassertstypesandredefines.::>) is not reported at all #2007 script and the Symbol API fields answer differently from GetElementProperties, with no sign that the answer is incomplete #2021 pattern 2/3 checks run clean againstbin/sysml-grpcthrough the Python client (pSub,pRef,tuned::plainagree withelement_properties("type");pRefhas onereferencesedge).go build ./...,go vet ./...,gofmt -l .(empty),go test ./...,make lint,tests/wasmsize budgets (sysml-core.wasm7.25 MB gzipped under the 7.3 MB budget);make protoregenerated the Go, Python, TypeScript and Rust stubs;cargo build,mvn compile,npm test(477 pass), Python suite (thetest_signing/test_fmi_runnerfailures need sigstore/fmpy and are unrelated).Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/37041a3dec3e41ed8c8270afd900241f
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/37041a3dec3e41ed8c8270afd900241f?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work