diff --git a/hack/automation/README.md b/hack/automation/README.md index 77f3743..63914d6 100644 --- a/hack/automation/README.md +++ b/hack/automation/README.md @@ -18,10 +18,10 @@ Workflows run them with a token of the `ai-openshell-sdk-go` GitHub App (`ai-ope | `rpc-marker.jq` | | The hidden issue marker, parsed by `rpc-issues.jq` and `update-drift-issue.sh` (jq module). | | `rpc-issue-body.md` | | Issue body template for `rpc-issues.jq`. | | `rpc-coverage.sh` | | The coverage rule shared by `rpc-issues.sh` and `drift-check.sh` (sourced, not run). | -| `rpc-issues-lib.sh` | | Exceptions list parser (sourced, not run). | +| `rpc-issues-lib.sh` | | Exceptions list parser and helpers for listing the bot's issues (sourced, not run). | | `rpc-exceptions.txt` | | RPCs the SDK deliberately does not wrap, one `Service.Method reason` per line. | | `rpc-issues-test.sh [--update]` | | Offline planner, `rpc-issues.sh --plan-input`, coverage, exceptions, and drift link tests on `testdata/rpc-issues/`; part of `workflows:check`. | -| `report-failure.sh ` | | Append a dated failure line to the drift issue. Called from `if: failure()` steps. | +| `report-failure.sh ` | | Record a failed run in the drift issue: one dated line per job and day, with the latest run and a count when the job fails again that day. Called from `if: failure()` steps. | | `drift-issue.sh` | | Shared helpers for the two drift issue scripts (sourced, not run). | | `start-gateway.sh `, `stop-gateway.sh` | | Run the published gateway container for a core version with the Docker driver and a plaintext endpoint for the E2E lane, and collect its log. | @@ -42,7 +42,8 @@ Workflows run them with a token of the `ai-openshell-sdk-go` GitHub App (`ai-ope - **Coverage**: an RPC is covered when a package under `openshell/v1` (tests and `fake/` excluded) that calls `NewClient(` also calls `.(` (`rpc-coverage.sh`, also used by `drift-check.sh`). - **Grouping**: when the SDK wraps none of a service's user-facing methods, one issue tracks the whole service; otherwise each method gets its own issue. The hidden marker on the first body line (``) 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