Extract shared tag-scope-splitting helper in internal/difc/violations.go - #11433
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
🔒 mcpg Read-Only Stress — default AWFSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No FAIL conditions: zero writes succeeded.
|
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked. The read-only guarantee held across all surfaces probed, though the gVisor run has the same authentication gap as other runtimes — the D/E boundary cannot be confirmed without a read-scoped token. References: §32100925678
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked. Result:
|
The semantic clustering analysis flagged one actionable item:
formatIntegrityLevelandformatSecrecyLeveleach reimplement the same:-suffix parsing of aTagwith different string primitives. Items 2 and 3 of the issue were explicitly marked "no action needed" and are untouched.Changes
internal/difc/violations.gosplitTagScope(tag Tag) (base, scope string).formatIntegrityLeveluses it in place of inlinestrings.Indexslicing.formatSecrecyLeveluses it in place ofstrings.HasPrefix+TrimPrefix.internal/difc/format_functions_test.go— table-drivenTestSplitTagScopecovering no-scope, scoped, colon-in-scope, empty-scope, leading-colon, and empty-tag inputs.Behavior preservation
Two edge cases in the original code are load-bearing and preserved:
":all") is not a scope separator —idx > 0, so the tag is returned unsplit."private:"(empty scope) is distinct from bare"private": only the latter setshasPrivate. Since both yieldscope == "",formatSecrecyLevelnow disambiguates viastring(tag) == "private".Existing
TestFormatIntegrityLevel/TestFormatSecrecyLevelare unchanged and serve as the regression check on output strings.