Skip to content

fix(metamodel): answer send-action input, constructor function and arguments, and sourceless transition ends - #2549

Merged
HuiJun merged 15 commits into
developfrom
fix/element-properties-2495-regressions
Nov 24, 2026
Merged

HuiJun merged 15 commits into
developfrom
fix/element-properties-2495-regressions

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

Fixes #2495.

What and why

Four GetElementProperties answers regressed with #2042 (reported in #2495). Each is fixed in the shared derivation, so the gRPC reader, the api-json element form, the query surface and the Symbol API give the same answer. None of the four was fixed by #2496: all four still reproduced on its merge commit f17bc5d10e.

One commit per item:

  1. Type::input of a send action (action sendRef send new Sig(gain) via sp;) was empty. structureDirectedFeatures had a SendActionUsage branch that only collected owned Expression members; it is removed, so the generic directed-feature derivation supplies the in parameters.
  2. Expression::function of a ConstructorExpression was refused. The refusal branch is removed; the typed-feature derivation answers Performances::Evaluation.
  3. A sourceless transition after a state (state a; accept Sig then b;) answered sourceFeature = b and no target. The succession derivation now takes the closest preceding state usage as the source (ast.LeavableByTransition, shared by the semantic model, the reflective transitions and the RDF export), and the succession ends are resolved against the enclosing body's members.
  4. InstantiationExpression::argument of a constructor of a library type (new Cuboid(4800 [mm], 1840 [mm], 1350 [mm])) was refused as unbindable. Positional binding compared structure elements only by identity, which never matches a library feature the structure names by id; sameDeclaredElement also matches through the catalogued symbol that declares it. In the same derivation, a named constructor argument (new Box(l = …, w = …, h = …)) now gives its result feature the Redefinition of the instantiated type's feature it names, in the shared representation the reader and both exports use. A genuinely unbindable argument list is still refused.

