Skip to content

refactor: migrate BFF from direct gRPC to openshell-sdk-go - #2

Open
rhuss wants to merge 3 commits into
Gkrumbach07:mainfrom
rhuss:002-sdk-migration
Open

refactor: migrate BFF from direct gRPC to openshell-sdk-go#2
rhuss wants to merge 3 commits into
Gkrumbach07:mainfrom
rhuss:002-sdk-migration

Conversation

@rhuss

@rhuss rhuss commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace the BFF's direct gRPC/protoc gateway layer with the openshell-sdk-go SDK client.

Net diff: +1,000 / -26,000 lines (proto stubs + generated code removed).

What changed

Area Before After
Gateway client internal/gateway/ (8 files, raw gRPC) SDK ClientInterface (single import)
Proto files backend/proto/ (5 files) Removed
Generated stubs backend/gen/ (7 files, 26K lines) Removed
Auth forwarding Custom PerRPCCredentials sdkclient.ContextAuthProvider
Error mapping grpc/status codes directly SDK IsNotFound() etc. helpers
Build Requires protoc for make proto No proto tooling needed

Merge order

Merge PR #4 first (dev setup DX), then this PR. This branch is rebased on PR #4.

Known SDK gaps

  • Global policy listing needs WithGlobal(true) option (openshell-sdk-go#44). The handler is in place but will error until the SDK fix lands.

SDK dependency

Uses github.com/rhuss/openshell-sdk-go v0.3.1. This is a private fork that will eventually move to the OpenShell org. Issues and feedback welcome on that repo.

Test plan

  • go build ./... passes
  • go test ./... passes (5 packages)
  • Deep review: 5 agents, 100% spec compliance, gate PASS
  • Manual e2e: start dev stack, log in via OIDC, exercise Gateway/Workspaces/Settings pages
  • Multi-user RBAC: verify admin vs user see different data
  • Global policy page (blocked on SDK #44)

🤖 Generated with Claude Code

@rhuss
rhuss marked this pull request as draft July 31, 2026 19:08
@rhuss

rhuss commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

I haven't tested it yet, so please hold on a bit. 'will do a sanity check tomorrow.

@rhuss

rhuss commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Ready for prime time, I will keep it updated and incorporate fixes while we are going. Fully up to you if and when you want to do the switch.

@rhuss
rhuss force-pushed the 002-sdk-migration branch 3 times, most recently from c54f355 to 138fc5c Compare August 1, 2026 12:26
rhuss and others added 3 commits August 3, 2026 09:00
DX improvements:
- dev-env.sh writes scripts/.env.dev with all config (including OPENSHELL_DIR)
- Makefile auto-sources scripts/.env.dev via -include (zero manual exports)
- make dev-full: one command starts infra + dashboard
- make dev: auto-reads config from previous dev-env.sh start

OPENSHELL_DIR resolution:
- Checks env var first, then scripts/.env.dev, then prompts interactively
- Offers to clone NVIDIA/OpenShell if no checkout exists
- Persists the path to .env.dev for future runs

Robust shutdown:
- Graceful stop with 10s timeout, then SIGKILL
- Detects and kills orphaned gateway processes on the expected port
- Force-removes Keycloak containers regardless of state
- Cleans up stale PID/log/config files (preserves PKI, DB, env config)

Also: fix grpcurl to use proto descriptor instead of server reflection

Assisted-By: 🤖 Claude Code
* Redesign sandbox cards, table, and attention alerts

Card view: status dot + name + uptime header, PF Alert-based attention
section with paginated prev/next for multiple items, DescriptionList
for providers/labels, policy egress summary with expandable rule list
showing rule name + host/binary counts + enforcement labels.

Table view: new columns — Name (with image subtitle), Status (dot +
phase text), Policy (shield icon + version + host summary + proposed
badge), Providers (teal labels with overflow). Actions kebab has
Terminal, Logs, Delete.

Attention system: shared SandboxAttention component with two modes —
card (single alert with top-right 1/N pager) and detail (AlertGroup
stack with dismiss). Builds severity-ranked items from sandbox phase,
policy revision status, and draft proposal summary.

Shared utilities: StatusDot component, getStatusDotColor,
countEgressHosts, getEnforcementLabel/Color extracted to utils.ts.
Policy data sourced from policy view API (not stale spec.policy).
Draft summary endpoint re-added and wired to card view.

Also: BFF draft-summary route fix (binary was stale), advisorProposed
added to NetworkEndpoint type, PF6 consistency pass (DescriptionList,
Content, Alert, Divider, CardTitle removal, no hardcoded pixels).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add Labels column to sandbox table

LabelsList now accepts numLabels prop (default 3). Table shows labels
with overflow at 2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add Claude project settings with PatternFly plugins

Enables patternfly-mcp and design-audit plugins for PF6 component
docs, token checking, and design compliance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address PR review findings

- Replace 'rhoai' with 'managed' in DeploymentContext type
- Feature-gate Terminal button and table action behind features.terminal
- Gate draft-summary polling on features.draftPolicy (enabled param)
- Gate onReviewDrafts callback on features.draftPolicy
- Extract SandboxEgressSummary component (97 lines out of card)
- Share getPolicySummary between card and table (remove duplicate)
- Export SandboxAttention, SandboxEgressSummary, StatusDot from barrel
- Replace hardcoded logo height with PF spacer token
- Add useSlots to SandboxCard for sandboxActions/sandboxMetadata slots
- Move attention pager out of Alert actionClose into sibling flex

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace internal/gateway/ (~50 gRPC wrapper methods) with the
openshell-sdk-go SDK client. All handlers now use typed sub-clients
(Sandboxes, Workspaces, Providers, Policy, Config, Inference,
Services, Exec, Files, Health).

- New internal/sdkclient/auth.go: context-based AuthProvider for
  per-request JWT forwarding through the SDK
- All From* DTO converters updated for SDK domain types
- SDK error mapping (11 gRPC codes) replaces direct status handling
- CA cert support via SDK Config.TLS.CAFile
- Deleted: internal/gateway/, proto/, gen/, terminal_handler.go
- Removed: make proto target, PROTO_* Makefile variables
- Updated: CLAUDE.md and .claude/rules/bff-go.md architecture rules

Assisted-By: 🤖 Claude Code
@rhuss
rhuss force-pushed the 002-sdk-migration branch 2 times, most recently from 6931e7b to f44bff4 Compare August 3, 2026 09:14
Gkrumbach07 added a commit that referenced this pull request Aug 7, 2026
…extension surface

Rewrites the auth ADRs to match post-#24 reality and adds three new ADRs
that take firm architectural stances:

- ADR 0001 v2: auth described as modes (dev/standalone/federated) x
  patterns (token relay / session custodian / future token exchange),
  replacing the conflated 'three-mode' framing
- ADR 0003 v2: 'token custody, not token validation' replaces the no-longer-
  accurate 'dumb pipe' doctrine; the custody/validation line is the boundary
- ADR 0005: adds Aug 6-7 #team-openshell outcomes (standalone-first,
  shared OIDC recommended, own-flow vs token-exchange mechanisms)
- ADR 0008 v2: polling for data, WebSocket for the terminal only —
  reconciles the ADR with the shipped terminal relay
- ADR 0011 (new): BFF scope boundary — four jobs, an explicit never-list,
  and rulings on previously ambiguous proposals
- ADR 0012 (new): the extension surface — five downstream mechanisms
  (barrels, slots, callbacks, flags, runtime config) and the zero-CSS policy
- ADR 0013 (new, Proposed): adopt openshell-sdk-go (PR #2) with provenance,
  parity, and secret-hygiene conditions

CLAUDE.md and .claude rules updated to match (cookie sessions replace the
stale sessionStorage guidance; bearer precedence chain; scope never-list).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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