Skip to content

fix(export): a composite usage states isReference = false in the element form - #2166

Open
devin-ai-integration[bot] wants to merge 8 commits into
developfrom
fix/usage-is-reference-false
Open

devin-ai-integration[bot] wants to merge 8 commits into
developfrom
fix/usage-is-reference-false

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

Refs #1986.

A composite usage answered nothing for isReference on the element form: GetElementProperties returned an empty value list for M::Car::engine and sysml -convert api-json wrote no isReference key, while a ref usage answered true and the query leg answered false correctly. Usage::isReference is a required Boolean derived as not isComposite (SysML v2.1 Beta 2 §8.3.6.4 deriveUsageIsReference), so a composite usage must answer false.

Root cause. No false was dropped in serialisation (derivedJSONValue writes a Boolean false, derivedValueEmpty treats only null and empty sequences as absent). Usage::isReference was simply absent from the completion table of the shared element form (apiJSONCompletedProperties in internal/translate/export/api_json_derived.go), so it appeared only where the graph stated it, which the RDF writer does for referential usages only. isComposite is an authored attribute the graph always states, which is why isComposite = false was never lost.

Fix, in the shared layer.

  • api_json_derived.go: Usage::isReference joins the completion table, so the one element form behind GetElementProperties, api-json and the clients completes it through the evaluator's existing deriveUsageIsReference.
  • structure_rules.go (structureUsageComposite): for a graph-backed element, the isComposite the graph states answers the derivation, so the completed isReference is always the negation of the isComposite on the same element form. A symbol-backed element keeps the semantic model's answer.

Other required Booleans. isDefault, isInitial, isAbstract, isVariable, isPortion, isEnd, isDerived, isOrdered, isUnique, isNonunique were checked on the same surfaces: none is omitted for this reason (a required derived Boolean missing from the completion table), so nothing else was changed; api_json_booleans_test.go pins the Booleans the element form writes, false included.

Specification basis

SysML v2.1 Beta 2 §8.3.6.4 deriveUsageIsReference (isReference = not isComposite, multiplicity [1]). The row for derived Booleans in docs/project/spec-compliance/06-model-persistence-and-rdf-interchange.md is updated.

Known limitation: residual isComposite disagreement between the symbol and graph structures

After this change the two structures still disagree on Feature::isComposite (and so Usage::isReference) for 60 usages. The graph states what the RDF writer derives from UsageIsComposite; the symbol structure reads reflectiveFeatureFlags in internal/semantic/semantics/annotations.go, which does not yet apply these rules. They are left visible in the structure differential rather than overridden in the symbol structure, as a follow-up in reflectiveFeatureFlags:

  • Graph composite, symbol referential — a render usage of a view (RenderingUsage), a framed concern (ConcernUsage), an asserted constraint (AssertConstraintUsage) and one RequirementUsage. The two framed concerns of the training corpus are the 5 → 7 movement: the graph-backed side used to derive them referential, agreeing with the symbol side, and now answers the composite the graph states.
  • Graph referential, symbol composite — a perform in a state's entry/do/exit (PerformActionUsage) and two variant PortUsages.

The element form served by GetElementProperties and api-json is graph-backed, so it answers the graph's value for all of these.

The 60 elements, by root

examples (26)

File Metaclass Element graph symbol
disposal-robot-demo/robot.sysml RenderingUsage RobotViews__interfaces__asInterconnectionDiagram true false
disposal-robot-demo/robot.sysml RenderingUsage RobotViews__partsTable__asElementTable true false
phase-c-behavioral-bodies.sysml PerformActionUsage PhaseC__ConnectionStateMachine___4011__announce false true
phase-c-behavioral-bodies.sysml PerformActionUsage PhaseC__ConnectionStateMachine___4012__reportFailure false true
phase-c-behavioral-bodies.sysml PerformActionUsage PhaseC__ConnectionStateMachine___4013__drain false true
phase-c-behavioral-bodies.sysml PerformActionUsage PhaseC__VehicleOperating___4014__handbrake false true
phase-c-behavioral-bodies.sysml PerformActionUsage PhaseC__VehicleOperating___4015__emergencyResponse false true
phase-c-behavioral-bodies.sysml PerformActionUsage PhaseC__AutopilotMode___409__engage false true
phase-c-behavioral-bodies.sysml PerformActionUsage PhaseC__AutopilotMode___4011__reportFault false true
self-model/views.sysml RenderingUsage OpenSysMLViews__pipelineStructure__asInterconnectionDiagram true false
self-model/views.sysml RenderingUsage OpenSysMLViews__toolchainStructure__asInterconnectionDiagram true false
self-model/views.sysml RenderingUsage OpenSysMLViews__documentPipeline__asInterconnectionDiagram true false
self-model/views.sysml RenderingUsage OpenSysMLViews__stageTable__asElementTable true false
self-model/views.sysml RenderingUsage OpenSysMLViews__invariantTable__asElementTable true false
self-model/views.sysml RenderingUsage OpenSysMLViews__instanceLayer__asInterconnectionDiagram true false
self-model/views.sysml RenderingUsage OpenSysMLViews__analysisFramework__asInterconnectionDiagram true false
self-model/views.sysml RenderingUsage OpenSysMLViews__engineTable__asElementTable true false
self-model/views.sysml RenderingUsage OpenSysMLViews__editorPipeline__asInterconnectionDiagram true false
self-model/views.sysml RenderingUsage OpenSysMLViews__renderingKinds__asElementTable true false
self-model/views.sysml RenderingUsage OpenSysMLViews__surfaceTable__asElementTable true false
self-model/views.sysml RenderingUsage OpenSysMLViews__markupParsers__asElementTable true false
self-model/views.sysml RenderingUsage OpenSysMLViews__identityPath__asInterconnectionDiagram true false
views-demo.sysml RenderingUsage LanderViews__interfaces__asInterconnectionDiagram true false
views-demo.sysml RenderingUsage LanderViews__partsTable__asElementTable true false
views-demo.sysml RenderingUsage LanderViews__useCases__asCaseDiagram true false
views-demo.sysml RenderingUsage LanderViews__mixedOverview__asMixedDiagram true false

