Skip to content

Update explainer.md (stage 2)#96

Merged
m-alkalbani merged 2 commits intomainfrom
m-alkalbani-explainer-2
Mar 23, 2026
Merged

Update explainer.md (stage 2)#96
m-alkalbani merged 2 commits intomainfrom
m-alkalbani-explainer-2

Conversation

@m-alkalbani
Copy link
Copy Markdown
Contributor

As outlined in #94, added content for stage 2 of re-writing the explainer. This covers Proposed Approach (basic testing pattern and a few primer JS examples on getting started).

As outlined in #94, added content for stage 2 of re-writing the explainer. This covers Proposed Approach (basic testing pattern and a few primer JS examples on getting started).
@flyingzl flyingzl closed this Feb 26, 2026
@flyingzl flyingzl reopened this Feb 26, 2026
Copy link
Copy Markdown
Contributor

@alcooper91 alcooper91 left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, I was unexpectedly OOO the last three weeks. I have one minor concern with the "Next animation frame" logic being described here; relevant to some logic we do in the tests. LMK your thoughts.

Comment thread explainer.md Outdated
1. **Connect a fake device** with the desired capabilities (session types, views, supported features, etc.).
2. **Use WebXR entry points** to obtain a session (e.g. `navigator.xr.requestSession(. . .)`).
3. **Drive device state** (viewer pose, tracking loss, bounds/floor origin, visibility state etc.).
4. **Advance one frame**, then assert on data returned by WebXR (poses, events, hit test results etc.).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think in some cases in the spec we require two frames to pass before state is guaranteed. This is because there may be a delay in getting data updated. e.g. If you submit the data update in the returned animation frame it may not take effect before the next frame has been sent to you, but it should be fixed by that following frame (e.g. an update made during frame N is only guaranteed to be present in the data for frame N+2).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. Just to make sure I understand correctly, is this referring specifically to cases where the test state is updated from within the XR animation frame callback, so the change may then only be guaranteed in the N+2 frame?

In order to address this, would it be better to change the explainer language throughout from "wait at least one frame" to "wait for up to two frames"? I am thinking of the examples below (and future ones) which are mostly framed around asserting expected outcomes on the next frame.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, I guess the comment on the code says only if it's outside of the animation frame that the update method is called, so I guess we may still want it to be the next frame? (And of course there's no guarantees for methods that return promises).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the extra insights, makes sense - I still think it may be worth adding a note about this at the top to align with what's on the spec and better manage expectations. I made another PR with a short note after step 4 in the basic testing flow section. LMK your thoughts on the wording

@alcooper91 alcooper91 self-requested a review March 13, 2026 22:41
Added a note after step 4 in the basic testing flow section to address the next animation frame logic described.
@m-alkalbani m-alkalbani requested a review from alcooper91 March 18, 2026 16:07
@m-alkalbani m-alkalbani merged commit 318f4d9 into main Mar 23, 2026
@m-alkalbani m-alkalbani deleted the m-alkalbani-explainer-2 branch April 2, 2026 15:15
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.

3 participants