From 4b5703b89b5566ac54aa3786360d765988f0f407 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 04:46:13 +0000 Subject: [PATCH 1/2] Initial plan From b7e7608e185bdc8c0efaf37e24bf4fb16e63b66f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 04:49:24 +0000 Subject: [PATCH 2/2] Refactor DIFC label constructors to reduce duplication Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- internal/difc/labels.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/difc/labels.go b/internal/difc/labels.go index 27a65160..456f0953 100644 --- a/internal/difc/labels.go +++ b/internal/difc/labels.go @@ -19,6 +19,14 @@ func NewLabel() *Label { return &Label{tags: make(map[Tag]struct{})} } +// newLabelWithTags is a helper function that creates a label with the given tags. +// This helper reduces duplication in NewSecrecyLabelWithTags and NewIntegrityLabelWithTags. +func newLabelWithTags(tags []Tag) *Label { + label := NewLabel() + label.AddAll(tags) + return label +} + // Add adds a tag to this label func (l *Label) Add(tag Tag) { l.mu.Lock() @@ -100,9 +108,7 @@ func NewSecrecyLabel() *SecrecyLabel { // NewSecrecyLabelWithTags creates a secrecy label with the given tags func NewSecrecyLabelWithTags(tags []Tag) *SecrecyLabel { - label := NewSecrecyLabel() - label.Label.AddAll(tags) - return label + return &SecrecyLabel{Label: newLabelWithTags(tags)} } // CanFlowTo checks if this secrecy label can flow to target @@ -180,9 +186,7 @@ func NewIntegrityLabel() *IntegrityLabel { // NewIntegrityLabelWithTags creates an integrity label with the given tags func NewIntegrityLabelWithTags(tags []Tag) *IntegrityLabel { - label := NewIntegrityLabel() - label.Label.AddAll(tags) - return label + return &IntegrityLabel{Label: newLabelWithTags(tags)} } // CanFlowTo checks if this integrity label can flow to target