Skip to content

fix(symbol): report a member's direction relative to the type it is read through - #2251

Merged
HuiJun merged 49 commits into
developfrom
fix/conjugated-port-member-direction
Nov 18, 2026
Merged

HuiJun merged 49 commits into
developfrom
fix/conjugated-port-member-direction

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

Fixes #2200.

What and why

For port def CmdPort { out attribute cmd : Integer; in attribute ack : Boolean; } and port pIn : ~CmdPort;, the Symbol API listed cmd/ack through pIn with metadata direction out/in. GetElementProperties, the pilot and the specification answer in/out: a feature's direction is relative to the type it is a member of (KerML 1.1 §8.3.3.1.10 Type::directionOf; SysML v2.1 §7.13.3, §8.3.12.2–§8.3.12.3 for conjugated port definitions and typings).

One semantic answer, no client-side inversion:

  • Semantic layer — (*Model).EffectiveDirection(owner, feature) answers Type::directionOf: the feature's own direction when the type owns it, otherwise the direction through the type's generalizations, reversed across a conjugation. DeclaredDirection remains the context-free Feature::direction.
  • Symbol API — GetSymbolRequest.member_of (field 6, after resolve_name 4 and the lookup 5 of fix(grpc): an explicit lookup kind tells a qualified name from an element id #2255) names the type the symbol is read as a member of; symbolfacts then states direction from EffectiveDirection. member_of is read as an element id, never as a name, so an unnamed port's generated id is not answered by a sibling declared with that spelling. An empty member_of keeps the feature's own direction, which is also what the pilot answers for the feature itself. Advertised as capability symbol_member_direction; the JSON and MCP symbol request carry memberOf.
  • GetElementProperties — the structural evaluator now walks the same rule, which fixes two disagreements the new cross-surface test exposed:
    • a port that subsets or redefines a conjugated port (port pSub :> pIn;) answered unconjugated input/output;
    • a port typed ~P also reversed the features it declares itself (port p : ~P { out ref :>> publish; }); directionOf gives those their own direction.
    • types that specialize each other (part def A :> B, C; part def B :> A, C;) end the walk at the type owning the feature: one visited set follows the whole read, locked by TestAPIJSONDirectionThroughMutuallySpecializingTypes, which overflows the stack without it.
  • Clients — Python children()/members()/parts()/attributes() pass the listing symbol as member_of; Go gains AsMemberOf(typeID) for LookupSymbol. Node, Java, Rust, Julia and MATLAB do not bind the capability yet (parity table updated).
  • LSP — hover and completion do not show a feature's direction, so there was nothing to align.

Specification basis

  • KerML 1.1 §8.3.3.1.10 Type::directionOf: the direction of a feature relative to a type is the feature's own when the type owns it, otherwise the direction through the type's supertypes, reversed across a conjugation.
  • SysML v2.1 §7.13.3, §8.3.12.2 (ConjugatedPortDefinition) and §8.3.12.3 (ConjugatedPortTyping): ~P types a port by the conjugate of P.
  • The gRPC area of docs/project/spec-compliance/ gains the symbol_member_direction row.

How it was verified

Tests

  • internal/semantic/semantics: TestEffectiveDirectionIsRelativeToTheType.
  • internal/frontend/symbolfacts: TestMemberDirectionIsRelativeToTheTypeItIsReadThrough.
  • tests/grpc/member_direction_test.go: Symbol direction equals GetElementProperties input/output through a plain typing, a conjugated typing, a specializing definition, nested ports, subsetting, redefinition, and features a conjugated port owns.
  • Python and Go client tests for the new argument/option and the capability refusal.

hideo67/sysmlv2-tests (pin 99eae49a), pass / fail / unsupported

Suite develop this PR Rows moved
opensysml-py-props 1608 / 172 / 33 1608 / 172 / 33 none
opensysml-go-props 1608 / 172 / 33 1608 / 172 / 33 none
opensysml-py 847 / 105 / 861 857 / 95 / 861 A30-027, 028, 031, 032, 035, 036, 039, 040, 043, 044: fail → pass
opensysml-go 821 / 131 / 861 821 / 131 / 861 none

No other matrix moves in any suite. docs/project/hideo-suite-baseline.tsv is re-recorded with hideo-suite -update for those ten rows.

Limitation: the ten A30 rows stay fail in opensysml-go

The suite's Go reader checks that the step is in the owner's listing and then looks the member up by id alone (LookupSymbol(ctx, m, "A30::CmdPort::cmd", WithLibraryMembers())). A30-029/030 (through pOut, want out/in) and A30-031/032 (through pIn, want in/out) therefore make the identical call and cannot both pass on any implementation; today the pOut half passes, and answering the conjugated direction context-free would turn those passing rows to fail and contradict Feature::direction. The expectation is right; the reader is context-free. It would pass with LookupSymbol(..., AsMemberOf(owner)). Follow-up for the suite's owner; nothing is filed here.

Baselines re-recorded (repository tools only)

  • api-json differential (pilot-apijson-diff -update): six PortUsage.input/output rows in Interaction Sequencing Examples/ServerSequenceRealization-3.sysml and ServerSequenceOutsideRealization-3.sysml become equal to the pilot (totals: +6 present-equal, −4 present-different, −2 ours-missing, −2 pilot-missing, +2 absent-both). These are the ports that declare their own directed features under a conjugated typing. No FlowEnd row moves. Adjudicated in docs/project/api-json-differential.md.
  • Derived census (derived-census -update): Type::input on pilot-examples 1466 → 1464 values, Type::output 2407 → 2409 — the same two ports, whose owned out feature was reported as an input.
    On the test-data root, Type::input 63 → 64 values and Type::output 61 → 60 (641 elements, unchanged). One element moves the cell: in tests/testdata/passes/corpus_notation.sysml, interface def CommunicationInterface has end spacePort : ~CommunicationPort over port def CommunicationPort { out item data; in item ping; }, and the flow end of flow from groundPort.ping to spacePort.ping that is reached through the conjugated spacePort now lists CommunicationPort::data under input instead of output. That flow end is one of the elements docs(self-model): bring the pipeline, runtime, identity and quality packages up to date #2047 added to the census; with declared directions it counted as an output (63 / 61 on docs(self-model): bring the pipeline, runtime, identity and quality packages up to date #2047's head), and read through the conjugation it is an input. SpaceLink::spacePort in the same file swaps its two lists as well and stays non-empty in both, so it moves no cell. No other model under tests/testdata differs between docs(self-model): bring the pipeline, runtime, identity and quality packages up to date #2047's head and this branch.

Merged in

This branch contains develop and the heads of #2249 and #2255, each merged once, since they change the same generated files: the api-json differential index and the derived census (#2242, #2245, #2249), and the GetSymbol request, its stubs and the capability list (#2255). The baselines were re-recorded with the same tools on the merged tree, and symbol_member_direction follows symbol_lookup_kind in the capability list; the movement owned by this change stays the rows listed above. The #2255 head merged is the one that makes every RPC taking a symbol accept the id GetSymbol reports and adds Specialization.target_qualified_name and TypeInfo.resolved_qualified_name; the stubs both sides changed were regenerated with make proto.

Gates

go build ./..., go vet ./..., go vet -C tools ./..., gofmt -l (empty), make lint, go test ./... and go test -C tools ./... with the training, pilot, specification-example, library-XMI and PSSM corpora required, derived-census -check, pilot-apijson-diff -check, hideo-suite -check, make docs-counts, scripts/check-doc-ids.py, scripts/changelog.py check, the Python client suite and cargo check for the Rust client all pass. Protobuf stubs regenerate unchanged with make proto.

Checklist

  • make lint passes locally; the suite was run as go test ./... with the corpora required (without -race)
  • 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

🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

devin-ai-integration Bot and others added 15 commits November 13, 2026 15:13
…ead through

A feature listed through a conjugated port carried its declared direction in
Symbol metadata. GetSymbolRequest.member_of names the type the symbol is read
as a feature of, and the direction is then the semantic model's
Type::directionOf answer (KerML 8.3.3.1.10), the one GetElementProperties
gives. GetElementProperties now reverses input/output for a port subsetting or
redefining a conjugated one too.

Fixes #2200

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ares itself

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…t-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	api/proto/sysml.pb.go
#	api/proto/sysml.proto
#	client/node/src/generated/sysml_pb.ts
#	client/opensysml/client.go
#	client/opensysml/types.go
#	client/python/opensysml/capabilities.py
#	client/python/opensysml/connection.py
#	client/python/opensysml/proto/sysml_pb2.py
#	client/python/opensysml/proto/sysml_pb2.pyi
#	client/python/opensysml/symbol.py
#	client/python/tests/test_connection.py
#	client/python/tests/test_integration.py
#	client/rust/conformance/sysml.descriptor.binpb
#	client/rust/opensysml/src/connection.rs
#	client/rust/opensysml/src/proto/sysml/sysml.rs
#	conformance/README.md
#	internal/frontend/combined/combined.go
#	internal/frontend/core/json.go
#	internal/frontend/grpc/capability_test.go
#	internal/frontend/grpc/service.go
#	internal/frontend/mcp/runtimetools/info.go
#	internal/frontend/mcp/runtimetools/parse.go
#	tests/wasm/combined_test.go
…wer moves

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…t-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	client/node/src/generated/sysml_pb.ts
#	client/python/opensysml/proto/sysml_pb2.py
#	client/python/tests/test_symbol.py
#	client/rust/conformance/sysml.descriptor.binpb
#	docs/project/api-json-differential/index.json
#	docs/project/api-json-differential/pilot-examples/Interaction Sequencing Examples/ServerSequenceOutsideRealization-3.sysml.json
#	docs/project/api-json-differential/pilot-examples/Interaction Sequencing Examples/ServerSequenceRealization-3.sysml.json
#	internal/frontend/grpc/capability_test.go
#	internal/frontend/grpc/service.go
…ort direction rows that now pass

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…cted features

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…t-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	docs/project/api-json-differential/index.json
#	internal/semantic/metamodel/derived_census_records.tsv
@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

devin-ai-integration Bot and others added 3 commits November 14, 2026 21:06
…nnector end included

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…l_member_direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>
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.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 3 findings. Devin automatically fixed all 3 findings.

Fixed by Devin (3)
  • Unnamed connector ends rejected as owners — The JSON core now reads memberOf with LookupElement, as symbolId and the gRPC service do; a new test fails without the change for an unnamed connector end id.
  • Silent direction fallback on older services — get_symbol now raises MissingCapabilityError when member_of is given and the service does not report symbol_member_direction; member listings already checked the capability.
  • Four-line capability comment exceeds limit — Comment shortened to two lines.

View findings in Devin Review · Follow Devin's work

Devin Review

devin-ai-integration Bot and others added 6 commits November 14, 2026 21:37
…s capabilities

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…t-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ugated-port-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…r-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	api/proto/sysml.pb.go
#	api/proto/sysml.proto
#	client/node/src/generated/sysml_pb.ts
#	client/opensysml/client.go
#	client/opensysml/types.go
#	client/python/opensysml/capabilities.py
#	client/python/opensysml/connection.py
#	client/python/opensysml/proto/sysml_pb2.py
#	client/python/opensysml/proto/sysml_pb2.pyi
#	client/python/opensysml/symbol.py
#	client/python/tests/test_connection.py
#	client/python/tests/test_symbol.py
#	client/rust/conformance/sysml.descriptor.binpb
#	client/rust/opensysml/src/connection.rs
#	client/rust/opensysml/src/proto/sysml/sysml.rs
#	conformance/README.md
#	docs/project/spec-compliance/08-grpc-service-layer.md
#	internal/frontend/core/json.go
#	internal/frontend/grpc/capability_test.go
#	internal/frontend/grpc/service.go
#	internal/frontend/mcp/runtimetools/info.go
#	internal/frontend/mcp/runtimetools/parse.go
An unnamed port's generated id (Device::@0) was read name first, so a sibling
declared '@0' answered for it and a conjugated port's features kept the
unreversed direction. member_of is documented as an id; gRPC and JSON now
look it up as one.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 7 commits November 15, 2026 20:30
…t-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ugated-port-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	internal/semantic/metamodel/derived_census_records.tsv
Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	internal/semantic/metamodel/derived_census_records.tsv
Cases B13-055, B13-056, B13-057, B13-073, B13-074 and B13-075 of the
opensysml-py-props and opensysml-go-props readers pass since develop's
range 2cdfa98..613a430 (#2259, #2260) and fail on neither side of
this branch's own change. Recorded with hideo-suite -update, which also
rewrites the table of docs/project/hideo-suite.md.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Merges 212483d (the cell-wise baseline merge driver, the ours-only census check and the pilot side recorded once per pin).

Conflicts, both in generated baselines and both resolved by the recorders:

- internal/semantic/metamodel/derived_census_records.tsv: the cell-wise driver declined it (the incoming side reshapes every row with a new pilot column while this branch moves two of them), so it was re-recorded with `derived-census -update -require-exporter`. It equals the incoming file except this branch's two rows, Type::input and Type::output over pilot-examples (1699/12523 and 2873/11349), which report a conjugated port's inherited features in the reversed direction.
- docs/project/hideo-suite.md: regenerated with `hideo-suite -update`. The baseline keeps this branch's ten rows; the twelve B13 property-reader cells come from develop's range 2cdfa98..613a430 (#2259, #2260).

Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits November 16, 2026 06:21
docs/project/api-json-differential/index.json conflicted: both sides moved
its aggregate counts. Resolved by taking develop's side and folding the merged
fragments with pilot-apijson-diff -reindex; pilot-apijson-diff -check
reproduces the result. No fragment conflicted and none was re-recorded.

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

devin-ai-integration Bot and others added 6 commits November 16, 2026 11:37
…t-member-direction

The generated protocol stubs both sides regenerated (the Node and Python
message modules and the Rust conformance descriptor) are regenerated from the
merged sysml.proto with make proto. No count baseline moves in this merge.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
… fix/conjugated-port-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…t-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…jugated-port-member-direction

Re-recorded by tool on the merged tree: the hideo-suite table and baseline
(both sides moved it), and the Type::input and Type::output rows of the
derived census for the pilot-examples and testdata roots.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Keeps both tests appended to parity_options_internal_test.go: this branch's
member-direction capability test and develop's Convert option tests.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun added this pull request to the merge queue Nov 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 17, 2026
devin-ai-integration Bot and others added 5 commits November 17, 2026 19:59
…by the feature it redefines in the RDF conversion and answers isVariable true on the native walk — `image` in `flow from telescope.image to …`, owned by an Occurrence-typed FlowEnd — as KerML 1.1 § 8.3.3.3.4 names it, SysML v2.1 § 8.3.16.6 types its owner and the pilot exports both

The two legs disagreed on four cells of a flow end's redefining ReferenceUsage (the QVTS reflection cross at the #2266 pin): the native walk answered isVariable false where the conversion stated true, and the conversion stated no memberName on its FeatureMembership (nor a name on the usage) where the native walk derived the redefined feature's. The pilot exports memberName and name "image", isVariable and mayTimeVary true.

- semantics/usage.go: synthesizedUsageMayTimeVary answers for the implied flow-end feature as for the other synthesized referential parts — its owning type is the FlowEnd, redefining Flows::Flow::source/target, an Occurrence-typed feature (UsageMayTimeVaryUnderLibraryFeature), never in a KerML document.
- export/rdf_out.go: flowEndReferences states sysml:name on the usage and sysml:memberName on its membership from the model's effective name (flowEndFeatureName); nothing when the end resolves to nothing.
- export/mapping_shape.go: a nameless feature its FeatureMembership names under a positional owner stays positional for the decoder, as the end itself is, so the round trip holds.
- Tests: TestFlowEndFeatureVariesInTime (library-backed), TestElementFormFlowEndFeatureIsNamedByItsRedefinedFeatureAndVaries.
- Re-recorded by tool: tests/export goldens (4 files: two name and two memberName triples); structure differential (name/qualifiedName/memberName/ownedMemberName symbol-extra 5 -> 2 and 4 -> 1, both roots, all toward agreement); api-json differential (FeatureMembership.memberName oursMissing -> presentEqual in 11 fragments, 92 values; presentEqual 2105606 -> 2105698, oursMissing 303083 -> 302991), adjudicated in docs/project/api-json-differential.md; derived census and the corpus round-trip sweep reproduce.

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…ow-end-feature-name-variable

Conflicts: the api-json differential (index and six fragments both PRs re-recorded), one Turtle golden digest, the adjudication prose and the api-json form test file, where #2359 and this branch each appended a paragraph and a test — both kept, develop's first.

Re-recorded by tool on the merged tree: tests/export goldens (-update), the structure differential (-update-structure-differential), the api-json differential (pilot-apijson-diff -update; -check reproduces). The movement against develop is this branch's alone: FeatureMembership.memberName oursMissing -> presentEqual in the same 11 fragments, 92 values (presentEqual 2106153 -> 2106245, oursMissing 302536 -> 302444), restated in docs/project/api-json-differential.md. derived-census -check reproduces.

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…ugated-port-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	docs/project/hideo-suite.md
@HuiJun
HuiJun added this pull request to the merge queue Nov 18, 2026
Merged via the queue into develop with commit 8a873da Nov 18, 2026
32 of 56 checks passed
@HuiJun
HuiJun deleted the fix/conjugated-port-member-direction branch November 18, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symbol API reports the features of a conjugated port with the unconjugated direction

1 participant