examples/sysml-v2-training (7)

File Metaclass Element graph symbol
31. Constraints/Constraint Assertions-2.sysml AssertConstraintUsage Constraint_20Assertions-2__Vehicle___400 true false
42. Views/Viewpoint Example.sysml ConcernUsage Viewpoint_20Example__system_20structure_20perspective__system_20breakdown true false
42. Views/Viewpoint Example.sysml ConcernUsage Viewpoint_20Example__system_20structure_20perspective__modularity true false
42. Views/Views Example.sysml RenderingUsage Views_20Example__vehicle_20structure_20view__asTreeDiagram true false
42. Views/Views Example.sysml RenderingUsage Views_20Example__asTextualNotationTable__columnView__asTextualNotation true false
42. Views/Views Example.sysml RenderingUsage Views_20Example__vehicle_20tabular_20views__safety_20features_20view__asTextualNotationTable true false
42. Views/Views Example.sysml RenderingUsage Views_20Example__vehicle_20tabular_20views__non-safety_20features_20view__asTextualNotationTable true false

examples/pilot-corpora (19)

File Metaclass Element graph symbol
sysml-examples/Arrowhead Framework Example/AHFNorwayTopics.sysml PerformActionUsage AHFNorway__AHFNorway_5fLocalCloudDD__APISProducer__APISPbehavior___403___400 false true
sysml-examples/Mass Roll-up Example/MassConstraintExample.sysml AssertConstraintUsage MassConstraintExample__Vehicle4___400 true false
sysml-examples/Simple Tests/ConstraintTest.sysml AssertConstraintUsage ConstraintTest__vehicle3___400 true false
sysml-examples/Simple Tests/RequirementTest.sysml ConcernUsage RequirementTest__R2__c3 true false
sysml-examples/Simple Tests/StateTest.sysml PerformActionUsage StateTest__S___404__D false true
sysml-examples/Simple Tests/StateTest.sysml PerformActionUsage StateTest__S___407__D false true
sysml-examples/Simple Tests/ViewTest.sysml ConcernUsage ViewTest__VP__c true false
sysml-examples/Simple Tests/ViewTest.sysml RenderingUsage ViewTest__V__v__r true false
sysml-examples/Simple Tests/ViewTest.sysml RenderingUsage ViewTest__v__r true false
sysml-examples/Variability Examples/VehicleVariabilityModel.sysml PortUsage VehicleVariabilityModel__150_25_20Model__PartsTree__EngineChoices__6cylEngine__autoPort__autoPort1 false true
sysml-examples/Variability Examples/VehicleVariabilityModel.sysml PortUsage VehicleVariabilityModel__150_25_20Model__PartsTree__EngineChoices__6cylEngine__autoPort__autoPort2 false true
sysml-examples/Vehicle Example/Annex_A_VehicleViews.sysml RenderingUsage Annex_5fA_5fVehicleViews__VehicleSafetyView_5fViewpoint__ViewDefinitions__TreeView__asTreeDiagram true false
sysml-examples/Vehicle Example/SysML v2 Spec Annex A SimpleVehicleModel.sysml RenderingUsage SimpleVehicleModel__Views_5fViewpoints__ViewDefinitions__TreeView__asTreeDiagram true false
sysml-validation/08-Requirements/8-Requirements.sysml RequirementUsage 8-Requirements__vehicle1_5fc1_20Specification_20Context__vehicle1-c1_20Specification___402 true false
sysml-validation/11-View and Viewpoint/11a-View-Viewpoint.sysml ConcernUsage 11a-View-Viewpoint__ViewModel__system_20structure_20perspective__system_20breakdown true false
sysml-validation/11-View and Viewpoint/11a-View-Viewpoint.sysml RenderingUsage 11a-View-Viewpoint__ViewModel__system_20structure_20generation__asElementTable true false
sysml-validation/11-View and Viewpoint/11a-View-Viewpoint.sysml RenderingUsage 11a-View-Viewpoint__ViewModel__system_20structure_20generation__asElementTable__columnView__asTextualNotation true false
sysml-validation/11-View and Viewpoint/11b-Safety and Security Feature Views.sysml RenderingUsage 11b-Safety_20and_20Security_20Feaure_20Views__ViewDefinitions__SafetyFeatureView__asTreeDiagram true false
sysml-validation/11-View and Viewpoint/11b-Safety and Security Feature Views.sysml RenderingUsage 11b-Safety_20and_20Security_20Feaure_20Views__Views__vehicleMandatorySafetyFeatureViewStandalone__asElementTable true false

