Skip to content

[log] Add debug logging to internal/difc/resource.go#3099

Merged
lpcox merged 1 commit intomainfrom
log/difc-resource-logging-688fa392cd84a0b5
Apr 3, 2026
Merged

[log] Add debug logging to internal/difc/resource.go#3099
lpcox merged 1 commit intomainfrom
log/difc-resource-logging-688fa392cd84a0b5

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Apr 3, 2026

Adds a logResource debug logger to internal/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

  • Added import "github.com/github/gh-aw-mcpg/internal/logger" and var logResource = logger.New("difc:resource")
  • Added 5 targeted debug log calls:
Method Log message
CollectionLabeledData.Overall() Item count before union aggregation
CollectionLabeledData.Overall() Empty collection path
FilteredCollectionLabeledData.Overall() Accessible vs filtered item counts
FilteredCollectionLabeledData.Overall() No-accessible-items path
FilteredCollectionLabeledData.ToResult() Items returned + filter reason

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

DEBUG=difc:resource ./awmg --config config.toml

Checklist

  • Exactly 1 file modified
  • No test files modified
  • Logger follows pkg:filename convention (difc:resource)
  • No side-effecting log arguments
  • Meaningful messages helpful for debugging
  • No duplicate logging with existing logs

Generated by Go Logger Enhancement ·

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>
@github-actions github-actions Bot added automation enhancement New feature or request labels Apr 3, 2026
@lpcox lpcox marked this pull request as ready for review April 3, 2026 05:10
Copilot AI review requested due to automatic review settings April 3, 2026 05:10
@lpcox lpcox merged commit 0dda6f3 into main Apr 3, 2026
5 checks passed
@lpcox lpcox deleted the log/difc-resource-logging-688fa392cd84a0b5 branch April 3, 2026 05:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:resource debug logger in internal/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants