Skip to content

fix(grpc): GetElementProperties reads a model one document at a time - #2424

Merged
HuiJun merged 2 commits into
developfrom
fix/element-properties-per-document
Nov 20, 2026
Merged

HuiJun merged 2 commits into
developfrom
fix/element-properties-per-document

Conversation

@HuiJun

@HuiJun HuiJun commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Fixes #2029. On develop, when several documents are parsed as one model, GetElementProperties answers 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.ReadableModelElementForm builds 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. Convert and ModelElementForm are unchanged and keep refusing such a model whole.
  • GetElementPropertiesResponse.excluded_documents (new field 4, message ExcludedDocument{document, error}) lists the documents left out, in document order, on every response; it is empty when the whole model was read.
  • A request for an element of an excluded document answers that document's error; every other element is answered. A name two documents declare is read from the document the model is read with. A validation error alone excludes nothing.
  • Clients expose the list: Go ElementProperties.ExcludedDocuments, Python excluded_documents (and on ConversionError), Node excludedDocuments, Rust excluded_documents, Java excludedDocuments(), Julia excluded_documents, MATLAB excludedDocuments. The MCP element_properties tool 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 in CachedModel.documentExclusions over the symbol index, on top of #2042's symbol-backed reader; here the export decides it while writing the form, because develop still 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 GetElementProperties onto the symbol-backed structure, it reconciles in one file, internal/frontend/grpc/element_properties.go: ElementForm/documentExclusions here are replaced by #2042's elementReader, which takes #2052's documentExclusions and excluded map. The proto, the generated stubs, the client changes and element_properties_documents_test.go carry over as they are. ReadableModelElementForm then has no caller and can be removed with the form path.

Specification basis

No specification clause changes. The row for GetElementProperties in docs/project/spec-compliance/08-grpc-service-layer.md now 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:

m = opensysml.parse_sources([("a.sysml", "package A { part x; }"), other])
m.element_properties("A::x", "name")
other develop this branch
("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; }") x x, nothing excluded

Tests 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.
  • The same check through the Go client (both transports), the Python client and the Node client against a live service; decode tests for Rust, Java, Julia and MATLAB.

Run locally: go build ./..., go vet ./..., gofmt -l . clean; make proto-lint, make proto-breaking, make changelog-check, make spec-compliance-check, make docs-counts pass. internal/frontend/grpc, tests/grpc, internal/translate/export, internal/frontend/mcp/..., tests/hygiene, client/opensysml and the rest of the frontend and translate packages pass. Python client 1841 passed, Node 502 passed, Rust and Java suites pass.

Not verified locally:

  • In a whole-repository 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 lint was not run.
  • The MATLAB decode test was not run (no MATLAB or Octave available), and the Julia suite could not be re-run after the change.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

QA Engineer opened this PR for Jason
Implemented in session Re-test past grpc service and clients fixes (b)
Review with Devin · Open in Devin Desktop


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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

…spell them

Co-Authored-By: jason.han <hanhuijun@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@HuiJun
HuiJun added this pull request to the merge queue Nov 20, 2026
Merged via the queue into develop with commit fe073d0 Nov 20, 2026
33 checks passed
@HuiJun
HuiJun deleted the fix/element-properties-per-document branch November 20, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetElementProperties answers nothing for a model when one document has an error or a duplicate top-level name

1 participant