Skip to content

fix(semantics): a change trigger binds its in parameter to the FeatureReferenceExpression wrapper whose referent is the condition — the wrapper, its FeatureMembership and result read natively as the conversion writes them - #1817

Merged
HuiJun merged 7 commits into
developfrom
fix/expression-body-chain-parts
Nov 1, 2026

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What and why

The third part of the expression-parts parity work (after #1814, #1815, #1816): a change trigger's condition. For

action acc accept e when a > 1;

the RDF/API-JSON writer (changeArgument in internal/translate/export/rdf_expr.go) states the TriggerInvocationExpression as owning an in0 parameter bound to a FeatureReferenceExpression argument a0, whose referent is the written condition (a > 1, held through a FeatureMembership) and which owns its own out result. The native read owned none of that: the trigger's value had the in0 parameter and the condition as a bare operand, no wrapper, so ownedMembership, referent, metaclasses and ids disagreed across ledgers.

Now the semantics synthesize the wrapper (role ExpressionChangeWrapper, metaclass FeatureReferenceExpression) as the trigger's single argument, and the condition (role ExpressionChangeCondition) as the wrapper's referent, owned through a FeatureMembership ahead of the wrapper's ReturnParameterMembership. Side tables only — no AST or scope change; the two enum values are appended (the snapshot stores them). The id reader (internal/translate/export/element_ids.go) registers in0, a0, a0.change (the condition, keyed by node and span, with its FeatureMembership id) and a0.out as the writer mints them, and recurses into the condition for its own parts.

Not in this PR, each as its own follow-up PR: a body expression's parameters/result, and the chain Feature a dotted name owns. A transition's accept when … payload has no native symbol at all today, so this PR covers the trigger of an accept action; the transition form is a separate gap.

Specification basis

SysML v2 1.0 §8.3.16.4 TriggerInvocationExpression (when form: the argument is a FeatureReferenceExpression whose referent is the condition expression, owned through a FeatureMembership), KerML 1.0 §8.3.4.8 FeatureReferenceExpression (referent, result parameter). No spec-compliance.md row moves: this is the reflective read agreeing with the conversion, not a new rule.

How it was verified

  • internal/semantic/semantics — TestChangeTriggerOwnsItsConditionThroughAWrapper: metaclasses, the two memberships and their order, referent, no operator on the wrapper and > on the condition, the condition's own parameters, repeated-read identity.
  • internal/translate/export — TestElementIDReaderSpellsAChangeTriggerAsTheConversionWritesIt: in0/a0/a0.out, the condition's id and FeatureMembership, and the condition's in0, all as the conversion writes them.
  • go build ./..., go vet ./..., gofmt -l . (empty), go test -count=1 ./... all green (the four slowest packages re-run alone after a first run under CPU contention timed them out).
  • api-json: pilot-apijson-diff -update then -check over this tree — only the writer sourceDigest moved; scorecard unchanged at 1144182 present-equal / 27977 present-different; go -C tools test ./referee/apijson/... ./oracle/baseline/... green.

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

devin-ai-integration Bot and others added 3 commits November 1, 2026 04:01
…eReferenceExpression wrapper whose referent is the condition — the wrapper, its FeatureMembership and result read natively as the conversion writes them

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…trigger id registration (digest only)

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
@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 2 commits November 1, 2026 07:50
…y-chain-parts

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>

# Conflicts:
#	docs/project/api-json-differential-baseline.json
… merge (digest only)

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review November 1, 2026 09:03
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits November 1, 2026 09:22
…apper's ownedElement/ownedFeature list the condition it owns

The trigger is result-bearing (expressionStructure writes its out), so the change-event branch of expressionPartsOf keeps parts.result and the id reader registers the trigger's out. expressionOwnedParts lists the wrapper's condition ahead of its result, as its FeatureMembership leads; parameter and directedFeature read expressionParameterParts, the parameters alone.

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
… out registration (digest only)

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
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.

2 participants