[Repo Assist] refactor(guard): extract parseDIFCTagsFromAny helper in wasm_parse.go#6743
Merged
lpcox merged 1 commit intoMay 30, 2026
Conversation
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>
Contributor
There was a problem hiding this comment.
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.Tagto centralize conversion from[]anyto[]difc.Tag. - Replaced four duplicated secrecy/integrity parsing blocks in
parseResourceResponseandparseCollectionLabeledDatawith 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
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Closes #6514
Summary
Extracts a
parseDIFCTagsFromAnyhelper to eliminate 4 duplicate tag-parsing blocks ininternal/guard/wasm_parse.go, as identified in #6514.Root Cause
Both
parseResourceResponseandparseCollectionLabeledDatacontain 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.Taghelper and replace all 4 duplicate blocks with calls to it.Trade-offs
Test Status
proxy.golang.orgis blocked in this environment, preventinggo buildandgo testfrom running. Syntax was verified withgofmt -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.orgSee Network Configuration for more information.
Add this agentic workflows to your repo
To install this agentic workflow, run