Repository navigation
fix(critcheck): treat BSD grep regex errors as malformed checks - #198
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
macOS grep reports "parentheses not balanced" and a lowercase "trailing backslash" when it refuses a pattern. Those lines were not usage errors, so a malformed grep criterion counted as a real failure. Fixes Agent-Field#192 Fixes Agent-Field#190
Collaborator
|
Thanks! Before we can review this, please sign the SWE-AF CLA: https://cla-assistant.io/Agent-Field/SWE-AF?pullRequest=198 (it's separate from the agentfield one). |
Author
|
@AbirAbbas the CLA is signed and the check is green now. |
This branch has not been deployed
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.
Fixes #192
Summary
Malformedrecognized GNU grep and ripgrep regex failures (Unmatched,Invalid regular expression,Trailing backslash,regex parse error) and option errors. It did not recognize BSD grep.regerror(3)in lowercase:parentheses not balanced,brackets ([ ]) not balanced,trailing backslash (\), and the other pattern-compile errors (braces not balanced,invalid regular expression,invalid character class,invalid character range,invalid backreference number,invalid repetition count(s),invalid collating element,repetition-operator operand invalid,empty (sub)expression).grep -E 'Checksum(' filetherefore stayed a real failure on macOS, andTestAMalformedCheckWithNoRepairIsNotCountedfailed there because it re-runs grep. Those lines are now usage errors, same as the GNU wording. A missing file (No such file or directory) andout of memorystay real failures. Exit status 2 alone is not enough: grep uses it for both.Testing and validation
TestMalformedTellsUsageFromAssertioncovers each BSDregerrorline above, plusegrep:, and keeps a missing file andout of memoryas assertions.TestABSDGrepRegexErrorIsNotCountedre-runs`grep -E 'Checksum(' ledger.go`with tool outputgrep: parentheses not balancedand expects the criterion not counted.TestAMissingGrepTargetStaysARealFailurekeepsgrep: ledger.go: No such file or directoryas a failure.TestABSDGrepRegexErrorIsNotCountedandTestMalformedTellsUsageFromAssertionfailed. After it,go test -race -count=1 ./internal/critcheckpassed (23 tests). The existing GNU case still passes on a host whose grep printsUnmatched (.Behavior Impact
A malformed grep or egrep pattern is not counted on macOS as well as on Linux. A check that runs and fails, including a missing path, is unchanged.
AI assistance was used to prepare this change and its tests.