You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(components): render ComposerRestored..PromptCard tests in a happy-dom page - #4816
Second of four PRs moving the src/ tests off the deprecated react-test-renderer. Stacked on #4815 (it needs src/lib/page.fixture.ts and the DOM preload from there); this PR's own diff is only the 37 component tests from ComposerRestored to PromptCard.submission. Retarget to main after #4815 merges.
Test meaning
Every file keeps its test names, order, test count and expect() count (checked per file against origin/main). Assertions go through the DOM instead of React props: props.onClick() → click(), onChange → page.type(), toJSON() text → textContent. Shifts worth a look, all toward what a user sees:
InboxList: the filter menu is checked through its real radio items (names, order, checked state) instead of the props handed to RowMenu; the more-menu callback receives the button that was clicked.
FileViewer.scripts: turning scripts on replaces the real iframe element; relay messages start from the iframe's real load event.
ConnectPhoneDialog: QR codes are checked in the rendered SVG; tab and list order, the relay toggle and the remove-all confirmation through the DOM instead of child-component props. The waiting tab's link is matched in full instead of by suffix.
OwnJoins, PaneCanvas: focus is checked as the real document.activeElement instead of an autoFocus prop or a fake focus().
PromptCard view-only: a click on the disabled button sends nothing (React drops events on disabled buttons) instead of calling its handler by hand.
InboxRail: no longer mocks RowMenu (the module mock outlived the file in a shared process and hid InboxList's real menus); "no menu" is checked in the DOM.
PromptCard.submission: a watch-only device's answer buttons stay disabled, and the answer handler called directly (through the fixture's reactProps) still sends nothing; deleting || watching fails the test.
NewSessionDialog: an effort Claude lacks leaves Start enabled and the request without an effort.
Validation
bun run typecheck: pass.
The 37 changed test files, one process per file: 37/37 pass. The 37 files in one bun process: 529 pass, 0 fail (before the review fixes, InboxRail then InboxList failed 3 there).
Review fixes checked by mutation (watch-only guard, effort carry-over, InboxRail menu, NewPcNotices storage block): each mutation fails its test.
Skipped locally: bun run check fast (this PC above 85% CPU); CI's Fast checks runs it.
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Tests
Updated component tests to run in a browser-like environment and verify behavior through rendered pages and real DOM interactions.
Existing coverage for dialogs, navigation, file viewing, device and account management, messaging, and other workflows remains in place.
The PR migrates 37 component test files from react-test-renderer and hand-built browser mocks to a page fixture. Tests render through browser-like pages and use DOM queries, events, and controls while retaining their existing scenarios and expected outcomes.
Changes: Browser-backed component test migration
Layer / File(s)
Summary
Composer and connection tests src/components/ComposerRestored.test.tsx, ComposerUploadFailure.test.tsx, ConnectPhoneDialog.test.tsx, ConnectStart.listAdd.test.tsx, ConnectionRouteMark.test.tsx
Tests use page rendering and DOM events for Composer input, connection dialogs, QR-code output, and route assertions.
devswha/ovis#4815: Adds the page fixture and Bun loader plugin used by these migrated tests.
Suggested reviewers:najy97
Merge Risk: Minimal · previous review c3995
This change only migrates component tests to a different test harness, and it does not change production behavior. No actionable merge-blocking risk was found in the review.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: component tests moved from react-test-renderer to a happy-dom page fixture for ComposerRestored through PromptCard. The raw summary and objectives confirm this is the …
Description check
The description follows the template's two sections. The 'What' section explains the problem (react-test-renderer deprecation) and the resulting behavior, and it links the stacked dependency #4815. Th…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: component tests moved from react-test-renderer to a happy-dom page fixture for ComposerRestored through PromptCard. The raw summary and objectives confirm this is the changeset's primary purpose. The title is specific and concise.
Full details: Description check
Explanation
The description follows the template's two sections. The 'What' section explains the problem (react-test-renderer deprecation) and the resulting behavior, and it links the stacked dependency #4815. The 'Validation' section lists the commands run, their results, and the skipped check with its reason. It notes that no changelog fragment is needed. The template's 'Change' heading is adapted to 'What' and the 'Test meaning' section is extra, but the required information is present.
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.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
…y-dom page
Second step off react-test-renderer: the 37 component tests from
ComposerRestored to PromptCard.submission render with react-dom into the
happy-dom page (src/lib/page.fixture.ts) and act through the DOM: clicks,
typed input, submit and focus events instead of calling React props, and the
page's text instead of the serialized element tree.
Each file keeps its test names, test count and expect() count.
- InboxRail: drop the RowMenu module mock, which outlived the file in a shared
bun process and hid InboxList's real menus; check the real menu instead.
- NewSessionDialog: an effort Codex has and Claude lacks leaves Start enabled and
the request without an effort, not only an empty-looking select.
- PromptCard.submission: keep the disabled answers and call the answer handler of
a watch-only device directly; it must still send nothing.
- NewPcNotices: block storage writes with defineProperty (happy-dom's Storage
ignores assignments to its methods).
Merged through pr-merge at head 14de94d1e. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.
main moved but untouched: merged without update. Its new commits up to 40a850458 change no file of this pull request, none imported by one, nothing that decides which checks run, and no core path.
Reviews: omo gate CLEAR at c39956e (dori review receipt; an earlier BLOCK at 887e700 was fixed); Codex adversarial review (gpt-6.2-sol-fast, xhigh) ran once on the whole 4-PR series and its findings for this batch (InboxRail mock, watch-only guard, effort carry-over) were fixed. CodeRabbit skipped it while it was stacked on #4815. Test-only change on the lane brief from the maintainer (dep-react-test-renderer).
…py-dom page (#4829)
## What
Third of four PRs moving the `src/` tests off the deprecated
`react-test-renderer` (after #4815, merged, and #4816). **Stacked on
#4816**: its own diff is the 38 component tests below; retarget to main
after #4816 merges. This one moves the 38 component tests from
`AccessGate` to `ComposerPasteSend` to react-dom rendering into the
happy-dom page (`src/lib/page.fixture.ts`).
## Test meaning
Every file keeps its test names, order and test count (checked per file
against origin/main); `expect()` counts are equal or higher where the
review added a positive control. Assertions go through the DOM instead
of React props. Shifts worth a look:
- `AgentSidebar`: menu ids and the stop item are read from the real
buttons (`data-item`, labels) instead of `RowMenu` props; a kept row is
checked as the same DOM node.
- `Artifacts`: counts the app's 3-second refresh timer instead of all
fake timers (react-dom schedules its own).
- `ChatTimeline`, `ChatView.scrollInput`: rows and scroll corrections
come from the real list (DOM scroll and row resize) instead of calling
LegendList's callbacks; the tests' ResizeObserver reaches the list
whichever file mounted it first.
- `AccountDeviceNotices`, `AccountPcs`, `ComposerPasteSend`: disabled
buttons are checked as disabled, and the in-flight/busy handler guards
are also called directly through the fixture's `reactProps` (React drops
clicks on disabled buttons); removing a guard fails its test.
- `AccessGate`: "not mounted" is checked as an empty root (the component
draws nothing either way).
## Validation
- `bun run typecheck`: pass.
- The 38 changed test files, one process per file: 38/38 pass.
- The 38 files in one bun process: 525 pass, 43 fail. **The same 43 fail
on main** with these files in one process (same files, same errors, e.g.
`bound.accountList is not a function` from a module mock another file
leaves behind); none comes from this PR.
- Skipped locally: `bun run check fast` (this PC above 85% CPU); CI's
Fast checks runs it.
No user-visible change, so no changelog fragment.
…er and drop it (#4831)
## What
Last of four PRs moving the `src/` tests off the deprecated
`react-test-renderer` (after #4815, #4816 and #4829, all merged). It
moves the 37 component tests from `PromptCard` to `review-client-p12`,
plus `MachineDialog.progress` (#4811), `RelayPanel.compact` (#4615),
`FileViewer.save` (#4073) and `RecentFolderChips`, all added on
react-test-renderer while this series was under way,, to the happy-dom
page and **removes `react-test-renderer` and
`@types/react-test-renderer`** from package.json and bun.lock. Nothing
in the repository names react-test-renderer any more.
## Test meaning
Every file keeps its test names, order and test count (checked per file
against origin/main); `expect()` counts are equal or higher where the
review added checks. Across all 175 migrated files the series keeps
**2762 tests, file for file the same as current main**. Shifts worth a
look:
- `StrictModePanel`: nothing forbidden may show anywhere in the
document, portals included (the old renderer drew portals inline).
- `WorktreeDialog`: a fresh create request must start before the
repository changes, and only that request is answered.
- `Visualization`: pending work runs while the fake transport is
installed before checking that no request went out.
- `RelayShell`: three notice components are checked through DOM markers;
link taps through `defaultPrevented` on the real click. Includes main's
newer offline test from #4810, and #4614's check that the pairing-code
field is wired to `typePairCode`/`endPairCodeComposition` (read through
the fixture's `reactProps`, as those are props the DOM cannot show; also
in `RelayShellScreens`).
- `RelayPanel.compact`: `KeyId`'s id and label are read from its
rendered group (`role="group"`, `aria-label`, the group spans); the
pairing window's `CustomEvent` announcements dispatch through the page's
own event classes.
- `VoiceInput`: #4793's shortcut test presses Ctrl+Shift+Space as real
KeyboardEvents on the page's window.
- `TextFileEditor`: the unsaved-changes warning is checked as a
cancelled `beforeunload` event.
## Validation
- `bun run typecheck`: pass.
- All 175 migrated files, one process per file, on this branch and on
origin/main: 175/175 pass on both, 2762 tests on both, equal file for
file. No file in the repository names react-test-renderer.
- This PR's 37 files in one bun process: 735 pass, 0 fail. `PortalAuth`
then `SettingsControls` in one process, both orders: pass (the order
case the Codex review reproduced).
- Codex adversarial review (gpt-6.2-sol-fast, xhigh) ran once on the
whole series: 13 findings, all fixed in this series (see each PR).
- Skipped locally: `bun run check fast` (this PC above 85% CPU); CI's
Fast checks runs it.
No user-visible change, so no changelog fragment.
…e a self-hosted app (#4616)
Closes#3595
## Change
A PC on its own relay (`OVIS_RELAY_URL`) showed only the QR code,
because typed codes met on `relay.ovis.sh` alone. On an iPhone that
leaves the Home Screen app unpaired: its storage is apart from Safari's,
and the camera opens a QR link in Safari. With this change a self-hosted
relay beside a self-hosted app pairs by typed code too.
- **A PC on its own relay that names an app of its own holds its codes
on that relay.** `RelayService.pairCode` mints there when
`OVIS_RELAY_APP_URL` is neither `app.ovis.sh` nor a regional copy of it.
The reply names the app and the relay. The full panel, the compact view
beside the QR code, `plugin.ts link --code` and the account pairing of
`plugin.ts link` name that app as the place to type the code. With
Ovis's app the PC still answers 409 `code_unavailable`, now with a
message that says what the setup needs. A PC on Ovis's relays holds its
codes there as before. One that names an app of its own now names that
app as the place to type the code.
- **A shell built with `OVIS_RELAY_URL` looks typed codes up on that
relay.** `bun run build:shell` writes `<meta name="ovis-relay">`, which
`shellRelayOf` reads from the page, and the code screen passes it to
`offerFromCode`. The build writes no meta for Ovis's own relays and
fails on a value the PC would refuse, an empty one included:
`relayEndpoint` moved to `shared/relay-offer.ts`, so both use one rule.
It now also refuses an origin longer than the 255 characters an offer
may carry, which the shell would ignore.
- **Adding such a PC over Tailscale looks its code up on its relay.**
`TailnetPcs.code` takes the relay from the reply when it is a wss
origin, and `addTailnet` passes it on. The `server_id` check after the
lookup is unchanged. Before, that PC answered `code_unavailable` and the
add was refused.
A code typed by hand into Remote PCs still looks on `relay.ovis.sh`,
since the typing PC cannot know the other PC's relay.
The reply of `POST /api/relay/code` gains two fields, `app` and `relay`.
An older client ignores them, and a client that finds no `app` names
`app.ovis.sh` as before.
Each of these one-line reverts turns a test red:
```text
the shell takes no relay from its page's meta:
(fail) the hosted shell's front page > looks a typed code up on the relay its page's ovis-relay meta names, and on Ovis's own without one
the full panel names app.ovis.sh whatever the code's app:
(fail) Connect a phone on a phone > names the app the code is looked up by under the full panel's code to type
link --code names app.ovis.sh whatever the code's app:
(fail) ovis link, on the PC itself > --code shows the code to type, this PC's ID and the relay QR code, and a new pair when they run out
the account pairing of link names app.ovis.sh whatever the code's app:
(fail) ovis link, on the PC itself > with the fleet preview off, names the app the PC's reply names for its code
the relay's code_unavailable message replaced:
(fail) a relay that is not Ovis's own has no codes to type while the app is Ovis's, which looks for them on Ovis's relay
the Tailscale add's code_unavailable message replaced:
(fail) tells each refusal of the code request in its own failure, never with that PC's own words
```
With the change, each of these files passes in its own `bun test` run.
Run together in one process, `scripts/plugin-link.test.ts` fails after
`src/lib/relay/shell.test.tsx` with `ReferenceError: document is not
defined`, because the shell tests leave their mounts running past their
fake document. Most of those failures also show without this change's
new shell test, so each file runs on its own here.
```text
$ bun test ./server/relay/service.contract.test.ts
86 pass
0 fail
$ bun test ./server/tailnet-pcs.contract.test.ts
18 pass
0 fail
$ bun test ./server/account/account-code.contract.test.ts
15 pass
0 fail
$ bun test ./src/components/ConnectPhoneDialog.test.tsx
152 pass
0 fail
$ bun test ./src/lib/relay/shell.test.tsx
111 pass
0 fail
$ bun test ./src/lib/relay/pairCode.test.ts
8 pass
0 fail
$ bun test ./scripts/shell-build.test.ts
21 pass
0 fail
$ bun test ./src/lib/i18n.test.ts
44 pass
0 fail
$ bun test ./scripts/plugin-link.test.ts
204 pass
0 fail
```
`server/account/account-code.contract.test.ts` now names Ovis's app for
its PC, so it passes with `OVIS_RELAY_APP_URL` set as well. Before, it
hung on that PC's unreachable test relay.
## Screenshots
The relay tab of Add a connection on a test server whose PC is on a
relay of its own with `OVIS_RELAY_APP_URL=https://ovis.example.com`, at
1280 and 390 px wide.
Before, the PC makes no code and says to scan the QR code:
<img alt="before, 1280 px"
src="https://raw.githubusercontent.com/Danipulok/ovis-fork/416cc36e87a419243bce84459f7588947faef8de/self-hosted-before-1280.png"
width="640">
<img alt="before, 390 px"
src="https://raw.githubusercontent.com/Danipulok/ovis-fork/416cc36e87a419243bce84459f7588947faef8de/self-hosted-before-390.png"
width="260">
After, it shows a code and names the app to type it in:
<img alt="after, 1280 px"
src="https://raw.githubusercontent.com/Danipulok/ovis-fork/416cc36e87a419243bce84459f7588947faef8de/self-hosted-after-1280.png"
width="640">
<img alt="after, 390 px"
src="https://raw.githubusercontent.com/Danipulok/ovis-fork/416cc36e87a419243bce84459f7588947faef8de/self-hosted-after-390.png"
width="260">
## Validation
- `bun run check fast` on the branch tip: green (generated files,
typecheck, build, unit tests).
- Skipped: `bun run check full`, `bun run test:ui`, the integration
suite and the native Windows run.
## Not covered
No browser run types a code into a shell built with `OVIS_RELAY_URL`. My
iPhone Home Screen app paired with a typed code on my own relay and app,
but on my fork's earlier version of this change, not on this branch.
A PC beside a self-hosted app built before this change, without
`OVIS_RELAY_URL`, now shows a code that its app looks up on
`relay.ovis.sh` and does not find. Before, it showed no code. The PC
does not check how its app was built, so such an app has to be built
again.
This PR changes the reply of `POST /api/relay/code`, so it waits for a
review and your word. The screenshots show the compact window's hint
only: the longer hint under Pair with a code, which names the app too,
has none.
## Maintainer changes
The maintainer approved this feature and the `POST /api/relay/code`
contract addition (`app`, `relay`) on 2026-11-28. Changes on top, merged
with main:
- **Tailscale one-tap add.** The code answer must name the relay ID that
PC's own health named, or nothing is added (`tailnet_mismatch`). A relay
the other PC names is dialled only when it is one of Ovis's relays, or a
wss origin whose host is and resolves only to public addresses.
Loopback, LAN, Tailscale, link-local, special-use and reserved addresses
are refused (`tailnet_code_unavailable`), and the name lookup gets 5
seconds. The new tests in `server/tailnet-pcs.contract.test.ts` fail on
the previous `server/tailnet-pcs.ts`.
- The two new `ConnectPhoneDialog` tests now use the happy-dom helpers,
following main's #4816.
- The changelog now has a **Changed** entry: self-hosters must rebuild
their app with `OVIS_RELAY_URL`, or it will not find the codes their PC
now shows.
- `docs/remote-pcs.md` describes both checks.
Residual, accepted: the relay's host name is resolved once for the check
and again when it is dialled. Only a PC of this PC's own Tailscale login
that lets it drive can name a relay at all.
### Screenshots (isolated test server, own relay +
`OVIS_RELAY_APP_URL=https://app.own.test`)
Before (main):
<img alt="before, 1440 px"
src="https://raw.githubusercontent.com/devswha/ovis/d7aefe8dcea306209903e62ff8b03993ded81d34/pr4616/before-1440.png"
width="640"> <img alt="before, 390 px"
src="https://raw.githubusercontent.com/devswha/ovis/d7aefe8dcea306209903e62ff8b03993ded81d34/pr4616/before-390.png"
width="200">
After:
<img alt="after, 1440 px"
src="https://raw.githubusercontent.com/devswha/ovis/d7aefe8dcea306209903e62ff8b03993ded81d34/pr4616/after-1440.png"
width="640"> <img alt="after, 390 px"
src="https://raw.githubusercontent.com/devswha/ovis/d7aefe8dcea306209903e62ff8b03993ded81d34/pr4616/after-390.png"
width="200">
### Validation
- `bun run check fast`: green (29965 unit tests pass, typecheck, build).
- Browser: relay-account-pcs, relay-e2e, relay-first-link,
add-pc-more-relay, ui-access and relay-shell-browser-qa: 6/6 passed.
- Reviews: omo gate CLEAR. Codex (via axwith) found no HIGH, and its
MEDIUM and LOW findings are fixed, except the residual above.
---------
Co-authored-by: devswha <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Second of four PRs moving the
src/tests off the deprecatedreact-test-renderer. Stacked on #4815 (it needssrc/lib/page.fixture.tsand the DOM preload from there); this PR's own diff is only the 37 component tests fromComposerRestoredtoPromptCard.submission. Retarget to main after #4815 merges.Test meaning
Every file keeps its test names, order, test count and
expect()count (checked per file against origin/main). Assertions go through the DOM instead of React props:props.onClick()→click(),onChange→page.type(),toJSON()text →textContent. Shifts worth a look, all toward what a user sees:InboxList: the filter menu is checked through its real radio items (names, order, checked state) instead of the props handed toRowMenu; the more-menu callback receives the button that was clicked.FileViewer.scripts: turning scripts on replaces the real iframe element; relay messages start from the iframe's realloadevent.ConnectPhoneDialog: QR codes are checked in the rendered SVG; tab and list order, the relay toggle and the remove-all confirmation through the DOM instead of child-component props. The waiting tab's link is matched in full instead of by suffix.OwnJoins,PaneCanvas: focus is checked as the realdocument.activeElementinstead of anautoFocusprop or a fakefocus().PromptCardview-only: a click on the disabled button sends nothing (React drops events on disabled buttons) instead of calling its handler by hand.InboxRail: no longer mocksRowMenu(the module mock outlived the file in a shared process and hid InboxList's real menus); "no menu" is checked in the DOM.PromptCard.submission: a watch-only device's answer buttons stay disabled, and the answer handler called directly (through the fixture'sreactProps) still sends nothing; deleting|| watchingfails the test.NewSessionDialog: an effort Claude lacks leaves Start enabled and the request without an effort.Validation
bun run typecheck: pass.bun run check fast(this PC above 85% CPU); CI's Fast checks runs it.No user-visible change, so no changelog fragment.