refactor: extract checkBoolFailure helper in parseLabelAgentResponse#2106
Merged
refactor: extract checkBoolFailure helper in parseLabelAgentResponse#2106
Conversation
5 tasks
… in parseLabelAgentResponse Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [duplicate-code] Fix identical failure-check blocks in parseLabelAgentResponse
refactor: extract checkBoolFailure helper in parseLabelAgentResponse
Mar 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors parseLabelAgentResponse in the WASM guard to eliminate duplicated boolean failure-handling logic when interpreting label_agent responses, improving maintainability while preserving behavior.
Changes:
- Extracted shared
"success"/"ok"failure-detection logic into a newcheckBoolFailurehelper. - Simplified
parseLabelAgentResponseto delegate those checks to the helper.
💡 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.
This was referenced Mar 18, 2026
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.
parseLabelAgentResponseininternal/guard/wasm.gocontained two byte-for-byte identical 7-line blocks handling"success"and"ok"boolean failure fields — any future change to error formatting or logging had to be applied twice.Changes
checkBoolFailure— extracts the shared failure-detection logic into a single function parameterized by field name:parseLabelAgentResponsesimplified — the two duplicate blocks replaced with:Pure refactor; no behavioral change.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build2594320058/b332/launcher.test /tmp/go-build2594320058/b332/launcher.test -test.testlogfile=/tmp/go-build2594320058/b332/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2594320058/b237/vet.cfg u/13/liblto_plugin.so _64-linux-gnu/13/lto-wrapper x_amd64/asm(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build2594320058/b317/config.test /tmp/go-build2594320058/b317/config.test -test.testlogfile=/tmp/go-build2594320058/b317/testlog.txt -test.paniconexit0 -test.timeout=10m0s conf�� p/go-build mon/httpcommon.go x_amd64/compile(dns block)nonexistent.local/tmp/go-build2594320058/b332/launcher.test /tmp/go-build2594320058/b332/launcher.test -test.testlogfile=/tmp/go-build2594320058/b332/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2594320058/b237/vet.cfg u/13/liblto_plugin.so _64-linux-gnu/13/lto-wrapper x_amd64/asm(dns block)slow.example.com/tmp/go-build2594320058/b332/launcher.test /tmp/go-build2594320058/b332/launcher.test -test.testlogfile=/tmp/go-build2594320058/b332/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2594320058/b237/vet.cfg u/13/liblto_plugin.so _64-linux-gnu/13/lto-wrapper x_amd64/asm(dns block)this-host-does-not-exist-12345.com/tmp/go-build2594320058/b341/mcp.test /tmp/go-build2594320058/b341/mcp.test -test.testlogfile=/tmp/go-build2594320058/b341/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2594320058/b251/vet.cfg g_.a ddBm/I3yvPfrQT7ES2YQJddBm x_amd64/link(dns block)If you need me to access, download, or install something from one of these locations, you can either:
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.