Validate TOML `gateway.port` and cover `config.example.toml` by Copilot · Pull Request #7792 · github/gh-aw-mcpg · GitHub
Skip to content

Validate TOML gateway.port and cover config.example.toml#7792

Merged
lpcox merged 2 commits into
mainfrom
copilot/go-fan-review-burntsushi-toml
Jun 19, 2026
Merged

Validate TOML gateway.port and cover config.example.toml#7792
lpcox merged 2 commits into
mainfrom
copilot/go-fan-review-burntsushi-toml

Conversation

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

The TOML config path accepted out-of-range gateway.port values even though the documented and JSON-stdin validation surface requires 1-65535. This change brings TOML loading into parity and adds coverage for the repository’s primary example config.

  • Config validation

    • Reject explicitly configured TOML gateway.port values outside 1-65535 during LoadFromFile
    • Gate the check on md.IsDefined("gateway", "port") so defaulting behavior remains unchanged when the key is omitted
  • Regression coverage

    • Add a focused test for invalid TOML input with port = 99999
    • Add a load test for config.example.toml to catch parser/example drift
  • Behavior

    • Explicit invalid TOML now fails early instead of being silently accepted
if md.IsDefined("gateway", "port") {
	if err := PortRange(cfg.Gateway.Port, "gateway.port"); err != nil {
		return nil, err
	}
}

GitHub Advanced Security started work on behalf of lpcox June 19, 2026 15:34 View session
GitHub Advanced Security finished work on behalf of lpcox June 19, 2026 15:35
GitHub Advanced Security started work on behalf of lpcox June 19, 2026 15:38 View session
GitHub Advanced Security finished work on behalf of lpcox June 19, 2026 15:39
Copilot AI changed the title [WIP] Review Go module BurntSushi/toml Validate TOML gateway.port and cover config.example.toml Jun 19, 2026
Copilot AI requested a review from lpcox June 19, 2026 15:41
Copilot finished work on behalf of lpcox June 19, 2026 15:41
@lpcox lpcox marked this pull request as ready for review June 19, 2026 15:45
Copilot AI review requested due to automatic review settings June 19, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request tightens TOML config validation to match the documented/JSON-stdin behavior by enforcing the gateway.port range only when explicitly set in TOML, and adds regression tests including a “smoke load” of the repository’s config.example.toml.

Changes:

  • Validate TOML gateway.port during LoadFromFile (only when gateway.port is explicitly defined), rejecting values outside 1-65535.
  • Add a focused regression test that fails on an out-of-range TOML port (99999).
  • Add a test that loads config.example.toml to catch example/config drift.
Show a summary per file
File Description
internal/config/config_core.go Adds explicit TOML gateway.port range validation gated by TOML metadata (md.IsDefined).
internal/config/config_core_test.go Adds regression coverage for invalid TOML port and a load test for config.example.toml.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@lpcox lpcox merged commit ae0a419 into main Jun 19, 2026
40 checks passed
@lpcox lpcox deleted the copilot/go-fan-review-burntsushi-toml branch June 19, 2026 16:19
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.

3 participants