InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

NEW: Test case for monotonic timestamps.

Open ekcoh opened this issue 2 months ago • 5 comments

Description

As part of a pending Unity PR we ended up in a discussion whether Input System requires strictly increasing timestamps or not. This PR proves with an automated tests that timestamps do not have to be strictly incrementing, but should have timestamps greater or equal to the last received timestamp for the same source (device).

Skipping CHANGELOG update since test only.

Testing status & QA

Adds a single test.

Overall Product Risks

  • Complexity: Minimal
  • Halo Effect: Minimal

Comments to reviewers

Nothing special.

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 %<ID>%). 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.

After merge:

  • [ ] Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

ekcoh avatar Oct 21 '25 12:10 ekcoh

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

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

The PR adds a single, straightforward automated test that is easy to understand and validate.
🏅 Score: 100

The PR adds a well-structured and clear automated test that perfectly validates the intended timestamp behavior, with no apparent issues.
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

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

u-pr-agent[bot] avatar Oct 21 '25 12:10 u-pr-agent[bot]

PR Code Suggestions ✨

No code suggestions found for the PR.

u-pr-agent[bot] avatar Oct 21 '25 12:10 u-pr-agent[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

@@             Coverage Diff             @@
##           develop    #2262      +/-   ##
===========================================
+ Coverage    76.70%   76.81%   +0.10%     
===========================================
  Files          465      476      +11     
  Lines        87919    88659     +740     
===========================================
+ Hits         67442    68101     +659     
- Misses       20477    20558      +81     
Flag Coverage Δ
inputsystem_MacOS_2021.3 5.93% <ø> (+0.02%) :arrow_up:
inputsystem_MacOS_2022.3 5.39% <ø> (+0.02%) :arrow_up:
inputsystem_MacOS_2022.3_project 74.74% <100.00%> (+0.16%) :arrow_up:
inputsystem_MacOS_6000.0 5.18% <ø> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.0_project 76.60% <100.00%> (+0.09%) :arrow_up:
inputsystem_MacOS_6000.2 5.18% <ø> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.2_project 76.60% <100.00%> (+0.09%) :arrow_up:
inputsystem_MacOS_6000.3 5.18% <ø> (-0.01%) :arrow_down:
inputsystem_MacOS_6000.3_project 76.60% <100.00%> (+0.09%) :arrow_up:
inputsystem_MacOS_6000.4 5.19% <ø> (+<0.01%) :arrow_up:
inputsystem_MacOS_6000.4_project 76.61% <100.00%> (+0.11%) :arrow_up:
inputsystem_MacOS_6000.5 5.19% <ø> (?)
inputsystem_MacOS_6000.5_project 76.61% <100.00%> (?)
inputsystem_Ubuntu_2021.3 5.94% <ø> (+0.02%) :arrow_up:
inputsystem_Ubuntu_2022.3 5.40% <ø> (+0.02%) :arrow_up:
inputsystem_Ubuntu_2022.3_project 74.54% <100.00%> (+0.15%) :arrow_up:
inputsystem_Ubuntu_6000.0 5.19% <ø> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.0_project 76.40% <100.00%> (+0.08%) :arrow_up:
inputsystem_Ubuntu_6000.2 5.19% <ø> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.2_project 76.40% <100.00%> (+0.08%) :arrow_up:
inputsystem_Ubuntu_6000.3 5.19% <ø> (-0.01%) :arrow_down:
inputsystem_Ubuntu_6000.3_project 76.40% <100.00%> (+0.08%) :arrow_up:
inputsystem_Ubuntu_6000.4 5.19% <ø> (+<0.01%) :arrow_up:
inputsystem_Ubuntu_6000.4_project 76.41% <100.00%> (+0.09%) :arrow_up:
inputsystem_Ubuntu_6000.5 5.19% <ø> (?)
inputsystem_Ubuntu_6000.5_project 76.41% <100.00%> (?)
inputsystem_Windows_2021.3 5.93% <ø> (+0.02%) :arrow_up:
inputsystem_Windows_2022.3 5.39% <ø> (+0.02%) :arrow_up:
inputsystem_Windows_2022.3_project 74.87% <100.00%> (+0.14%) :arrow_up:
inputsystem_Windows_6000.0 5.18% <ø> (-0.01%) :arrow_down:
inputsystem_Windows_6000.0_project 76.73% <100.00%> (+0.08%) :arrow_up:
inputsystem_Windows_6000.2 5.18% <ø> (-0.01%) :arrow_down:
inputsystem_Windows_6000.2_project 76.72% <100.00%> (+0.08%) :arrow_up:
inputsystem_Windows_6000.3 5.18% <ø> (-0.01%) :arrow_down:
inputsystem_Windows_6000.3_project 76.72% <100.00%> (+0.08%) :arrow_up:
inputsystem_Windows_6000.4 5.19% <ø> (+<0.01%) :arrow_up:
inputsystem_Windows_6000.4_project 76.73% <100.00%> (+0.09%) :arrow_up:
inputsystem_Windows_6000.5 5.19% <ø> (?)
inputsystem_Windows_6000.5_project 76.73% <100.00%> (?)

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

Files with missing lines Coverage Δ
Assets/Tests/InputSystem/CoreTests_Events.cs 98.50% <100.00%> (+0.03%) :arrow_up:

... and 25 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-github-com[bot] avatar Oct 21 '25 12:10 codecov-github-com[bot]

This currently fails for Android due to package containing Android specific path which ignores timestamps.

ekcoh avatar Oct 21 '25 21:10 ekcoh

Thanks for adding this, makes a lot of sense to have this.

How should we proceed with regards to Android CI errors? I'm fine approving once CI is green

Good question, I want to sync up with Android team how they decide to land and backport the pending PR first. Then we either need to add an exception to the test (until it can be removed from InputManager), or let this just sit here until it can be removed from Input Manager. It might be that the exception becomes version specific, but ideally not.

Other ideas @jfreire-unity ?

ekcoh avatar Oct 27 '25 09:10 ekcoh