Repository navigation
fix: parse_xpath keeps what follows true() / false() (closes #1894) - #1895
Closed
Joshua-TOF wants to merge 1 commit into
Closed
Joshua-TOF wants to merge 1 commit into
Joshua-TOF wants to merge 1 commit into
Conversation
…bs#1894) In XPath mode parseIdentLed returned a BoolLit for true/false before the '(' check, so the empty argument list of true() / false() was left on the stream. The parse ended there and Parse reported E014; builtinParseXPath discarded the hints, so a rule got the first comparison of [IsConfidential = false() or Mod.Report_Owner = '[%CurrentUser%]'] as if it were the whole constraint. - XPath mode consumes the empty () after true / false. In a microflow expression false() stays an error (E014). - parse_xpath returns a recovered root, with the whole source, when the parse leaves tokens over (E014), as the write-lint-rules skill says parse failures do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
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.
Closes #1894
What.
parse_xpathreturns the whole tree of an XPath that usestrue()orfalse():[IsConfidential = false() or Mod.Report_Owner = '[%CurrentUser%]'](IsConfidential = false)((IsConfidential = false) OR (Mod.Report_Owner = '[%CurrentUser%]'))[Name = 'x' 'y'](Name = 'x')recoveredroot with the whole sourceWhy.
true()/false()is how Mendix XPath constraints usually write a Boolean, so access rules hit this often. A lint rule that checks whether everyorbranch of an access rule leads to the current user judged a fragment of the constraint, and which fragment depended on the order of its terms. The partial tree also gave no sign that anything was missing.How.
mdl/exprcheck/parser.go,parseIdentLed: in XPath mode,true/falsefollowed by()consume the empty argument list and stay aBoolLit. Without XPath mode nothing changes, sofalse()in a microflow expression is still E014.mdl/linter/starlark.go,builtinParseXPath: whenParsereports E014 (tokens left over), it returns arecoveredroot holding the whole source, with the hint's problem asreason, as the write-lint-rules skill says parse failures do. Before, the hints were discarded and the partial tree came back as if it were complete.XPath mode is only set in
builtinParseXPath, socheck,execand describe are unaffected, and no bundled lint rule callsparse_xpath.Testing.
mdl/exprcheck/xpath_mode_test.go: three XPaths withtrue()/false()in eitherororder and inside parentheses parse with no E014 and keep their top-levelor/and;Active = true()gives aBoolLit;$X = false() or $Yas an expression still reports E014.mdl/linter/starlark_xpath_paths_test.go:parse_xpathrenders the full tree for those XPaths through a Starlark rule, and returnsrecoveredwith the whole source for[Name = 'x' 'y'].mdl/executor,mdl/exprcheck/...,mdl/linter,mdl/exprcatalog,cmd/mxcli/syntaxandcmd/mxcli/testrunnerpass, onmainand on this branch.go vetreports nothing;gofmtis clean.make lintnot run.orwithfalse()first, and a nestedand/or): the full trees, where v0.31.0 returns only the first comparison.🤖 Generated with Claude Code