Skip to content

[log] difc: add debug logging to path_labels.go#1888

Merged
lpcox merged 1 commit intomainfrom
log/difc-path-labels-debug-logging-c6ccb2acee95ca00
Mar 14, 2026
Merged

[log] difc: add debug logging to path_labels.go#1888
lpcox merged 1 commit intomainfrom
log/difc-path-labels-debug-logging-c6ccb2acee95ca00

Conversation

@github-actions
Copy link
Contributor

Summary

Adds 5 targeted debug log calls to internal/difc/path_labels.go to improve troubleshooting visibility for DIFC path-label resolution during tool response processing.

Changes

File modified: internal/difc/path_labels.go

The file already had a logPathLabels logger (logger.New("difc:path_labels")). Three functions were enhanced with new logging calls:

getItems()

  • Logs when a root-level array is found with its item count
  • Logs before path navigation begins (with the path value)
  • Logs when items are successfully found at a navigated path (with count)

pathEntryToResource()

  • Logs when a nil entry is encountered, indicating the item will use default (unlabeled) labels — useful for diagnosing cases where items unexpectedly receive no DIFC labels

Overall()

  • Logs the computed aggregate secrecy and integrity labels along with item count — helps debug label propagation issues where the wrong labels are being applied to a collection

Quality Checklist

  • Exactly 1 file modified
  • No test files modified
  • Logger (logPathLabels) reused — already declared in file
  • Logger naming follows pkg:filename convention (difc:path_labels)
  • Logger arguments are all value reads (no side effects)
  • Logging messages are meaningful for debugging label resolution
  • No duplicate logging with existing log calls
  • Import statements unchanged (logger already imported)

Generated by Go Logger Enhancement ·

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>
@github-actions github-actions bot added automation enhancement New feature or request labels Mar 14, 2026
@lpcox lpcox marked this pull request as ready for review March 14, 2026 22:24
Copilot AI review requested due to automatic review settings March 14, 2026 22:24
@lpcox lpcox merged commit b6ea262 into main Mar 14, 2026
3 checks passed
@lpcox lpcox deleted the log/difc-path-labels-debug-logging-c6ccb2acee95ca00 branch March 14, 2026 22:24
Copy link
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 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 ItemsPath with %q (or escaping) instead of %s so 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")
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