Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

chore: remove redundant comments

Mariocaf04aafb401
diff --git a/cmd/pinchtab/cmd_doctor_browsers.go b/cmd/pinchtab/cmd_doctor_browsers.go
index 88c2c145..ada9e4cb 100644
--- a/cmd/pinchtab/cmd_doctor_browsers.go
+++ b/cmd/pinchtab/cmd_doctor_browsers.go
@@ -50,13 +50,11 @@ func writeBrowsersJSON(w io.Writer, report doctor.BrowsersReport) error {
func writeBrowsersText(w io.Writer, report doctor.BrowsersReport) {
_, _ = fmt.Fprintf(w, "pinchtab doctor browsers\n\n")
- // Compact status summary.
for _, bi := range report.Browsers {
_, _ = fmt.Fprintf(w, " %-18s %-12s %s\n", bi.Name, bi.Status, bi.StatusDetail)
}
_, _ = fmt.Fprintln(w)
- // Config summary.
if len(report.ConfiguredBrowsers) > 0 {
_, _ = fmt.Fprintf(w, "Configured: %s\n", strings.Join(report.ConfiguredBrowsers, ", "))
} else {
diff --git a/cmd/pinchtab/root.go b/cmd/pinchtab/root.go
index 44272542..1fd0d1a6 100644
--- a/cmd/pinchtab/root.go
+++ b/cmd/pinchtab/root.go
@@ -235,11 +235,9 @@ func init() {
rootCmd.Version = version
rootCmd.SetVersionTemplate("pinchtab {{.Version}}\n")
- // Global flags
rootCmd.PersistentFlags().StringVar(&serverURL, "server", "", "PinchTab server URL (default: http://127.0.0.1:<server.port>)")
rootCmd.PersistentFlags().StringVar(&cliAgentID, "agent-id", "", "Agent identifier recorded in activity logs")
- // Grouping commands
primaryGroup := &cobra.Group{ID: "primary", Title: "Primary Commands"}
browserGroup := &cobra.Group{ID: "browser", Title: "Browser Control"}
mgmtGroup := &cobra.Group{ID: "management", Title: "Profiles and Instances"}
diff --git a/internal/bridge/api.go b/internal/bridge/api.go
index 063820b5..2a543c23 100644
--- a/internal/bridge/api.go
+++ b/internal/bridge/api.go
@@ -391,5 +391,3 @@ type InstanceTab struct {
URL string `json:"url"`
Title string `json:"title"`
}
-
-// test
diff --git a/internal/bridge/bridge.go b/internal/bridge/bridge.go
index d3fe01b1..fad3a3ad 100644
--- a/internal/bridge/bridge.go
+++ b/internal/bridge/bridge.go
@@ -28,7 +28,6 @@ type Bridge struct {
Dialogs *DialogManager
LogStore *ConsoleLogStore
- // Network monitoring
netMonitor *NetworkMonitor
// Network route interception (Fetch domain). Lazy: enables CDP fetch
diff --git a/internal/bridge/download.go b/internal/bridge/download.go
index 68b50eeb..76d1506e 100644
--- a/internal/bridge/download.go
+++ b/internal/bridge/download.go
@@ -42,7 +42,6 @@ type DownloadResult struct {
// It creates a temporary tab, enables fetch interception to validate requests,
// navigates to the URL, and returns the response body.
func (b *Bridge) DownloadURL(ctx context.Context, dlURL string, opts DownloadOpts) (*DownloadResult, error) {
- // Create a temporary tab context for the download.
browserCtx := b.BrowserContext()
tabCtx, tabCancel := chromedp.NewContext(browserCtx)
defer tabCancel()
@@ -77,7 +76,6 @@ func (b *Bridge) DownloadURL(ctx context.Context, dlURL string, opts DownloadOpt
return blockedErr
}
- // Enable fetch interception.
if err := chromedp.Run(tabCtx, chromedp.ActionFunc(func(ctx context.Context) error {
return fetch.Enable().Do(ctx)
})); err != nil {
@@ -185,7 +183,6 @@ func (b *Bridge) DownloadURL(ctx context.Context, dlURL string, opts DownloadOpt
return nil, fmt.Errorf("network enable: %w", err)
}
- // Navigate the temp tab to the URL.
navErr := chromedp.Run(tabCtx, chromedp.Navigate(dlURL))
if navErr != nil {
if bErr := getBlockedErr(); bErr != nil {
diff --git a/internal/bridge/screencast.go b/internal/bridge/screencast.go
index fc91b560..6984b6a2 100644
--- a/internal/bridge/screencast.go
+++ b/internal/bridge/screencast.go
@@ -53,7 +53,6 @@ func (b *Bridge) startScreencastEventDriven(ctx context.Context, opts Screencast
done := make(chan struct{})
ackCh := make(chan int64, 128)
- // ACK goroutine
go func() {
for {
select {
@@ -111,7 +110,6 @@ func (b *Bridge) startScreencastEventDriven(ctx context.Context, opts Screencast
}
})
- // Start the CDP screencast
err := chromedp.Run(ctx,
chromedp.ActionFunc(func(c context.Context) error {
return page.StartScreencast().
diff --git a/internal/bridge/upload.go b/internal/bridge/upload.go
index 29feff98..ee671b30 100644
--- a/internal/bridge/upload.go
+++ b/internal/bridge/upload.go
@@ -23,7 +23,6 @@ func (b *Bridge) SetFileInputFiles(ctx context.Context, nodeID int64, paths []st
func (b *Bridge) ResolveSelectorToNodeID(ctx context.Context, selector string) (int64, error) {
var nodeID int64
err := chromedp.Run(ctx, chromedp.ActionFunc(func(ctx context.Context) error {
- // Determine the JavaScript expression based on selector type.
var expr string
switch {
case strings.HasPrefix(selector, "xpath:"):
diff --git a/internal/browsers/chrome/chrome.go b/internal/browsers/chrome/chrome.go
index f94728f8..1ab697fe 100644
--- a/internal/browsers/chrome/chrome.go
+++ b/internal/browsers/chrome/chrome.go
@@ -122,7 +122,6 @@ func (Browser) BuildLaunchArgs(cfg browsers.LaunchConfig) ([]string, []string, e
args = append(args, fmt.Sprintf("--remote-debugging-port=%d", cfg.DebugPort))
}
- // Base flags
args = append(args,
"--disable-background-networking",
"--enable-features=NetworkService,NetworkServiceInProcess",
@@ -149,7 +148,6 @@ func (Browser) BuildLaunchArgs(cfg browsers.LaunchConfig) ([]string, []string, e
"--use-mock-keychain",
)
- // Headless flags
if cfg.Headless {
args = append(args,
"--headless=new",
@@ -160,7 +158,6 @@ func (Browser) BuildLaunchArgs(cfg browsers.LaunchConfig) ([]string, []string, e
)
}
- // Extensions
if validPaths := existingExtensionPaths(cfg.ExtensionPaths); len(validPaths) > 0 {
joined := strings.Join(validPaths, ",")
args = append(args, "--load-extension="+joined, "--disable-extensions-except="+joined)
@@ -168,16 +165,13 @@ func (Browser) BuildLaunchArgs(cfg browsers.LaunchConfig) ([]string, []string, e
args = append(args, "--disable-extensions")
}
- // Profile directory
if cfg.ProfileDir != "" {
args = append(args, "--user-data-dir="+cfg.ProfileDir)
}
- // Window size
w, h := randomWindowSize()
args = append(args, fmt.Sprintf("--window-size=%d,%d", w, h))
- // Timezone
if cfg.Timezone != "" {
args = append(args, "--tz="+cfg.Timezone)
}
@@ -185,7 +179,6 @@ func (Browser) BuildLaunchArgs(cfg browsers.LaunchConfig) ([]string, []string, e
// Extra flags (caller pre-filters)
args = append(args, cfg.ExtraFlags...)
- // Compatibility
if cfg.NoSandbox {
args = append(args, "--no-sandbox")
}
diff --git a/internal/browsers/chrome/instance.go b/internal/browsers/chrome/instance.go
index 1413920e..17aca891 100644
--- a/internal/browsers/chrome/instance.go
+++ b/internal/browsers/chrome/instance.go
@@ -120,7 +120,6 @@ func (i *Instance) startScreencastEventDriven(ctx context.Context, opts browsers
)
})
- // ACK goroutine
go func() {
for {
select {
@@ -178,7 +177,6 @@ func (i *Instance) startScreencastEventDriven(ctx context.Context, opts browsers
}
})
- // Start the CDP screencast
err := chromedp.Run(ctx,
chromedp.ActionFunc(func(c context.Context) error {
return page.StartScreencast().
@@ -630,7 +628,6 @@ func (i *Instance) CurrentTitle(ctx context.Context) (string, error) {
// It creates a temporary tab, enables fetch interception to validate requests,
// navigates to the URL, and returns the response body.
func (i *Instance) DownloadURL(ctx context.Context, dlURL string, opts browsers.DownloadOpts) (*browsers.DownloadResult, error) {
- // Create a temporary tab context for the download.
tabCtx, tabCancel := chromedp.NewContext(i.browserCtx)
defer tabCancel()
@@ -664,7 +661,6 @@ func (i *Instance) DownloadURL(ctx context.Context, dlURL string, opts browsers.
return blockedErr
}
- // Enable fetch interception.
if err := chromedp.Run(tabCtx, chromedp.ActionFunc(func(ctx context.Context) error {
return fetch.Enable().Do(ctx)
})); err != nil {
@@ -772,7 +768,6 @@ func (i *Instance) DownloadURL(ctx context.Context, dlURL string, opts browsers.
return nil, fmt.Errorf("network enable: %w", err)
}
- // Navigate the temp tab to the URL.
navErr := chromedp.Run(tabCtx, chromedp.Navigate(dlURL))
if navErr != nil {
if bErr := getBlockedErr(); bErr != nil {
diff --git a/internal/browsers/ghostchrome/staticfetch/staticfetch.go b/internal/browsers/ghostchrome/staticfetch/staticfetch.go
index a174f831..3aad2114 100644
--- a/internal/browsers/ghostchrome/staticfetch/staticfetch.go
+++ b/internal/browsers/ghostchrome/staticfetch/staticfetch.go
@@ -56,15 +56,13 @@ func (l *Browser) Navigate(ctx context.Context, url string) (*browserops.Navigat
l.mu.Lock()
defer l.mu.Unlock()
- // Normalize the request URL for construction. SSRF enforcement happens
- // before this call in the handler and again at redirect/dial time in
- // clientForNavigate.
+ // SSRF is enforced before this call (handler) and again at dial/redirect
+ // time, so an inline nav guard here is intentionally omitted.
safeURL, err := urls.Sanitize(url)
if err != nil {
return nil, fmt.Errorf("lite navigate: %w", err)
}
- // Fetch HTML via HTTP.
req, err := http.NewRequestWithContext(ctx, http.MethodGet, safeURL, nil)
if err != nil {
return nil, fmt.Errorf("lite navigate: %w", err)
@@ -82,7 +80,6 @@ func (l *Browser) Navigate(ctx context.Context, url string) (*browserops.Navigat
return nil, fmt.Errorf("lite navigate: HTTP %d from %s", resp.StatusCode, url)
}
- // Detect content type — only process HTML.
ct := resp.Header.Get("Content-Type")
if ct != "" && !strings.Contains(ct, "html") && !strings.Contains(ct, "xml") {
return nil, fmt.Errorf("lite navigate: unsupported content type %q", ct)
@@ -276,8 +273,6 @@ func (l *Browser) resolveTab(tabID string) (*liteTab, error) {
return tab, nil
}
-// ---------- helpers ----------
-
func (l *Browser) walkDOM(tab *liteTab, node dom.Node, filter string, depth int) []browserops.SnapshotNode {
var nodes []browserops.SnapshotNode
diff --git a/internal/browsers/runtime.go b/internal/browsers/runtime.go
index ce14aed1..6ae0980e 100644
--- a/internal/browsers/runtime.go
+++ b/internal/browsers/runtime.go
@@ -149,10 +149,6 @@ type PDFParams struct {
FooterTemplate string
}
-// ---------------------------------------------------------------------------
-// RuntimeInstance interface
-// ---------------------------------------------------------------------------
-
// RuntimeInstance defines post-launch browser operations. Each browser
// provider (chrome, cloak, ghost-chrome) implements this interface to
// own its runtime behavior. The Bridge delegates operations to the
diff --git a/internal/cdptk/annotate.go b/internal/cdptk/annotate.go
index 5938ab34..57769f09 100644
--- a/internal/cdptk/annotate.go
+++ b/internal/cdptk/annotate.go
@@ -43,12 +43,6 @@ func AnnotationRectForNode(ctx context.Context, nodeID int64) (*AnnotationRect,
return nil, fmt.Errorf("element not found (backendNodeId=%d)", nodeID)
}
- // boxFn returns top-level viewport-relative rects so the overlay (which we
- // always inject into the top document) can place boxes correctly even for
- // iframe-owned nodes. Frame ancestors are walked and their iframe-element
- // bounding rects (already in their parent's viewport) are added. Cross-
- // origin frames throw on access; in that case we mark the rect as
- // unprojectable so the caller can drop it.
// boxFn returns top-level viewport-relative rects. Walks frame ancestors,
// adding each iframe-element's bounding rect (already in its parent's
// viewport). If we hit a null frameElement before reaching the top window
diff --git a/internal/config/config_load.go b/internal/config/config_load.go
index f2917cd0..46fa7703 100644
--- a/internal/config/config_load.go
+++ b/internal/config/config_load.go
@@ -500,7 +500,6 @@ func applyFileConfig(cfg *RuntimeConfig, fc *FileConfig) {
cfg.ExtensionPaths = append([]string(nil), fc.Browser.ExtensionPaths...)
}
- // Process browsers block — available list
if len(fc.Browsers.Available) > 0 {
cfg.BrowsersAvailable = make([]string, len(fc.Browsers.Available))
copy(cfg.BrowsersAvailable, fc.Browsers.Available)
diff --git a/internal/doctor/browsers.go b/internal/doctor/browsers.go
index 0f0a90b2..5e181a46 100644
--- a/internal/doctor/browsers.go
+++ b/internal/doctor/browsers.go
@@ -84,7 +84,6 @@ func ReportBrowsers(ctx context.Context, cfg *config.RuntimeConfig) BrowsersRepo
if ok {
info.Registered = true
- // Run doctor checks.
for _, dc := range b.DoctorChecks(browsers.TargetConfig{Provider: id}) {
r := dc.Fn(ctx, env)
info.Checks = append(info.Checks, CheckResult{
@@ -96,7 +95,6 @@ func ReportBrowsers(ctx context.Context, cfg *config.RuntimeConfig) BrowsersRepo
})
}
- // Probe CanHandle for each shape.
for _, shape := range allShapes {
d := b.CanHandle(browsers.RequestIntent{Shape: shape})
if d.Decision == browsers.DecisionHandle {
@@ -128,7 +126,6 @@ func deriveBrowserStatus(info *BrowserInfo) {
return
}
- // Check for failures first.
for _, c := range info.Checks {
if c.Status == StatusFail {
info.Status = "missing"
@@ -140,7 +137,6 @@ func deriveBrowserStatus(info *BrowserInfo) {
}
}
- // Check for warnings.
for _, c := range info.Checks {
if c.Status == StatusWarn {
info.Status = "needs-config"
@@ -149,9 +145,7 @@ func deriveBrowserStatus(info *BrowserInfo) {
}
}
- // All pass/skip → ready.
info.Status = "ready"
- // Find a useful detail from the first passing check.
for _, c := range info.Checks {
if c.Status == StatusPass && c.Detail != "" {
info.StatusDetail = c.Detail
diff --git a/internal/doctor/runner.go b/internal/doctor/runner.go
index 003ccd84..5533be25 100644
--- a/internal/doctor/runner.go
+++ b/internal/doctor/runner.go
@@ -75,7 +75,6 @@ func Registry(cfg *config.RuntimeConfig) []CheckEntry {
{Name: "config_file", Fn: checkConfigFile},
}
- // Add browser-specific checks from the browser registry.
browserID := config.NormalizeBrowser(browserFromCfg(cfg))
if b, ok := browsers.Get(browserID); ok {
env := buildDoctorEnv(cfg)
diff --git a/internal/doctor/version.go b/internal/doctor/version.go
index 50f63d34..33e97417 100644
--- a/internal/doctor/version.go
+++ b/internal/doctor/version.go
@@ -2,8 +2,6 @@ package doctor
import "github.com/pinchtab/pinchtab/internal/browserprobe"
-// compareSemver delegates to the shared browserprobe implementation.
func compareSemver(a, b string) int { return browserprobe.CompareSemver(a, b) }
-// extractVersionToken delegates to the shared browserprobe implementation.
func extractVersionToken(s string) string { return browserprobe.ExtractVersionToken(s) }
diff --git a/internal/handlers/action_execution.go b/internal/handlers/action_execution.go
index b47ea048..7f136a3d 100644
--- a/internal/handlers/action_execution.go
+++ b/internal/handlers/action_execution.go
@@ -67,7 +67,6 @@ func shouldRetryPointerAction(req bridge.ActionRequest, err error) bool {
switch kind {
case bridge.ActionClick, bridge.ActionDoubleClick, bridge.ActionHover, bridge.ActionDrag,
bridge.ActionMouseDown, bridge.ActionMouseUp, bridge.ActionMouseWheel:
- // pointer action kinds
default:
return false
}
diff --git a/internal/handlers/actions.go b/internal/handlers/actions.go
index 4bf1fbbf..2c0404fe 100644
--- a/internal/handlers/actions.go
+++ b/internal/handlers/actions.go
@@ -209,7 +209,6 @@ func (h *Handlers) HandleAction(w http.ResponseWriter, r *http.Request) {
}
}
- // Resolve tab
var resolvedTabID string
var ctx context.Context
{
diff --git a/internal/handlers/credentials.go b/internal/handlers/credentials.go
index 1f3e32db..9b1dbd0c 100644
--- a/internal/handlers/credentials.go
+++ b/internal/handlers/credentials.go
@@ -157,7 +157,6 @@ func (h *Handlers) setCredentials(w http.ResponseWriter, r *http.Request, req cr
Password: req.Password,
})
- // Enable Fetch domain with auth request interception.
if err := h.Bridge.EnableFetchWithAuth(tCtx); err != nil {
httpx.Error(w, 500, fmt.Errorf("CDP fetch enable: %w", err))
return
diff --git a/internal/handlers/health_tabs.go b/internal/handlers/health_tabs.go
index 2d5b1ea0..28a1100d 100644
--- a/internal/handlers/health_tabs.go
+++ b/internal/handlers/health_tabs.go
@@ -14,7 +14,6 @@ type tabHandoffReader interface {
}
func (h *Handlers) HandleHealth(w http.ResponseWriter, r *http.Request) {
- // Guard against nil Bridge
if h.Bridge == nil {
httpx.JSON(w, 503, map[string]any{"status": "error", "reason": "bridge not initialized"})
return
@@ -29,7 +28,6 @@ func (h *Handlers) HandleHealth(w http.ResponseWriter, r *http.Request) {
return
}
- // Ensure Chrome is initialized before checking health
if err := h.ensureChrome(); err != nil {
if h.writeBridgeUnavailable(w, err) {
return
@@ -46,7 +44,6 @@ func (h *Handlers) HandleHealth(w http.ResponseWriter, r *http.Request) {
resp := map[string]any{"status": "ok", "tabs": len(targets)}
- // Include crash logs if any
if crashLogs := h.Bridge.GetCrashLogs(); len(crashLogs) > 0 {
resp["crashLogs"] = crashLogs
}
@@ -61,7 +58,6 @@ func (h *Handlers) HandleHealth(w http.ResponseWriter, r *http.Request) {
}
func (h *Handlers) HandleEnsureChrome(w http.ResponseWriter, r *http.Request) {
- // Ensure Chrome is initialized for this instance
if err := h.ensureChrome(); err != nil {
if h.writeBridgeUnavailable(w, err) {
return
@@ -93,7 +89,6 @@ func (h *Handlers) HandleMetrics(w http.ResponseWriter, r *http.Request) {
result["crashes"] = bridge.CrashSnapshot()
}
- // Aggregate memory metrics across all tabs
if h.Bridge != nil {
if mem, err := h.Bridge.GetAggregatedMemoryMetrics(); err == nil && mem != nil {
result["memory"] = mem
@@ -130,7 +125,6 @@ func (h *Handlers) HandleTabMetrics(w http.ResponseWriter, r *http.Request) {
}
func (h *Handlers) HandleTabs(w http.ResponseWriter, r *http.Request) {
- // Guard against nil Bridge
if h.Bridge == nil {
httpx.Error(w, 503, fmt.Errorf("bridge not initialized"))
return
@@ -185,13 +179,11 @@ func (h *Handlers) HandleTabs(w http.ResponseWriter, r *http.Request) {
tabs = append(tabs, entry)
}
- // First pass: add the current focused tab
for _, t := range targets {
if t.TargetID == currentTabID {
appendTab(t)
}
}
- // Second pass: add all other tabs
for _, t := range targets {
if t.TargetID == currentTabID {
continue
diff --git a/internal/handlers/pdf.go b/internal/handlers/pdf.go
index d7a0592d..5ea9fef0 100644
--- a/internal/handlers/pdf.go
+++ b/internal/handlers/pdf.go
@@ -56,7 +56,6 @@ func (h *Handlers) HandlePDF(w http.ResponseWriter, r *http.Request) {
return
}
- // Ensure Chrome is initialized
if err := h.ensureChrome(); err != nil {
if h.writeBridgeUnavailable(w, err) {
return
diff --git a/internal/handlers/screenshot.go b/internal/handlers/screenshot.go
index c166f29b..12bb600f 100644
--- a/internal/handlers/screenshot.go
+++ b/internal/handlers/screenshot.go
@@ -22,7 +22,6 @@ import (
//
// @Endpoint GET /screenshot
func (h *Handlers) HandleScreenshot(w http.ResponseWriter, r *http.Request) {
- // Ensure Chrome is initialized
if err := h.ensureChrome(); err != nil {
if h.writeBridgeUnavailable(w, err) {
return
diff --git a/internal/handlers/snapshot.go b/internal/handlers/snapshot.go
index 1794cb06..3f167ec6 100644
--- a/internal/handlers/snapshot.go
+++ b/internal/handlers/snapshot.go
@@ -126,7 +126,6 @@ func (h *Handlers) HandleSnapshot(w http.ResponseWriter, r *http.Request) {
}
h.recordActivity(r, activity.Update{Route: snapChromeRoute})
- // Ensure Chrome is initialized
if err := h.ensureChrome(); err != nil {
if h.writeBridgeUnavailable(w, err) {
return
@@ -135,7 +134,6 @@ func (h *Handlers) HandleSnapshot(w http.ResponseWriter, r *http.Request) {
return
}
- // filter and tabID already parsed above for lite path
doDiff := r.URL.Query().Get("diff") == "true"
format := r.URL.Query().Get("format")
output := r.URL.Query().Get("output")
diff --git a/internal/handlers/stealth.go b/internal/handlers/stealth.go
index 094631ad..210baece 100644
--- a/internal/handlers/stealth.go
+++ b/internal/handlers/stealth.go
@@ -48,7 +48,6 @@ func (h *Handlers) HandleFingerprintRotate(w http.ResponseWriter, r *http.Reques
tCtx, tCancel := context.WithTimeout(ctx, 5*time.Second)
defer tCancel()
- // Set user agent override
if err := h.Bridge.SetUserAgentOverride(tCtx, bridge.UserAgentOverrideParams{
UserAgent: fp.UserAgent,
Platform: fp.Platform,
@@ -82,7 +81,6 @@ func (h *Handlers) HandleFingerprintRotate(w http.ResponseWriter, r *http.Reques
return
}
}
- // Add platform overlay script for new documents
if fp.Platform != "" {
overlayScript := fingerprintRotatePlatformOverlayScript(fp.Platform)
if _, err := h.Bridge.AddScriptToEvaluateOnNewDocument(tCtx, overlayScript); err != nil {
diff --git a/internal/handlers/text.go b/internal/handlers/text.go
index 802073ac..a403de14 100644
--- a/internal/handlers/text.go
+++ b/internal/handlers/text.go
@@ -85,7 +85,6 @@ func (h *Handlers) HandleText(w http.ResponseWriter, r *http.Request) {
}
h.recordActivity(r, activity.Update{Route: textRoute})
- // Ensure Chrome is initialized
if err := h.ensureChrome(); err != nil {
if h.writeBridgeUnavailable(w, err) {
return
diff --git a/internal/handlers/wait.go b/internal/handlers/wait.go
index 7ef2a3aa..e4f938b6 100644
--- a/internal/handlers/wait.go
+++ b/internal/handlers/wait.go
@@ -261,7 +261,6 @@ func (h *Handlers) handleWaitCore(w http.ResponseWriter, r *http.Request, req wa
matchLabel = "fn"
}
- // Poll loop
for {
var result bool
evalErr := h.Bridge.Evaluate(tCtx, js, &result, bridge.EvalOpts{})
@@ -284,7 +283,6 @@ func (h *Handlers) handleWaitCore(w http.ResponseWriter, r *http.Request, req wa
})
return
case <-time.After(pollInterval):
- // continue polling
}
}
}
diff --git a/internal/orchestrator/handlers_instances.go b/internal/orchestrator/handlers_instances.go
index 649f3a2c..e19e0674 100644
--- a/internal/orchestrator/handlers_instances.go
+++ b/internal/orchestrator/handlers_instances.go
@@ -418,13 +418,11 @@ func (o *Orchestrator) handleAttachInstance(w http.ResponseWriter, r *http.Reque
return
}
- // Validate attach is enabled and URL is allowed
if err := o.validateAttachURL(req.CdpURL); err != nil {
httpx.Error(w, 403, err)
return
}
- // Generate name if not provided
name := req.Name
if name == "" {
name = fmt.Sprintf("attached-%d", time.Now().UnixNano())
diff --git a/internal/orchestrator/proxy.go b/internal/orchestrator/proxy.go
index c776f3f9..11094ad8 100644
--- a/internal/orchestrator/proxy.go
+++ b/internal/orchestrator/proxy.go
@@ -45,7 +45,6 @@ func (o *Orchestrator) proxyTabRequest(w http.ResponseWriter, r *http.Request) {
o.proxyToURL(w, r, targetURL)
}
- // Fast path: Locator cache hit
if o.instanceMgr != nil {
if inst, err := o.instanceMgr.FindInstanceByTabID(tabID); err == nil {
proxyToInstance(inst)
@@ -53,10 +52,8 @@ func (o *Orchestrator) proxyTabRequest(w http.ResponseWriter, r *http.Request) {
}
}
- // Slow path: legacy lookup
inst, err := o.findRunningInstanceByTabID(tabID)
if err == nil {
- // Cache for future O(1) lookups
if o.instanceMgr != nil {
o.instanceMgr.Locator.Register(tabID, inst.ID)
}
diff --git a/internal/server/server.go b/internal/server/server.go
index 43a6a121..6f9d394e 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -72,7 +72,6 @@ func RunDashboard(cfg *config.RuntimeConfig, version string) {
configAPI.SetSessionManager(sessions)
authAPI := dashboard.NewAuthAPI(cfg, sessions)
- // API sessions
sessionStore := session.NewStore(session.Config{
Enabled: cfg.Sessions.Agent.Enabled,
Mode: cfg.Sessions.Agent.Mode,
diff --git a/internal/session/store.go b/internal/session/store.go
index 8e11c365..de762117 100644
--- a/internal/session/store.go
+++ b/internal/session/store.go
@@ -383,8 +383,6 @@ func (s *Store) pruneExpiredLocked() []LifecycleEvent {
return events
}
-// persistence types
-
type persistedStore struct {
SavedAt time.Time `json:"savedAt"`
Sessions []persistedSession `json:"sessions"`
diff --git a/internal/strategy/autorestart/handlers.go b/internal/strategy/autorestart/handlers.go
index 2f5fb680..1cd5ee4d 100644
--- a/internal/strategy/autorestart/handlers.go
+++ b/internal/strategy/autorestart/handlers.go
@@ -24,7 +24,6 @@ func (s *Strategy) RegisterRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET "+s.config.StatusPath, s.handleStatus)
}
-// proxyToManaged ensures the managed instance is running, then proxies.
func (s *Strategy) proxyToManaged(w http.ResponseWriter, r *http.Request) {
target, status, err := s.ensureRunning(r)
if err != nil {
diff --git a/internal/strategy/simple/simple.go b/internal/strategy/simple/simple.go
index fd800371..d8d09d43 100644
--- a/internal/strategy/simple/simple.go
+++ b/internal/strategy/simple/simple.go
@@ -48,7 +48,6 @@ func (s *Strategy) RegisterRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET /tabs", s.handleTabs)
}
-// proxyToFirst ensures an instance is running, then proxies the request to it.
func (s *Strategy) proxyToFirst(w http.ResponseWriter, r *http.Request) {
target, status, err := s.ensureRunning(r)
if err != nil {