Repository navigation
fix(semantics): reflect a #M prefix through the OwningMembership its element owns - #2486
Closed
devin-ai-integration[bot] wants to merge 4 commits into
Closed
devin-ai-integration[bot] wants to merge 4 commits into
devin-ai-integration[bot] wants to merge 4 commits into
Conversation
…element owns A definition, usage or package owns the metadata usage of a `#M` prefix through an OwningMembership (KerML.xtext PrefixMetadataMember); only a relationship such as a dependency owns it through an Annotation (PrefixMetadataAnnotation). The reflective layer reported an Annotation for every prefix, an element the RDF conversion never writes, so a query read it with no elementId. Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…-metadata-owning-membership Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov> # Conflicts: # internal/semantic/metamodel/derived_census_records.tsv # internal/semantic/semantics/annotations.go # internal/translate/export/testdata/structure_differential_expected.txt
…herits Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
Contributor
Author
There was a problem hiding this comment.
Devin Review found 2 findings. Devin automatically fixed all 2 findings.
Fixed by Devin (2)
- Prefix metadata leaks into inherited features — Confirmed: B's
featurelisted A's #M prefix. Thefeaturefilter now excludes a prefix metadata usage; TestPrefixMetadataIsNoInheritedFeature fails without the fix. - API comment exceeds repository length limit — The OwnedAnnotations comment is now two lines.
Contributor
Author
|
Closing as superseded: this fix already landed on It would have added two tests, which both pass against the landed implementation and can go in a follow-up if wanted:
|
devin-ai-integration
Bot
deleted the
fix/reflect-prefix-metadata-owning-membership
branch
November 23, 2026 15:24
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 reflective query over
#M part def n;returned anAnnotationwith noelementId. The RDF conversion never writes that element: it writes theOwningMembershipthrough whichnowns the prefix'sMetadataUsage, and that membership has an id (<owner>___400_om). The reflective layer disagreed with the grammar,docs/reference/rdf-mapping.mdand the conversion by reporting anAnnotationfor every#Mprefix.This PR changes the reflective layer only (
internal/semantic/semantics);internal/translate/exportis untouched.ownedMembership, and its metadata usage is an owned member whoseowningMembershipis that membership. It annotates its owner through noAnnotation, like the body spelling@M;.OwningMembership, so it is not anownedFeature, and itsowningTypeandowningFeatureMembershipare empty, as in the graph.dependencykeeps itsAnnotation(PrefixMetadataAnnotation), with the id<owner>___400_an.Follow-up to #2414, which left this case out because it is not an export defect.
Specification basis
SysML.xtext/KerML.xtext:PrefixMetadataMember returns OwningMembershipforDefinitionExtensionKeywordandUsageExtensionKeyword;PrefixMetadataAnnotation returns Annotationappears only inDependency. The compliance row for prefix metadata indocs/project/spec-compliance/02-detailed-semantic-compliance-map/35-parser-recovery.mdmoves from Approximate to Faithful.How it was verified
internal/doc/queryexec/prefix_metadata_ids_test.go(TestPrefixMetadataIsOwnedThroughAnIdentifiedMembership): fails ondevelopwith three blank-idAnnotations; asserts the ids of the membership and metadata usage for a definition, a usage and a package, and of theAnnotationfor a dependency.internal/semantic/semantics/reflective_memberships_test.go: five tests asserted the old contract (prefix owned through anAnnotation, absent fromownedMembership); they now assert the membership, its position, and the dependency/relationship-body cases unchanged.go build ./...,go vet ./...,gofmt -l .,make lintandgo test ./...with the corpus require variables set, on the commit beforedevelopwas merged in. After the merge both baselines were re-recorded on the merged tree with the same movement, and the semantic, document, export, gRPC, corpus and hygiene suites were rerun.go run -C tools ./cmd/pilot-apijson-diff -checkpasses with no movement: the API-JSON output is unchanged.Baseline movements
Structure differential (
internal/translate/export/testdata/structure_differential_expected.txt, symbol side against graph side). More elements match in every root, and unmatched falls by the same amount:examples+259,tests/testdata+6, training +6, pilot corpora +168, specification examples +10. These are the prefix memberships, which the symbol side did not state before.examples:Element::ownedAnnotationandAnnotatingElement::annotation261 → 2,Element::owningMembership280 → 21,Namespace::ownedMembership950 → 692; theDefinition::ownedItem/ownedMetadataandUsage::nestedItem/nestedMetadatarows that differed by the prefix count now agree.Membership::memberElementIdandOwningMembership::ownedMemberElementId,symbol-missingup by exactly the newly matched count in each root. The symbol side states nomemberElementIdfor any membership; the newly matched memberships join that existing class.Derived census (
internal/semantic/metamodel/derived_census_records.tsv, our column only; the pilot column is unchanged). Of the rows that move, 125 move toward the pilot's count, 56 keep the same distance and 20 move away.Annotation::*,AnnotatingElement::annotation,Element::ownedAnnotation,owningMembership,owningNamespace,Membership::*,Namespace::ownedMember(ship)rows, andDefinition::ownedMetadata/Usage::nestedMetadata(e.g.examplesownedMetadata1 → 130 against the pilot's 132).Definition::ownedItem,ownedOccurrence,ownedUsageandUsage::nestedItem,nestedOccurrence. The prefix is now an owned member, and these collections are derived by filtering owned members by metaclass, so they list it; the pilot's counts suggest it does not. The graph side already listed it there before this PR (the structure differential rows above), so this is the symbol side reaching the conversion's existing answer, not a new one. I tried deriving these from owned features instead and excluding metadata usages from them; each made other rows worse, so the derivation is left alone here and is a candidate follow-up for both sides.Annotation::annotatedElementin the specification examples, 28 → 18 carriers against the pilot's 32. The symbol side now has the annotations the graph has (structure differentialElement::ownedAnnotationthere 19 → 11 different). I did not identify which annotations the pilot has that neither side states.training_examples_expected.txtis untouched, andTestExamplesSweepverdicts do not move.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 fixed all 2 findings · Follow Devin's work