Repository navigation
fix(grpc): GetElementProperties reads a model one document at a time - #2424
Merged
Merged
Conversation
A document the parser could not read whole, one the element form cannot write, or one declaring an element an earlier document already declares is left out of the model instead of refusing every element. The response lists the excluded documents (excluded_documents); an element of one answers that document's error and every other element is answered. Convert keeps refusing a model it cannot write whole. Fixes #2029. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…spell them Co-Authored-By: jason.han <hanhuijun@gmail.com>
This was referenced Nov 21, 2026
Merged
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
Fixes #2029. On
develop, when several documents are parsed as one model,GetElementPropertiesanswers the same error for every element of every document as soon as one document has a syntax error or declares a top-level name another document already declares. The issue was closed as completed, but the fix written for it (#2052, stacked on #2042) never merged.This PR lands that fix on its own, on
develop's current element-form reading:export.ReadableModelElementFormbuilds the API element form without the documents that cannot be read: one the parser could not read whole, one the form cannot write, and one whose ids an earlier document already declares. Every document is still analyzed with the model, so a value of a readable element can still name an excluded document's element.ConvertandModelElementFormare unchanged and keep refusing such a model whole.GetElementPropertiesResponse.excluded_documents(new field 4, messageExcludedDocument{document, error}) lists the documents left out, in document order, on every response; it is empty when the whole model was read.ElementProperties.ExcludedDocuments, Pythonexcluded_documents(and onConversionError), NodeexcludedDocuments, Rustexcluded_documents, JavaexcludedDocuments(), Juliaexcluded_documents, MATLABexcludedDocuments. The MCPelement_propertiestool returns it through protojson.Relation to #2052 and #2042
This supersedes #2052: same wire contract (
excluded_documents,ExcludedDocument), same client surface for Go, Python, Node and Rust, and its tests are carried over. It differs in where the exclusion is decided. #2052 decided it inCachedModel.documentExclusionsover the symbol index, on top of #2042's symbol-backed reader; here the export decides it while writing the form, becausedevelopstill reads the form, and the form refuses more collisions than top-level names (two documents each with an unnamed top-level member collide on@0, which the corpora test below found).When #2042 moves
GetElementPropertiesonto the symbol-backed structure, it reconciles in one file,internal/frontend/grpc/element_properties.go:ElementForm/documentExclusionshere are replaced by #2042'selementReader, which takes #2052'sdocumentExclusionsandexcludedmap. The proto, the generated stubs, the client changes andelement_properties_documents_test.gocarry over as they are.ReadableModelElementFormthen has no caller and can be removed with the form path.Specification basis
No specification clause changes. The row for
GetElementPropertiesindocs/project/spec-compliance/08-grpc-service-layer.mdnow states the per-document reading; its status is unchanged.How it was verified
The three-document check from #2029, with the Python client against
sysml-grpc:otherdevelop("c.sysml", "package C { part y }")ConversionError(c.sysml syntax error)x,excluded_documents == [c.sysml]("d.sysml", "package A { part z; }")ConversionError(same IRI)x,excluded_documents == [d.sysml]("v.sysml", "package V { part y : Missing; }")xx, nothing excludedTests added:
internal/frontend/grpc/element_properties_documents_test.go: the check above (TestElementPropertiesAnswerBesideAnExcludedDocument), the syntax-error, repeated-name, validation-error, shared-package and short-name cases from fix(grpc): GetElementProperties reads a model one document at a time #2052, and a value naming an excluded document's element.TestElementPropertiesAnswersEveryElementOfTheCorpora: the pilot corpora and the training examples as one model. 313 documents, 15 excluded, 8,733 elements answered, 92 answering their excluded document's error. It skips when the corpora are absent.Run locally:
go build ./...,go vet ./...,gofmt -l .clean;make proto-lint,make proto-breaking,make changelog-check,make spec-compliance-check,make docs-countspass.internal/frontend/grpc,tests/grpc,internal/translate/export,internal/frontend/mcp/...,tests/hygiene,client/opensysmland the rest of the frontend and translate packages pass. Python client 1841 passed, Node 502 passed, Rust and Java suites pass.Not verified locally:
go test ./...on a loaded machine, nine heavy packages (cmd/sysml,internal/exec/runtime,internal/exec/smt,tests/codegen,tests/corpus,tests/export,tests/migrate,tests/model,tests/wasm) hit the default 10-minute timeout mid-run without a failing test; CI runs them with its own 55-minute limit.make lintwas not run.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 changelogImplemented in session Re-test past grpc service and clients fixes (b)
Review with Devin · Open in Devin Desktop