examples/spec-examples (8)

File Metaclass Element graph symbol
sysml/7.18.3/5.sysml PerformActionUsage Sysml_207_2e18_2e3_20example_205__OnOff5___407__powerUp false true
sysml/7.20.3/2.sysml AssertConstraintUsage Sysml_207_2e20_2e3_20example_202__testObject___401 true false
sysml/7.20.3/2.sysml AssertConstraintUsage Sysml_207_2e20_2e3_20example_202__alienObject___401 true false
sysml/7.26.2/1.sysml RenderingUsage Sysml_207_2e26_2e2_20example_201__Part_20Structure_20View__asTreeDiagram true false
sysml/7.26.2/2.sysml RenderingUsage Sysml_207_2e26_2e2_20example_202__vehicle_20parts_20view__asMyTreeDiagram true false
sysml/7.26.2/3.sysml RenderingUsage Sysml_207_2e26_2e2_20example_203__vehicle_20parts_20view__asMyTreeDiagram true false
sysml/7.26.3/2.sysml ConcernUsage Sysml_207_2e26_2e3_20example_202__System_20Structure_20Perspective__system_20breakdown true false
sysml/7.26.3/2.sysml ConcernUsage Sysml_207_2e26_2e3_20example_202__System_20Structure_20Perspective__modularity true false

How it was verified

Tests

  • internal/translate/export/api_json_is_reference_test.go: every usage of a SysML and a KerML model states isReference, as the negation of its isComposite; composite part / variant / action usages false, ref, attribute and parameter usages true.
  • tests/grpc/testdata/conformance/: element_properties_feature_composite_usage (isComposite = true, isReference = false), element_properties_feature_referential_usage (the inverse), element_properties_variant_usage, and query_usage_is_reference for the query leg.
  • internal/semantic/metamodel/structure_usage_composite_test.go: the symbol structure's Feature::isComposite and Usage::isReference for composite, ref, attribute, action and perform usages.

Generated baselines (re-recorded with the repository tools, each moved row adjudicated)

  • api-json differential (pilot-apijson-diff -update): 713 fragments; only isReference rows move and no element match does. 11,659 values leave ours-missing: 11,639 become present-equal and 20 present-different (the elements whose isComposite already differs from the pilot's, negated). Adjudicated in docs/project/api-json-differential.md.
  • derived census (derived-census -update): two rows, Feature::isComposite and Usage::isReference under examples, whose 15 disagreeing values each become equal.
  • structure differential (-update-structure-differential): Feature::isComposite / Usage::isReference rows only. Differences drop from 93/89 to 19 in the pilot corpora and from 50 to 8 in the specification examples; the last symbol-missing values (1 in examples, 2 in the specification examples) and the tests/testdata difference close; the training corpus goes from 5 to 7 (below).

Gates on this head

go build ./..., go vet ./..., go vet -C tools ./..., gofmt -l . (empty), make lint, go test ./... with the training, pilot and specification-example corpora required, go test -C tools ./..., make docs-counts, scripts/check-doc-ids.py, scripts/changelog.py check, scripts/spec_compliance.py check, and the three baseline -check runs reproduce on this head.

Checklist

  • make lint and go test ./... pass locally (the suite ran without -race; make test adds the race detector)
  • 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

Devin Review

devin-ai-integration Bot and others added 7 commits November 11, 2026 06:18
…osite one

Usage::isReference is a required Boolean derived as not isComposite (SysML
v2.1 Beta 2 8.3.6.4 deriveUsageIsReference). The shared element-form
completion table did not list it, so GetElementProperties and api-json
stated it only where the graph did and a composite usage answered nothing.
It is now completed from the evaluator on every usage.

A graph element that states isComposite answers it ahead of its metaclass
rule, and the symbol-backed structure states the effective isComposite, so
both element readers agree with the element form.

Re-records the api-json differential, the derived census and the structure
differential, whose movement is isReference and isComposite and the
collections that read them.

Refs #1986

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…sus and the structure differential on the develop merge

The api-json fragments move only in isReference rows: 11659 values leave
ours-missing (11639 present-equal, 20 present-different) and seven
pilot-missing rows appear (1280 values). The census and the structure
differential move in isComposite, isReference and the collections that
read them.

Refs #1986

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

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

# Conflicts:
#	internal/translate/export/testdata/structure_differential_expected.txt
… reflective flags

The reflective feature flags now answer the always-referential usages themselves, so the
symbol structure's own override is superseded; the structure differential is re-recorded.

Refs #1986

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

@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

This branch has not been deployed

No deployments
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.

1 participant