Repository navigation
fix(semantics,query): serve the relationship ends and expression operators a query used to refuse - #2140
Draft
devin-ai-integration[bot] wants to merge 4 commits into
Draft
fix(semantics,query): serve the relationship ends and expression operators a query used to refuse#2140devin-ai-integration[bot] wants to merge 4 commits into
devin-ai-integration[bot] wants to merge 4 commits into
Conversation
…ators a query used to refuse Relationship: :source, target and relatedElement answer on a connector as the features its ends reference and on a dependency as its clients and suppliers; a keyword-first disjoining, inverting or featuring answers the ends its metaclass declares; Expression::operator reads '.', 'collect' and 'select' on a feature chain, collect and select expression; the typing a transition's accept trigger writes resolves in the scope the trigger is written in. A keyword-first relationship's chain source stays unresolved, as its chain target does. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…rs no source, target or relatedElement The resolved end was read as the source, since the related features drop the missing position before the first is taken. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
There was a problem hiding this comment.
Devin Review found 1 finding. Devin automatically fixed it.
Fixed by Devin (1)
- Unresolved connector end shifts source — A connector with an end that references nothing (
connector cn from Missing to g;) read the resolved end as its source. It now leaves source, target and relatedElement underived; TestConnectorRelationshipEndsUnresolved covers it.
Keeps one arm for a connector's relatedElement, source and target: it reads through declaredRelationshipEnds, which reuses connectorEndRedefinition and keeps the dependency ends and the unresolved-end guard. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ationship-ends Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # internal/translate/export/testdata/structure_differential_expected.txt
This branch has not been deployed
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
A query that read one of these metamodel properties stopped with the path error
expected <Class>::<property> derived by OpenSysML, although the semantic layer already held the answer. They are now derived in the reflective layer (internal/semantic/semantics), which the query evaluator,-run-queryand the symbol-backed element structure all read:Relationship::source,targetandrelatedElementon a connector — KerMLbinding n of f = g;,succession n first f then g;,connector n from f to g;, SysMLbinding n bind a1 = a2;,succession n first a1 then a2;— as itssourceFeature,targetFeatureandrelatedFeature, and ondependency n from A to C;as its clients and suppliers. A connector with an end that references nothing (connector n from Missing to g;) answers none of the three, so the end that did resolve is not read as the source.Disjoining::typeDisjoined/disjoiningType,FeatureInverting::featureInverted/invertingFeature,TypeFeaturing::featureOfType/featuringTypeon the keyword-first membersdisjoining n disjoint A from B;,inverting n inverse f of g;,featuring n of f by A;, with thesource,targetandrelatedElementthey redefine. TheirowningType,owningFeatureandowningFeatureOfTypeare empty, as a namespace owns them.Expression::operator:.on a feature chain expression (a.b),collectona.{in q; q},selectona.?{in q; true}.FeatureTyping::targetof the typing a transition'saccepttrigger writes (transition t first s1 accept Sig then s2;). The trigger's parts carry no scope of their own, so the first read resolved the type against nothing and the resolver remembered the miss for every later read; they now resolve in the scope the trigger is written in. The typing of an ordinaryfeature f : A;orpart p : A;already answered its target.One correction rides along: a keyword-first relationship whose source is a feature chain (
inverting n inverse g.f of h;) answered the chain's last feature as its source. It now leaves that end underived, as it already did for a chain target, since the end is the chain feature the relationship owns.Overlap with #2135
#2135 landed first with a connector arm for
relatedElement,sourceandtargetinReflectiveElements. This branch merges it and keeps one arm: it reads throughdeclaredRelationshipEnds, which reuses #2135'sconnectorEndRedefinitionand adds what that arm did not have, the dependency ends and the unresolved-end guard. The keyword-first relationship ends, the three operators and the trigger typing do not touch #2135's code.Specification basis
KerML 1.1 Beta 2: 8.3.4.5.3 Connector (
sourceFeatureredefinessource,targetFeatureredefinestarget,relatedFeatureredefinesrelatedElement); 8.3.2.2.2 Dependency (clientredefinessource,supplierredefinestarget); 8.3.3.1.4 Disjoining, 8.3.3.3.6 FeatureInverting, 8.3.3.3.11 TypeFeaturing (each end redefinessourceortarget; the textual grammar writesinverse featureInverted of invertingFeature); 8.3.4.8.2 CollectExpression (operator = 'collect'), 8.3.4.8.18 SelectExpression (operator = 'select'), 8.3.4.8.4 FeatureChainExpression (operator = '.'). No compliance row moves.How it was verified
internal/semantic/semantics/reflective_relationship_ends_test.go: each property on the tree and on its recorded form, the unresolved and chain ends, non-relationships, the three operators, the trigger typing with no document walk before it, a connector with an unresolved end.internal/doc/queryexec/relationship_ends_test.go: oneProjecttest per property group. Every new test fails ondevelop.sysml <fixture> -run-queryover a model with each construct returns the elements wheredevelopreturned the path error. The qvts recipe audit (scripts/check-synthetic.shagainst this build) goes from 46 unverifiable probe instances to 0, with 0 mismatches.internal/translate/export/testdata/structure_differential_expected.txtre-recorded, five lines againstdevelop:Relationship::source,targetandrelatedElementgain agreements in theexamplesand pilot roots (adisjoint … from …, afeaturing … of … by …and five relationships with a chain source); nothing else moves.developafter fix(semantics,export): a connector's Relationship::relatedElement, source and target are the features its relatedFeature, sourceFeature and targetFeature redefine them as — the query leg answers them for a connection, a flow and athensuccession, and the RDF writer states them for a plain end, as the pilot exports them #2135:go build ./...,go vet ./...,gofmt -l .andmake lintclean;go test -timeout 120m ./...passes;go test -C tools ./referee/apijsonpasses; the qvts audit was re-run (0 mismatches, 0 unverifiable).pilot-apijson-diff -checkwas not run locally; no writer underinternal/translatereads the reflective layer.Known limitations
These are outside this change and unchanged by it:
connection,interface,allocationorflowusage and an association therefore still readsourceandtargetas the emptyLinks::BinaryLinkends, and a metadata usage readsannotatedElementempty, though the reflective layer derives them:part def D; part a : D; part b : D; part def Ctx { connection n connect a to b; }projectssource = (none)besiderelatedElement = [a, b].relatedElement(relatedType,sourceType,targetType) is not derived.inverse a of basinvertingFeature, the reverse of the grammar; the structure differential keeps those rows as differences. They also write nooperatoron feature chain, collect and select expressions.accepttrigger reflects its payload's typing on the accept, on the payload and, when the payload is named, on the named parameter, all under one element id.Connector::sourceFeatureandtargetFeaturestill read the resolved end of a connector whose other end references nothing as its source; only the threeRelationshipproperties are left underived there.clientandsupplierdo not.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelog🟢 Devin Review found nothing to fix · View findings · Follow Devin's work