Skip to content

[Repo Assist] refactor(guard): extract parseDIFCTagsFromAny helper in wasm_parse.go#6743

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/fix-issue-6514-extract-difc-tag-parser-505d9a5779394943
May 30, 2026
Merged

[Repo Assist] refactor(guard): extract parseDIFCTagsFromAny helper in wasm_parse.go#6743
lpcox merged 1 commit into
mainfrom
repo-assist/fix-issue-6514-extract-difc-tag-parser-505d9a5779394943

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Closes #6514

Summary

Extracts a parseDIFCTagsFromAny helper to eliminate 4 duplicate tag-parsing blocks in internal/guard/wasm_parse.go, as identified in #6514.

Root Cause

Both parseResourceResponse and parseCollectionLabeledData contain identical secrecy and integrity tag-parsing logic (converting []any[]difc.Tag). This pattern appeared 4 times across ~48 lines.

Fix

Extract a single parseDIFCTagsFromAny(raw any) []difc.Tag helper and replace all 4 duplicate blocks with calls to it.

Trade-offs

  • Pure refactor — no behaviour change
  • Any future changes to tag-parsing logic (e.g., whitespace trimming, case normalisation) now have a single place to update

Test Status

⚠️ Infrastructure limitation: Network access to proxy.golang.org is blocked in this environment, preventing go build and go test from running. Syntax was verified with gofmt -e. The change is a mechanical substitution with no logic changes — the helper function contains exactly the code that was previously inlined 4 times.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

Generated by Repo Assist · sonnet46 3.1M ·

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

Remove 4 duplicate tag-parsing blocks (~48 lines) by extracting a shared
parseDIFCTagsFromAny helper. The duplicated logic appeared in both
parseResourceResponse and parseCollectionLabeledData for both secrecy and
integrity tag fields.

Closes #6514

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review May 30, 2026 13:31
Copilot AI review requested due to automatic review settings May 30, 2026 13:31
Copy link
Copy Markdown
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

This PR refactors DIFC tag parsing in the WASM guard response parsing code by extracting a shared helper, reducing duplication while preserving existing parsing semantics.

Changes:

  • Added parseDIFCTagsFromAny(raw any) []difc.Tag to centralize conversion from []any to []difc.Tag.
  • Replaced four duplicated secrecy/integrity parsing blocks in parseResourceResponse and parseCollectionLabeledData with calls to the helper.
Show a summary per file
File Description
internal/guard/wasm_parse.go Extracts a shared tag-parsing helper and reuses it in resource/collection response parsing to remove duplicated logic.

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: 0

@lpcox lpcox merged commit b130c49 into main May 30, 2026
23 checks passed
@lpcox lpcox deleted the repo-assist/fix-issue-6514-extract-difc-tag-parser-505d9a5779394943 branch May 30, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[duplicate-code] Duplicate Code Pattern: DIFC Tag Parsing in wasm_parse.go

2 participants