Skip to content

feat: close proto-to-SDK type gaps for full parity - #57

Merged
rhuss merged 6 commits into
mainfrom
feat/proto-gap-parity
Aug 9, 2026
Merged

feat: close proto-to-SDK type gaps for full parity#57
rhuss merged 6 commits into
mainfrom
feat/proto-gap-parity

Conversation

@rhuss

@rhuss rhuss commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Docs: Add missing API docs for edge and fake packages (fixes CI docs:check)
  • Profile/Credential/Refresh: Map previously unmapped proto fields: ProviderProfile (annotations, source, scope), ProfileCredential (6 new fields including token grant sub-types), RefreshStrategy (AWS STS assume role)
  • Policy/Sandbox: Add SandboxPolicyRevision.Provenance and expose SandboxTemplate.Resources/DriverConfig as map[string]any via structpb
  • Client-layer: SandboxInterface.Create now accepts variadic ...CreateOptions with Annotations; ConfigUpdate/ConfigUpdateResult gain Annotations

All new fields include deep-copy at proto/SDK boundaries and proto-reflection coverage tests to catch future drift.

Test plan

  • mise run ci passes all 5 checks (lint, build, test, proto:check, docs:check)
  • Coverage tests verify every proto field is handled or explicitly skipped
  • Deep-copy mutation tests confirm boundary isolation
  • Fake client compiles and all fake tests pass after interface change
  • Existing tests remain green (no regressions from interface signature change)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added API documentation for Edge connectivity and the in-memory SDK client.
    • Sandbox creation now supports optional annotations.
    • Added sandbox policy provenance and template resource/driver configuration metadata.
    • Expanded provider profile credentials with authentication, environment variables, OAuth2 token grants, and audience overrides.
    • Added AWS STS AssumeRole refresh support.
    • Added annotations to configuration updates and results.
  • Bug Fixes

    • Improved metadata conversion, preservation, and isolation across SDK operations.

rhuss added 4 commits August 9, 2026 08:10
The docs:check CI step was failing with 4 missing documentation gaps
for the edge and fake packages. Add API docs pages and SUMMARY.md
entries to get CI green.

Assisted-By: 🤖 Claude Code
Add previously unmapped proto fields to SDK domain types:

- ProviderProfile: annotations, source, scope
- ProfileCredential: env_vars, auth_style, header_name, query_param,
  path_template, token_grant (with CredentialTokenGrant sub-types)
- RefreshStrategy: add AWSStsAssumeRole enum value

All new fields include deep-copy at proto/SDK boundaries and coverage
tests using proto reflection to catch future drift.

Assisted-By: 🤖 Claude Code
- SandboxPolicyRevision: add provenance map for audit metadata
- SandboxTemplate: expose resources and driver_config as map[string]any
  using structpb.Struct round-trip (same pattern as middleware config)
- Add coverage test for SandboxPolicyRevision proto fields

Assisted-By: 🤖 Claude Code
- SandboxInterface.Create now accepts variadic ...CreateOptions with
  Annotations field for setting metadata at sandbox creation time
- ConfigUpdate and ConfigUpdateResult gain Annotations for caller-
  provided and response metadata on config/policy updates
- Update all SandboxInterface implementations (real client, fake,
  test stubs) for the new signature

Assisted-By: 🤖 Claude Code
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a914f8d2-7602-4cad-811a-427bfc5ab8c1

📥 Commits

Reviewing files that changed from the base of the PR and between 3834fd4 and 97464d5.

📒 Files selected for processing (1)
  • openshell/v1/fake/sandbox_test.go

📝 Walkthrough

Walkthrough

The PR expands SDK types and protobuf converters for metadata, credentials, refresh strategies, sandbox configuration, and annotations. It updates sandbox creation options, adds converter coverage, and documents the Edge and Fake APIs.

Changes

SDK contracts and conversion support

