Skip to content

Conversation

@robindiddams
Copy link
Member

@robindiddams robindiddams commented Jan 5, 2026

Summary by CodeRabbit

  • New Features

    • Sandbox routing: request and receive sandbox virtual IPs for isolated environments.
    • DNS CLI: new command-line tool to submit DNS CNAME add actions and report results (including record ID when returned).
  • Bug Fixes / Notes

    • Deployment hostname marked deprecated (still accepted today but planned for removal).

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

Added sandbox routing protobuf messages and integrated them into control messaging; implemented a client-side API and plumbing to send a RouteSandbox request and receive its response; and added a standalone DNS CLI tool that sends DNS Add actions via a Redis-backed DNS service.

Changes

Cohort / File(s) Summary
Protobuf Schema Extensions
gravity/proto/gravity.proto
Added RouteSandboxRequest (fields: sandbox_id, virtual_ip) and RouteSandboxResponse (field: ip). Extended ControlMessage.oneof message_type with route_sandbox = 26 and route_sandbox_response = 27. Updated deprecation comment on RouteDeploymentRequest.hostname.
gRPC client plumbing
gravity/grpc_client.go
Added SendRouteSandboxRequest(sandboxID, virtualIP, timeout) API; introduced pendingRouteSandbox map and mutex; added handler handleRouteSandboxResponse and integrated response dispatch into processControlMessage.
CLI tool (DNS)
cmd/dns-cli/main.go
New command-line tool to send DNS Add (CNAME) actions using a Redis backend: parses Redis URL, validates args, PINGs Redis, sends action with timeout, prints result or errors.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as Caller
  participant GC as GravityClient
  participant Srv as Remote Gravity Server
  participant Ctrl as ControlMessage Dispatcher

  Note right of GC `#DDEBF7`: SendRouteSandboxRequest creates pending entry\nand sends request via gRPC
  App->>GC: SendRouteSandboxRequest(sandboxID, virtualIP, timeout)
  GC->>Srv: RPC: RouteSandboxRequest{sandbox_id, virtual_ip}
  alt Server processes request
    Srv->>Ctrl: emit ControlMessage(route_sandbox_response)
    Ctrl->>GC: delivers ControlMessage(RouteSandboxResponse{ip})
    GC->>GC: handleRouteSandboxResponse -> resolve pending chan
    GC-->>App: returns RouteSandboxResponse{ip}
  else Timeout / no response
    GC-->>App: returns error (timeout)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch route-sandbox-request

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ded083 and be4a421.

⛔ Files ignored due to path filters (1)
  • gravity/proto/gravity.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (1)
  • gravity/proto/gravity.proto
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (go)
🔇 Additional comments (3)
gravity/proto/gravity.proto (3)

74-75: LGTM! Clean integration of sandbox routing into the control message protocol.

The field numbers (26-27) fit appropriately within the deployment management range (20-29), and the naming follows the established pattern for request/response pairs.


140-140: Good documentation of the deprecated field.

Clearly marking the hostname field as deprecated helps guide users away from it while maintaining wire compatibility.


567-572: LGTM! The sandbox routing messages are well-defined.

The structure is clean and follows protobuf best practices. Field types are appropriate, and the messages integrate properly with the control message protocol.


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

@coderabbitai coderabbitai bot changed the title @coderabbitai Add sandbox routing protobuf messages to ControlMessage Jan 5, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @gravity/proto/gravity.proto:
- Around line 567-570: Add a clarifying comment inside the RouteSandboxRequest
protobuf message to document why field number 2 is skipped: update the
RouteSandboxRequest definition (message RouteSandboxRequest) to include a
comment like "Field 2 reserved for alignment with RouteDeploymentRequest"
between sandbox_id (field 1) and virtual_ip (field 3) so readers know the gap is
intentional and mirrors the deprecated hostname field in RouteDeploymentRequest.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9570931 and ac6a9c0.

⛔ Files ignored due to path filters (1)
  • gravity/proto/gravity.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (1)
  • gravity/proto/gravity.proto
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: Analyze (go)
🔇 Additional comments (3)
gravity/proto/gravity.proto (3)

