Skip to content

[WIP] Split gateway_logs.go into focused files#24004

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/split-gateway-logs-files
Closed

[WIP] Split gateway_logs.go into focused files#24004
Copilot wants to merge 1 commit intomainfrom
copilot/split-gateway-logs-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[plan] Split gateway_logs.go into focused files</issue_title>
<issue_description>## Objective

Split pkg/cli/gateway_logs.go (1,332 lines) into four focused files without changing any public APIs or function signatures.

Context

From discussion #23903 (Repository Quality: File Size Discipline). This file mixes four distinct concerns: type definitions, RPC parsing, log processing, and metrics rendering — violating the 300-line hard limit documented in AGENTS.md.

Approach

  1. Create pkg/cli/gateway_log_types.go — move all type definitions and constants (GatewayLogEntry, DifcFilteredEvent, GuardPolicyEvent, GatewayServerMetrics, GatewayToolMetrics, GatewayMetrics, RPCMessageEntry, rpc* types, etc.)
  2. Create pkg/cli/gateway_log_parser.go — move parseRPCMessages, findRPCMessagesPath, parseGatewayLogs and related helpers
  3. Create pkg/cli/gateway_log_processor.go — move processGatewayLogEntry, getOrCreateServer, getOrCreateTool, calculateGatewayAggregates, buildGuardPolicySummary
  4. Create pkg/cli/gateway_log_renderer.go — move renderGatewayMetricsTable, getSortedServerNames, and any other render helpers
  5. Remove or reduce gateway_logs.go if it becomes empty/redundant
  6. Keep the logger variable (var gatewayLogsLog) in the most appropriate file

Rules

  • Keep the same package (package cli)
  • Do NOT change any function signatures, type names, or package-level variable names
  • Run make fmt after changes
  • Run go test ./pkg/cli/ -run ".*[Gg]ateway.*" to validate
  • Run make agent-finish before committing

Acceptance Criteria

  • pkg/cli/gateway_log_types.go contains all type/const definitions
  • pkg/cli/gateway_log_parser.go contains parsing functions
  • pkg/cli/gateway_log_processor.go contains processing functions
  • pkg/cli/gateway_log_renderer.go contains render functions
  • Original gateway_logs.go removed or reduced to a thin file
  • All gateway-related tests pass
  • Each new file is under 350 lines

Generated by Plan Command for issue #discussion #23903 ·

  • expires on Apr 3, 2026, 2:40 PM UTC

Comments on the Issue (you are @copilot in this section)

@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Apr 2, 2026

@copilot keep working

@pelikhan pelikhan closed this Apr 2, 2026
Copilot stopped work on behalf of pelikhan due to an error April 2, 2026 04:19
@github-actions github-actions Bot deleted the copilot/split-gateway-logs-files branch April 13, 2026 02:59
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.

[plan] Split gateway_logs.go into focused files

2 participants