feat(grpc): carry the diagnostic code on the wire - #124
Merged
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
|
End-to-end check of the wire field against a rebuilt local
Controls: resolved type, safe guard, single transition, clean model and no-op action emitted no diagnostics; division by zero in the first evaluated guard stays an execution error. Python Not exercised live: no current producer emits an uncoded diagnostic, so the empty-code path was checked only through serialization. |
devin-ai-integration
Bot
force-pushed
the
fix/diagnostic-wire-code
branch
from
September 8, 2026 13:30
ca22d60 to
f38f323
Compare
Diagnostic gains string code = 4, populated from passes.Diagnostic.Code in every conversion so clients branch on a stable identifier instead of a message prefix. The Go, Python, Node, Rust and Java clients expose it. Co-Authored-By: jason.han <[email protected]>
A service that populates Diagnostic.code advertises diagnostic_codes, so a client can tell an uncoded finding from a service that carries no code at all. Without the capability every code crosses empty; every response family that carries diagnostics is gated the same way. The Go, Python, Node and Java clients name the capability. Co-Authored-By: jason.han <[email protected]>
devin-ai-integration
Bot
force-pushed
the
fix/diagnostic-wire-code
branch
2 times, most recently
from
September 8, 2026 14:04
f38f323 to
22b8e1a
Compare
…mment Co-Authored-By: jason.han <[email protected]>
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
The gRPC/Connect
Diagnosticmessage carried onlyseverity,messageandspan, so a client that wanted to tell a choice point from a guard note, or an unresolved name from a type error, had to match message prefixes. The runtime already assigns a stable identifier,passes.Diagnostic.Code, andDiagnosticToProto,RunNoteDiagnosticsToProtoandParserDiagnosticToProtodropped it.api/proto/sysml.proto:message Diagnosticgainsstring code = 4;(additive;make proto-breakingagainstorigin/mainpasses). Go, Java, Python, TypeScript and Rust stubs plus the Rust descriptor are regenerated with the repo's pinned generators.internal/grpc/convert.go: every conversion copies the code. Parser errors are codedsyntaxbyParserDiagnosticToProto, the same code the workspace and REPL give them (the parser codes only its warnings; seeparser.Diagnostic.Code).export.gocodes aConvertinput's syntax errors the same way.internal/core/edit/validate.gonow gives an edit's parse errors thesyntaxcode too, as the other reporters do, soApplyEditsrefusals cross coded rather than empty. No runtime behaviour or code constant changes.client/opensysml(Diagnostic.Code), Python (Diagnostic.code), Node (ModelDiagnostic.code), Rust (Diagnostic.code), Java (Diagnosticrecord gainscode;ModelExceptionserializes it and itsserialVersionUIDmoves to 2). The Go and Java conformance renderers round-trip the field.docs/reference/wire-contract.mdgets a Diagnostic field table,codein the examples, and the execution section now says the two run notes are distinguished bychoice-point/guard-unevaluable, not by prefix;docs/reference/api.md; Python, Node and Java READMEs.changes/unreleased/diagnostic-wire-code.added.md.A diagnostic whose producer assigned no code sends
""(omitted in JSON); the wire contract documents that.diagnostic_codes: a service that populatesDiagnostic.codeadvertises it inServerInfo.capabilities, so a client can tell a finding that was assigned no code from a service that carries no code at all. Every response family that carries diagnostics passes throughService.filterDiagnosticCapabilities, which clears the code when the capability is withheld and leaves everything else untouched. The proto comment,service-transports.mdcapability table, wire contract and client READMEs describe it; Go (CapabilityDiagnosticCodes), Python (CAPABILITY_DIAGNOSTIC_CODES), Node (CAPABILITY_DIAGNOSTIC_CODES) and Java (Capabilities.DIAGNOSTIC_CODES) name it (the Rust client takes capability names as strings).How it was verified
New
internal/grpc/diagnostic_code_test.goasserts the code round-trips on ParseFile, ParseSources, GetDiagnostics-style validation codes, Evaluate, ExecuteAction (choice-point,guard-unevaluable), ExecuteState (choice-point), RunAnalysis (choice-point), Convert and ApplyEdits;TestDiagnosticCodes_Capabilityruns each family against a current and a capability-withheld service and checks the withheld one reports the same diagnostics with the code cleared, whileTestCapabilitiescovers the advertisement. One handwritten-wrapper test per client: Go (TestADiagnosticCarriesItsCode), Python (test_diagnostic_code), Node (client.test.ts), Rust (a_diagnostic_carries_its_code), Java (PublicTypesTest.diagnosticCarriesTheWireCode).The Java Maven suite could not be run locally (Maven Central answered 429 for every dependency fetch); it relies on the CI 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 changelog