config: document SetStrict tradeoff and add parse error position logging#4946
Merged
config: document SetStrict tradeoff and add parse error position logging#4946
Conversation
…ogging Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/11a3e21a-44a4-4049-ad9c-04da6d2c0b04 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review Go module BurntSushi/toml for config loading
config: document SetStrict tradeoff and add parse error position logging
May 1, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Improves TOML config loading ergonomics in internal/config by clarifying why strict TOML decoding can’t be enabled globally and by adding debug-only logging that pinpoints TOML syntax error locations.
Changes:
- Add debug logging of TOML parse error line/column by extracting
toml.ParseErrorviaerrors.As. - Expand the unknown-field checking comment to document why
Decoder.SetStrict(true)isn’t viable due to dynamicmap[string]interface{}sections.
Show a summary per file
| File | Description |
|---|---|
internal/config/config_core.go |
Logs TOML parse error position at debug level and documents the strict-decoder tradeoff around dynamic config sections. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Go Fan module review for
BurntSushi/tomlidentified two improvement opportunities inLoadFromFile: the non-obvious reason for not usingDecoder.SetStrict(true)was undocumented, and parse error line/column info was not surfaced at debug level.Changes
Document
SetStrict(true)design decision — expands the comment before theUndecoded()loop to explain whySetStrict(true)cannot replace the manual approach: theguard_policiesandguards.*.configsections aremap[string]interface{}fields whose arbitrary nested keys would be incorrectly rejected as unknown by strict mode.Debug-log parse error position — uses
errors.Asto extracttoml.ParseErrorand emit line/column at debug level, making TOML syntax errors easier to locate whenDEBUG=config:*is active. The%wwrapping for structured caller access is unchanged.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build1929706461/b513/launcher.test /tmp/go-build1929706461/b513/launcher.test -test.testlogfile=/tmp/go-build1929706461/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1929706461/b463/vet.cfg _.a -I x_amd64/vet --gdwarf-5 /known/durationp-atomic -o w7vn10ecHFwD -W .cfg 212348/b314/ x_amd64/asm . --gdwarf2 --64 x_amd64/asm(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build1929706461/b495/config.test /tmp/go-build1929706461/b495/config.test -test.testlogfile=/tmp/go-build1929706461/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1929706461/b368/vet.cfg 1.10.2/active_hego1.25.9 1.10.2/args.go x_amd64/vet --gdwarf-5 ions =0 x_amd64/vet swit�� _.a 212348/b151/ x_amd64/vet --gdwarf-5 transport p=/opt/hostedtoo-bool x_amd64/vet(dns block)nonexistent.local/tmp/go-build1929706461/b513/launcher.test /tmp/go-build1929706461/b513/launcher.test -test.testlogfile=/tmp/go-build1929706461/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1929706461/b463/vet.cfg _.a -I x_amd64/vet --gdwarf-5 /known/durationp-atomic -o w7vn10ecHFwD -W .cfg 212348/b314/ x_amd64/asm . --gdwarf2 --64 x_amd64/asm(dns block)slow.example.com/tmp/go-build1929706461/b513/launcher.test /tmp/go-build1929706461/b513/launcher.test -test.testlogfile=/tmp/go-build1929706461/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1929706461/b463/vet.cfg _.a -I x_amd64/vet --gdwarf-5 /known/durationp-atomic -o w7vn10ecHFwD -W .cfg 212348/b314/ x_amd64/asm . --gdwarf2 --64 x_amd64/asm(dns block)this-host-does-not-exist-12345.com/tmp/go-build1929706461/b522/mcp.test /tmp/go-build1929706461/b522/mcp.test -test.testlogfile=/tmp/go-build1929706461/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s 2123�� .cfg -trimpath x_amd64/vet -p mime/quotedprint/usr/bin/runc -lang=go1.25 x_amd64/vet .cfg�� 212348/b306/_pkg_.a -trimpath x_amd64/vet -p .io/otel/exportedocker-cli-plugin-metadata -lang=go1.24 x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: