Skip to content

Conversation

@josepmariapujol-unity
Copy link
Collaborator

@josepmariapujol-unity josepmariapujol-unity commented Jan 7, 2026

Description

Normalize consecutive wildcards ('' / '**') semantics are handled correctly. Consecutive wildcard characters ('') used in input control-paths are now collapsed into a single wildcard when multiple consecutive wildcard characters are present.

NOW, if we have multiple **** result the same behaviour than only one *
BEFORE, multiple **** result in a different behaviour than only one *

JIRA: ISX-2467

Testing status & QA

Type multiple ****, should behave the same way as if you typed only one *.
First editor contains PR changes, second editor uses old input system version (hence, not working with multiple ***).

Screen.Recording.2026-01-16.at.14.09.03.mov

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity: 1
  • Halo Effect: 1

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

@josepmariapujol-unity josepmariapujol-unity self-assigned this Jan 7, 2026
@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Jan 7, 2026

PR Reviewer Guide 🔍

(Review updated until commit 322b52e)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪

Small, localized behavior change in path matching plus a focused test and changelog update.
🏅 Score: 86

The fix is straightforward and test-backed, but visibility changes and wildcard semantics should be validated against existing callers and expected `*` vs `**` behavior.
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

API Surface

PathComponentType and MatchPathComponent were changed from private to internal; confirm this is intentional (tests vs. product code) and won’t create unwanted external dependencies or API-compat expectations within the assembly.

internal enum PathComponentType
{
    Name,
    DisplayName,
    Usage,
    Layout
}

internal static bool MatchPathComponent(string component, string path, ref int indexInPath, PathComponentType componentType, int startIndexInComponent = 0)
{
Semantics Change

Collapsing consecutive * changes behavior by making **/*** equivalent to *; verify this matches desired semantics for all component types (Name/Layout/Usage/DisplayName) and doesn’t conflict with any prior or planned special meaning for **.

// If we've reached a '*' in the path, skip character in name.
if (nextCharInPath == '*')
{
    // Collapse consecutive '*' so matching logic here only needs to handle a single '*'.
    while (indexInPath + 1 < pathLength && path[indexInPath + 1] == '*')
        ++indexInPath;

    // But first let's see if we have something after the wildcard that matches the rest of the component.
Test Coverage

The new test only asserts match success for *Trigger, **Trigger, ***Trigger; consider adding assertions for non-matches and edge cases (e.g., patterns consisting only of */**, wildcard at end, and interaction with delimiters) to prevent regressions in indexInPath advancement and termination conditions.

[Test]
[Category("Controls")]
public void Controls_MatchPathComponent_CollapsesConsecutiveWildcards()
{
    var component = "leftTrigger";
    var componentType = InputControlPath.PathComponentType.Name;

    var patterns = new[]
    {
        "*Trigger",
        "**Trigger",
        "***Trigger"
    };

    foreach (var path in patterns)
    {
        var indexInPath = 0;
        var result = InputControlPath.MatchPathComponent(component, path, ref indexInPath, componentType);

        // All patterns should match
        Assert.IsTrue(result, $"Pattern '{path}' should match '{component}'");
        Assert.AreEqual(path.Length, indexInPath,
            $"Index should advance past entire pattern for '{path}'");
    }
  • Update review

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@josepmariapujol-unity josepmariapujol-unity changed the title Normalize consecutive wildcards so */** semantics are handled correctly Handle consecutive wildcards in StringMatches (2/x) Jan 7, 2026
@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Jan 7, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

@codecov-github-com
Copy link

codecov-github-com bot commented Jan 7, 2026

Codecov Report

Attention: Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...putsystem/InputSystem/Controls/InputControlPath.cs 75.00% 1 Missing ⚠️
@@           Coverage Diff            @@
##           develop    #2311   +/-   ##
========================================
  Coverage    77.95%   77.95%           
========================================
  Files          476      476           
  Lines        97453    97464   +11     
========================================
+ Hits         75971    75981   +10     
- Misses       21482    21483    +1     
Flag Coverage Δ
inputsystem_MacOS_2022.3 5.53% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_2022.3_project 75.47% <93.75%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.0 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.0_project 77.36% <93.75%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.3 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.3_project 77.36% <93.75%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.4 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.4_project 77.37% <93.75%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.5 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.5_project 77.37% <93.75%> (+<0.01%) ⬆️
inputsystem_Ubuntu_2022.3 5.54% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_2022.3_project 75.27% <93.75%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.0 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0_project 77.16% <93.75%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.3 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3_project 77.18% <93.75%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.4 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.4_project 77.18% <93.75%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.5 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.5_project 77.18% <93.75%> (+<0.01%) ⬆️
inputsystem_Windows_2022.3 5.54% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_2022.3_project 75.60% <93.75%> (+<0.01%) ⬆️
inputsystem_Windows_6000.0 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.0_project 77.49% <93.75%> (-0.01%) ⬇️
inputsystem_Windows_6000.3 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.3_project 77.49% <93.75%> (+<0.01%) ⬆️
inputsystem_Windows_6000.4 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.4_project 77.50% <93.75%> (+<0.01%) ⬆️
inputsystem_Windows_6000.5 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.5_project 77.50% <93.75%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Assets/Tests/InputSystem/CoreTests_Controls.cs 99.81% <100.00%> (+<0.01%) ⬆️
...putsystem/InputSystem/Controls/InputControlPath.cs 91.78% <75.00%> (-0.10%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josepmariapujol-unity josepmariapujol-unity changed the title Handle consecutive wildcards in StringMatches (2/x) FIX: Handle consecutive wildcards in StringMatches (2/x) Jan 8, 2026
Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

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

Change looks good to me but I would suggest making sure this is covered in a unit test. If this logic currently lacks any unit test I would suggest adding at least one covering this specific scenario.

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

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

Another thing to address, there is no ticket trace nor any CHANGELOG entry for this fix, please add that.

@josepmariapujol-unity josepmariapujol-unity marked this pull request as draft January 12, 2026 14:01
@josepmariapujol-unity josepmariapujol-unity marked this pull request as ready for review January 12, 2026 14:29
@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Jan 12, 2026

Persistent review updated to latest commit 322b52e

@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Jan 12, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

@ekcoh ekcoh requested a review from Pauliusd01 January 13, 2026 09:19
@Pauliusd01
Copy link
Collaborator

Did not forget about this one, taking a look

@Pauliusd01
Copy link
Collaborator

/test_plan

@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Jan 16, 2026

Test Plan

  • Test plan approved by PR author
  • Test execution in progress
  • Test execution complete
  • Ready for merge

Summary of Changes & Risk Assessment

Summary of Changes

This PR addresses a long-standing TODO in the InputControlPath matching logic by normalizing consecutive wildcards (*). When multiple asterisks appear in a control path (e.g., ** or ***), they are now collapsed and treated as a single wildcard *. The MatchPathComponent method and its associated enum were changed from private to internal to allow for direct unit testing of the matching logic.

Risk Assessment

  • High Risk Areas: None identified.
  • Medium Risk Areas: Core path matching logic (InputControlPath.MatchPathComponent) which affects how controls are resolved from strings.
  • Low Risk Areas: Visibility changes (private to internal) and documentation/changelog updates.

Test Scenarios

Functional Testing

  • Verify that patterns with varying consecutive wildcards (*Trigger, **Trigger, ***Trigger) all successfully match a target string like leftTrigger as shown in CoreTests_Controls.cs:L1618-L1634.
  • Validate that wildcard collapsing works for all PathComponentType values: Name, DisplayName, Usage, and Layout.
  • Verify that standard single-wildcard matching still functions correctly without regressions.

Regression Testing

  • Negative Matching: Ensure that collapsed wildcards do not cause false positives (e.g., **Stick should NOT match leftTrigger).
  • Index Advancement: Verify that indexInPath correctly advances to the end of the collapsed wildcard sequence, ensuring subsequent path components (after a /) are parsed from the correct position.
  • Run existing InputControlPath tests to ensure no breaking changes to complex path resolution: ./utr --testfilter=InputControlPath.
🔍 Regression Deep Dive (additional risks identified)
  • Delimiters: Verify that collapsing stops at path delimiters (e.g., **/{Stick} should collapse the first two stars but not affect the {} component).
  • Case Sensitivity: Ensure that the existing case-insensitive matching logic still applies correctly when wildcards are involved.

Edge Cases

  • Trailing Wildcards: Test a path that ends with multiple wildcards (e.g., left**) against a valid component.
  • Only Wildcards: Test a path consisting entirely of multiple wildcards (e.g., ****) to ensure it matches any valid component string without hanging or crashing.
  • Interspersed Wildcards: Ensure that *A*B does NOT collapse into *AB (only consecutive characters should collapse).

💡 This test plan updates automatically when /test_plan is run on new commits. If you have any feedback, please reach out in #ai-qa


🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@josepmariapujol-unity josepmariapujol-unity changed the title FIX: Handle consecutive wildcards in StringMatches (2/x) FIX: Handle consecutive wildcards in StringMatches Jan 16, 2026
@josepmariapujol-unity josepmariapujol-unity changed the title FIX: Handle consecutive wildcards in StringMatches FIX: Handle consecutive wildcards in StringMatches (1/x) Jan 16, 2026
@Pauliusd01
Copy link
Collaborator

Pauliusd01 commented Jan 16, 2026

image

Just an FYI in case it is relevant but if you use /*/* you get these two errors. It is the same in develop but thought I'd mention it anyway.

@josepmariapujol-unity josepmariapujol-unity merged commit a83a39f into develop Jan 16, 2026
111 checks passed
@josepmariapujol-unity josepmariapujol-unity deleted the input/removing-legacy-todos-3 branch January 16, 2026 14:22
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.

4 participants