Repository navigation
feat: mxcli search --fail-on-match exits 1 on a hit, 0 on none - #1492
Merged
Merged
Conversation
This was referenced Oct 14, 2026
AI Code ReviewSummaryThe PR adds Critical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove. The PR is ready for merge. No blocking issues identified. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
…xlabs#1477) A pipeline that must refuse a change when a forbidden word turns up in the project's text had no exit status to read. With --fail-on-match, search exits 1 on at least one hit and 0 on none; a search that cannot run (an unbalanced quote, an unknown project) exits 2, so 1 always means a match. The SEARCH statement and search without the flag behave as before. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
stagknee
force-pushed
the
feat/search-fail-on-match
branch
from
October 14, 2026 23:07
c398a26 to
328268d
Compare
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.
Part of #1477. It was split out of #1478 at review, and it is independent of that PR because it is based on
main.What it does
mxcli search … --fail-on-matchturns a search into a gate:012", an unknown project)Results are printed as before (a JSON array under
--json). Without the flag a hit still exits 0, and theSEARCHstatement is unchanged.How
SearchOptions{Strict bool}andExecutor.SearchWithreturn the hit count.Strictreturns the index's error for a query it can't run. Without it, the error is swallowed as "no matches", as before. A gate needs this difference, because "nothing found" and "could not look" are not the same answer.os.Exit(1).docs-site/src/tools/search.md, plus the help text, the syntax entry and a CHANGELOG entry under Added.Evidence
Tests:
TestSearchFailOnMatch_ExitCode,TestSearchWithoutFailOnMatch_HitExitsZero,TestSearchFailOnMatch_UnrunnableQueryExitsTwo,TestSearchWith_ReturnsTheNumberOfHitsandTestSearchWith_StrictReportsAQueryTheIndexRejects(in table and JSON formats).HitExitsZerois a regression guard and passes both ways.Real app (Mendix 11.12.5):
--fail-on-matchon a hit--fail-on-matchon no hit--fail-on-matchon"unbalanced--fail-on-matchon an unknown projectWindows: the failing tests across
mdl/executorandcmd/mxcliare the same set as onmain.Linux (
golang:1.26.6-bookworm, ANTLR 4.13.2, as in CI):make grammar build test check-mdl check-findings check-conformance check-migration-reference lint-goall pass.--exclude-marketplace(#1493) also adds a field toSearchOptions. Whichever PR lands second will need a small rebase, and I'll do it.🤖 Generated with Claude Code