Enhancement: Python client cannot read a parameter's bound expression (`in power = powerPort.power;`); only constant values are exposed
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #1981 @devin-ai-integration による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
調査の方向性
Start with the attached repro.py and model to reproduce the missing binding in the Python client, then trace how Symbol facts and attribute_facts() expose parameter values. The requested API should report the binding expression, default status, and referenced features for feature chains while retaining folded constants. Also investigate why reflection returns an empty targetFeature.qualifiedName; done means the reproduced bindings and target feature are accessible through the relevant APIs.
索引モデルが issue の本文から書いたものです。
説明
This issue was written with AI help. The model, the reproduction script and its output are
attached and were run against the version below.This is mainly a feature request. The issue form points feature requests to Discussions, but
Discussions are not enabled on this repository, so it is filed as an issue.
What happened, and what you expected instead
An action performed by a part binds its input parameter to a feature of the part's port:
part def Motor {
port powerPort : PowerPort;
perform action consume : Consume {
in power = powerPort.power; // bound to a feature chain
in gain = 0.5; // literal
}
action boost : Consume {
in power = powerPort.power * 2.0; // operator expression
}
}
A client walking the model (to generate an interface table, a simulation wiring, or code) needs
to know what each parameter is bound to. From Python:
| Route | consume::power = powerPort.power |
consume::gain = 0.5 |
boost::power = powerPort.power * 2.0 |
|---|---|---|---|
parameter Symbol (metadata, type_facts) |
direction in, type Real; no value |
same | same |
owner's attribute_facts() value |
None |
0.5 ✔ |
None |
model.query |
no property carries a value | same | same |
reflection, ….metadata.ownedRelationship (the FeatureValue) |
UnsupportedValueError: metaobject of an element with no qualified name |
same | same |
| api-json | FeatureValue → FeatureChainExpression, targetFeature = PowerPort::power ✔ |
FeatureValue → LiteralRational 0.5 ✔ |
FeatureValue → OperatorExpression '*' ✔ |
So a value is exposed only when it folds to a model-level constant (AttributeFacts.value is
documented that way: "Default value, when it is a model-level constant"). An expression that
refers to another feature, which is the normal way to wire a parameter, is invisible: there is
no text, no referenced feature, and no indication that the parameter is bound at all. The only
route to it is exporting the whole model as api-json and following
ownedRelationship → FeatureValue.value → the expression tree.
Requested: the Symbol API reports a feature's value binding when there is one. At minimum
that means the expression's source text and whether it is a default (isDefault/isInitial).
For a feature-chain expression it should also give the referenced features
(powerPort → PowerPort::power), so a client can follow the binding without parsing text.
AttributeFacts.value could stay as the folded constant beside it.
One reflection defect found on the way: even when navigating straight through the anonymous
elements, last(…::consume::power.metadata).ownedRelationship.value.targetFeature.qualifiedName
returns []. KerML v1.1 §8.3.4.8.4 derives FeatureChainExpression::targetFeature, and
api-json writes it as PowerPort::power. The anonymous-element limitation of reflection
(UnsupportedValueError) is the same one described in #1957.
Reproduction
$ python repro.py # loads model.sysml with opensysml.loads() over sysml-grpc
## consume::power = powerPort.power
[OK ] consume::power: Symbol reports direction and type
observed: {'metadata': {'visibility': 'default', 'direction': 'in'}, 'type_facts.primitive': 'Real'}
[INFO] consume::power: owner's attribute_facts() value
observed: None
[BUG ] consume::power: the Symbol API exposes the value or expression
observed: {'facts': {'metadata': {'visibility': 'default', 'direction': 'in'}, 'type_facts.primitive': 'Real'}, 'value': None}
expected: 'the expression `powerPort.power` (text, and for a chain the referenced feature)'
[INFO] consume::power: reflection ownedRelationship (the FeatureValue)
observed: UnsupportedValueError('unsupported: metaobject of an element with no qualified name')
[OK ] consume::power: api-json has FeatureValue -> FeatureChainExpression
observed: {'@type': 'FeatureChainExpression', 'targetFeature': {'@id': 'ParameterValues__PowerPort__power'}}
## consume::gain = 0.5
[INFO] consume::gain: owner's attribute_facts() value
observed: 0.5
## Reflection: FeatureChainExpression::targetFeature of consume::power
[BUG ] consume::power: ownedRelationship.value.targetFeature is PowerPort::power
observed: []
expected: ['ParameterValues::PowerPort::power']
model.sysml:
package ParameterValues {
port def PowerPort {
out attribute power : ScalarValues::Real;
}
action def Consume {
in power : ScalarValues::Real;
in gain : ScalarValues::Real;
}
part def Motor {
port powerPort : PowerPort;
perform action consume : Consume {
in power = powerPort.power; // bound to a feature chain -> not exposed
in gain = 0.5; // literal (for comparison) -> exposed as a value
}
action boost : Consume {
in power = powerPort.power * 2.0; // operator expression -> not exposed
}
}
}
Reproduction files (attached)
| File | Contents |
|---|---|
model.sysml.txt |
the model above (GitHub does not accept .sysml uploads): rename it to model.sysml next to repro.py |
repro.py |
loads model.sysml with opensysml.loads() and, for each parameter, checks the Symbol facts, the owner's attribute_facts(), the query API, reflection and the api-json export. Each check prints OK, BUG or INFO, and the script exits 1 while any BUG reproduces. |
_common.py |
shared helper the script imports: starts the sysml-grpc named by $OPENSYSML_BINARY, prints the server and client versions, and formats the checks |
output.txt |
the full output of the run reported here |
To run it, put _common.py in the parent directory of the folder holding repro.py and the model,
install the client (pip install -e client/python from an OpenSysML checkout), and point
OPENSYSML_BINARY at a sysml-grpc build:
$ OPENSYSML_BINARY=/path/to/OpenSysML/bin/sysml-grpc python repro.py
Without OPENSYSML_BINARY, _common.py assumes an OpenSysML checkout next to the directory
that holds _common.py, with bin/sysml-grpc built by make build-grpc.
Version
sysml-grpc v0.12.0-262-gc86932321 (develop at c86932321), opensysml Python client 0.12.0, Python 3.13.15
Surface
Python client (opensysml)
- 主要言語
- Go
- スター
- 56
- フォーク
- 17
- 平均マージ
- 12時間 31分
- マージ済み PR(30日)
- 909
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Open-MBEE/OpenSysML のほかの issue
-
dependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Open-MBEE/OpenSysML#1951 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
bug enhancement spec compliance
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Open-MBEE/OpenSysML#2009 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
bug spec compliance
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
Open-MBEE/OpenSysML#2008 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Open-MBEE/OpenSysML#2007 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
Open-MBEE/OpenSysML の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
adrianbrad/queue#92 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
agent-ready area:skills
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
jmbarzee/temporal-architect#444 ·
メンテナーはふだん 1 日以内に返信
-
enhancement needs:sonnet ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信