Skip to content

fix(metamodel): type a change trigger's argument wrapper by its metaclass, not the trigger's node - #2432

Merged
HuiJun merged 12 commits into
developfrom
fix/change-trigger-argument-implied-type
Nov 20, 2026
Merged

HuiJun merged 12 commits into
developfrom
fix/change-trigger-argument-implied-type

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

Chained behind #2425. This branch contains refs/pull/2425/head 09a230b (the accept-payload fixes ahead of it in the baseline lane) and origin/develop 8ec712f (where #2002 merged); one merge base.

Refs #2002.

What and why

#2002 typed an expression declaring no typing by the function it invokes, and resolved a trigger's function from its syntax node: *ast.TimeEvent → Triggers::TriggerAt/TriggerAfter, *ast.ChangeEvent → Triggers::TriggerWhen (structureExpressionFunction in internal/semantic/metamodel/structure_implied_types.go). A change trigger's argument wrapper — the FeatureReferenceExpression over the condition that accept when ready owns through in0/a0, as the pilot writes it (ExpressionChangeWrapper in internal/semantic/semantics/reflective_expression_parts.go) — shares the trigger's ChangeEvent node, so a structure that hands the wrapper out with that node had it typed as the trigger: Feature::type and Expression::function answered Triggers::TriggerWhen where the wrapper, like the condition it refers to, evaluates Performances::Evaluation.

structureExpressionFunction now resolves a trigger function only for an element that reflects as a TriggerInvocationExpression (structureIsTriggerInvocation, through the structure's metaclass); a part sharing the node falls to the base its own metaclass implies.

Specification basis

KerML 1.1 Beta 2 §8.4.4.7 Expressions: an expression's function is its single result-typing Function; a FeatureReferenceExpression invokes none and specializes Performances::evaluations, so its type is Performances::Evaluation. SysML v2 §8.3.16 TriggerInvocationExpression: only the invocation itself is typed by Triggers::TriggerWhen/TriggerAt/TriggerAfter. No compliance row moves.

How it was verified

  • TestSymbolStructureChangeTriggerArgumentIsNotTypedAsTheTrigger (internal/semantic/metamodel/structure_change_trigger_test.go), written first and failing on the parent commit with argument wrapper's implied types = [TriggerWhen Evaluation], want [Evaluation]: walks accept when ready through the symbol-backed structure (the trigger types by TriggerWhen, the wrapper and the condition by Evaluation), then hands the wrapper and the trigger to a structure with the shared ChangeEvent node and checks structureImpliedFeatureTypes on each.
  • TestAPIJSONChangeTriggerArgumentIsNotTypedAsTheTrigger (internal/translate/export/api_json_change_trigger_bases_test.go): the element form of the same model types the TriggerInvocationExpression by Triggers::TriggerWhen and both FeatureReferenceExpressions (the wrapper and the condition) by Performances::Evaluation, function alike.
  • Generated-file movement: none. The served structures hand elements out without a node (SymbolStructure.ElementFor, the graph structure), so the structure differential, derived-census -check -require-exporter, pilot-apijson-diff -check, pilot-diff -check, the convert goldens and the gRPC library table reproduce unchanged; nothing was re-recorded, training_examples_expected.txt untouched.
  • Full gate on the head with the corpora present (OPENSYSML_REQUIRE_TRAINING_CORPUS, _PILOT_CORPORA, _SPEC_EXAMPLES, _PILOT_LIBRARY_XMI, _PSSM_SUITE): go build, go vet (root and tools), gofmt -l empty, make lint, make extension-libraries-pin-check, make changelog-check, SPEC_COMPLIANCE_PAGE=forbid make spec-compliance-check, make docs-counts, go test -C tools ./..., go test ./tests/hygiene, go test ./....

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/c507b405abda4b6fb7b63448eca5b9c7
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/c507b405abda4b6fb7b63448eca5b9c7?variant=devin
Requested by: @HuiJun


🟢 Devin Review found nothing to fix · View findings

Devin Review

devin-ai-integration Bot and others added 11 commits November 20, 2026 05:50
The payload a trigger names (`accept x : Sig`) was two symbols: the one the
transition's scope declares and a ReferenceUsage synthesized for the accept.
OwningMembership(x) answered the synthesized one's membership, whose member
is not x, and x read as an ItemUsage the transition owned.

The accept's payload parameter is now the declared symbol: a ReferenceUsage
the accept owns through its ParameterMembership.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
The payload reads as a ReferenceUsage, which takes no implicit [1..1] by
metaclass, so the conversion stopped writing the Multiplicity it owns.

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

Co-Authored-By: jason.han <hanhuijun@gmail.com>
The payload is declared as an item usage, so it took Items::Item as a type
beside the one it declares (`accept x : ScalarValues::Integer`).

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

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…lass, not the trigger's node

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

@HuiJun
HuiJun added this pull request to the merge queue Nov 20, 2026
@devin-ai-integration
devin-ai-integration Bot removed this pull request from the merge queue due to a manual request Nov 20, 2026
@HuiJun
HuiJun added this pull request to the merge queue Nov 20, 2026
Merged via the queue into develop with commit 9f2e14b Nov 20, 2026
32 of 56 checks passed
@HuiJun
HuiJun deleted the fix/change-trigger-argument-implied-type branch November 20, 2026 16:39
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