fix: correct malformed WASM binary and stale test expectation in guard tests#1849
Merged
fix: correct malformed WASM binary and stale test expectation in guard tests#1849
Conversation
…d tests - Fix blockingGuardWasm: type section header claimed 7 bytes but had 4; rebuilt correct 39-byte WASM binary for (module (func (export "loop") (loop (br 0)))) - Fix TestParsePathLabeledResponse: empty labeled_paths with nil data no longer errors after NewPathLabeledData behavior change Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes failing WASM guard tests by correcting an embedded WASM binary used for context-cancellation testing and updating a test expectation around path-based labeling parsing.
Changes:
- Rebuilds
blockingGuardWasminto a valid WASM binary (fixing section sizes and code body bytes). - Updates
TestParsePathLabeledResponseto expect success (not error) whenlabeled_pathsis empty andoriginalDataisnil.
💡 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Mar 13, 2026
lpcox
added a commit
that referenced
this pull request
Mar 15, 2026
…w error wrapping (#1929) ## Summary Addresses the High and Medium priority findings from the [BurntSushi/toml Go module review](#1849). ## Changes ### Remove dead `*toml.ParseError` pointer assertion (`config_core.go`) `toml.Decode` always returns `ParseError` as a **value type**, so the `err.(*toml.ParseError)` pointer assertion could never match. This was misleading dead code with a stale comment claiming it was needed for "compatibility". ### Use `%w` wrapping for richer parse error messages Replaced: ```go return nil, fmt.Errorf("failed to parse TOML at line %d, column %d: %s", perr.Position.Line, perr.Position.Col, perr.Message) ``` With: ```go return nil, fmt.Errorf("failed to parse TOML: %w", perr) ``` This surfaces `ParseError.Error()`'s full formatted output — including the TOML source line and a `^` column pointer — giving users much better context when their config has a syntax error. It also preserves the structured `ParseError` type for callers using `errors.As`. **Before:** ``` failed to parse TOML at line 5, column 12: expected value but found 'x' ``` **After:** ``` failed to parse TOML: 5 | port = x ^ Error: expected value but found 'x' ``` ### Update package doc comment Reflects the new error-wrapping approach instead of the old manual field extraction. ## Testing All unit and integration tests pass (`make agent-finished`).
4 tasks
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.
Summary
Fixes two failing tests in
internal/guard/wasm_test.go.1. Malformed WASM binary (
TestWasmGuardContextPropagation)The hand-crafted
blockingGuardWasmbyte array had incorrect section lengths:0x07(7 bytes) but only 4 bytes followedRebuilt as a correct 39-byte WASM binary for
(module (func (export "loop") (loop (br 0)))).2. Stale test expectation (
TestParsePathLabeledResponse)parsePathLabeledResponsewith emptylabeled_pathsand nil original data now succeeds (returns empty collection) after theNewPathLabeledDatabehavior change. Updated the test to expect success instead of error.Testing
make agent-finishedpasses.