[log] Add debug logging to internal/difc/resource.go#3099
Merged
Conversation
Add logger var and 5 targeted debug log calls to help troubleshoot DIFC label aggregation for collection filtering: - CollectionLabeledData.Overall(): log item count before union - CollectionLabeledData.Overall(): log when collection is empty - FilteredCollectionLabeledData.Overall(): log accessible vs filtered counts - FilteredCollectionLabeledData.Overall(): log when no accessible items - FilteredCollectionLabeledData.ToResult(): log returned item count and filter reason Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds debug-level instrumentation to the DIFC resource aggregation layer (internal/difc/resource.go) to make label aggregation and filtering paths observable when DEBUG=difc:* is enabled.
Changes:
- Introduced a
difc:resourcedebug logger ininternal/difc/resource.go. - Added targeted debug logs for: empty-collection paths, aggregation item counts, and filtered vs accessible counts, plus
ToResult()return summary.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Apr 3, 2026
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.
Adds a
logResourcedebug logger tointernal/difc/resource.go, which previously had no logging at all. This file contains security-critical DIFC label aggregation logic for collections and filtered collections.Changes
import "github.com/github/gh-aw-mcpg/internal/logger"andvar logResource = logger.New("difc:resource")CollectionLabeledData.Overall()CollectionLabeledData.Overall()FilteredCollectionLabeledData.Overall()FilteredCollectionLabeledData.Overall()FilteredCollectionLabeledData.ToResult()Why this file?
Label aggregation bugs (e.g., wrong secrecy/integrity union) are hard to reproduce without knowing how many items were processed and which path was taken. These logs enable tracing DIFC filtering behaviour when
DEBUG=difc:*is set.Usage
Checklist
pkg:filenameconvention (difc:resource)