Repository navigation
fix(semantics): reflect the concrete metaclass of eight grammar forms - #2142
Merged
Merged
Conversation
Reflection, the query metamodel, API JSON and RDF now state the metaclass the grammar production returns rather than the kind's general class: exhibit state (ExhibitStateUsage), include use case (IncludeUseCaseUsage), library package (LibraryPackage), a prefix-metadata usage with no kind keyword (Usage, SysML.xtext ExtendedUsage) and KerML succession flow (SuccessionFlow). A namespace's filter conditions are owned through ElementFilterMemberships, a function-like body's result through a ResultExpressionMembership, and a flow's two ends as FlowEnds through EndFeatureMemberships: named source and target by the Transfer end they redefine, each reference-subsetting the feature it attaches to, listed by ownedMembership, ownedMember, ownedFeature and ownedEndFeature. The members live in a memoized side table of the Model. Regenerates the grammar-to-metaclass map baseline, the structure differential and the pilot API JSON differential (improvements only). 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)".
|
2 of 6 tasks
…te-metaclasses Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential/index.json # docs/project/api-json-differential/pilot-examples/Arrowhead Framework Example/AHFNorwayTopics.sysml.json # docs/project/api-json-differential/pilot-examples/Cause and Effect Examples/CauseAndEffectExample.sysml.json # docs/project/api-json-differential/pilot-examples/Requirements Examples/RequirementDerivationExample.sysml.json # docs/project/api-json-differential/pilot-examples/Vehicle Example/SysML v2 Spec Annex A SimpleVehicleModel.sysml.json # docs/project/api-json-differential/training/41. Language Extension/User Keyword Example.sysml.json # internal/semantic/semantics/reflective_relationships.go # internal/semantic/symbols/expression.go # internal/translate/export/testdata/structure_differential_expected.txt
…ting; element-form ids for flow ends and filter conditions A `message` relates events through MessageEventMembers (SysML.xtext), so it mints no FlowEnds; a FlowEnd owns a ReferenceSubsetting only when its clause names a feature of a feature (SysML.xtext FlowEndSubsetting). SynthesizedElementID composes a FlowEnd's id at its end slot, the id reader records a filter condition and a chained flow end's reference subsetting as the conversion writes them, and the element form reads a condition by node. Co-Authored-By: jason.han <hanhuijun@gmail.com>
… leg identifies them The conversion mints a flow's ends at end0/end1 with their EndFeatureMemberships; the id reader now records them by the feature each from/to clause selects, as it does a connector's ends, so ElementIDOf reads a FlowEnd, its membership and a chained end's ReferenceSubsetting as written. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…te-metaclasses Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential/index.json # docs/project/api-json-differential/pilot-examples/Vehicle Example/SysML v2 Spec Annex A SimpleVehicleModel.sysml.json # docs/project/grammar-metaclass-map-baseline.json # internal/frontend/symbolfacts/elementform/element_identity_test.go # internal/translate/export/element_ids.go # internal/translate/export/testdata/structure_differential_expected.txt
…te-metaclasses Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential/index.json # docs/project/api-json-differential/pilot-examples/Vehicle Example/SysML v2 Spec Annex A SimpleVehicleModel.sysml.json # internal/frontend/symbolfacts/elementform/element_identity_test.go # internal/semantic/metamodel/derived_census_baseline.json # internal/semantic/metamodel/derived_census_records.tsv # internal/semantic/semantics/annotations.go # internal/translate/export/element_ids.go # internal/translate/export/kinds.go # internal/translate/export/testdata/structure_differential_expected.txt
… it is written as A calc, verification or other function-like body's closing bare expression is written as the member stating it (ResultExpressionMembership), so its operands, parameters and result take ids under that member, as a constraint's condition already did; the synthesized element id no longer names it at `result`, which only a body expression's result carries. The structure differential is re-recorded over the newly compared result-expression subtrees. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ord severity change The three spec-example cells that moved (7.13.4/3, 8.4.9.2/3, 8.4.13.6/8) are the kerml-notation diagnostic now reported as an error (#2275); clean develop reproduces the same movement. Re-recorded with pilot-diff -update. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ve it in its namespace A namespace with two `filter` members synthesized conditions that shared one expression record (owner, role, index 0), so KeyOf and the metamodel's structure keyed them as one element: reads conflated the two and the second condition's subtree never compared. Each condition now carries its position among the namespace's filters, as a flow end carries its end's. Before the document is resolved, the reflective layer resolved a filter condition's names in the scope enclosing the namespace, where the walk reads them in the namespace itself (document.go FilterMember), so a reference bound an outer namesake or nothing. expressionScopeOf answers the namespace's own scope for a filter condition. The structure differential re-records tests/testdata: the five filters of parse/expressions.sysml now compare one by one, so 26 cells improve and Expression::result and Feature::featureTarget leave the differing set. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
There was a problem hiding this comment.
Note
Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.
Devin Review found 3 findings. Devin automatically fixed all 3 findings.
Fixed by Devin (3)
- Explicit extended references become compositions — Confirmed: IsReference is set only by the ref keyword, so the ExtendedUsage exemption in usageIsComposite wrongly kept
ref #M x;composite. Removed the exemption; test covers#M x;composite andref #M y;referential on the declared and recorded paths. - Recorded extended usages lose composition — Confirmed: UsageIsComposite's recorded branch rejected the ReferenceUsage kind before recordedUsageIsReferential's ExtendedUsage exception, so EffectiveIsComposite was false for a recorded
#M x;. The kind rule now exempts ModExtendedUsage in both places while ref/end/event modifiers still apply; test asserts EffectiveIsComposite on both fixtures. - Three-line comment exceeds repository limit — Comment shortened to two lines.
…rML-keyword severity change" This reverts commit 34e5f41.
…te-metaclasses Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # internal/translate/export/kinds.go
… now reached A namespace's second and later filter conditions have their own identity since the filter-identity fix, so the census walk reaches the FeatureChainExpression of tests/testdata/parse/expressions.sysml's `filter a.b.c;`: FeatureChainExpression::operator and ::targetFeature on the testdata root move from 1 to 2 of the pilot's 3. Co-Authored-By: jason.han <hanhuijun@gmail.com>
develop's native FlowEnds (#2266, #2268, #2369) supersede this branch's synthesized ones, so the synthesis, its ExpressionFlowEnd role, ids and tests are dropped; the filter-condition and body-result synthesis stays and wraps develop's withFlowEndFeature. kinds.go keeps this branch's ExtendedUsage branch ahead of #2279's narrowed ReferenceUsage test. Two gaps the merge exposed are fixed at the root: a flow's FlowEnds are now also its ownedMember/ownedElement/member (withSynthesizedMembers places FlowEndMembers at their clause) and the element form answers an implied end, its ReferenceUsage and its ReferenceSubsetting from the conversion's slots; and a usage declared by prefix metadata alone (`#M x;`, a plain Usage) is composite by default on the symbol side as the RDF writer already states it, instead of referential. Generated artifacts re-recorded by tool only: structure differential (FlowEnds listed as members, Usage::isReference back to develop's figures), derived census (elements/implied fall where the duplicate FlowEnd synthesis went away). Co-Authored-By: jason.han <hanhuijun@gmail.com>
The calculation row named the branch's superseded flowEndRedefinedEnd and ExpressionFlowEnd; develop's FlowEndMembers/flowEndFeatureRedefinition own flow ends now. Drops the test helper the FlowEnd synthesis left unused. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…) into fix/reflect-concrete-metaclasses
usageIsComposite exempted every ExtendedUsage from the reference rule, but IsReference is set only by the ref keyword, so `ref #M x;` reflected as a composition (SysML v2 8.3.6.10). Co-Authored-By: jason.han <hanhuijun@gmail.com>
UsageIsComposite rejected a recorded ExtendedUsage by its ReferenceUsage kind before recordedUsageIsReferential could see it, so EffectiveIsComposite disagreed with direct reflection; the kind rule now exempts ModExtendedUsage while the ref/end/event modifiers still apply. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…reflect-concrete-metaclasses
…elop's owned succession ends Clean develop reproduces its own baseline; the ten cells move only on the combined tree, where #2311's owned succession ends are also listed among the synthesized members this branch adds. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…s owned succession ends Clean develop reproduces its own census; the pilot-validation rows (and one pilot-examples, one training row) move only on the combined tree, where the succession ends #2311 owns are also members this branch synthesizes. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # internal/translate/export/testdata/structure_differential_expected.txt
…elop 9d9b320 The merge took develop's copy; this records the combined tree, where this branch's synthesized memberships, FlowEnd members and ExtendedUsage composition move the cells develop's baseline cannot see. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…d9b320 The cell-wise merge summed both sides' deltas (one cell went negative); the sixteen rows now hold the measured values of the combined tree. Co-Authored-By: jason.han <hanhuijun@gmail.com>
element_ids.go keeps this branch's filter-condition and body-result id registration beside develop's send-argument and guard registration (#2408); the structure differential takes develop's copy pending its tool re-record. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…elop 052fdb9 The merge took develop's copy; this records the combined tree, where this branch's synthesized memberships, FlowEnd members and ExtendedUsage composition raise every root's matched count. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Develop's #2410 classifies a library package, an exhibited state, an included use case and a succession flow by their production; this branch keeps those classifications once, through develop's isExhibitedState, isIncludedUseCase and ModInclude, and UsageFormMetaclassName (the query metamodel's entry) now reads them beside the event and ExtendedUsage forms. ModExhibitedState and ModIncludedUseCase go; ModExtendedUsage stays, so the interface format version moves to 25. The changelog fragment names the four forms this branch alone adds. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Only the structure differential conflicts; it takes develop's copy pending its tool re-record on the combined tree. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…elop 13bb942 The merge took develop's copy; this records the combined tree, where this branch's synthesized memberships, FlowEnd members and ExtendedUsage composition raise every root's matched count. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Only the structure differential conflicts; it takes develop's copy pending its tool re-record on the combined tree. Co-Authored-By: jason.han <hanhuijun@gmail.com>
One pilot-corpora cell moves on the combined tree (OwningMembership:: ownedMemberElementId, one more differing pair) where #2425's trigger payload ownership meets this branch's synthesized memberships. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…class row The row still named ModExhibitedState and ModIncludedUseCase, which went when this branch adopted develop's isExhibitedState, isIncludedUseCase and ModInclude; TestComplianceTablesNameLiveGoIdentifiers reads the row again. Co-Authored-By: jason.han <hanhuijun@gmail.com>
The cell-wise merge kept #2002's derived counts on this branch's larger element totals; the tool records the measured values of the 80 rows (our-side columns only, each with at least as many derived as before). Co-Authored-By: jason.han <hanhuijun@gmail.com>
6 tasks done
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.
Refs #2244.
What and why
The qvts synthetic atlas asks reflection (
Reflection::Elements_<Metaclass>) what each element is, and eight concrete metaclasses answered nothing or their general class. Each now reflects the metaclass its grammar production returns, consistently in the semantic model, the query metamodel (@type), the element-form and query element ids, API JSON and RDF:exhibit state s : T;/exhibit s;developsince #2410)include use case u : T;/include u;library package L;standard library packagetoo, still warninglibrary-package)#M x;(prefix metadata, no kind keyword)succession flow f from a.x to b.y;filter @M;calc def K { 1 }(andcalc,constraint def, other function-like bodies)a.{in q; q}was already owned so)flow f from p1.x to p2.x;ownedRelationship/ownedEndFeatureonlydevelopowns natively (#2266, #2369) are also the flow'sownedMember/ownedElement/member, and the element form's@idnames each end (<flow>_end0), its ReferenceUsage (_end0_ff) and a chained end's ReferenceSubsetting (_end0_rs), as the query leg already read themThe members a declaration owns without a symbol of its own (filter conditions, body results) are minted once per
Modelin a memoized side table (synthesizedMembersOf); together withdevelop's FlowEnds (FlowEndMembers) they are placed at their clause amongownedMembership,ownedMember,member,ownedElementandownedFeature/feature; the AST is untouched. #2410 landed theLibraryPackage,ExhibitStateUsage,IncludeUseCaseUsageandSuccessionFlowclassifications ondevelopwhile this PR was open; this head keeps that one implementation (isExhibitedState,isIncludedUseCase,ModInclude) and drops its own duplicate, so againstdevelopit adds the plainUsage, the two memberships and the FlowEnd members, plus the focused tests for all eight.UsageFormMetaclassNameis the one entry the query metamodel reads the form-selected usage metaclasses through (event, exhibit, include, prefix metadata), for declarations and library records alike;interface.gorecordsModExtendedUsage, so the interface format version moves to 25. Amessagemints no FlowEnds (SysML.xtextMessageEventMemberhas none).The synthesized elements carry ids on every surface: the RDF/API JSON exporter mints
<filter member>_filter, the symbolfacts element form reads it by node, and the id reader (export.ElementIDs,queryexec.ElementIDOf) records acalc/verificationbody result's expression parts like a constraint condition's (develop'sConstraintResultMemberwork had registered only the latter), so element-form@id, query results and the structure differential map them instead of answering empty or[unmapped]. The element form likewise answers an implied flow end, its ReferenceUsage and its ReferenceSubsetting from the slots the conversion mints (end0,end0.ff,end0.rs), mirroringqueryexec.#2244 (chained flow ends failing
validateConnectorRelatedFeatures) is fixed ondevelopby #2266's native FlowEnds; its reproducer self-checks clean on this head too (245 checks, 0 violations, 0 unevaluated).Related work: #2410 (the four classifications above), #2008 (the SysML
SuccessionFlowUsage), #2266 (native FlowEnds, closing #651's flow-end gap; this PR lists those ends as members).This head also contains #2002 and #2425, which precede it in the merge order because all three move
structure_differential_expected.txt; their commits leave this diff once they merge.Specification basis
SysML.xtext (pilot
2026-09):ExhibitStateUsage,IncludeUseCaseUsage,ExtendedUsage returns SysML::Usage(vsDefaultReferenceUsage returns SysML::ReferenceUsage),ResultExpressionMember,FlowEnd(FlowEndSubsetting),MessageEventMember; KerML.xtextLibraryPackage,SuccessionFlow,ElementFilterMember. KerML 1.1 8.2.4 (ElementFilterMembership), 8.3.4.7.6 (ResultExpressionMembership), 8.3.4.8.4 (FlowEnd,checkFlowEndRedefinition); SysML v2 8.3.6.10, 8.3.17.5, 8.3.21.4.One row added to
docs/project/spec-compliance/02-detailed-semantic-compliance-map/02-calculation.md(✅). The grammar-to-metaclass map is regenerated: theLibraryPackage,ExhibitStateUsageandIncludeUseCaseUsagedisagreements are gone.Known limitations, named here rather than left to discover: a flow's
connectorEnd/endFeaturestill answer the inherited Transfer ends ahead of its own; RDF for a KerML file keeps mappingsuccession flowtoFlowUsageas it maps every KerML feature to its SysML usage kind.How it was verified
internal/semantic/semantics/reflective_concrete_metaclasses_test.go: one exact-metaclass test per form (declaration and recorded-library paths, explicit and shorthandexhibit/include,libraryvs plain package,#M x;vs a barex;, SysML and KerML succession flows, filter/result membership chains and owners, distinct filter identities, a filter condition's scope before resolution).filtermembers minted conditions sharing one expression record (one identity for all of them, so the second condition's subtree was never compared), and before document resolution a condition's names resolved in the scope enclosing the namespace rather than its own; each condition now carries its position and resolves in its namespace, withTestElementFilterConditionsKeepDistinctIdentitiesandTestElementFilterConditionResolvesInItsNamespaceBeforeResolution(the structure differential'stests/testdataroot improves in 26 cells,parse/expressions.sysmlhaving five filters).elementform/element_identity_test.go(implied flow ends and their ReferenceSubsetting, filter conditions, constraint and calc results),queryexec/flow_end_ids_test.go(filter condition) andqueryexec/calc_result_ids_test.go,export/element_ids_reader_test.goandexport/element_ids_identity_test.go.TestExtendedDefinitionUsageMetaclassnow expectsUsage;tests/export/testdata/convert/end_prefix_metadata.golden.ttlmovessysml:ReferenceUsage→sysml:Usageforend #M x(3 lines, the only change).developrecording: structure differential (examples/matched 36647 → 39953;Flow::flowEndleaves the disagreement list,develophad equal 17 / different 38;Type::ownedEndFeaturedifferent 40 → 2;Expression::resultequal 3520 → 4105; therelatedFeaturemovement above),pilot-apijson-diff(typeMismatch 1838 → 1808, presentDifferent 147578 → 147550, pilotMissing 84347 → 84342, improvements only),derived-census(the walk now reaches the FlowEnd, filter-condition and body-result subtrees; the pilot columns do not move), grammar-metaclass map.pilot-differential-baseline.jsonandtraining_examples_expected.txtuntouched:pilot-diff -checkfails ondevelopitself since fix(check): reject KerML-only declaration keywords in SysML files by default #2275 (three spec-example cells), and that re-record is chore(baselines): re-record the pilot differential for the KerML declaration keyword error #2323's.go build ./... && go vet ./... && gofmt -l . && go test ./...with all sixOPENSYSML_REQUIRE_*corpus gates after their download scripts,tests/wasm(REPL 16,305,374 B, engine 11,104,766 B, core 7,488,741 B gzipped, under the budgets),make lint,make docs-counts,go test ./tests/hygiene,go test -C tools ./referee/apijson,pilot-apijson-diff -check,derived-census -check -require-exporter(JDK 21),go test -C tools ./referee/diff,scripts/check-doc-ids.py,scripts/changelog.py check, the comment-length scan;cmd/sysmlandtests/codegenre-run alone after a loaded box hit the 10m default.develop, feat(export): an expression's implied base completes its type and inherited family in the element form #2002 and SWF(bug): fix OwningMembership for a trigger's named payload #2425):go build ./...,go vet ./...,gofmt -l .,make lint, theinternal/semantic/...,internal/workspace/libs,internal/frontend/symbolfacts/...,internal/doc/queryexec,internal/translate/exportandtests/exportpackages with the corpus gates, andpilot-apijson-diff -check; the structure differential is re-recorded by tool on the combined tree (one cell beyond this PR's own movement:examples/pilot-corporaOwningMembership::ownedMemberElementIddifferent 32 → 33, where SWF(bug): fix OwningMembership for a trigger's named payload #2425's trigger-payload ownership meets the synthesized memberships). The full-suite and wasm figures above are from the last full local gate, before these merges.sysml -convert ttlon a probe with all eight forms states the metaclasses above;standard library packagestill warns;sysml -self-checkon the A flow with chained ends (flow from a.b.x to c.d.y) fails validateConnectorRelatedFeatures: the query leg answers no relatedFeature for it #2244 reproducer.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 changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/a37d687b08a14a4684e597b532b8dd66
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/a37d687b08a14a4684e597b532b8dd66?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work