[log] difc: add debug logging to path_labels.go#1888
Merged
Conversation
Add 5 meaningful debug log calls to PathLabeledData methods that were previously missing logging coverage: - getItems: log when root-level array is found (with item count) - getItems: log before path navigation (with path value) - getItems: log when items are found at a navigated path (with count) - pathEntryToResource: log when nil entry is used (unlabeled resource) - Overall: log computed aggregate labels (item count, secrecy, integrity) These additions help troubleshoot DIFC label resolution issues by providing visibility into how path-based labels are resolved and aggregated during tool response processing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds additional debug logging to DIFC path-label resolution to improve observability when mapping guard-provided JSON pointer labels onto tool responses.
Changes:
- Log discovery of root-level arrays and navigated item arrays in
getItems(). - Log when
pathEntryToResource()receives a nil entry (default/unlabeled behavior). - Log aggregate secrecy/integrity tags computed in
Overall().
Comments suppressed due to low confidence (1)
internal/difc/path_labels.go:235
- Same as above: consider logging
ItemsPathwith%q(or escaping) instead of%sso the path is clearly delimited and can’t inject newlines into debug output.
logPathLabels.Printf("getItems: found %d items at path=%s", len(arr), p.PathLabels.ItemsPath)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| } | ||
|
|
||
| // Navigate to the items path using UnwrappedData (which may have been extracted from MCP wrapper) | ||
| logPathLabels.Printf("getItems: navigating to items at path=%s", p.PathLabels.ItemsPath) |
Comment on lines
279
to
282
| if entry == nil { | ||
| logPathLabels.Print("pathEntryToResource: no entry provided, returning unlabeled resource") | ||
| // Return empty labels if no entry | ||
| return NewLabeledResource("unlabeled") |
This was referenced Mar 14, 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.
Summary
Adds 5 targeted debug log calls to
internal/difc/path_labels.goto improve troubleshooting visibility for DIFC path-label resolution during tool response processing.Changes
File modified:
internal/difc/path_labels.goThe file already had a
logPathLabelslogger (logger.New("difc:path_labels")). Three functions were enhanced with new logging calls:getItems()pathEntryToResource()nilentry is encountered, indicating the item will use default (unlabeled) labels — useful for diagnosing cases where items unexpectedly receive no DIFC labelsOverall()Quality Checklist
logPathLabels) reused — already declared in filepkg:filenameconvention (difc:path_labels)