Skip to content

feat(edit): expose connection authoring through ApplyEdits and the clients - #609

Merged
HuiJun merged 4 commits into
developfrom
feature/apply-edits-add-connection
Sep 26, 2026
Merged

HuiJun merged 4 commits into
developfrom
feature/apply-edits-add-connection

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Closes #599 and #601. The edit layer already writes connection-like usages (edit.OpAddConnection, used by the LSP), but ApplyEdits had no operation for them, so the Python, Go and Java clients couldn't author an allocation or a flow. add_member(kind="allocate") was never the right path: an allocation or flow is a connection between two feature ends, not a named member.

This PR exposes the existing operation. The edit-layer writer is unchanged.

message EditOperation { oneof operation { ...; AddConnectionEdit add_connection = 6; } }
message AddConnectionEdit { string owner = 1; string kind = 2; string from_end = 3; string to_end = 4; string name = 5; string type = 6; }
  • gRPC: add_connection maps to edit.AddConnection(owner, kind, from, to, name) with Type. It requires authoring plus a new connection_authoring capability. An older service advertises authoring but can't decode oneof arm 6, so the extra capability lets a client refuse locally instead of getting INVALID_ARGUMENT for an unset operation. The Go, Python and Java clients check both before sending.
  • Python: Editor.add_connection(owner, kind, from_, to, name=None, type=None), plus add_allocation(owner, from_, to, ...) and add_flow(owner, from_, to, ...). The fields are from_end/to_end because from is a Python keyword.
  • Go: opensysml.AddConnection{Owner, Kind, From, To, Name, Type}. Java: Edit.AddConnection.of(owner, kind, from, to).withName(..).withType(..).
  • Stubs regenerated for Go, Python, Java, TypeScript and Rust with make proto.

Example: model.edit().add_allocation("Demo::System", "a", "b", name="alloc1").apply() inserts allocation alloc1 allocate a to b;, and add_flow("Demo::System", "tank.fuelOut", "engine.fuelIn") inserts flow from tank.fuelOut to engine.fuelIn;.

Specification basis

The written forms are the ones the edit layer already produces, and each is a production of the pinned SysML v2 grammar: AllocationUsage (allocation [decl] allocate a to b), FlowConnectionUsage (flow [decl] from a to b), ConnectionUsage/InterfaceUsage (connect a to b), BindingConnectorAsUsage (bind a = b), SuccessionAsUsage (first a then b), plus the KerML Connector/BindingConnector/ItemFlow/Succession forms. A type is accepted only for kinds whose declaration admits one, so succession with a type is refused as an illegal kind. Every edit is re-parsed and re-analysed, and an edit that introduces errors (for example an unresolved end) is refused. No spec-compliance rows move.

How it was verified

  • go test ./internal/frontend/grpc/... ./internal/check/edit/... ./client/opensysml/... ./tests/grpc/... and go test -C tools ./cmd/conformance/.... New tests: allocation, flow and typed-connection round trips; refusals for an unknown kind, a type on a succession and an unresolved end; the authoring and connection_authoring gates (the service refuses add_connection without connection_authoring while add_member still works, and each client refuses before sending); a golden add_connection case.
  • Python test_edit.py / test_wire_compat.py (100 passed), including a live allocation round trip against sysml-grpc.
  • Java EditProtosTest and build. Java conformance: 260 passed, 0 failed, 10 skipped, including the new apply_edits/an_allocation_is_written_between_two_features scenario. Node and Rust runners skip ApplyEdits scenarios, as before.
  • make lint, make docs-check, python3 scripts/changelog.py check, make proto-lint proto-breaking (additive only), git diff --check.

Checklist

  • make test and make lint pass locally (make lint and the focused suites above; the full make test is left to CI)
  • 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 (no gate count moved)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

devin-ai-integration Bot and others added 2 commits September 26, 2026 01:52
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…e attribute

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

Copy link
Copy Markdown
Contributor Author

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

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review September 26, 2026 02:44
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit 865ed07 into develop Sep 26, 2026
18 checks passed
@HuiJun
HuiJun deleted the feature/apply-edits-add-connection branch September 26, 2026 03:46
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.

Editor.add_member() does not support 'allocate' (AllocationUsage authoring)

1 participant