Skip to content

Support exact matches with -tag syntax even when tag is considered pattern like PORT or HAND #5579

Closed as duplicate

Description

@jyligehc

To my understanding RF test code should be case insensitive when naming tags but when using names in CAPS in include & exclude statements they should be written with lower letters when the contain words NOT, AND & OR.

With the new -TAG syntax we have noticed an issue with tag names in CAPS.

Let say in suite have defined:

Test Tags           SWPCK_ICU    SWPCK_ED    SWPCK_OR   TAG_WHYNOT

And in one of tests, tags are set as:

This Test Is Only For ICU SW
    [Tags]        SW_FEATURE    -SWPCK_ED    -SWPCK_OR    -TAG_WHYNOT

Then when I want to select SW_FEATURE tests but only those for OR SW I would use something like this:

--include sw_featureANDswpack_or

So now running this what happens is that the test “This Test Is Only For ICU SW” still gets executed.

But if in the RF code the tags are written like this:

    [Tags]        SW_FEATURE    -SWPCK_ED    -swpck_or    -TAG_WHYNOT

Now the test does not get executed, as expected.

Problem for us is that we have robocop checker in place that check that all our tags are written in CAPS (our internal decision).
To me this looks like a bug but maybe its intentional new requirement?

Activity

  1. pekkaklarck commented on Dec 17, 2025

    @pekkaklarck
    Member

    This certainly sounds wrong. Do I get it right that the same example works as expected if tags are in lower case? Which Robot version you are using?

  2. pekkaklarck commented on Dec 17, 2025

    @pekkaklarck
    Member

    Hmm, looking at rhe example again, I suspect the problem is with the name SWPCK_OR. Removing tags supports patterns and there's that OR on the name making -SWPCK_OR a pattern. That's not good. We probably should change to tag removal so that if there's a tag matching the given value directly, that tag is removed and the value is not considered a pattern.

  3. jyligehc commented on Dec 18, 2025

    @jyligehc
    Author

    Yes, it works as expected when tag name is written with lower case in RF testdata.

    And yes, I strongly think that it is related to those OR, NOT & AND words.
    I don't know how those -tags are handled in the code but looks like they are handled similar to include/exclude strings i.e. using CAPS there break things but works correctly with small letter.
    So if internally when working with -tags they would be converted to lower letter they would work fine. Just a thought.

  4. pekkaklarck commented on Dec 18, 2025

    @pekkaklarck
    Member

    I looked at this and realized that Boolean opetators don't make much sense in this context. The idea is to remove individual tags thus -xORy could be -x -y and -xANDy can never match anything. Using NOTx ought to remove all tags but x and possibly could be useful.

    The problem with removing Boolean opetator support is that someone could have used it for something useful. It's unlikely and I'd be fine with the removal in RF 7.5, but doing it in RF 7.4.1 doesn't sound good.

  5. pekkaklarck commented on Dec 18, 2025

    @pekkaklarck
    Member

    I tested that -NOTx removes all other tags than x and that -NOTxORy removes all other tags than x or y. These feel somewhat useful. Removing this support in RF 7.4.1 is certainly not possible and I don't think removing it is a good idea in general. We could change the -tag syntax so that if there's an exact match, we remove the matching tag. That could be a good behavior when matching tags in general, though. It would avoid the current problem with a tag like PORT not matching --include PORT as well. Such a change could cause subtle backwards incompatibility issues, though, and it's not something I want to do in RF 7.4.1.

    Overall I think it's best to delay fixing this to RF 7.5. We don't want to do bigger backwards in compatible changes in such a release either, but small behavioral changes are possible. Until that users who encounter this need to use lower case letters with the -tag syntax.

  6. added this to the v7.5 milestone on Dec 18, 2025
  7. added theissue type on Dec 18, 2025
  8. changed the issue type fromtoon Dec 18, 2025
  9. changed the title [-]With "-tag" syntax tags are not case‑Insensitive[/-] [+]Support exact matches with `-tag` syntax even when `tag` is considered pattern like `PORT` or `HAND`[/+] on Dec 18, 2025
  10. pekkaklarck commented on Apr 22, 2026

    @pekkaklarck
    Member

    I looked at changing tag pattern handling so that Boolean operators would always be considered literal values as well. In other words, something like FORCE would match a test with a tag FORCE, but it would also continue to match a test with tag F or CE. I was able to make this simple case work, but unfortunately making this work also if Boolean operators are actually used like FORCE AND XXX turned out to be impossible with the current semantics. We could consider changing the syntax so that Boolean operators could never be used like XXXORYYY and you needed to use XXX OR YYY instead. Supporting also XXX_OR_YYY and xxxORyyy could be considered as well. This would, however, be a bigger and more backwards incompatible change than what was discussed above. It could be worth it, but it would probably require a deprecation period and should also get its own issue.

    After noticing that handling tag pattern handling everywhere is a too big change for RF 7.5, I looked at changing only the -tag syntax. Based on my experiments that seems to be possible. I have a prototype ready that fixes to original reported issues and also passes all existing tests. I'll continue with it tomorrow.

  11. self-assigned this
    on Apr 22, 2026
  12. pekkaklarck commented on Apr 23, 2026

    @pekkaklarck
    Member

    I started thread about this topic on the #devel channel on our Slack. Not that many people have participated, but everyone agreed that the current behavior with tag patterns like HAND, PORT and KNOT is not good. We also agreed that we should change the semantics so that AND, OR and NOT are interpreted as Boolean operators only when surrounded with spaces (e.g. X AND Y) or when tag names are lower case (e.g. xORy). That change is backwards incompatible, so we decided to do it in RF 8.0 (#5656), but we'll deprecate the current behavior already in RF 7.5 (#5657).

    Changing Boolean operators in tag patterns are handled will automatically fix this issue so I'll mark this one as a duplicate of #5656. Unfortunately you need to wait for RF 8.0 until that, but I suspect you have already changed your data to use -swpck_or or have otherwise worked around this issue. The -SWPCK_OR usage will also cause a deprecation warning with RF 7.5 so it will be easier for others to understand what's going on.

  13. removed this from the v7.5 milestone on Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions