Skip to content

[test-improver] Improve tests for util collections - #15792

Merged
lpcox merged 1 commit into
mainfrom
test-improver/util-collections-a7cca1e92a3d8da8
Nov 1, 2026
Merged

lpcox merged 1 commit into
mainfrom
test-improver/util-collections-a7cca1e92a3d8da8

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

File: internal/util/collections_test.go

Changes

  • Converted TestGetStringFromMap to a table-driven test and added a nil-value case.
  • Added ShallowCloneMap edge cases: nil input, writability of the clone, and that adding keys to the clone leaves the original unchanged.
  • Removed TestCopyTrimmedStringIntMap_NilAndEmptyReturnNil, which duplicated the table cases.

Coverage: the internal/util package stays at 96.2% before and after. The uncovered lines are OS error paths in atomic_write.go and one line in truncate.go, so this change is about structure and assertion quality rather than coverage.

Verification: go vet and gofmt are clean, and go test -count=3 ./internal/util/ passes.

Generated by Test Improver Β· copilot Β· auto Β· ~27 AIC Β· ⊞ 8.9K Β· β—·

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review November 1, 2026 15:49
Copilot AI auto review requested due to automatic review settings November 1, 2026 15:49

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.

🟒 Approval recommended

No active review issues are identified, and the changes are limited to reorganizing and expanding focused utility tests without modifying production behavior.

No open issues πŸŽ‰

What changed in this PR

This pull request improves the organization and edge-case coverage of utility collection tests without changing production behavior.

Changes:

  • Converted TestGetStringFromMap to a table-driven test with nil-value coverage.
  • Added ShallowCloneMap tests for nil inputs, writable clones, and clone isolation.
  • Removed redundant CopyTrimmedStringIntMap nil and empty-input coverage.
File Description
internal/​util/​collections_test.go Reorganizes collection utility tests and adds focused edge-case assertions.

Review effort: Lite (auto)

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

πŸ”’ mcpg Read-Only Stress β€” default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED βœ…
B MCP writes (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) all 'unknown tool' (-32602), absent from 23-tool catalog BLOCKED ⚠️
C CLI reads (same calls via github proxy) data returned ALLOWED βœ…
D CLI REST writes (reaction/star/issue/comment) gh not authenticated β€” not attempted BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh not authenticated β€” not attempted BLOCKED ⚠️

Overall: INCONCLUSIVE

⚠️ Part B: all 6 write-tool targets (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) were absent from the gateway's exposed tool catalog (only 23 read tools listed: list_issues, list_pull_requests, get_file_contents, list_commits, etc.). Per the test's own methodology, absence from the catalog only proves backend/toolset configuration (gh-aw's GITHUB_READ_ONLY=1), not independent mcpg gateway-level DIFC/guard enforcement β€” so these rows are recorded INCONCLUSIVE, not PASS.

⚠️ Parts D/E: gh auth status confirmed no GH_TOKEN was set in this job (gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable). No REST or GraphQL write attempts could be made, so the token-scope boundary was not exercised this run.

No write of any kind succeeded or leaked through either surface. No security regression found; the gaps are purely test-coverage INCONCLUSIVE results, not FAIL.

πŸ”’ mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit 91c48ef into main Nov 1, 2026
28 checks passed
@lpcox
lpcox deleted the test-improver/util-collections-a7cca1e92a3d8da8 branch November 1, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants