From d4e211c6d36ec935e2973a3a5c5164b4d9fd9296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Thu, 19 Nov 2026 12:09:46 +0100 Subject: [PATCH] fix(automation): harden RPC coverage issues and failure reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three follow-ups from the review of the RPC coverage automation: - Text from core's proto comments is defused before it goes into an issue body: a zero-width space after @ and before a digit after # keeps GitHub from mentioning people or linking issues of this repository, and one inside `) is the issue's identity; an issue keeps the methods its marker lists, and new methods of a service join its open service issue. - Only issues the bot opened and that keep the `rpc-coverage` label count; a marker in any other issue is ignored. + Only issues the bot opened count, found by creator and marker rather than by label: a marker in any other issue is ignored, and an issue whose `rpc-coverage` label someone removed gets the label back instead of a duplicate. + Text from core's proto comments is defused before it goes into a body (`@name`, `#123`, and `\n\nCore `v0.2.0` has `OpenShell.ForwardTcp`, a user-facing RPC that the Go SDK does not wrap yet. First seen in core `v0.1.9`.\n\n**Buildable on `main`**: the generated bindings on the SDK's `main` already contain every method listed here.\n\n## `OpenShell.ForwardTcp`\n\nForwardTcp does something useful.\n\n- Streaming: unary\n- Authorization: `bearer`, scope `sandbox:read`, workspace role `user`\n- Definition: [`proto/openshell.proto`](https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12) at core `v0.2.0`\n- Generated bindings on the SDK's `main`: yes\n\n```proto\nrpc ForwardTcp(ForwardTcpRequest) returns (ForwardTcpResponse) {}\n```\n\nRequest and response messages:\n\n```proto\nmessage ForwardTcpRequest {\n string name = 1;\n}\n```\n\n```proto\nmessage ForwardTcpResponse {}\n```\n\n## Where core implements it\n\n### `OpenShell.ForwardTcp`\n\n- Server (`crates/openshell-server/src`): [`crates/openshell-server/src/grpc/mod.rs`](https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs)\n- Rust SDK (`crates/openshell-sdk/src`): not found\n- TypeScript SDK (`sdk/typescript/src`): not found\n\n## Implementation brief\n\nCopy this block as the task description when you start the work.\n\n````text\nWrap the OpenShell.ForwardTcp RPC of OpenShell core in the OpenShell Go SDK (https://github.com/ai-openshell/sdk-go).\n\nCore version: NVIDIA/OpenShell at tag v0.2.0.\nBranch: start from main; its generated bindings already contain the methods.\n\nRead first:\n- AGENTS.md and CONTRIBUTING.md in the SDK repository: conventions, commands, and commit rules.\n- OpenShell.ForwardTcp: proto definition https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12; core server: https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs\n- The pattern to follow: the sub-client in openshell/v1/service_client.go, its types in openshell/v1/types/service.go, its converter in openshell/v1/internal/converter/service.go, and its fake in openshell/v1/fake/service.go.\n\nDeliverables:\n- The method in openshell/v1, on the sub-client that fits it, behind its interface like the other sub-client methods.\n- Domain types in openshell/v1/types/ without proto imports.\n- Converters in openshell/v1/internal/converter/ that deep-copy slices and maps.\n- The fake implementation in openshell/v1/fake/.\n- Unit tests with bufconn and testify.\n- Documentation: a page under docs/src/api/ (like docs/src/api/services.md) with its entry in docs/src/SUMMARY.md, or an update of the existing page.\n\nDone when `mise run ci` passes. Use Conventional Commits and sign off every commit.\n````\n\n## About this issue\n\nThe RPC coverage automation (`hack/automation/rpc-issues.sh`, run by the hourly core-watch workflow) opened this issue and keeps it in sync with the newest core release tag.\nIt rewrites this description when the definition or the buildability changes, and closes the issue when the SDK covers every method listed here under `openshell/v1`, when core removes them or makes them internal, or when they are listed with a reason in [`hack/automation/rpc-exceptions.txt`](https://github.com/ai-openshell/sdk-go/blob/main/hack/automation/rpc-exceptions.txt).\nAn issue closed by hand stays closed. Reopen it by hand to keep it open while the automation considers the methods covered.", + "labels": [], + "last_actor_is_bot": null, + "last_event": null, + "number": 20, + "state": "OPEN", + "title": "t" + } + ], + "max_new": 10, + "repo": "ai-openshell/sdk-go", + "rpcs": [ + { + "auth_mode": "bearer", + "client_streaming": false, + "comment": "GetSandbox does something useful.", + "file": "openshell.proto", + "global_role": null, + "messages": [ + { + "name": "openshell.v1.GetSandboxRequest", + "source": "message GetSandboxRequest {\n string name = 1;\n}" + }, + { + "name": "openshell.v1.GetSandboxResponse", + "source": "message GetSandboxResponse {}" + } + ], + "method": "GetSandbox", + "proto_url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12", + "request": "openshell.v1.GetSandboxRequest", + "response": "openshell.v1.GetSandboxResponse", + "rust_sdk_refs": [], + "scope": "sandbox:read", + "server_refs": [ + { + "path": "crates/openshell-server/src/grpc/mod.rs", + "url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs" + } + ], + "server_streaming": false, + "service": "OpenShell", + "signature": "rpc GetSandbox(GetSandboxRequest) returns (GetSandboxResponse) {}", + "ts_sdk_refs": [], + "workspace_role": "user" + }, + { + "auth_mode": "bearer", + "client_streaming": false, + "comment": "ForwardTcp does something useful.", + "file": "openshell.proto", + "global_role": null, + "messages": [ + { + "name": "openshell.v1.ForwardTcpRequest", + "source": "message ForwardTcpRequest {\n string name = 1;\n}" + }, + { + "name": "openshell.v1.ForwardTcpResponse", + "source": "message ForwardTcpResponse {}" + } + ], + "method": "ForwardTcp", + "proto_url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12", + "request": "openshell.v1.ForwardTcpRequest", + "response": "openshell.v1.ForwardTcpResponse", + "rust_sdk_refs": [], + "scope": "sandbox:read", + "server_refs": [ + { + "path": "crates/openshell-server/src/grpc/mod.rs", + "url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs" + } + ], + "server_streaming": false, + "service": "OpenShell", + "signature": "rpc ForwardTcp(ForwardTcpRequest) returns (ForwardTcpResponse) {}", + "ts_sdk_refs": [], + "workspace_role": "user" + } + ], + "services_bound": [ + "OpenShell" + ], + "tag": "v0.2.0" +} diff --git a/hack/automation/testdata/rpc-issues/planner/label-removed/input.json.license b/hack/automation/testdata/rpc-issues/planner/label-removed/input.json.license new file mode 100644 index 0000000..2137e95 --- /dev/null +++ b/hack/automation/testdata/rpc-issues/planner/label-removed/input.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: Apache-2.0 diff --git a/hack/automation/testdata/rpc-issues/planner/untrusted-text/expected.json b/hack/automation/testdata/rpc-issues/planner/untrusted-text/expected.json new file mode 100644 index 0000000..0c97e0a --- /dev/null +++ b/hack/automation/testdata/rpc-issues/planner/untrusted-text/expected.json @@ -0,0 +1,13 @@ +[ + { + "action": "open", + "body": "\n\nCore `v0.2.0` has `OpenShell.ForwardTcp`, a user-facing RPC that the Go SDK does not wrap yet. First seen in core `v0.2.0`.\n\n**Buildable on `main`**: the generated bindings on the SDK's `main` already contain every method listed here.\n\n## `OpenShell.ForwardTcp`\n\nForwards a port. Ask @​octocat, see #​123 and owner/repo#​45.\n<​!-- hidden part -->Still visible.\n\n- Streaming: unary\n- Authorization: `bearer`, scope `sandbox:read`, workspace role `user`\n- Definition: [`proto/openshell.proto`](https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12) at core `v0.2.0`\n- Generated bindings on the SDK's `main`: yes\n\n```proto\nrpc ForwardTcp(ForwardTcpRequest) returns (ForwardTcpResponse) {}\n```\n\nRequest and response messages:\n\n````proto\nmessage ForwardTcpRequest {\n // Format: ```host:port```\n string name = 1;\n}\n````\n\n```proto\nmessage ForwardTcpResponse {}\n```\n\n## Where core implements it\n\n### `OpenShell.ForwardTcp`\n\n- Server (`crates/openshell-server/src`): [`crates/openshell-server/src/grpc/mod.rs`](https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs)\n- Rust SDK (`crates/openshell-sdk/src`): not found\n- TypeScript SDK (`sdk/typescript/src`): not found\n\n## Implementation brief\n\nCopy this block as the task description when you start the work.\n\n````text\nWrap the OpenShell.ForwardTcp RPC of OpenShell core in the OpenShell Go SDK (https://github.com/ai-openshell/sdk-go).\n\nCore version: NVIDIA/OpenShell at tag v0.2.0.\nBranch: start from main; its generated bindings already contain the methods.\n\nRead first:\n- AGENTS.md and CONTRIBUTING.md in the SDK repository: conventions, commands, and commit rules.\n- OpenShell.ForwardTcp: proto definition https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12; core server: https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs\n- The pattern to follow: the sub-client in openshell/v1/service_client.go, its types in openshell/v1/types/service.go, its converter in openshell/v1/internal/converter/service.go, and its fake in openshell/v1/fake/service.go.\n\nDeliverables:\n- The method in openshell/v1, on the sub-client that fits it, behind its interface like the other sub-client methods.\n- Domain types in openshell/v1/types/ without proto imports.\n- Converters in openshell/v1/internal/converter/ that deep-copy slices and maps.\n- The fake implementation in openshell/v1/fake/.\n- Unit tests with bufconn and testify.\n- Documentation: a page under docs/src/api/ (like docs/src/api/services.md) with its entry in docs/src/SUMMARY.md, or an update of the existing page.\n\nDone when `mise run ci` passes. Use Conventional Commits and sign off every commit.\n````\n\n## About this issue\n\nThe RPC coverage automation (`hack/automation/rpc-issues.sh`, run by the hourly core-watch workflow) opened this issue and keeps it in sync with the newest core release tag.\nIt rewrites this description when the definition or the buildability changes, and closes the issue when the SDK covers every method listed here under `openshell/v1`, when core removes them or makes them internal, or when they are listed with a reason in [`hack/automation/rpc-exceptions.txt`](https://github.com/ai-openshell/sdk-go/blob/main/hack/automation/rpc-exceptions.txt).\nAn issue closed by hand stays closed. Reopen it by hand to keep it open while the automation considers the methods covered.", + "group": "method:OpenShell.ForwardTcp", + "labels": [ + "help wanted", + "rpc-coverage", + "rpc:ready" + ], + "title": "feat(sdk): wrap OpenShell.ForwardTcp (core v0.2.0)" + } +] diff --git a/hack/automation/testdata/rpc-issues/planner/untrusted-text/expected.json.license b/hack/automation/testdata/rpc-issues/planner/untrusted-text/expected.json.license new file mode 100644 index 0000000..2137e95 --- /dev/null +++ b/hack/automation/testdata/rpc-issues/planner/untrusted-text/expected.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: Apache-2.0 diff --git a/hack/automation/testdata/rpc-issues/planner/untrusted-text/input.json b/hack/automation/testdata/rpc-issues/planner/untrusted-text/input.json new file mode 100644 index 0000000..e0f1734 --- /dev/null +++ b/hack/automation/testdata/rpc-issues/planner/untrusted-text/input.json @@ -0,0 +1,95 @@ +{ + "built": [ + "OpenShell.GetSandbox", + "OpenShell.ForwardTcp" + ], + "bump_branch_exists": true, + "core_repo": "NVIDIA/OpenShell", + "covered": [ + "OpenShell.GetSandbox" + ], + "exceptions": [], + "generated_files": [ + "openshell.proto", + "datamodel.proto", + "sandbox.proto", + "options.proto" + ], + "issues": [], + "max_new": 10, + "repo": "ai-openshell/sdk-go", + "rpcs": [ + { + "auth_mode": "bearer", + "client_streaming": false, + "comment": "GetSandbox does something useful.", + "file": "openshell.proto", + "global_role": null, + "messages": [ + { + "name": "openshell.v1.GetSandboxRequest", + "source": "message GetSandboxRequest {\n string name = 1;\n}" + }, + { + "name": "openshell.v1.GetSandboxResponse", + "source": "message GetSandboxResponse {}" + } + ], + "method": "GetSandbox", + "proto_url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12", + "request": "openshell.v1.GetSandboxRequest", + "response": "openshell.v1.GetSandboxResponse", + "rust_sdk_refs": [], + "scope": "sandbox:read", + "server_refs": [ + { + "path": "crates/openshell-server/src/grpc/mod.rs", + "url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs" + } + ], + "server_streaming": false, + "service": "OpenShell", + "signature": "rpc GetSandbox(GetSandboxRequest) returns (GetSandboxResponse) {}", + "ts_sdk_refs": [], + "workspace_role": "user" + }, + { + "auth_mode": "bearer", + "client_streaming": false, + "comment": "Forwards a port. Ask @octocat, see #123 and owner/repo#45.\nStill visible.", + "file": "openshell.proto", + "global_role": null, + "messages": [ + { + "name": "openshell.v1.ForwardTcpRequest", + "source": "message ForwardTcpRequest {\n // Format: ```host:port```\n string name = 1;\n}" + }, + { + "name": "openshell.v1.ForwardTcpResponse", + "source": "message ForwardTcpResponse {}" + } + ], + "method": "ForwardTcp", + "proto_url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/proto/openshell.proto#L10-L12", + "request": "openshell.v1.ForwardTcpRequest", + "response": "openshell.v1.ForwardTcpResponse", + "rust_sdk_refs": [], + "scope": "sandbox:read", + "server_refs": [ + { + "path": "crates/openshell-server/src/grpc/mod.rs", + "url": "https://github.com/NVIDIA/OpenShell/blob/v0.2.0/crates/openshell-server/src/grpc/mod.rs" + } + ], + "server_streaming": false, + "service": "OpenShell", + "signature": "rpc ForwardTcp(ForwardTcpRequest) returns (ForwardTcpResponse) {}", + "ts_sdk_refs": [], + "workspace_role": "user" + } + ], + "services_bound": [ + "OpenShell" + ], + "tag": "v0.2.0" +} diff --git a/hack/automation/testdata/rpc-issues/planner/untrusted-text/input.json.license b/hack/automation/testdata/rpc-issues/planner/untrusted-text/input.json.license new file mode 100644 index 0000000..2137e95 --- /dev/null +++ b/hack/automation/testdata/rpc-issues/planner/untrusted-text/input.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: Apache-2.0 diff --git a/hack/automation/update-drift-issue.sh b/hack/automation/update-drift-issue.sh index 61334fe..621ba32 100755 --- a/hack/automation/update-drift-issue.sh +++ b/hack/automation/update-drift-issue.sh @@ -37,7 +37,7 @@ header=$(head -1 <<<"$text") # issues cannot be listed, the report goes out without them. issues_file=$(mktemp) trap 'rm -f "$issues_file"' EXIT -if gh api --paginate "repos/$sdk_repo/issues?labels=rpc-coverage&state=open&per_page=100" \ +if gh api --paginate "$(rpc_bot_issues_url "$sdk_repo" "${BOT_LOGIN:-ai-openshell-sdk-go[bot]}" open)" \ --jq '.[] | select(.pull_request == null) | {number, body, author: .user.login}' | rpc_bot_issues "${BOT_LOGIN:-ai-openshell-sdk-go[bot]}" >"$issues_file" && linked=$(link_uncovered_rpcs "$issues_file" "$text"); then