Repository navigation
fix(semantics): an implied conjugated port definition is named only by its original's name and never has a short name - #1812
Merged
Conversation
…rtDefinition it implies (ImpliedDecl) Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…t implies, with its OwningMembership and PortConjugation, as the conversion writes them Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…t-definition-member
…gest Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…erting it Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…tion, its PortConjugation reads as ownedConjugator/isConjugated, and the snapshot decoder interns ImpliedDecls under a mutex Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…t-definition-member Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov> # Conflicts: # docs/project/api-json-differential-baseline.json # internal/semantic/symbols/facts.go # internal/translate/export/element_ids.go # internal/workspace/libs/stdlib.snapshot
Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…s its conjugate too Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…s short name, not an empty declared name Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…gest Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…ion's conjugate by its short name Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…gest over the reverse-converter fix Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ember' into fix/conjugated-port-definition-names Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential-baseline.json
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Base automatically changed from
fix/conjugated-port-definition-member
to
develop
October 31, 2026 19:41
…t-definition-names
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Follow-up to #1807 (merged); originally stacked on it, now merged with develop and targeting
develop.#1807 gives a port definition's implied
ConjugatedPortDefinitiona native element. For a port definition with a short name, the conjugate was named after the short name in three places that agreed with each other but not with the specification: nativeName/ShortName~s/~q, RDFdeclaredShortName "~s"/"~q"and an invented address segmentP::@0::'~s', and a reverse converter that required them. (The~qshort name forport def <q> Q;is also present on develop, and develop could not round-tripport def <s>;through RDF.)Now the conjugate is named
~plus the original's name when the original has a name and is otherwise anonymous. It never has a short name:symbols/implied.gobuildConjugatedPortDefinition): the conjugate's identification hasName~Nameonly for a named original and never has aShortName. The conjugate is still built for a short-name-only port. Its ids,OwningMembershipandPortConjugationfrom fix(semantics): a port definition owns the ConjugatedPortDefinition it implies — its OwningMembership and PortConjugation read natively as the conversion writes them #1807 are unchanged.port x : ~s;still resolves, because the~typing resolves the originalsand then conjugates it, so it never looks up the conjugate's own name. A test covers this case.export/positional.go): an implied symbol's declaration span is its original's span, so an anonymous conjugate would have claimed its original's positional name (P::@0).positionalSymbolnow skips implied symbols, which get their ids fromElementIDs.conjugateOf.export/rdf_normative.goconjugatedPortDefinition): writes nodeclaredShortName. It writesdeclaredName "~P"andsysml:qualifiedName <owner>::'~P'only for a named original. An anonymous conjugate gets no declared name and the addresssysx:positionalName <owner>::@conjugated. That address follows the minted-segment form fix(export): an unnamed element's address is sysx:positionalName; sysml:qualifiedName states only the qualified name the metamodel derives #1805 documents inaddress.gofor implied elements without a name (@triggerfor a transition's trigger action). The unnamed-member form@Ndoes not fit, becauseP::@0::@0already names the first unnamed member of<s>'s own body.export/rdf_in_normative.goverifyConjugated): requiresdeclaredName "~"+original namewhen the original is named, through itsdeclaredNameor a named address segment. It requires nodeclaredNamewhen the original is unnamed. It accepts an absentdeclaredShortName, or exactly~<original short>(the legacy value earlier writers emitted). It rejects anything else.TestConversionNamesAShortNamedPortsConjugateByItsShortNameasserteddeclaredShortName "~s"and an address ending::'~s', which is the non-conformant behavior. It is replaced byTestConversionNamesConjugatesFromOriginalDeclaredNames, which asserts the spec behavior for all three originals. The~q/~sexpectations inTestPortDefinitionOwnsItsConjugatechange for the same reason.Specification basis
ConjugatedPortDefinition::effectiveName():let originalName : String = originalPortDefinition.name in if originalName = null then null else '~' + originalName endif.Element::shortNameis derived byeffectiveShortName(), whose default body isdeclaredShortName.ConjugatedPortDefinitiondoes not redefine it, and the implied conjugate declares nothing, so itsshortNameis null in every case.Element::qualifiedNameis null if there is not a complete ownership chain of named Namespaces. The original<s>is unnamed.The pinned pilot agrees. For
package P { port def <s>; port def <q> Q; }its api-json exporter gives: the conjugate of<q> Qhas name~Q, shortName null, qualifiedNameP::Q::'~Q'and declaredName/declaredShortName null; the conjugate of<s>has name, shortName and qualifiedName all null.No
docs/project/spec-compliance.mdrow moves.How it was verified
TestConjugatedPortDefinitionNamesFollowTheOriginalName(semantics) runs over<s>,<q> QandRand a part typing~s/~Q/~R. It checks the reflectivename/declaredName/shortName/declaredShortName/qualifiedNameof each conjugate and that each port'sConjugatedPortTypingreaches its original with no resolver diagnostics. A metamodel-evaluator test checks the derivedElement::qualifiedNameagainst the pilot'sP::Q::'~Q'.TestConversionNamesConjugatesFromOriginalDeclaredNameschecks the RDF properties and address for each original.TestElementIDReaderSeparatesShortPortAndAnonymousConjugateandTestPositionalIdentityIgnoresImpliedConjugatecheck that<s>and its conjugate read distinct graph-written ids.TestShortNamedPortDefinitionRoundTripsThroughRDFruns overport def <s>;,port def <q> Q;,port def Q;and the~s/~Q/~Rmodel. Each does ToRDF → ToSysML withsysx:sourceTextstripped, then re-converts, and checks that the graph is identical. Reverse-converter tests cover the legacydeclaredShortName "~q"(accepted), a wrongdeclaredName/declaredShortName(rejected) and adeclaredNameon the anonymous conjugate (rejected).pilot-apijson-diff -updatemoved only the writersourceDigestindocs/project/api-json-differential-baseline.json, and the scorecard did not move.make stdlib-snapshot-checkis clean, sostdlib.snapshotdid not move. Grep shows no port definition with a short name (port def <…>, short-only or name plus short) inexamples/,tests/or the downloaded training, pilot and spec-example corpora. That is why the corpus round-trip and scorecard do not move.TestCorpusRoundTrippasses withOPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1.go build ./...,go vet ./...,gofmt -l .(empty),go test -count=1 ./internal/semantic/... ./internal/translate/... ./tests/export/... ./tests/corpus/... ./internal/check/... ./internal/doc/queryexec/... ./internal/frontend/repl/... ./internal/workspace/libs/...,go -C tools test -count=1 ./referee/apijson/... ./oracle/baseline/....Known difference not changed here: the semantics reflective
qualifiedNamefeature joins raw names for every element (P::Q::~Q, as it wouldP::a b), while the metamodel evaluator escapes segments as the pilot does.Checklist
make testandmake lintpass locally (the targeted gate above)docs/reference/rdf-mapping.md)changes/unreleased/conjugated-port-definition-names.fixed.mdpilot-apijson-diff -update: writer digest only)Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/0e3626a6a66d49e49fc83db32d479123
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/0e3626a6a66d49e49fc83db32d479123?variant=devin
Requested by: @HuiJun