Layer / File(s) Summary
Profile, policy, and refresh contracts
openshell/v1/types/profile.go, openshell/v1/types/policy.go, openshell/v1/types/refresh.go, openshell/v1/internal/converter/profile.go, openshell/v1/internal/converter/policy.go, openshell/v1/internal/converter/refresh.go, openshell/v1/internal/converter/*_test.go
Provider profiles, credentials, token grants, policy revisions, and refresh strategies now include the added fields and conversion mappings. Tests validate round trips and deep copies.
Sandbox and setting conversion
openshell/v1/types/sandbox.go, openshell/v1/types/setting.go, openshell/v1/internal/converter/sandbox.go, openshell/v1/internal/converter/setting.go, openshell/v1/internal/converter/*_test.go
Sandbox template maps convert through protobuf structs. Config update annotations convert in both directions with copied maps.
Sandbox creation annotations
openshell/v1/types/options.go, openshell/v1/sandbox.go, openshell/v1/sandbox_client.go, openshell/v1/fake/sandbox.go, openshell/v1/*_test.go
CreateOptions now carries annotations. Sandbox creation accepts variadic options, and implementations and test stubs match the interface.
Edge and fake API documentation
docs/src/SUMMARY.md, docs/src/api/edge.md, docs/src/api/fake.md
The documentation site links to new Edge and Fake API reference pages with usage and lifecycle details.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: completing proto-to-SDK type parity across the affected API areas.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/proto-gap-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.84%. Comparing base (b4a29fd) to head (97464d5).

Files with missing lines Patch % Lines
openshell/v1/internal/converter/profile.go 94.52% 2 Missing and 2 partials ⚠️
openshell/v1/sandbox_client.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #57      +/-   ##
==========================================
+ Coverage   89.59%   89.84%   +0.25%     
==========================================
  Files          78       78              
  Lines        4989     5102     +113     
==========================================
+ Hits         4470     4584     +114     
+ Misses        352      348       -4     
- Partials      167      170       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/src/api/fake.md`:
- Around line 69-73: Update the PrincipalSubject value in the AddMember
workspace example to use an opaque OIDC sub-style identifier such as
“subject-123” instead of an email address, while leaving the surrounding
workspace and role example unchanged.
- Around line 22-24: Update the quick-start example around
client.Sandboxes().Create to pass &types.SandboxSpec{} instead of
&v1.SandboxSpec{}, and add the types package to the example imports. Preserve
the existing Create call and assertion behavior.

In `@openshell/v1/fake/sandbox.go`:
- Line 214: Update fakeSandboxClient.Create to retain the variadic CreateOptions
input: inspect the first option when provided and copy its Annotations into the
created sandbox’s sb.Annotations before storing or returning it, while
preserving current behavior when no options are supplied.

In `@openshell/v1/internal/converter/sandbox.go`:
- Around line 184-190: Handle and propagate errors returned by
structpb.NewStruct for both spec.Template.Resources and
spec.Template.DriverConfig in the converter path. Do not discard either error or
assign a nil field after conversion failure; return the conversion error so
malformed configuration is rejected before the request is created.

In `@openshell/v1/sandbox.go`:
- Line 56: Update the fake client’s Create implementation to preserve the
selected CreateOptions.Annotations when constructing the new sandbox, matching
the gRPC client’s request behavior. Locate the Create method in the fake sandbox
client and copy the annotations into the created sandbox metadata without
discarding the provided options.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b570224b-e366-4c05-b20c-4e8de398ef13

📥 Commits

Reviewing files that changed from the base of the PR and between b4a29fd and 26e9374.

📒 Files selected for processing (26)
  • docs/src/SUMMARY.md
  • docs/src/api/edge.md
  • docs/src/api/fake.md
  • openshell/v1/exec_client_test.go
  • openshell/v1/fake/sandbox.go
  • openshell/v1/internal/converter/coverage_test.go
  • openshell/v1/internal/converter/policy.go
  • openshell/v1/internal/converter/policy_test.go
  • openshell/v1/internal/converter/profile.go
  • openshell/v1/internal/converter/profile_test.go
  • openshell/v1/internal/converter/refresh.go
  • openshell/v1/internal/converter/refresh_test.go
  • openshell/v1/internal/converter/sandbox.go
  • openshell/v1/internal/converter/sandbox_test.go
  • openshell/v1/internal/converter/setting.go
  • openshell/v1/internal/converter/setting_test.go
  • openshell/v1/sandbox.go
  • openshell/v1/sandbox_client.go
  • openshell/v1/ssh_client_test.go
  • openshell/v1/tcp_client_test.go
  • openshell/v1/types/options.go
  • openshell/v1/types/policy.go
  • openshell/v1/types/profile.go
  • openshell/v1/types/refresh.go
  • openshell/v1/types/sandbox.go
  • openshell/v1/types/setting.go

Comment thread docs/src/api/fake.md
Comment thread docs/src/api/fake.md
Comment thread openshell/v1/fake/sandbox.go Outdated
Comment thread openshell/v1/internal/converter/sandbox.go Outdated
Comment thread openshell/v1/sandbox.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes proto-to-SDK parity gaps by adding missing SDK fields, extending proto<->SDK converters (with deep-copy expectations), updating client interfaces to accept sandbox create annotations, and adding/expanding coverage tests that assert all proto fields are either handled or explicitly skipped.

Changes:

  • Add new SDK fields for profiles/credentials/refresh strategies, sandbox templates, policy revisions, and config update annotations.
  • Extend converters and tests to round-trip and deep-copy newly mapped fields (plus proto-reflection “coverage” tests to prevent future drift).
  • Update the sandbox client interface to accept ...CreateOptions (with Annotations) and adjust affected test mocks/fakes/docs.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openshell/v1/types/setting.go Adds annotations to ConfigUpdate and ConfigUpdateResult.
openshell/v1/types/sandbox.go Exposes SandboxTemplate.Resources and DriverConfig as map[string]any.
openshell/v1/types/refresh.go Adds AWS STS assume-role refresh strategy constant.
openshell/v1/types/profile.go Expands profile/credential types including token grant configuration.
openshell/v1/types/policy.go Adds SandboxPolicyRevision.Provenance.
openshell/v1/types/options.go Extends CreateOptions with Annotations.
openshell/v1/tcp_client_test.go Updates resolver mock for variadic CreateOptions.
openshell/v1/ssh_client_test.go Updates resolver mock for variadic CreateOptions.
openshell/v1/sandbox.go Updates SandboxInterface.Create signature to accept ...CreateOptions.
openshell/v1/sandbox_client.go Plumbs create annotations into CreateSandboxRequest.
openshell/v1/internal/converter/setting.go Converts annotations for config update request/response.
openshell/v1/internal/converter/setting_test.go Adds deep-copy tests for config update annotations.
openshell/v1/internal/converter/sandbox.go Converts sandbox template resources/driver config via structpb.
openshell/v1/internal/converter/sandbox_test.go Adds test coverage for resources/driver config conversions.
openshell/v1/internal/converter/refresh.go Maps new refresh strategy between proto and SDK.
openshell/v1/internal/converter/refresh_test.go Adds tests for AWS STS assume-role refresh strategy mapping.
openshell/v1/internal/converter/profile.go Maps new provider profile fields and credential token grants.
openshell/v1/internal/converter/profile_test.go Adds round-trip + deep-copy tests for new profile/credential fields.
openshell/v1/internal/converter/policy.go Maps policy revision provenance from proto.
openshell/v1/internal/converter/policy_test.go Adds deep-copy coverage for provenance mapping.
openshell/v1/internal/converter/coverage_test.go Adds proto-reflection coverage tests for newly mapped messages.
openshell/v1/fake/sandbox.go Adjusts fake sandbox client to match new Create signature.
openshell/v1/exec_client_test.go Updates resolver mock for variadic CreateOptions.
docs/src/SUMMARY.md Adds docs nav entries for edge and fake packages.
docs/src/api/fake.md Adds new API documentation page for the fake client package.
docs/src/api/edge.md Adds new API documentation page for the edge utilities package.
Suppressed comments (1)

openshell/v1/fake/sandbox.go:218

  • fakeSandboxClient.Create now accepts CreateOptions but currently ignores them, so sandbox-scoped annotations passed by callers won’t be reflected in the created sandbox. Also, the fake store claims to deep-copy objects at boundaries (store.go), but the sandbox copy helpers don’t appear to deep-copy the newly added SandboxTemplate.Resources / DriverConfig maps, which can allow caller mutation to affect stored state.
func (c *fakeSandboxClient) Create(_ context.Context, workspace, name string, spec *types.SandboxSpec, labels map[string]string, _ ...types.CreateOptions) (*types.Sandbox, error) {
	if c.closedFunc() {
		return nil, &types.StatusError{Code: types.ErrorUnavailable, Message: "client is closed"}
	}


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread openshell/v1/sandbox.go
Comment thread openshell/v1/internal/converter/sandbox.go
Comment thread openshell/v1/internal/converter/sandbox.go
rhuss added 2 commits August 9, 2026 14:35
- Deep-copy Resources/DriverConfig in fake copySandboxTemplate (correctness)
- Guard structpb.NewStruct with err==nil check (production consistency)
- Apply CreateOptions.Annotations in fake Create (fake-real parity)
- Add deep-copy mutation tests for Resources/DriverConfig and bytes ToProto
- Use opaque OIDC subject in fake.md example (docs accuracy)

Assisted-By: 🤖 Claude Code
Added tests to address Codecov coverage regression:
- TestSandbox_Create_WithAnnotations: verify annotations pass-through
- TestSandbox_Create_WithAnnotationsDeepCopy: mutation isolation
- TestCopyAnyMap: nil, flat, nested map, nested slice, scalar types
- TestCopySandboxTemplate_ResourcesDeepCopy: Resources/DriverConfig isolation

Assisted-By: 🤖 Claude Code
@rhuss
rhuss merged commit fe02b58 into main Aug 9, 2026
7 checks passed
@rhuss
rhuss deleted the feat/proto-gap-parity branch August 9, 2026 14:07
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.

2 participants