Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package controlapi
package debugapi

import (
"context"
Expand Down
35 changes: 35 additions & 0 deletions cmd/ateapi/internal/debugapi/service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package debugapi

import (
"github.com/agent-substrate/substrate/cmd/ateapi/internal/store"
"github.com/agent-substrate/substrate/pkg/proto/ateapipb"
)

// Service implements ateapipb.DebugServer.
type Service struct {
ateapipb.UnimplementedDebugServer
persistence store.Interface
}

var _ ateapipb.DebugServer = (*Service)(nil)

// NewService creates a new debug service.
func NewService(persistence store.Interface) *Service {
return &Service{
persistence: persistence,
}
}
3 changes: 3 additions & 0 deletions cmd/ateapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

"github.com/agent-substrate/substrate/cmd/ateapi/internal/controlapi"
"github.com/agent-substrate/substrate/cmd/ateapi/internal/credbundle"
"github.com/agent-substrate/substrate/cmd/ateapi/internal/debugapi"
"github.com/agent-substrate/substrate/cmd/ateapi/internal/k8sjwt"
"github.com/agent-substrate/substrate/cmd/ateapi/internal/sessionidentity"
"github.com/agent-substrate/substrate/cmd/ateapi/internal/store/ateredis"
Expand Down Expand Up @@ -159,6 +160,7 @@ func main() {
}

sessionIdentitySrv := sessionidentity.New(*clientJWTIssuer, *clientJWTAudience, *sessionIDJWTPoolFile, *sessionIDCAPoolFile, *workerpoolCACerts, jwtIssuerDiscoveryClient)
debugSrv := debugapi.NewService(redisPersistence)

lisCfg := &net.ListenConfig{}
lis, err := lisCfg.Listen(ctx, "tcp", *listenAddr)
Expand Down Expand Up @@ -191,6 +193,7 @@ func main() {
reflection.Register(mux)
ateapipb.RegisterControlServer(mux, sm)
ateapipb.RegisterSessionIdentityServer(mux, sessionIdentitySrv)
ateapipb.RegisterDebugServer(mux, debugSrv)

go serverboot.StartMetricsServer(ctx, serverboot.MetricsServerOptions{
Addr: *metricsListenAddr,
Expand Down
5 changes: 4 additions & 1 deletion internal/ateclient/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ import (
"k8s.io/client-go/transport/spdy"
)

// Client wraps the gRPC ControlClient and ensures the port-forward connection is closed when done.
// Client wraps the gRPC ControlClient and DebugClient and ensures the port-forward connection is closed when done.
type Client struct {
ateapipb.ControlClient
ateapipb.DebugClient
conn *grpc.ClientConn
cancel func()
tracerProvider *sdktrace.TracerProvider
Expand Down Expand Up @@ -108,6 +109,7 @@ func dialDirect(kubeconfigPath, k8sContext, endpoint string, traceEnabled bool)
}
return &Client{
ControlClient: ateapipb.NewControlClient(conn),
DebugClient: ateapipb.NewDebugClient(conn),
conn: conn,
cancel: func() {},
}, nil
Expand Down Expand Up @@ -230,6 +232,7 @@ func dialPortForward(ctx context.Context, kubeconfigPath, k8sContext string, tra

return &Client{
ControlClient: ateapipb.NewControlClient(conn),
DebugClient: ateapipb.NewDebugClient(conn),
conn: conn,
cancel: func() {
close(stopCh)
Expand Down
11 changes: 6 additions & 5 deletions pkg/proto/ateapipb/ateapi.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions pkg/proto/ateapipb/ateapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ service Control {

// Delete an empty Atespace. Rejects (FailedPrecondition) if any actors remain.
rpc DeleteAtespace(DeleteAtespaceRequest) returns (Atespace) {}

// Debugging: drop all data from the ate database.
rpc DebugClear(DebugClearRequest) returns (DebugClearResponse) {}
}

message ExternalSnapshotInfo {
Expand Down Expand Up @@ -306,6 +303,13 @@ message KubeNamespacedObjectRef {
string name = 2;
}

// Debug is the RPC interface for administrative and debugging operations
// (such as wiping state during development).
service Debug {
// Debugging: drop all data from the ate database.
rpc DebugClear(DebugClearRequest) returns (DebugClearResponse) {}
}

message DebugClearRequest {}

message DebugClearResponse {}
Expand Down
144 changes: 107 additions & 37 deletions pkg/proto/ateapipb/ateapi_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading