remove port monitoring and automatic tunneling features
Remove port_monitor, TunnelManager, and /port-events handler to eliminate
automatic port tunneling functionality that bridges outtie to innie environments.
Sketch got confused when I asked it to change how this works; removing
and re-adding was easier!
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s78f868b27a44cb2bk
diff --git a/loop/server/loophttp_test.go b/loop/server/loophttp_test.go
index adda4e3..f6ec8c7 100644
--- a/loop/server/loophttp_test.go
+++ b/loop/server/loophttp_test.go
@@ -3,7 +3,6 @@
import (
"bufio"
"context"
- "encoding/json"
"net/http"
"net/http/httptest"
"slices"
@@ -261,10 +260,9 @@
m.retryNumber++
}
-func (m *mockAgent) GetPortMonitor() *loop.PortMonitor { return loop.NewPortMonitor() }
-func (m *mockAgent) SkabandAddr() string { return m.skabandAddr }
-func (m *mockAgent) LinkToGitHub() bool { return false }
-func (m *mockAgent) DiffStats() (int, int) { return 0, 0 }
+func (m *mockAgent) SkabandAddr() string { return m.skabandAddr }
+func (m *mockAgent) LinkToGitHub() bool { return false }
+func (m *mockAgent) DiffStats() (int, int) { return 0, 0 }
// TestSSEStream tests the SSE stream endpoint
func TestSSEStream(t *testing.T) {
@@ -512,76 +510,6 @@
t.Log("Mock CompactConversation works correctly")
}
-// TestPortEventsEndpoint tests the /port-events HTTP endpoint
-func TestPortEventsEndpoint(t *testing.T) {
- // Create a mock agent that implements the CodingAgent interface
- agent := &mockAgent{
- branchPrefix: "sketch/",
- }
-
- // Create a server with the mock agent
- server, err := server.New(agent, nil)
- if err != nil {
- t.Fatalf("Failed to create server: %v", err)
- }
-
- // Test GET /port-events
- req, err := http.NewRequest("GET", "/port-events", nil)
- if err != nil {
- t.Fatalf("Failed to create request: %v", err)
- }
-
- rr := httptest.NewRecorder()
- server.ServeHTTP(rr, req)
-
- // Should return 200 OK
- if status := rr.Code; status != http.StatusOK {
- t.Errorf("Expected status code %d, got %d", http.StatusOK, status)
- }
-
- // Should return JSON content type
- contentType := rr.Header().Get("Content-Type")
- if contentType != "application/json" {
- t.Errorf("Expected Content-Type application/json, got %s", contentType)
- }
-
- // Should return valid JSON (empty array since mock returns no events)
- var events []any
- if err := json.Unmarshal(rr.Body.Bytes(), &events); err != nil {
- t.Errorf("Failed to parse JSON response: %v", err)
- }
-
- // Should be empty array for mock agent
- if len(events) != 0 {
- t.Errorf("Expected empty events array, got %d events", len(events))
- }
-}
-
-// TestPortEventsEndpointMethodNotAllowed tests that non-GET requests are rejected
-func TestPortEventsEndpointMethodNotAllowed(t *testing.T) {
- agent := &mockAgent{
- branchPrefix: "sketch/",
- }
- server, err := server.New(agent, nil)
- if err != nil {
- t.Fatalf("Failed to create server: %v", err)
- }
-
- // Test POST /port-events (should be rejected)
- req, err := http.NewRequest("POST", "/port-events", nil)
- if err != nil {
- t.Fatalf("Failed to create request: %v", err)
- }
-
- rr := httptest.NewRecorder()
- server.ServeHTTP(rr, req)
-
- // Should return 405 Method Not Allowed
- if status := rr.Code; status != http.StatusMethodNotAllowed {
- t.Errorf("Expected status code %d, got %d", http.StatusMethodNotAllowed, status)
- }
-}
-
func TestParsePortProxyHost(t *testing.T) {
tests := []struct {
name string