Skip to content

fix(xtext): match case-sensitive pattern lookups against the candidate name - #1551

Merged
joaodinissf merged 1 commit into
masterfrom
fix/case-sensitive-pattern-lookup
Sep 28, 2026
Merged

joaodinissf merged 1 commit into
masterfrom
fix/case-sensitive-pattern-lookup

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

Problem

PatternAwareEObjectDescriptionLookUp.getExportedObjects(type, name, ignoreCase) filters the candidates of a case-sensitive pattern query with:

((QualifiedNamePattern) name).matches(name)

This tests the pattern against itself, not against the candidate input. QualifiedNamePattern.matches returns false for any QualifiedNamePattern argument (QualifiedNamePattern.java:263-264), so the predicate is always false. Every case-sensitive pattern query returns an empty result, whatever descriptions are stored. The ignoreCase=true path and plain-name lookups are unaffected.

This lookup backs DDK's resource descriptions (ResourceDescription2, SimpleResourceDescription, FixedCopiedResourceDescription, FingerprintResourceDescription). Any case-sensitive ContainerQuery with a name pattern (ContainerQuery.java:300) is therefore affected.

Fix

Match the pattern against each candidate's name: matches(input.getName()).

Test

PatternAwareEObjectDescriptionLookUpTest is registered in XtextTestSuite:

  • Case-sensitive pattern queries: Foo* returns Foo and FooBar but not foobar, and an exact pattern returns its match. Both methods fail on master ([]) and pass with the fix.
  • Guards: the case-insensitive pattern, the case-sensitive plain name and the type filter. These already pass on master and must keep passing.

Local run: full mvn clean verify passes apart from failures that also occur on master in this environment; checkstyle and PMD are clean.

Compatibility

Case-sensitive pattern queries now return results, which is the documented behaviour. Downstream code that worked around the empty result, for example by always passing ignoreCase=true, may want to revisit that.

Found by the formal model of the qualified-name lookup in #1549 (formal/BUGS.md, TRIE-1). Lean proves the old predicate empty for all inputs (All.consumer_cs_empty), and 3/3 independent reviewers upheld it.

🤖 Generated with Claude Code

…e name

PatternAwareEObjectDescriptionLookUp tested a QualifiedNamePattern against
itself instead of against each candidate description's name. matches()
returns false for any QualifiedNamePattern argument, so every
case-sensitive pattern query (getExportedObjects(type, pattern, false))
returned an empty result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joaodinissf added a commit that referenced this pull request Sep 26, 2026
formal/README.md describes the method, target status, models and how to
reproduce. formal/BUGS.md catalogues 51 findings (49 confirmed, 1
plausible, 1 refuted) plus 9 observations, all verified by three
independent skeptics, with traces, test status, fix plans, a proposed
fix-PR sequence and links to the fix PRs opened so far (#1550, #1551,
#1552, #1553). REPORT.md is the chronological log of rounds 1-2. The
patches are reference fixes used to show each disabled test turns green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@rubenporras rubenporras left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

@rubenporras rubenporras left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind

@joaodinissf
joaodinissf marked this pull request as ready for review September 28, 2026 22:41
@joaodinissf
joaodinissf merged commit b416e9e into master Sep 28, 2026
4 checks passed
@joaodinissf
joaodinissf deleted the fix/case-sensitive-pattern-lookup branch September 28, 2026 22:42
joaodinissf added a commit that referenced this pull request Sep 29, 2026
formal/README.md describes the method, target status, models and how to
reproduce. formal/BUGS.md catalogues 51 findings (49 confirmed, 1
plausible, 1 refuted) plus 9 observations, all verified by three
independent skeptics, with traces, test status, fix plans, a proposed
fix-PR sequence and links to the fix PRs opened so far (#1550, #1551,
#1552, #1553). REPORT.md is the chronological log of rounds 1-2. The
patches are reference fixes used to show each disabled test turns green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants