Skip to content

Expose the visible revision for stamping events - #96

Merged
andreamancuso merged 1 commit into
mainfrom
core/event-revision
Nov 21, 2026
Merged

andreamancuso merged 1 commit into
mainfrom
core/event-revision

Conversation

@andreamancuso

@andreamancuso andreamancuso commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Why

xframes-core resolves a widget event to a message through the tree installed when the event is delivered. If a publication lands between the frame that processed a click and its delivery, the newer tree interprets it, and an unkeyed widget that moved can produce its neighbour's message (xframes-core#15). To resolve an event against the tree it was drawn from, each event must say which revision that was.

What

XFrames::VisibleRevision(): an atomic copy of the native revision, stored where the revision advances inside the publication's visibility locks. Render holds the same locks, so every event raised while a frame is built belongs to exactly that revision, and any thread can read it. The shared C library stamps its events with it; the engine itself raises no new events.

Tests

VisibleRevisionFollowsAppliedPublicationsOnly: the revision starts at 0, follows applied publications, does not move on a rejected one, and equals the commit state's nativeRevision. All 409 engine tests pass locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_0186WhMU3KjnmjR7Y4r49GrT

Summary by CodeRabbit

  • New Features
    • Applications can now read the revision number of the currently visible frame tree. The value starts at zero and updates after a publication is applied, allowing callers to check which revision is being displayed. Rejected publications leave the visible revision unchanged.

XFrames::VisibleRevision() returns the native revision of the tree that
frames show. It is an atomic stored where the revision advances, under
the visibility locks that rendering also holds, so an event raised
while a frame is built belongs to exactly that revision, and any thread
may read it. The shared C library stamps events with it, so that
xframes-core can resolve a widget event against the tree it was drawn
from (xframes-core#15).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0186WhMU3KjnmjR7Y4r49GrT
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

XFrames now exposes an atomic visible revision. Applied commits publish the native revision to it, and tests check its initial value and behavior after accepted and rejected publications.

Changes: Visible revision tracking

Layer / File(s) Summary
Revision publication and validation
packages/dear-imgui/cpp/app/include/xframes.h, packages/dear-imgui/cpp/app/src/xframes_commit.cpp, packages/dear-imgui/cpp/tests/xframes_test.cpp
XFrames adds an atomic visible-revision counter and an acquire-load accessor. Applied commits update the counter with release ordering. Tests check initialization, successful publication, and rejection behavior.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Merge Risk: Minimal · up to a5640

This adds a thread-safe read-only accessor for the revision of the tree currently shown, updated at the same point where the native revision advances. The change is small and additive, and the engine's existing behavior is unchanged. The new test covers the intended behavior. Event stamping happens in the shared C library, which this review did not cover.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Expose the visible revision for stamping events" matches the main change. The PR adds XFrames::VisibleRevision(), which exposes the native revision of the tree shown in frames, and the stat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Expose the visible revision for stamping events" matches the main change. The PR adds XFrames::VisibleRevision(), which exposes the native revision of the tree shown in frames, and the stated purpose is letting events be stamped with that revision. The supporting edits in xframes_commit.cpp and xframes_test.cpp are consistent with this aim. The title is specific and short, and it names the primary change from the developer's perspective.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bd24c0d8-29eb-4e2e-aa09-3dfff1a769db
Commits

Reviewing files that changed from the base of the PR and between 65576a3 and a5640e9.

Files selected for processing: 3

  • packages/dear-imgui/cpp/app/include/xframes.h
  • packages/dear-imgui/cpp/app/src/xframes_commit.cpp
  • packages/dear-imgui/cpp/tests/xframes_test.cpp

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@andreamancuso
andreamancuso merged commit a5640e9 into main Nov 21, 2026
10 checks passed
@andreamancuso
andreamancuso deleted the core/event-revision branch November 21, 2026 20:36

This branch was previously deployed

1 inactive deployment
github-pages — a5640e9f Deployed Nov 21, 2026 by andreamancuso via deploy #275
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.

1 participant