Commit f2686f5
authored
[log] Add debug logging to GitHub API URL derivation (#6043)
## Summary
Adds meaningful debug logging to `internal/envutil/github.go` for the
`deriveAPIFromServerURL` function, which previously had **no logging**
despite containing important control-flow decisions.
## Changes
**File:** `internal/envutil/github.go`
### New logging in `deriveAPIFromServerURL`
- Logs entry with the raw server URL being parsed
- Logs when URL parsing fails or returns an empty host
- Logs when an unsupported scheme (not `http`/`https`) is detected
- Logs which resolution path was taken for each case:
- `github.com` → default API URL
- `*.ghe.com` tenant → `copilot-api.<tenant>.ghe.com`
- GHES instance → `<host>/api/v3`
### New logging in `DeriveGitHubAPIURL`
- Logs when falling back to the caller-provided `defaultURL`
## Why this matters
When debugging "why is the gateway using the wrong GitHub API URL?" or
"why isn't my GHEC tenant resolving correctly?", operators previously
had no visibility into which resolution branch was taken. The new
`DEBUG=envutil:*` log lines make this transparent.
## Testing
- Pre-existing test failure in `internal/config`
(`TestFetchAndFixSchema_NetworkError` — HTTP 403 network issue)
confirmed to be unrelated and present on the base branch.
- All other unit and integration tests pass.
> [!WARNING]
> <details>
> <summary>Firewall blocked 1 domain</summary>
>
> The following domain was blocked by the firewall during workflow
execution:
>
> - `invalidhostthatdoesnotexist12345.com`
>> To allow these domains, add them to the `network.allowed` list in
your workflow frontmatter:
>
> ```yaml
> network:
> allowed:
> - defaults
> - "invalidhostthatdoesnotexist12345.com"
> ```
>
> See [Network
Configuration](https://github.github.com/gh-aw/reference/network/) for
more information.
>
> </details>
> Generated by [Go Logger
Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/26132068575/agentic_workflow)
· ● 5M ·
[◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+go-logger%22&type=pullrequests)
<!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot,
version: 1.0.40, model: claude-sonnet-4.6, id: 26132068575, workflow_id:
go-logger, run:
https://github.com/github/gh-aw-mcpg/actions/runs/26132068575 -->
<!-- gh-aw-workflow-id: go-logger -->1 file changed
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| 84 | + | |
| 85 | + | |
81 | 86 | | |
82 | 87 | | |
| 88 | + | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
| 100 | + | |
93 | 101 | | |
94 | 102 | | |
| 103 | + | |
95 | 104 | | |
96 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | | - | |
| 109 | + | |
| 110 | + | |
99 | 111 | | |
100 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
101 | 115 | | |
102 | 116 | | |
0 commit comments