74-75: LGTM! Clean integration into ControlMessage.

The new sandbox routing messages are properly integrated into the ControlMessage oneof with appropriate field numbers (26, 27) within the deployment management range.


140-140: LGTM! Clear deprecation notice.

The explicit deprecation comment helps prevent this field from being used in new implementations.


572-572: LGTM! Consistent with existing response pattern.

The RouteSandboxResponse message properly mirrors the structure of RouteDeploymentResponse, maintaining consistency across similar operations.

Comment on lines 567 to 570
message RouteSandboxRequest {
string sandbox_id = 1;
string virtual_ip = 3; // Hadron virtual IP for the sandbox
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's check the structure of the proto file and find the relevant messages
cat -n gravity/proto/gravity.proto | sed -n '560,580p'

Repository: agentuity/go-common

Length of output: 690


🏁 Script executed:

#!/bin/bash
# Now let's search for RouteDeploymentRequest to compare the structure
rg -n 'message RouteDeploymentRequest' gravity/proto/gravity.proto -A 5

Repository: agentuity/go-common

Length of output: 328


🏁 Script executed:

#!/bin/bash
# Check for reserved field declarations in the proto file
rg -n 'reserved' gravity/proto/gravity.proto

Repository: agentuity/go-common

Length of output: 45


🏁 Script executed:

#!/bin/bash
# Search for messages with non-sequential field numbers
rg -n 'message \w+' gravity/proto/gravity.proto | head -20

Repository: agentuity/go-common

Length of output: 847


🏁 Script executed:

#!/bin/bash
# Get a more detailed view to check field number patterns
rg -B 1 '= [23456789] *;' gravity/proto/gravity.proto | grep -E '(message|= [0-9])' | head -30

Repository: agentuity/go-common

Length of output: 2052


🏁 Script executed:

#!/bin/bash
# Check specific messages with full structure
rg -n 'message ProtocolResponse' gravity/proto/gravity.proto -A 5

Repository: agentuity/go-common

Length of output: 402


🏁 Script executed:

#!/bin/bash
# Check ConnectResponse which might have skipped fields
rg -n 'message ConnectResponse' gravity/proto/gravity.proto -A 10

Repository: agentuity/go-common

Length of output: 843


🏁 Script executed:

#!/bin/bash
# Get overall structure - check if skipped fields are common
python3 << 'EOF'
import re

with open('gravity/proto/gravity.proto', 'r') as f:
    content = f.read()

# Find all message definitions and their fields
messages = re.finditer(r'message\s+(\w+)\s*\{([^}]+)\}', content, re.MULTILINE)

for match in messages:
    msg_name = match.group(1)
    msg_body = match.group(2)
    
    # Extract field numbers
    fields = re.findall(r'=\s*(\d+)\s*;', msg_body)
    
    if fields and len(fields) > 1:
        field_nums = [int(f) for f in fields]
        # Check for gaps
        expected = set(range(1, max(field_nums) + 1))
        actual = set(field_nums)
        gaps = expected - actual
        
        if gaps:
            print(f"{msg_name}: Fields {sorted(field_nums)}, Missing: {sorted(gaps)}")
EOF

Repository: agentuity/go-common

Length of output: 149


🏁 Script executed:

#!/bin/bash
# Get more context around ConnectResponse to see if there's any comment about field 2
sed -n '113,145p' gravity/proto/gravity.proto

Repository: agentuity/go-common

Length of output: 1667


🏁 Script executed:

#!/bin/bash
# Search for any comments or documentation about removed/deprecated fields
rg -n 'field 2|skip.*2|deprecated' gravity/proto/gravity.proto

Repository: agentuity/go-common

Length of output: 94


Add a comment documenting the skipped field number.

The RouteSandboxRequest message intentionally skips field number 2 to mirror the structure of RouteDeploymentRequest, which has a deprecated hostname field at position 2. However, this gap lacks documentation. Add a comment to clarify the intent:

message RouteSandboxRequest {
  string sandbox_id = 1;
  // Field 2 reserved for alignment with RouteDeploymentRequest
  string virtual_ip = 3;    // Hadron virtual IP for the sandbox
}
🤖 Prompt for AI Agents
In @gravity/proto/gravity.proto around lines 567-570, Add a clarifying comment
inside the RouteSandboxRequest protobuf message to document why field number 2
is skipped: update the RouteSandboxRequest definition (message
RouteSandboxRequest) to include a comment like "Field 2 reserved for alignment
with RouteDeploymentRequest" between sandbox_id (field 1) and virtual_ip (field
3) so readers know the gap is intentional and mirrors the deprecated hostname
field in RouteDeploymentRequest.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
gravity/grpc_client.go (1)

38-45: Global gzip compression level affects all gRPC services in the process.

The grpcgzip.SetLevel() call sets a process-wide default compression level for all gRPC services, not just Gravity control messages. This could cause unexpected behavior in multi-service applications or when this package is imported by other code.

Consider either:

  1. Removing this global configuration and relying on gRPC's default
  2. Documenting this side effect prominently in package documentation
  3. Moving compression configuration to per-stream options only (already done at line 463 with grpc.UseCompressor)
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac6a9c0 and 3ded083.

📒 Files selected for processing (2)
  • cmd/dns-cli/main.go
  • gravity/grpc_client.go
🧰 Additional context used
🧬 Code graph analysis (2)
cmd/dns-cli/main.go (1)
dns/aether.go (4)
  • NewAddAction (135-146)
  • RecordTypeCNAME (122-122)
  • SendDNSAction (335-387)
  • WithRedis (257-261)
gravity/grpc_client.go (1)
gravity/proto/gravity.pb.go (13)
  • RouteSandboxResponse (4065-4070)
  • RouteSandboxResponse (4083-4083)
  • RouteSandboxResponse (4098-4100)
  • ControlMessage_RouteSandboxResponse (510-512)
  • ControlMessage_RouteSandboxResponse (568-568)
  • ControlMessage (244-270)
  • ControlMessage (283-283)
  • ControlMessage (298-300)
  • ControlMessage_RouteSandbox (506-508)
  • ControlMessage_RouteSandbox (566-566)
  • RouteSandboxRequest (4013-4019)
  • RouteSandboxRequest (4032-4032)
  • RouteSandboxRequest (4047-4049)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (go)
🔇 Additional comments (8)
cmd/dns-cli/main.go (3)

1-18: LGTM!

The CLI argument validation is well-structured with clear usage messages and examples.


20-44: LGTM!

The Redis client setup follows best practices with proper connection testing and resource cleanup via defer.


53-55: Code is safe—GetID() properly handles empty slices.

The GetID() method (in dns/aether.go) checks if len(r.IDs) == 0 and returns an empty string, making the pre-check at line 53 redundant but harmless. The defensive check len(result.IDs) > 0 is good practice and doesn't need to change.

gravity/grpc_client.go (5)

139-141: LGTM!

The pending route sandbox fields mirror the existing route deployment pattern, ensuring consistency in the request/response tracking mechanism.


269-269: LGTM!

Proper initialization of the pendingRouteSandbox map in the constructor, consistent with the existing pendingRouteDeployment pattern.


711-712: LGTM!

The RouteSandboxResponse case is correctly integrated into the control message processing switch, following the same pattern as RouteDeploymentResponse.


864-880: LGTM!

The handleRouteSandboxResponse implementation correctly follows the same pattern as handleRouteDeploymentResponse with proper mutex handling and non-blocking channel operations.


1601-1644: LGTM!

The SendRouteSandboxRequest implementation is correct and follows the established pattern from SendRouteDeploymentRequest with proper timeout handling, mutex protection, and cleanup.

@robindiddams robindiddams merged commit deca40f into main Jan 5, 2026
5 checks passed
@robindiddams robindiddams deleted the route-sandbox-request branch January 5, 2026 23:11
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