Skip to content

fix(grpc): derive Symbol type facts from Feature::type and report reference subsetting - #2040

Merged
HuiJun merged 5 commits into
developfrom
fix/symbol-derived-types
Nov 8, 2026
Merged

HuiJun merged 5 commits into
developfrom
fix/symbol-derived-types

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A symbol's type_info reported 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 while GetElementProperties type answered one, and specializations dropped reference subsetting altogether (relationshipKindName returned "" for ast.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 KerML Feature::type as the semantic model derives it for the reflective layer — semantics.Model.ReflectiveFeatureTypes, the derivation metamodel.Evaluator answers Feature::type from (moved there from the evaluator's featureTypes/completeFeatureTypeInputs/completeRelationships, which now delegate to it, so symbolfacts does not link the evaluator into sysml-core and 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_id and resolved_kind keep their meaning, the typing as written.
  • Specialization.kind reports ::> and include as references, with the target taken from semantics.Model.ReferencedFeature (which resolves outside the referencing feature, so ref part q ::> q names the outer q, not itself); the proto comment and every client that enumerates kinds list it.
  • SymbolInfo field docs (proto) and the Python, Go, TypeScript, Java, Rust and Julia Symbol docs say what kind (declaration keyword, not the metaclass), metadata["direction"] (written direction; derived Feature::direction is element_properties' direction), type_info (Feature::type) and specializations (Type::ownedSpecialization, written edges only) summarise.
  • Clients: TypeFacts.types / TypeRef added to Python, Go (TypeInfo.Types), TypeScript, Java (Symbol.TypeFacts gains a types component), Rust and Julia; the core JSON surface gains JTypeInfo.Types.
  • Generators: the Python _with_inherited_facts workaround is kept but no longer the primary path — a feature that names no type takes TypeFacts.types[0] (_derived_type); the walk over specializations remains only as the fallback for a service that predates types, and still supplies the inherited multiplicity, which the service does not derive. The TypeScript and Julia generators mirror this, and all three count references among 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: GetElementProperties type for pBoth : V :> q answers V only, not V, T — completeDerived (internal/translate/export/api_json_derived.go) keeps the graph's stated sysml:type (the written typing) and runs the Feature::type derivation only when nothing is stated. The Symbol surface answers V, T as the specification and the pilot do; the agreement test asserts equality where the element form is derived and containment for pBoth. The RPC-side gap is resolved through #2042, which moves GetElementProperties onto the same evaluator derivation; the exporter is not touched here.

Specification basis

KerML v1.1 Beta 2 §8.3.3.3 deriveFeatureType: a feature's type is 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 the GetSymbol row of docs/project/spec-compliance/08-grpc-service-layer.md (derived types, references, the summary/element_properties documentation).

How it was verified

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link 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

Devin Review

…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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

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>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

… 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>
@HuiJun
HuiJun merged commit 0eca4a4 into develop Nov 8, 2026
33 checks passed
@HuiJun
HuiJun deleted the fix/symbol-derived-types branch November 8, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant