Skip to content

fix(semantics,export): Feature::type joins a feature's own typings with those it inherits - #2263

Merged
HuiJun merged 72 commits into
developfrom
fix/feature-type-typing-and-subsetting
Nov 18, 2026
Merged

HuiJun merged 72 commits into
developfrom
fix/feature-type-typing-and-subsetting

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

Fixes #2198.

What and why

GetElementProperties (element_properties in the clients) and the api-json element form answered Feature::type with a feature's written typing alone when the feature also subsets or redefines a typed feature:

part def Owner {
    part q : T;
    part pBoth : V :> q;   // type was [V]; the Symbol API and the pilot answer [V, T]
}

Two causes, both below the surfaces:

  • internal/semantic/metamodel (featureTypeConforms): deriveFeatureType collects the own and the inherited typings and then drops the ones another candidate already specializes. That redundancy check could only answer for two source symbols, so on the graph-backed Structure it reported "unknown" and the rule fell back to the stated typing. It now walks the Structure's own specializations where an element has no symbol, and still uses semantics.Model.Conforms where both do.
  • internal/translate/export (api-json element form): the writer completed a derived property only when the graph stated nothing for it, and the graph's sysml:type is the written typing. Feature::type is now marked overStated: the element form writes the derived value from the same evaluator and keeps the written typings as the type entry of sysx:mappingValues, so the document reads back to the same graph and the same notation. The RDF graph itself is unchanged.

The Symbol API already answered both types and is untouched; no surface got its own rule.

Specification basis

KerML 1.1 Beta 2 §8.3.3.3.4 deriveFeatureType: a feature's type is the union of the types of its typings over the closure of typingFeatures() (the features it subsets, redefines or reference-subsets, and the last feature of a chain), with types that another already specializes removed. No compliance row moves.

How it was verified

New tests:

  • TestStructureFeatureTypesJoinOwnedAndSubsettedTypings (metamodel, graph-backed Structure): typing + subsetting, typing + redefinition, and an inherited type the written one specializes.
  • TestElementPropertiesFeatureTypeJoinsOwnedAndInheritedTypings (gRPC): pBoth : V :> q → [V, T], pSub :> q → [T], pSpecific : W :> q with W :> T → [W], a redefinition in a specializing definition → [V, T], reference subsetting → [V, T], a chained subsetting → [V, W], partDefinition following type, and the feature read through a typing usage and through a usage of the specializing definition.
  • TestAPIJSONFeatureTypeJoinsOwnedAndInheritedTypings (export): the same shapes in the element form, the written typing in sysx:mappingValues, and no triple difference after reading the document back.

Gates on this head: go build ./..., go vet ./..., gofmt -l . (empty), make lint, go vet -C tools ./..., go test ./... and go test -C tools ./... with all six OPENSYSML_REQUIRE_* corpus variables set, pilot-apijson-diff -check, derived-census -check -require-exporter, pilot-diff -check, make docs-counts, check-doc-ids, changelog.py check.

hideo67/sysmlv2-tests at 99eae49af071a79c81bf4262eb0c73d014fbb983 (pass / fail / unsupported)

Suite Base (develop with #2251 merged) This branch Moved
opensysml-py-props 1599 / 181 / 33 1602 / 178 / 33 A40-040, A40-041, A40-042 fail → pass
opensysml-go-props 1599 / 181 / 33 1602 / 178 / 33 A40-040, A40-041, A40-042 fail → pass
opensysml-py 857 / 95 / 861 857 / 95 / 861 none
opensysml-go 821 / 131 / 861 821 / 131 / 861 none

Matrix A40 is the only matrix with a delta; no case moved from pass. docs/project/hideo-suite-baseline.tsv and the table in docs/project/hideo-suite.md are re-recorded with tools/cmd/hideo-suite -update. No suite expectation was judged wrong.

Baselines re-recorded (repo tools only)

  • docs/project/api-json-differential/ (pilot-apijson-diff -update): 44 fragment files, every moved row a type or a property derived from it. Present-equal 2093866 → 2094489, ours-missing 301463 → 300846, present-different 147594 → 147588, pilot-missing 84343 → 84419. type gains 85 present-equal (9 from present-different, 76 from ours-missing) and the derived definitions follow. Pilot-missing grows because those elements are a Feature here and a metaclass without that property in the pilot. One ItemUsage stays present-different: the pilot adds the implied Parts::Part beside II2. The full adjudication is in docs/project/api-json-differential.md.
  • internal/translate/export/testdata/structure_differential_expected.txt (-update-structure-differential): Feature::type different 184 → 190 and symbol-extra 130 → 124, with the same six elements moving in Usage::definition, OccurrenceUsage::occurrenceDefinition, OccurrenceUsage::individualDefinition (to equal), ConstraintUsage::constraintDefinition, Expression::function and Step::behavior. They are the nameless require efficiencyRequirement { … } constraint usages of EVSample.sysml and EVSample1.sysml: the graph-backed side answered nothing (two candidates it could not rank) and now answers EfficiencyRequirement through the reference subsetting. The symbol-backed Structure does not record the reference subsetting of these nameless usages, so the two sides now differ instead of one being empty; that gap predates this change and is not closed here.
  • internal/semantic/metamodel/derived_census_records.tsv (derived-census -update): 38 rows of Feature::type and the properties derived from it move from not-derived to a value (811) or to empty (97, all OccurrenceUsage::individualDefinition); no carrier count and no pilot column moves in them. Recorded against the pinned pilot 2026-09.1 (0.63.1) under JDK 21, as CI runs it.
  • tests/corpus/testdata/training_examples_expected.txt is untouched.

Checklist

  • make test and make lint pass locally (the suite was run as go test ./..., 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 30 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>
…th those it inherits

GetElementProperties and the api-json element form answered only the written
typing of a feature that also subsets or redefines a typed feature. The
metamodel's redundancy elimination now decides conformance over the Structure's
specializations where an element has no symbol, and the api-json element form
writes the derived Feature::type, keeping the written typings as a mapping value
(KerML 1.1 8.3.3.3.4 deriveFeatureType).

Fixes #2198

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…g in Feature::type

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

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…yping-and-subsetting

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…census on the merged tree

The api-json fragments and index carry the Feature::type rows beside the chained-end
relationship-end rows; the census row Feature::featuringType / pilot-examples returns
to the pilot columns the pinned pilot measures (14551 value, 1312 empty).

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
…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>
…s capabilities

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…yping-and-subsetting

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

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

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

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 8 commits November 16, 2026 20:35
… fix/conjugated-port-member-direction

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ure-type-typing-and-subsetting

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

# Conflicts:
#	docs/project/api-json-differential.md
Both sides moved 'Verification Case Usage Example': the two individual
parameters the occurrence-prefix change makes OccurrenceUsages take their
occurrenceDefinition from the derived type, 2 ours-missing to present-equal.

Refs #2198.

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>
The merge kept this branch's A40 row (45 / 0 / 0) beside the other side's
total; the total now counts those three cases as passing.

Refs #2198.

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 8 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
…ure-type-typing-and-subsetting

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

# Conflicts:
#	docs/project/hideo-suite.md
…hideo suite table after the merge

The cell-wise merge kept three per-file property totals of the api-json
differential at one side's value where both sides had moved them, and the
hideo table took the merged side's A40 row. pilot-apijson-diff -update and
hideo-suite -update restore them; no per-property row moves.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to invalid changes in the merge commit Nov 18, 2026
@HuiJun
HuiJun added this pull request to the merge queue Nov 18, 2026
devin-ai-integration Bot added a commit that referenced this pull request Nov 18, 2026
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Merged via the queue into develop with commit d332e73 Nov 18, 2026
32 checks passed
@HuiJun
HuiJun deleted the fix/feature-type-typing-and-subsetting branch November 18, 2026 20:44
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.

GetElementProperties Feature::type leaves out the type a feature gets by subsetting when it also has its own typing

2 participants