refactor: narrow convertToGitHubActionsEnv env parameter from any to map[string]any - #48992
Conversation
…map[string]any Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
convertToGitHubActionsEnv env parameter from any to map[string]any
There was a problem hiding this comment.
Pull request overview
Narrows environment conversion to a concrete Go map type, improving compile-time type safety.
Changes:
- Updates the converter signature and removes its runtime assertion.
- Moves type assertions to configuration boundaries.
- Aligns unit tests with the narrowed contract.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/actions.go |
Narrows the converter input type. |
pkg/cli/mcp_add.go |
Validates environment maps at call sites. |
pkg/cli/actions_test.go |
Updates tests for the concrete input type. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Medium
|
@copilot please run the Run: https://github.com/github/gh-aw/actions/runs/30497974805
|
PR finisher complete. Here's the status:
Actions taken: Local validation confirmed clean; no code changes were needed. |
|
@copilot please run the Run: https://github.com/github/gh-aw/actions/runs/30499690701
|
This PR is ready for maintainer review. Here's the current status:
Why this PR is ready: The refactor is a pure type-safety improvement with no behavioral change. It narrows Remaining human-only actions:
|
|
@copilot please run the
|
Triage: refactor: narrow convertToGitHubActionsEnv env param from any to map
|
No changes needed — PR state is unchanged from the previous two passes:
Still needed (human-only):
|
|
@copilot please run the Run: https://github.com/github/gh-aw/actions/runs/30507870059
|
Still no code changes needed. Current status:
Remaining human-only actions:
|
|
@copilot please run the Run: https://github.com/github/gh-aw/actions/runs/30514455658
|
No code changes needed. This PR is ready for maintainer review:
Remaining human-only actions:
|
convertToGitHubActionsEnvacceptedenv anyand immediately performed a runtime type assertion tomap[string]any, with a silent no-op fallback for any other type. All three call sites always passserver.Config["env"]which is typedanybut is always amap[string]anyin practice.Changes
pkg/cli/actions.go— narrows parameter fromenv anytoenv map[string]any; removes theenv.(map[string]any)assertion wrapper (iterating a nil map is a no-op in Go, so nil safety is preserved).pkg/cli/mcp_add.go— the three call sites now assertserver.Config["env"]tomap[string]anyat the boundary before passing it in, making the type contract explicit where theanyoriginates.pkg/cli/actions_test.go— narrowsinputfield fromanytomap[string]any; removes thenon-map input returns empty mapcase, which is now statically impossible.Run: https://github.com/github/gh-aw/actions/runs/30503727864