Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a879f39
feat(automation): decide RPC coverage per service
rhuss Nov 18, 2026
f2867cd
test(automation): add the RPC coverage issue test runner
rhuss Nov 18, 2026
23d3583
feat(automation): plan RPC coverage issues per service and method
rhuss Nov 18, 2026
82d62df
fix(automation): parse service names starting with New, fetch actors …
rhuss Nov 18, 2026
c6252ea
feat(automation): add rpc-issues.sh to reconcile RPC coverage issues
rhuss Nov 18, 2026
25d8165
test(automation): add planner fixtures for new coverage issues
rhuss Nov 18, 2026
c16b55e
feat(automation): render complete RPC coverage issue bodies
rhuss Nov 18, 2026
1ba712c
feat(automation): update RPC coverage issues when their content changes
rhuss Nov 18, 2026
0e1516a
fix(automation): describe partially wrapped services and new proto fi…
rhuss Nov 18, 2026
3563372
feat(automation): close and reopen RPC coverage issues
rhuss Nov 18, 2026
a5b2bd9
test(automation): add lifecycle fixtures for RPC coverage issues
rhuss Nov 18, 2026
8230d54
ci: reconcile RPC coverage issues in core-watch
rhuss Nov 18, 2026
f10167e
feat(automation): link uncovered RPCs in the drift issue to coverage …
rhuss Nov 18, 2026
36e4068
docs(automation): document the RPC coverage issues
rhuss Nov 18, 2026
02f7d4f
fix(automation): harden RPC coverage issue discovery and parsing
rhuss Nov 18, 2026
e93773b
docs(automation): describe bot-owned coverage issues and new tests
rhuss Nov 18, 2026
fe5909c
fix(automation): apply RPC coverage plans only as the bot
rhuss Nov 18, 2026
d28d883
fix(automation): ignore comments and strings when counting proto rpcs
rhuss Nov 18, 2026
56e941b
fix(automation): require the bot identity to apply RPC coverage plans
rhuss Nov 18, 2026
1654704
test(automation): test the input rows built from core's buf image
rhuss Nov 18, 2026
22c49b6
fix(automation): accept proto services without methods
rhuss Nov 18, 2026
d4e211c
fix(automation): harden RPC coverage issues and failure reporting
rhuss Nov 19, 2026
9e0ab37
fix(automation): count RPCs passed as method values as covered
rhuss Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/core-watch.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Opens one update proposal per new core release tag (hack/automation/).
# Opens one update proposal per new core release tag, then reconciles the RPC
# coverage issues against the newest core tag (hack/automation/).
name: core-watch

on:
Expand All @@ -13,6 +14,10 @@ on:
description: Core tag to propose (vX.Y.Z or vX.Y.Z-pre.N); empty proposes every new tag
required: false
default: ""
max_new_issues:
description: Limit for new RPC coverage issues in this run (default 10)
required: false
default: ""

permissions:
contents: read
Expand Down Expand Up @@ -81,6 +86,17 @@ jobs:
hack/automation/open-bump-pr.sh "$t"
done

# Runs after a failed proposal step too, so issues can say that the
# proposal is pending; it needs only the bot token.
- name: Reconcile RPC coverage issues
if: ${{ !cancelled() && steps.app-token.outcome == 'success' }}
timeout-minutes: 10
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
MAX_NEW: ${{ inputs.max_new_issues }}
run: BOT_LOGIN="${APP_SLUG}[bot]" hack/automation/rpc-issues.sh ${MAX_NEW:+--max-new "$MAX_NEW"}

- name: Report failure
if: failure()
env:
Expand Down
35 changes: 32 additions & 3 deletions hack/automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,43 @@ Workflows run them with a token of the `ai-openshell-sdk-go` GitHub App (`ai-ope
| `bump-pr-body.md` | | PR body template for `open-bump-pr.sh`. |
| `tag-release.sh [--dry-run]` | `release:tag` | After a stable pin lands on `main`: create the lockstep tag `vX.Y.Z` and the GitHub release, then ask the Go module proxy for the version. |
| `drift-check.sh --out <file>` | `core:drift` | Compare core `main` against the pin: `buf breaking`, regenerate and build, uncovered RPCs. Writes the markdown report. |
| `update-drift-issue.sh <report.md>` | | Create, update, or close the single `Core main drift` issue from a report. |
| `report-failure.sh <job> <run-url>` | | Append a dated failure line to the drift issue. Called from `if: failure()` steps. |
| `update-drift-issue.sh <report.md>` | | Create, update, or close the single `Core main drift` issue from a report; uncovered RPCs link to their open RPC coverage issues. |
| `rpc-issues.sh [--dry-run] [--max-new <n>] [--tag <tag>]` | `core:rpc-issues` | Open, update, close, and reopen one issue per user-facing core RPC (or service) the SDK does not wrap, for the newest core tag. `BOT_LOGIN` names the bot (default `ai-openshell-sdk-go[bot]`); `--plan-input <file>` plans a saved input document, `--dump-input <file>` saves one. |
| `rpc-issues.jq` | | The planner for `rpc-issues.sh`: input document in, actions and rendered bodies out; no network. |
| `rpc-rows.jq` | | Turns core's buf image and proto sources into the planner's input rows (signatures, comments, messages, links). |
| `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 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 <job> <run-url>` | | 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 <core-semver>`, `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. |

| Workflow | Script |
|----------|--------|
| `core-watch.yml` (hourly) | `core-tags.sh`, then `open-bump-pr.sh` per tag |
| `core-watch.yml` (hourly) | `core-tags.sh`, then `open-bump-pr.sh` per tag, then `rpc-issues.sh` |
| `release-tag.yml` (push to `main`) | `tag-release.sh` |
| `core-drift.yml` (nightly) | `drift-check.sh`, then `update-drift-issue.sh` |
| `e2e.yml` (reusable) | `start-gateway.sh`, `mise run e2e`, `stop-gateway.sh` |

## RPC coverage issues

`rpc-issues.sh` keeps one GitHub issue (label `rpc-coverage`) per core RPC that end users can call and the SDK does not wrap yet, so every gap has an owner and a ready implementation brief.

- **Selection**: it reads core's protos at the newest core release tag (pre-release or stable, as `core-tags.sh` orders them).
An RPC is user-facing when its authorization annotation has `auth_mode` `bearer` or `dual`; a method without an annotation counts only in a proto file the gateway serves (one with annotated methods), and its issue says the annotation is missing.
Plugin and driver protos, and `sandbox`, `peer`, `supervisor`, `operator`, and `unauthenticated` RPCs, never get issues.
- **Coverage**: an RPC is covered when a package under `openshell/v1` (tests and `fake/` excluded) that calls `New<Service>Client(` also calls `.<Method>(` (`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 (`<!-- rpc-coverage: kind=... -->`) 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 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 `<!--` get a zero-width space), so it cannot mention people, link issues of this repository, or hide the rest of the body.
- **Lifecycle**: each run opens missing issues, rewrites a body or the `rpc:ready` / `rpc:blocked` label when they change, closes an issue with a reason per method (`covered`, `removed`, `excepted`, `not-user-facing`, or `tracked-elsewhere` when another issue's marker lists the method), and reopens an issue it closed itself when the methods apply again.
An issue a maintainer closes stays closed (a closed service issue silences the whole service); an issue a maintainer reopens is never closed as `covered` again.
- **Excluding an RPC**: add `Service.Method reason` to `rpc-exceptions.txt`; the next run closes its issue with the reason.
- **Limit**: a run that would open more than 10 issues fails before any write and lists them.
If they are expected, run core-watch by hand with the input `max_new_issues`, or locally `mise run core:rpc-issues -- --max-new <n>`.
- **Preview**: `mise run core:rpc-issues -- --dry-run` prints every planned action with its body and changes nothing (it reads GitHub, so `gh` must be logged in).
Without `--dry-run`, the script applies the plan only with an explicit `BOT_LOGIN` and the bot's token (core-watch passes both); under a person's `gh` login it stops before any write, because later runs would not manage the issues it opened.
30 changes: 17 additions & 13 deletions hack/automation/drift-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
# 2. regenerate and build: bindings from core main in a temporary
# worktree, then go build ./... && go vet ./...
# 3. uncovered RPCs: methods in the regenerated proto/openshellv1 gRPC
# stubs that no SDK code under openshell/v1 calls (fakes and tests
# excluded); informational, it does not fail the check
# stubs that the SDK does not cover, decided per service by
# rpc-coverage.sh (fakes and tests excluded); informational, it does
# not fail the check
# Writes a markdown report with the header
# "Pin: <tag> | Core main: <sha> | Result: pass|fail" and one section per
# check. Exits 0 when checks 1 and 2 pass, 1 otherwise.
set -euo pipefail
# shellcheck source=hack/automation/rpc-coverage.sh
. "$(dirname "${BASH_SOURCE[0]}")/rpc-coverage.sh"

core_url=${CORE_URL:-https://github.com/NVIDIA/OpenShell.git}
out=
Expand Down Expand Up @@ -80,19 +83,20 @@ $(fence "$(tail -n 60 <<<"$build")")"
fi

# 3. RPCs the SDK does not call yet. Full method names look like
# "/openshell.v1.OpenShell/CreateSandbox".
# "/openshell.v1.OpenShell/CreateSandbox"; coverage is decided per service by
# rpc-coverage.sh, the rule rpc-issues.sh uses too.
uncovered=""
if ls "$work/wt"/proto/openshellv1/*_grpc.pb.go >/dev/null 2>&1; then
methods=$(grep -ho '"/[a-zA-Z0-9_.]*\.[A-Za-z0-9_]*/[A-Za-z0-9_]*"' "$work/wt"/proto/openshellv1/*_grpc.pb.go |
tr -d '"' | sort -u)
for m in $methods; do
service=${m#/}; service=${service%%/*}; service=${service##*.}
method=${m##*/}
if ! grep -rqE "\.${method}\(" openshell/v1 --include='*.go' \
--exclude='*_test.go' --exclude-dir=fake; then
uncovered+="- ${service}.${method}"$'\n'
fi
done
grep -ho '"/[a-zA-Z0-9_.]*\.[A-Za-z0-9_]*/[A-Za-z0-9_]*"' "$work/wt"/proto/openshellv1/*_grpc.pb.go |
tr -d '"' | sed -E 's#^/([A-Za-z0-9_]+\.)*([A-Za-z0-9_]+)/([A-Za-z0-9_]+)$#\2.\3#' |
sort -u >"$work/keys.txt"
covered=$(rpc_covered_list . "$work/keys.txt") || {
echo "ERROR: cannot determine the RPCs the SDK covers" >&2
exit 1
}
while read -r key; do
grep -qxF "$key" <<<"$covered" || uncovered+="- ${key}"$'\n'
done <"$work/keys.txt"
fi
if [ -z "$uncovered" ]; then
uncovered_section="Every RPC in the regenerated stubs is called by the SDK."
Expand Down
46 changes: 45 additions & 1 deletion hack/automation/drift-issue.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# SPDX-License-Identifier: Apache-2.0

# drift-issue.sh: shared helpers for the "Core main drift" issue. Sourced by
# update-drift-issue.sh and report-failure.sh.
# update-drift-issue.sh, report-failure.sh, and rpc-issues-test.sh.
# shellcheck shell=bash

drift_automation_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

sdk_repo=${SDK_REPO:-ai-openshell/sdk-go}
drift_title="Core main drift"
drift_label=core-drift
Expand All @@ -23,6 +25,25 @@ failure_lines() {
f && /^- / { print }' <<<"$1"
}

# add_failure_line <failure-lines> <date> <job> <run-url>: the failure lines
# with one more failed run recorded. A job that already has a line for the
# date keeps that one line, now naming the latest run and the number of
# failed runs ("- <date> <job> <url> (<n> runs)"), so an hourly job that keeps
# failing adds one line per day instead of one per run.
add_failure_line() {
awk -v d="${2:?add_failure_line needs a date}" -v j="${3:?add_failure_line needs a job}" \
-v u="${4:?add_failure_line needs a run URL}" '
NF == 0 { next }
!seen && $1 == "-" && $2 == d && $3 == j {
seen = 1; n = 1
if ($5 ~ /^\([0-9]+$/) n = substr($5, 2) + 0
printf "- %s %s %s (%d runs)\n", d, j, u, n + 1
next
}
{ print }
END { if (!seen) printf "- %s %s %s\n", d, j, u }' <<<"$1"
}

# compose_body <report-text> <failure-lines>
compose_body() {
printf '%s\n\n%s\n\n' "$1" "$failures_heading"
Expand All @@ -33,3 +54,26 @@ compose_body() {
fi
printf '%s\n' "Automation appends a dated line here when core-watch, release-tag, or core-drift fails. Delete a line once it is handled; the issue closes when the drift check passes and no lines are left."
}

# link_uncovered_rpcs <issues.json> <report-text>: print the report with
# each "- Service.Method" line followed by a link to the RPC coverage issue
# whose marker (rpc-marker.jq) lists the method; the lowest number wins.
# issues.json is a JSON array of {number, body}.
link_uncovered_rpcs() {
local links
links=$(jq -L "$drift_automation_dir" -r 'include "rpc-marker";
.[] | .number as $n | (.body | parse_marker) // empty | "\(.service).\(.methods[]) \($n)"' "$1" |
sort -k2,2n) || return 1
if [ -z "$links" ]; then
printf '%s\n' "$2"
return 0
fi
awk -v repo="$sdk_repo" '
FILENAME == ARGV[1] { if (!($1 in issue)) issue[$1] = $2; next }
/^- [A-Za-z0-9_]+\.[A-Za-z0-9_]+$/ && (substr($0, 3) in issue) {
n = issue[substr($0, 3)]
print $0 " ([#" n "](https://github.com/" repo "/issues/" n "))"
next
}
{ print }' <(printf '%s\n' "$links") <(printf '%s\n' "$2")
}
9 changes: 6 additions & 3 deletions hack/automation/report-failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
#
# Usage: report-failure.sh <job> <run-url> [--dry-run]
#
# Appends "- <date> <job> <run-url>" to the "## Automation failures" section
# Records "- <date> <job> <run-url>" in the "## Automation failures" section
# of the open "Core main drift" issue, creating the issue when none is open.
# Repeated failures of a job on the same date update its one line with the
# latest run and a count instead of adding a line per run.
# Also writes the line to the job summary.
set -euo pipefail
# shellcheck source=hack/automation/drift-issue.sh
Expand All @@ -18,7 +20,8 @@ for a in "$@"; do
case $a in --dry-run) dry=1 ;; *) args+=("$a") ;; esac
done
[ ${#args[@]} -eq 2 ] || { echo "usage: $0 <job> <run-url> [--dry-run]" >&2; exit 2; }
line="- $(date -u +%Y-%m-%d) ${args[0]} ${args[1]}"
today=$(date -u +%Y-%m-%d)
line="- $today ${args[0]} ${args[1]}"
[ -z "${GITHUB_STEP_SUMMARY:-}" ] || echo "Automation failure: $line" >>"$GITHUB_STEP_SUMMARY"

n=$(drift_issue_number)
Expand All @@ -30,7 +33,7 @@ else
report="No drift report yet; the next core-drift run fills this in."
failures=
fi
failures=$(printf '%s\n%s' "$failures" "$line" | sed '/^$/d')
failures=$(add_failure_line "$failures" "$today" "${args[0]}" "${args[1]}")
body=$(compose_body "$report" "$failures")

if [ "$dry" -eq 1 ]; then
Expand Down
72 changes: 72 additions & 0 deletions hack/automation/rpc-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# SPDX-License-Identifier: Apache-2.0

# rpc-coverage.sh: the SDK's definition of a covered core RPC. Sourced by
# rpc-issues.sh, drift-check.sh, and rpc-issues-test.sh; defines functions
# only.
#
# Only non-test Go files under <sdk-root>/openshell/v1 outside fake/ count.
# A package directory binds service S when one of its files calls
# New<S>Client( (the generated constructor). Method M of S is covered when a
# file in a package that binds S calls it (".M(") or passes it as a method
# value (".M)" or ".M,"), as the bidi stream wrappers do with
# openBidiRouted(ctx, owner, start, e.client.ExecSandboxInteractive). Methods
# with the same name in different services are told apart by the binding.
# shellcheck shell=bash

# _rpc_go_files <sdk-root>: NUL-separated SDK Go files that count.
_rpc_go_files() {
local v1="$1/openshell/v1"
[ -d "$v1" ] || { echo "ERROR: $v1 does not exist" >&2; return 1; }
find "$v1" -type f -name '*.go' ! -name '*_test.go' \
! -path "$v1/fake/*" ! -path "$v1/*/fake/*" -print0
}

# _rpc_bindings <sdk-root>: "<package-dir> <service>" lines, sorted; returns 1
# when no package binds any service.
_rpc_bindings() {
local out
out=$(_rpc_go_files "$1" |
xargs -0 grep -HoE '(^|[^A-Za-z0-9_])New[A-Za-z0-9_]+Client\(' /dev/null |
awk '{
i = index($0, ":"); path = substr($0, 1, i - 1); m = substr($0, i + 1)
sub(/^[^A-Za-z0-9_]?New/, "", m); sub(/Client\($/, "", m)
dir = path; sub(/\/[^\/]*$/, "", dir)
print dir, m
}' | sort -u) || true
[ -n "$out" ] || { echo "ERROR: no package under $1/openshell/v1 binds a service (no New<Service>Client( call)" >&2; return 1; }
echo "$out"
}

# rpc_bound_services <sdk-root>: the services some package binds, sorted.
rpc_bound_services() {
local b
b=$(_rpc_bindings "$1") || return 1
awk '{ print $2 }' <<<"$b" | sort -u
}

# rpc_covered_list <sdk-root> <keys-file>: the Service.Method lines of
# keys-file that the SDK covers, in input order.
rpc_covered_list() {
local root=$1 keys=${2:?rpc_covered_list needs a keys file} b calls
[ -f "$keys" ] || { echo "ERROR: $keys: no such file" >&2; return 1; }
b=$(_rpc_bindings "$root") || return 1
calls=$(_rpc_go_files "$root" |
xargs -0 grep -HoE '\.[A-Za-z0-9_]+[(),]' /dev/null |
awk '{
i = index($0, ":"); path = substr($0, 1, i - 1); m = substr($0, i + 2)
sub(/[(),]$/, "", m)
dir = path; sub(/\/[^\/]*$/, "", dir)
print dir, m
}' | sort -u) || true
# Three inputs: bindings, calls, keys.
awk '
FILENAME == ARGV[1] { bound[$1] = bound[$1] " " $2; next }
FILENAME == ARGV[2] {
if (!($1 in bound)) next
m = split(bound[$1], svc, " ")
for (j = 1; j <= m; j++) covered[svc[j] "." $2] = 1
next
}
{ sub(/\r$/, "") }
$0 in covered { print }' <(printf '%s\n' "$b") <(printf '%s\n' "$calls") "$keys"
}
14 changes: 14 additions & 0 deletions hack/automation/rpc-exceptions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Core RPCs the Go SDK deliberately does not wrap.
#
# rpc-issues.sh opens no coverage issue for an RPC listed here, and closes an
# open one with a comment that quotes the reason.
#
# Format: one entry per line, "Service.Method reason (required)".
# - A line whose first non-blank character is "#" is a comment; blank lines
# are ignored.
# - The first whitespace-separated field is Service.Method, the rest of the
# line is the reason. An entry without a reason, or with a malformed key,
# fails the run.
#
# Example:
# OpenShell.BeginRootfsTarStaging Requires a client that shares the gateway filesystem.
25 changes: 25 additions & 0 deletions hack/automation/rpc-issue-body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{MARKER}}

{{SUMMARY}}

{{BUILDABILITY}}

{{METHODS}}

## Where core implements it

{{REFS}}

## Implementation brief

Copy this block as the task description when you start the work.

````text
{{BRIEF}}
````

## About this issue

The 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.
It 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`]({{EXCEPTIONS_URL}}).
An issue closed by hand stays closed. Reopen it by hand to keep it open while the automation considers the methods covered.
Loading