[log] Add debug logging to DIFC policy helper functions#6501
Merged
Conversation
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>
This was referenced May 26, 2026
This was referenced Jun 7, 2026
This was referenced Jun 14, 2026
This was referenced Jun 21, 2026
…stry.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
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) |
Collaborator
|
@copilot address review feedback |
Contributor
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
logDifcLogdebug logging to three DIFC policy helper functions:isSingularReadTool(ininternal/server/tool_registry.go): logs the tool name and whether it is classified as a singular-read tool (vs. collection tool)buildDIFCSingleItemFilteredError(ininternal/server/difc_log.go): logs item description, policy label, and reason before constructing the filtered-resource errordifcPolicyLabel(ininternal/server/difc_log.go): logs secrecy/integrity/total violation counts when determining the human-readable policy labelThese helpers are used during DIFC filtering decisions, and the new debug output improves traceability when
DEBUG=server:difc_logis enabled.Changes
internal/server/difc_log.gointernal/server/tool_registry.govar logDifcLog = logger.New("server:difc_log")loggerValidation
go test ./internal/server -run 'TestIsSingularReadTool|TestDIFCPolicyLabel|TestBuildDIFCSingleItemFilteredError'✅make agent-finished✅> Generated by Go Logger Enhancement · sonnet46 11.3M · ◷