Repository navigation
Description
This issue was written with AI help. The model and the reproduction were run against the version below.
What happened
A Symbol's type_info gives only the feature's own : T typing. A feature that gets its type by subsetting, reference subsetting or redefinition reports no type. A feature that has its own typing and also subsets another feature reports only its own type. Reference subsetting (::>) is not in specializations either, so nothing in the Symbol says where pRef gets its type.
package P {
part def T;
part def V;
part def Owner {
part q : T;
part pSub :> q; // subsetting
ref part pRef ::> q; // reference subsetting
part pBoth : V :> q; // typing and subsetting
attribute a : ScalarValues::Real;
}
part def SubOwner :> Owner {
part :>> q; // redefinition
}
part tuned : Owner {
attribute :>> a = 3.5; // redefinition with a value
}
}
import opensysml
m = opensysml.loads(SRC) # m.ok is True, no diagnostics
for qn in ["P::Owner::q", "P::Owner::pSub", "P::Owner::pRef",
"P::Owner::pBoth", "P::SubOwner::q", "P::tuned::a"]:
s = m.get(qn)
print(qn, repr(s.type_facts.resolved_id), repr(s.type_facts.primitive),
[(sp.kind, sp.target_id) for sp in s.specializations])P::Owner::q 'P::T' '' [('typing', 'P::T')]
P::Owner::pSub '' '' [('subsets', 'P::Owner::q')]
P::Owner::pRef '' '' []
P::Owner::pBoth 'P::V' '' [('typing', 'P::V'), ('subsets', 'P::Owner::q')]
P::SubOwner::q '' '' [('redefines', 'P::Owner::q')]
P::tuned::a '' 'Real' [('redefines', 'P::Owner::a')]
The last line is the most common case in practice: attribute :>> mass = 1500; in a usage. The service does follow the redefinition for primitive ('Real') but leaves resolved_id empty, so the type is known but not reported.
The Python client's own code generator already works around this. _with_inherited_facts in client/python/opensysml/generate.py walks subsets/redefines to fill in a feature's type. A user reading Symbols has no such fallback, and the workaround cannot help pRef, whose reference subsetting is not reported at all.
Expected
-
type_info(or a new field) reports the feature's types as KerML derives them.Feature::typecovers the feature's own typings and the types of every feature it subsets. Redefinition and reference subsetting are kinds of subsetting, so their targets count too:feature expected types pSub :> qTpRef ::> qTpBoth : V :> qV,TSubOwner::q :>> qTtuned::a :>> a = 3.5ScalarValues::RealpBothhas two types, andTypeInfo.resolved_idholds one. A list is probably needed. Alternatively, a separate field could hold the derived types and leavetype_infoas the declared typing. -
pRef ::> qlists a specialization forq, with its own kind (the spec metaclass isReferenceSubsetting). The comment onSpecialization.kindinapi/proto/sysml.protolists onlyspecializes,subsets,redefinesandtyping. Reporting::>assubsetswould also do, since a reference subsetting is a subsetting. Losing the relationship entirely is the bug.
For comparison, the SysML v2 Pilot Implementation (0.64.0-SNAPSHOT, commit 378a8700c) and sysml-toolkit (v0.11.3) give the types and specializations above for every case.
Version
OpenSysML develop at 1a8e4927dc (2026-11-05), built locally: sysml-grpc nightly-153-g1a8e4927dc, Python client from client/python. The Go API (client/opensysml) gives the same results.
Related
#1961 is about features not being listed through a typing usage or a specialization. This issue is about features read directly in their owner, which are found but report the wrong type.
Found by
The test suite at https://github.com/hideo67/sysmlv2-tests, matrices A20 (attribute usages) and A40 (feature typing, subsetting and redefinition). Models: test-suite/data/models/A20.sysml and A40.sysml. Failing cases:
- A20-037..039: the type of
:>> plain = 3.5,:>> boundand:>> dflt = 5.5in a usage. - A40-007, A40-022: the specializations and subsetted features of
pRef ::> q. - A40-034, A40-037, A40-040, A40-043: the types of
pSub,pRef,pBothandSubOwner::q.
The other A40 failures (read through owner, subOwner, subSub) are #1961.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
devin-ai-integration commentedon Nov 6, 2026
Confirmed as a bug in the Symbol surface; the semantic model already derives the right answer. Reproduced on
developat 1f0aef8 with output identical to yours. ReflectiveFeature::typeon the same model gives exactly your table:pSub→T,pRef→T,pBoth→V,T,SubOwner::q→T,tuned::a→ScalarValues::Real, and the pilot (2026-09 pin) agrees, listingReferenceSubsettingtoqaspRef'sownedSpecialization.KerML v1.1 Beta 2 §8.3.3.3
deriveFeatureType: the types of a Feature are the union of the types of its typings and the types of the Features it subsets, redundant supertypes removed.ReferenceSubsetting(§8.3.3.3.9) andRedefinitionare kinds ofSubsetting, so their targets count.Root cause, both in
internal/frontend/symbolfacts/facts.go:usageTypeInforeads only the firstRelTypingrelationship written on the declaration.PrimTypeOfwalks the generalization graph (which is whyprimitiveisRealfortuned::a), butresolved_idis never filled from the derived type.relationshipKindNamemapsspecializes,subsets,redefinesandtypingand returns the empty string for everything else, sospecializationsOfsilently drops::>(RelReferences) — and the other KerML relationship kinds with it.Generalised: every feature typed only through subsetting, redefinition or reference subsetting — attributes, parts, ports, items, parameters, and the common
attribute :>> mass = 1500;in a usage — on Symbol, gRPC, Python and Go clients;_with_inherited_factsin the Python generator is a client-side workaround for part of it.Planned fix: add a derived type list to
TypeInfo(SymbolInfo, PythonTypeFacts) filled from the semanticFeature::type, keepingdeclared/resolved_idas the written typing so existing readers do not change meaning; report reference subsetting as its ownSpecialization.kind(references) and update the proto comment and clients; tests at the symbolfacts, gRPC and Python layers over your six cases.devin-ai-integration commentedon Nov 6, 2026
Update on the plan: the Symbol-surface half (a derived type list on
TypeInfo, reference subsetting inspecializations) will not be added as moreSymbolInfofields. #2012 proposes one generic per-element read,GetElementProperties, that answers metamodel properties by their specification names (Feature::type,Feature::ownedSubsetting,Feature::ownedReferenceSubsetting,Feature::ownedRedefinition, …) from the same evaluator that already derives them, so these six cases are covered there. This issue stays open as the acceptance case for that work.devin-ai-integration commentedon Nov 7, 2026
Fixed in #2040.
What changed.
TypeInfogainstypes(repeated TypeRef {id, kind}, a new field —declared/resolved_id/resolved_kindkeep their meaning, the typing as written). It is KerML §8.3.3.3Feature::typeas the metamodel evaluator derives it (internal/frontend/symbolfacts/facts.goContext.derivedTypes→semantics.Model.ReflectiveFeatureTypes, the derivation the metamodel evaluator answersFeature::typefrom), so the six cases now answerq -> T,pSub -> T,pRef -> T,pBoth -> V, T,SubOwner::q -> T,tuned::a -> ScalarValues::Real.relationshipKindNamemapsast.RelReferences(andinclude) to"references", sopRef's edge is inspecializationsas('references', 'P::Owner::q'). Every client that mirrors the field (PythonTypeFacts.types/TypeRef, GoTypeInfo.Types, TypeScript, Java, Rust, Julia) carries it, and the generators take a feature's type from it instead of walking specializations.How to verify. Your script, with
[t.id for t in s.type_facts.types]added to the print:Pinned by
internal/frontend/symbolfacts/typeinfo_test.go,internal/frontend/grpc/derivedtypes_test.go, thetests/grpcconformance casessymbol_type_*andclient/python/tests/test_symbol.py::TestSymbolTypeFacts.One thing the verification turned up, left for its own PR:
GetElementPropertiestypeanswerspBoth -> Vonly — the element form keeps the graph's stated written typing and runsderiveFeatureTypeonly when nothing is written (export/api_json_derived.gocompleteDerived). The Symbol surface answersV, Tas the specification and the pilot do.fix(grpc): derive Symbol type facts from Feature::type and report ref…
Merge pull request Open-MBEE#2040 from Open-MBEE/fix/symbol-derived-t…