Skip to content

fix(cli): resolve query window by a numeric window server id - #442

Open
YuriNachos wants to merge 1 commit into
acsandmann:mainfrom
YuriNachos:YuriNachos/r3-rift
Open

fix(cli): resolve query window by a numeric window server id#442
YuriNachos wants to merge 1 commit into
acsandmann:mainfrom
YuriNachos:YuriNachos/r3-rift

Conversation

@YuriNachos

@YuriNachos YuriNachos commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The CLI window query only accepted the structured WindowId ({"pid":N,"idx":M} JSON). Resolving a window by its raw numeric window-server id (the u32 the macOS WindowServer assigns, e.g. as shown by rift query windows or system tools) required manually constructing that JSON. This adds first-class numeric-id resolution.

How it works

  • New protocol request RiftRequest::GetWindowInfoByServerId { window_server_id: u32 }.
  • A reactor query query_window_info_by_server_id resolves the server id to RuntimeWindowData.
  • The CLI Window subcommand now auto-detects the argument form:
    • decimal (6923) or hex (0x1b1b) → GetWindowInfoByServerId,
    • otherwise → existing JSON WindowId form → GetWindowInfo (back-compat preserved).
  • IPC handles the new request variant.

Existing JSON-form callers are unaffected: a non-numeric string still routes through the original parse_window_id path.

Test plan

  • cargo test498 passed, including 3 new rift-cli tests:
    • query_window_numeric_id_builds_by_server_id_request (decimal → ByServerId),
    • query_window_json_form_still_uses_window_id (JSON → WindowId back-compat),
    • query_window_hex_and_invalid (hex parse + invalid error).
  • Manual: rift query window <numeric-id> resolves the expected window on a live session.

Note on pre-existing test failures (not caused by this PR)

cargo test reports 12 failures in actor::reactor::tests::* (space/display topology resolution). These are pre-existing host-environment failures: an identical cargo test on a clean checkout of main (no changes) produces the same 12 failures with the same test names (498 passed / 12 failed). They assert multi-display SpaceId cross-display behavior that depends on the host display configuration, and are unrelated to the window-server-id query added here (which touches only query.rs / transport.rs / ipc.rs, not the reactor's space/display state machine).

The CLI window query only accepted the structured WindowId JSON. Add
first-class numeric window-server-id resolution: decimal/hex args route
to a new GetWindowInfoByServerId request (reactor lookup via
tracked_window_id), while the JSON form keeps working unchanged for
back-compat. Includes 3 CLI dispatch tests.
@YuriNachos

Copy link
Copy Markdown
Contributor Author

Rebased onto the new IPC model from 3a52122 — the window query path was untouched by the layout-state rework, so numeric window-server-id resolution re-applies unchanged on top of it. Decimal/hex args still route to GetWindowInfoByServerId, and the JSON WindowId form is unchanged. Targeted tests (rift-protocol suite + the CLI query_window dispatch tests) pass on the new base; main's pre-existing actor::reactor::tests failures are unchanged by this diff.

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