Skip to content

refactor(server): extract shared relay-await and sandbox-scan helpers#1495

Merged
TaylorMutch merged 1 commit into
NVIDIA:mainfrom
ericcurtin:refactor/deduplicate-scan-relay-helpers
May 21, 2026
Merged

refactor(server): extract shared relay-await and sandbox-scan helpers#1495
TaylorMutch merged 1 commit into
NVIDIA:mainfrom
ericcurtin:refactor/deduplicate-scan-relay-helpers

Conversation

@ericcurtin
Copy link
Copy Markdown
Contributor

Summary

Removes two sets of copy-pasted code in openshell-server:

  • Three identical relay-stream await match blocks (one per gRPC streaming handler) replaced by a single await_relay_stream() helper in sandbox.rs.
  • Three identical paginated sandbox scan loops replaced by a generic scan_sandboxes() helper in provider.rs that takes a closure for the per-sandbox predicate/projection.

Related Issue

N/A — housekeeping refactor.

Changes

  • grpc/sandbox.rs: add await_relay_stream<T>() helper; replace the match blocks in handle_exec_sandbox, handle_forward_tcp, and handle_exec_sandbox_interactive
  • grpc/provider.rs: add scan_sandboxes<T, F>() helper; rewrite sandboxes_using_provider, sandboxes_using_provider_records, and sandboxes_using_profile to use it

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

Replace three copy-pasted relay stream await match blocks in sandbox.rs
with a single await_relay_stream() helper that handles timeout, drop,
and error cases uniformly, varying only the log context string.

Replace three copy-pasted paginated sandbox scan loops in provider.rs
with a generic scan_sandboxes() helper that accepts a closure for the
per-sandbox predicate and projection, eliminating the duplicated
pagination arithmetic and decode boilerplate.

No behavior changes; all existing tests pass.
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 21, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@TaylorMutch
Copy link
Copy Markdown
Collaborator

/ok to test 774eb6a

@TaylorMutch TaylorMutch merged commit e3f009f into NVIDIA:main May 21, 2026
37 checks passed
@ericcurtin ericcurtin deleted the refactor/deduplicate-scan-relay-helpers branch May 21, 2026 14:28
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