Skip to content

[log] Add debug logging to DIFC policy helper functions#6501

Merged
lpcox merged 3 commits into
mainfrom
log/difc-log-helpers-9b850eace7e037e4
Jun 22, 2026
Merged

[log] Add debug logging to DIFC policy helper functions#6501
lpcox merged 3 commits into
mainfrom
log/difc-log-helpers-9b850eace7e037e4

Conversation

@github-actions

@github-actions github-actions Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Adds logDifcLog debug logging to three DIFC policy helper functions:

  • isSingularReadTool (in internal/server/tool_registry.go): logs the tool name and whether it is classified as a singular-read tool (vs. collection tool)
  • buildDIFCSingleItemFilteredError (in internal/server/difc_log.go): logs item description, policy label, and reason before constructing the filtered-resource error
  • difcPolicyLabel (in internal/server/difc_log.go): logs secrecy/integrity/total violation counts when determining the human-readable policy label

These helpers are used during DIFC filtering decisions, and the new debug output improves traceability when DEBUG=server:difc_log is enabled.

Changes

  • Files:
    • internal/server/difc_log.go
    • internal/server/tool_registry.go
  • Reuses existing var logDifcLog = logger.New("server:difc_log") logger
  • No side effects in log arguments

Validation

  • go test ./internal/server -run 'TestIsSingularReadTool|TestDIFCPolicyLabel|TestBuildDIFCSingleItemFilteredError'
  • make agent-finished

> Generated by Go Logger Enhancement · sonnet46 11.3M ·

Add logDifcLog calls to three helper functions that previously had no
debug logging:

- isSingularReadTool: log the tool name and classification result
- buildDIFCSingleItemFilteredError: log description, policy label, and
  reason before constructing the error
- difcPolicyLabel: log secrecy/integrity violation counts and total

These helpers drive DIFC policy decisions and benefit from debug output
when troubleshooting access-control behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…stry.go

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GitHub Advanced Security started work on behalf of lpcox June 21, 2026 17:43 View session
GitHub Advanced Security finished work on behalf of lpcox June 21, 2026 17:44
@lpcox lpcox marked this pull request as ready for review June 21, 2026 17:44
Copilot AI review requested due to automatic review settings June 21, 2026 17:44

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.

Pull request overview

This PR adds additional debug-level logging in the DIFC filtering/labeling helpers used by the server, improving traceability of policy outcomes when DEBUG=server:difc_log is enabled.

Changes:

  • Log the selected policy label + item description/reason when constructing the single-item “filtered” error.
  • Log secrecy/integrity violation counts when deriving the human-readable DIFC policy label.
Show a summary per file
File Description
internal/server/difc_log.go Adds two new logDifcLog.Printf calls to help debug DIFC single-item filtering and policy label selection.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

if detail.Reason != "" {
msg = fmt.Sprintf("%s (%s)", msg, detail.Reason)
}
logDifcLog.Printf("buildDIFCSingleItemFilteredError: description=%s, policy=%s, reason=%s", desc, policyLabel, detail.Reason)
@lpcox

lpcox commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Implemented in 5384a09: added the missing debug log in isSingularReadTool so the DIFC helper logging coverage matches the intended change set.

Copilot AI requested a review from lpcox June 21, 2026 17:56
Copilot finished work on behalf of lpcox June 21, 2026 17:56
@lpcox lpcox merged commit c0c95ae into main Jun 22, 2026
18 checks passed
@lpcox lpcox deleted the log/difc-log-helpers-9b850eace7e037e4 branch June 22, 2026 03:15
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.

3 participants