Before / after (the issue's four models)

Read develop before this branch
1. P::T::sendRef input empty the in ReferenceUsages parameter lists
2. new Sig(gain) function unanswered ("Expression::function is not defined for a ConstructorExpression") Performances::Evaluation
2. behavior, type Performances::Evaluation the same
3. transition source / succession sourceFeature Q::SD / Q::SD::b Q::SD::a / Q::SD::a
3. transition target / succession targetFeature Q::SD::b / empty Q::SD::b / Q::SD::b
4. c1 (new Cuboid(…)) argument unanswered ("incomplete-structure … cannot be bound to formal input Parameters") three OperatorExpressions
4. c2 (new Box(…)) argument three OperatorExpressions the same
4. instantiatedType ShapeItems::Cuboid, R::Box the same
4. named arguments' result features no Redefinition each owns the Redefinition of the feature it names

Specification basis

Re-derived from the specification text rendered by ./scripts/download-spec-examples.sh (build/spec-docs/*.txt), and checked against the pinned OMG pilot only where the specification backs it.

  • Item 1: KerML 8.3.3.1.10 deriveTypeInput: the features related to the Type by FeatureMemberships whose direction is in or inout. SysML SendActionUsage's payload, sender and receiver are input parameters.
  • Item 2: KerML 8.3.4.7.3: Expression::function redefines behavior and is the Function that types the Expression, so the answer is Performances::Evaluation. This matches the pinned pilot, whose exporter was run on the model to confirm. The P::Sig in the issue's earlier column was OpenSysML's own previous answer and was wrong: P::Sig is the instantiated type, an AttributeDefinition, not a Function.
  • Item 3: SysML 7.18.3 (textual notation of transitions): with the transition keyword and source omitted, the source is the closest lexically previous state usage. TransitionUsage: succession.sourceFeature = source, and target is the feature target of succession.targetFeature.
  • Item 4: KerML 8.3.4.8.3 deriveConstructorExpressionArgument and checkConstructorExpressionResultFeatureRedefinition: the arguments are the value Expressions of the result's owned features, in the order of the instantiated type's features they redefine; positional arguments bind to those features in order (KerML 7.4.9.4).

Baseline movement (recorders only, each adjudicated)

All generated files were moved by their recorders on top of the merged develop; nothing was edited by hand, and tests/corpus/testdata/training_examples_expected.txt is untouched.

Derived census (derived_census_baseline.json, derived_census_records.tsv): elements/implied +4 in the spec examples, +1 in the pilot corpora, +1 in the training corpus. These are the new named-argument Redefinitions. SendActionUsage input, ConstructorExpression function and argument, and the transition/succession ends fill as intended.

api-json differential (docs/project/api-json-differential/**, 34 files):

Row before after
ConstructorExpression.argument (equal / different) 56 / 2 58 / 0
ConstructorExpression.function (equal / different) 0 / 64 64 / 0
ConstructorExpression.instantiatedType (equal / ours missing) 0 / 64 64 / 0
SendActionUsage.input (equal / different) 5 / 29 14 / 20

Totals: presentEqual 2,333,106 → 2,333,139, presentDifferent 168,600 → 168,496, oursMissing 186,528 → 186,357. The remaining SendActionUsage.input differences are ordering.

One movement is against the grain and is adjudicated, not fixed here: matched elements 114,698 → 114,693 and our unkeyable elements 21,456 → 21,477, in Simple Tests/StateTest.sysml. The referee (tools/referee/apijson/ours.go, isRelationship) treats any element that states a source or target as a relationship, so the 13 transitions that now state their source become unkeyable and their matches drop out. The new values equal the pilot's; the referee is deliberately not changed in this PR.

Structure differential (structure_differential_expected.txt): the constructor rows close (InstantiationExpression::argument and Feature::ownedRedefinition disagreements disappear in the pilot corpora, spec examples and examples/). Two existing classes grow:

  • Connector::relatedFeature / sourceFeature / targetFeature and the matching Relationship::relatedElement / source / target rows (training different 56 → 81, pilot corpora 195–199 → 209–217, spec examples 37 → 41). The symbol side now derives the correct source of a sourceless transition's succession, while the graph-backed evaluator still reads an empty source end there, so successions that agreed on a wrong answer now differ. The symbol answer is the specified one.
  • Type::input (pilot corpora different 28 → 29, spec examples 16 → 18): body-form send actions now answer their inputs on both sides, in a different order; an ordering difference of the kind already recorded.

Agreement ratchet (tests/corpus/testdata/element_properties_agreement/*.txt): SendActionUsage::input 30 → 2; the ConstructorExpression rows are removed; SuccessionAsUsage and TransitionUsage source/target rows fall by about half (for example sourceFeature 75 → 49, TransitionUsage::source 39 → 13). Two existing classes gain members:

  • Feature::feature / featureMembership / inheritedFeature / inheritedMembership (export-57) 17 → 21: the four named-argument result features of KerML spec example 7.4.9.4/4 now carry their Redefinition and inherit the reader/export gap the redefined feature already has there.
  • SuccessionAsUsage::target 4 → 5 and targetFeature 2 → 3 (symbol-81): one SysML spec example's then done transition now has its source and joins the recorded "no exported target for a library done end" rows.

Normative-schema gap (tests/export/testdata/api_json_normative_schema_baseline.json, recorded with -update-normative-schema):

  • Elements 6,597 → 6,598: the one new element is the Redefinition owned by the result feature of new Telemetry(frames = 3) in tests/export/testdata/convert/send_new.sysml, redefining SendNew::Telemetry::frames — the named constructor-argument Redefinition of item 4. It accounts for every +1 row (its @id, owner, related-element, source/target and specialization references, and the properties any element still lacks), and for its owner's ownedRedefinition, ownedSpecialization, ownedSubsetting and ownedMemberName leaving missingRequired.
  • nonSchemaKeys/sysx:mappingValues 95 → 101: four ConstructorExpressions and two SendActionUsages in send_new.sysml and action_nodes.sysml now state the completed function (Performances::Evaluation) and input (the full Type::input) at top level and keep the mapping's own value under sysx:mappingValues. That is the same change that moves invalidValues/function 42 → 38 toward the schema.
  • invalidValues/instantiatedType format 0 → 4 with missingRequired/instantiatedType 118 → 114: four constructors now state instantiatedType as an {"@id": …} reference, which counts under the existing non-UUID id gap every reference property has.

Convert golden: tests/export/testdata/convert/send_new.golden.ttl gains the constructor's argument ownership.

How it was verified

New tests, each failing before its commit: internal/frontend/grpc/element_properties_{send_input,constructor_function,transition_source,library_constructor}_test.go and tests/export/api_json_{send_input,constructor_function,constructor_arguments,transition_source}_test.go (library Cuboid, user Box, named RectangularCuboid arguments with their redefinitions, and a refused unbindable list).

Gate on head c8654cb06d (merged develop 8d91bf8d68), with OPENSYSML_REQUIRE_TRAINING_CORPUS, _PILOT_CORPORA, _SPEC_EXAMPLES, _PILOT_LIBRARY_XMI and _OMG_JSON_SCHEMA set to 1 after their download scripts:

gofmt -l .                                                    (empty)
go build ./...                                                rc=0
go vet ./...                                                  rc=0
make lint                                                     rc=0
staticcheck@2026.2.2 ./...                                    rc=0
go test -count=1 -timeout 55m ./...                           rc=0
go test -C tools ./referee/apijson                            rc=0
go test ./tests/export -run TestAPIJSONNormativeSchema        rc=0
go run -C tools ./cmd/pilot-apijson-diff -check               rc=0
go run -C tools ./cmd/derived-census -check -recorded-pilot   rc=0
go run -C tools ./cmd/pilot-diff -check                       rc=0
make docs-counts                                              current
go test -race ./internal/frontend/grpc -run TestElementProperties   rc=0

The whole-module -race run was not repeated locally on this head; CI's race tiers cover it.

Checklist

  • make test and make lint pass locally
  • 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

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/c5ca2e36a22f4afea824815332b637dc
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/c5ca2e36a22f4afea824815332b637dc?variant=devin
Requested by: @HuiJun


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

Devin Review

devin-ai-integration Bot and others added 8 commits November 21, 2026 19:02
Type::input is every feature related to the type by a FeatureMembership
whose direction is in or inout (KerML 8.3.3.1.10), and a send action's
payload, sender and receiver are input parameters (SysML 8.3.17.15). The
reader answered a send action through a branch of its own that kept only
owned Expressions, so the list was empty while parameter named them.
The send action now takes the general derivation, and the element form
writes the derived list rather than the graph's owned parameters.

Refs #2495

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

Expression::function redefines Step::behavior and is the Function that
types the Expression (KerML 8.3.4.7.3). A ConstructorExpression is typed
by Performances::Evaluation, which behavior and type already answered,
while function was refused as not defined. It is answered now, as the
pinned OMG pilot answers it. The instantiated type the reader answered
before is not restored: for an attribute definition it is no Function.

Refs #2495

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

A transition written in a state body without the transition keyword and
a source takes the closest lexically previous state usage as its source
(SysML 7.18.3), and its succession's ends are that source and the target
(checkTransitionUsageSuccessionSourceSpecialization,
deriveTransitionUsageTarget). The declared succession of such a
transition had no source end, so its target was read as the source, and
a state usage with a body was not taken as the one left. The shared
derivation and the export now name the same previous state usage.

Refs #2495

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

The arguments of a ConstructorExpression are the values of its result's
owned features in the order of the instantiated type's features they
redefine (KerML 8.3.4.8.3). Binding matched a formal by structure key
alone, which a library type's catalogued features never share with the
symbols naming them, so a constructor of ShapeItems::Cuboid was refused.
Formals now match by the declared element. A named argument's result
feature owns the Redefinition of the feature it names
(checkConstructorExpressionResultFeatureRedefinition) in the shared
relationships, the feature's types follow it, and the export writes it.

Refs #2495

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ties-2495-regressions

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

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

…e part

A named constructor argument looked its feature up by the last `::`-separated
segment of the name's text, so an unrestricted name holding `::`
(`new Box('left::width' = 1)`) redefined the feature `width` instead.

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 3 commits November 23, 2026 16:48
…ties-2495-regressions

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

# Conflicts:
#	docs/project/api-json-differential/examples/disposal-team-demo/team.sysml.json
#	docs/project/api-json-differential/examples/relay-probe-demo/mission.sysml.json
#	docs/project/api-json-differential/index.json
#	docs/project/api-json-differential/kerml-examples/Simple Tests/Expressions.kerml.json
#	docs/project/api-json-differential/pilot-examples/Geometry Examples/VehicleGeometryAndCoordinateFrames.sysml.json
#	docs/project/api-json-differential/pilot-examples/Simple Tests/ParameterTest.sysml.json
#	docs/project/api-json-differential/pilot-examples/Simple Tests/StateTest.sysml.json
#	docs/project/api-json-differential/pilot-validation/09-Verification/9-Verification-simplified.sysml.json
#	docs/project/api-json-differential/spec-examples/kerml/7.4.9.4/4.kerml.json
…velop

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ties-2495-regressions

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

# Conflicts:
#	internal/semantic/semantics/annotations.go

@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 3 commits November 23, 2026 21:30
…ties-2495-regressions

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

# Conflicts:
#	internal/semantic/metamodel/derived_census_records.tsv
#	internal/translate/export/testdata/structure_differential_expected.txt
…ties-2495-regressions

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

# Conflicts:
#	docs/project/api-json-differential/index.json
#	internal/semantic/metamodel/derived_census_baseline.json
#	tests/corpus/testdata/element_properties_agreement/answered-not-exported.txt
#	tests/corpus/testdata/element_properties_agreement/value.txt
…nes over develop, and the normative-schema gap

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun added this pull request to the merge queue Nov 24, 2026
Merged via the queue into develop with commit 262a110 Nov 24, 2026
33 checks passed
@HuiJun
HuiJun deleted the fix/element-properties-2495-regressions branch November 24, 2026 04:58
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: four answers changed with #2042 (send action input, constructor function and argument, accept transition ends)

1 participant