[test] Add tests for difc.SetSinkServerIDs and difc.IsSinkServerID#2063
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[test] Add tests for difc.SetSinkServerIDs and difc.IsSinkServerID#2063github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
These two functions in internal/difc/sink_server_ids.go had 0% test coverage because they are only called from internal/cmd, which was not reachable from the unit test suite. Add a comprehensive test file covering all branches: - SetSinkServerIDs: empty/nil input (clears state), single ID, multiple IDs, sorted storage, duplicate deduplication, whitespace-only entries skipped, whitespace trimming, duplicates after trimming, mixed valid and whitespace entries, overwrite semantics - IsSinkServerID: empty configuration, exact match, case sensitivity, no partial matches, no whitespace matching - Integration tests combining both functions - Concurrent read/write safety tests Coverage improvement: SetSinkServerIDs: 0% → 100% IsSinkServerID: 0% → 100% internal/difc package: 93.8% → 99.7% Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lpcox
added a commit
that referenced
this pull request
Mar 19, 2026
…sue (#2158) ## Summary Adds a **Guard Filtering Summary** section to the repo-assist Monthly Activity Issue so maintainers can see what objects the guard policy blocked during each run. ## What it looks like When the guard filters objects, the monthly activity issue will include: ```markdown ## Guard Filtering Summary | Type | Count | Resources | |------|-------|-----------| | Issues | 7 | #1711, #2049, #2086, #2087, #2089, #2093, #2100 | | PRs | 7 | #2037, #2042, #2061, #2063, #2064, #2092, #2096 | | Other | 2 | actions_list, get_repository_tree | **Policy**: `repos: [github/*], min-integrity: merged` **Total filtered**: 54 items across 17 tool calls ``` When no filtering occurs, it states "No objects were filtered by the guard policy." ## How it works 1. **New section in issue template** — "Guard Filtering Summary" sits between "Future Work" and "Run History" 2. **New step 6** — Agent reads `/tmp/gh-aw/mcp-logs/rpc-messages.jsonl` via bash, parses `DIFC_FILTERED` entries, groups by type (issues/PRs/other), deduplicates across tool calls 3. **Python one-liner** — Extracts resource descriptions, groups into a JSON summary the agent uses to populate the template ## Motivation From [run 23274488766](https://github.com/github/gh-aw-mcpg/actions/runs/23274488766), 54 objects were silently filtered with `min-integrity: merged`. The agent reported "GitHub API access to private repo issues unavailable" without understanding why. This change gives both the agent and maintainers explicit visibility into guard policy impact.
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.
Test Coverage Improvement:
difc.SetSinkServerIDsanddifc.IsSinkServerIDFunctions Analyzed
internal/difcSetSinkServerIDs,IsSinkServerIDinternal/difc/sink_server_ids.goSetSinkServerIDshas 7+ branches including dedup, trimming, sorting)Why These Functions?
SetSinkServerIDsandIsSinkServerIDhad 0% coverage because they are only called frominternal/cmd(which depends oncobra), making them unreachable from the unit test suite. Yet they implement critical DIFC (Decentralized Information Flow Control) sink configuration logic:SetSinkServerIDs: configures which backend MCP server IDs receive DIFC tag snapshot enrichment in RPC JSONL logs. Has complex branching: empty-input clearing, whitespace trimming, deduplication, and sorted storage.IsSinkServerID: thread-safe lookup into the configured set.Despite the 0% coverage, these functions have no existing test file at all (
sink_server_ids_test.godid not exist).Tests Added
"github"and" github "collapse to one entryCoverage Report
Generated by Test Coverage Improver
Next run will target the next most complex under-tested function
Warning
The following domains were blocked by the firewall during workflow execution:
go.yaml.ingolang.orggopkg.ininvalidhostthatdoesnotexist12345.comproxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.