Skip to content

test(file-viewer): wait for the broken inline image fallback before acting - #2437

Merged
devswha merged 1 commit into
mainfrom
fix/file-viewer-broken-image-race
Oct 30, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/file-viewer-broken-image-race

Conversation

@devswha

@devswha devswha commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Change

Fix the browser regression synchronization introduced/exposed by #2435, with no product changes and no changelog fragment. Only scripts/file-viewer-regression.ts changes.

  • Subscribe to the final broken-image file action by role/name plus .markdown-file before navigation. Start each incarnation of that fixture image eagerly, without scrolling or clicking its transient viewer opener. Await attachment and Playwright's stability/actionability check, then click the freshly resolved fallback. Keep the single-action/no-nested-controls/no-image-viewer assertions.
  • The initial successful-image checks also load the current image incarnation rather than scrolling a handle a late skill render can detach. Actual decode, canonical file path and pane ownership assertions remain.
  • Activate notes by Enter in the presentation/history checks. Reloaded images and following/virtualized transcript layout can move a coordinate target during a pointer action. The dialog content, popup/panel, Back/Forward and history assertions remain unchanged; other steps retain pointer/touch coverage.

Product flicker and root cause

No extra product failure swap found. A pre-navigation MutationObserver probe on main 4c62f57 recorded, for one mounted inline decode failure: pending alt span -> image viewer button containing img -> final file button. That is 2 replacements including pending, exactly 1 replacement after the img/opener exists, with no extra intermediate control after the opener and no fallback -> opener -> fallback bounce. Initial follow/virtualization/skill-driven remounts produced distinct wrapper identities; those are separate mounted lifecycles, not a second failure swap within MarkdownImage. A missing-file stat failure never created an image opener: the pending span becomes the unavailable group containing the file action and Try again; retry retained the exact same file-action DOM node (0 fallback remounts).

MarkdownImage's successful stat renders ReservedImage. A byte/decode error sets failedUrl, and the parent selects Inline's file fallback. The old test used the shared accessible name before that transition, so scrollIntoViewIfNeeded could await stability on the soon-to-be-detached opener. Lazy loading plus follow/late transcript remounts could instead leave the expected fallback unloaded.

Fail-first mutation evidence

A temporary extracted real-browser fixture held the corrupt broken.png response behind an event gate and animated the opener so its pre-error state could not pass the stability check. It started the old getByRole(button, Chat broken inline).scrollIntoViewIfNeeded(), advanced animation frames, then released the corrupt bytes: FAIL, Element is not attached to the DOM, while waiting for the element to be stable (check report 995cc8fa-062b-423e-a865-823e179be043). The new fallback-first sequence under the same byte gate and animation passed both the failed-image and adjacent image-viewer cases (a55a6ca5-f702-490e-a5b7-b78f59ec0b31). No fixed sleep was used; temporary probes were removed.

Actual main CI notes timeout

Inspected run 41036856514 / job 123999785358. Both CI attempts failed before the default-text-popup PASS, waiting for notes.txt / File preview history regression immediately after setFileOpen(null)'s reload. The image-sheet checks occur much later and use their own page, so their forward entries cannot leak backward into this wait. No product history mutation was found.

The unchanged full script reached and passed the broken-image case twice locally; another baseline stopped earlier at a large-source wait. A held-image browser probe with pointer down/up across image loading reproduced the same notes dialog-content timeout with no file-preview history entry; keyboard activation passed with the same held-image fixture. This demonstrates the coordinate/follow-layout failure mode, not proof of the exact event ordering in the historical CI run. During full validation, a second notes pointer activation after a later reload also timed out waiting for the panel; converting the notes history activations consistently removed that dependency. This is test synchronization/isolation, not a product history fix.

Validation

All heavy commands ran through dori heavy fvfix, sequentially in the dedicated worktree.

  • bun install --frozen-lockfile: passed.
  • Unchanged main: bun run check run --build bun scripts/file-viewer-regression.ts, then two runs without --build. First stopped at a large-source waitForFunction timeout before the target; next two passed the complete script (target 2/2 passed locally).
  • Temporary MutationObserver, failed-stat retry-identity, gated old/new failed-image, and held-image notes probes via bun run check run bun scripts/.fvfix-probe.ts: results above; probes removed.
  • Final tree: 5 consecutive full bun run check run bun scripts/file-viewer-regression.ts runs passed, 65 PASS cases each, including the exact notes popup-content wait and failed-image fallback. Reports: 888926d2-c50e-458d-a05d-e766b460a06f, eb4833b3-8c24-4935-9133-8672ac8f9479, 87022761-4316-4a16-9a50-cf1cda6e8a6b, 48f98b46-fe60-4c2a-bc32-bdf854ca556d, c5c4952a-56b6-4793-9c58-cf7cfd1be216.
  • bun run check fast: passed workflow syntax, generated types/themes, typecheck, build, and 9,166 unit tests; 0 failed, 36 skipped in 591 files.
  • git diff --check: passed. LSP diagnostics could not initialize because the workspace TypeScript 7 package has no tsserver.js; the repository typecheck passed.
  • Earlier validation batches were interrupted by one Chromium Target crashed in an unrelated Markdown-reader check and a later notes pointer timeout; they are not counted as the five consecutive passes.
  • Full integration suite, all other browser scripts, Native Windows and macOS checks: not run for this test-only change. Linux browser checks used the supported Node PTY-host fallback; the Rust sidecar is absent in this fresh worktree. Local toolchain: Bun 1.4.3, Node 24.18.0 (check warns CI uses Node 22), herdr 0.9.5.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4c62f57 and 7b46f7f.

Files selected for processing: 1
  • scripts/file-viewer-regression.ts

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

📝 Summary

Summary by CodeRabbit

  • Tests
    • Improved regression-test reliability for chat images and file links by ensuring images load and links are activated before their behavior is checked.

The file-viewer regression test now eagerly loads images while waiting for them, checks file-action clickability in the broken-image case, and uses Enter to activate notes links in several scenarios.

Changes: File viewer regression checks

Layer / File(s) Summary
Image loading and file-action checks
scripts/file-viewer-regression.ts
The test eagerly loads the current image and each rendered image in the broken-image case. It waits for the file action and checks clickability with a trial click.
Keyboard activation of notes links
scripts/file-viewer-regression.ts
The test activates notes links with Enter in six scenarios.

Priority: Low

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

Change: Other

Possibly related PRs

  • devswha/ovis#2435: Adds local Markdown images and image-failure fallbacks to the same file-viewer regression fixture.

Suggested reviewers: cheol-95

Merge Risk: Minimal · up to 7b46f

The test-only synchronization changes do not introduce a merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title names the main change: a test-synchronization fix in scripts/file-viewer-regression.ts that waits for the broken inline image fallback before acting. It is specific, single-sentence, and mat…
Description check Passed The description follows the repository template. It has a Change section that explains the problem (regression synchronization exposed by #2435), the scope (only scripts/file-viewer-regression.ts, no …
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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 names the main change: a test-synchronization fix in scripts/file-viewer-regression.ts that waits for the broken inline image fallback before acting. It is specific, single-sentence, and matches the summary and objectives. The title uses the conventional test(scope) prefix and is 74 characters, within a typical length limit.

Full details: Description check

Explanation

The description follows the repository template. It has a Change section that explains the problem (regression synchronization exposed by #2435), the scope (only scripts/file-viewer-regression.ts, no product change, no changelog fragment), and the specific edits. It also has a Validation section listing the commands run (bun install, unchanged-main runs, probes, five consecutive full runs, bun run check fast, git diff --check), their results, and the checks skipped (full integration suite, other browser scripts, Native Windows and macOS). The template's reference to changelog.d/ is addressed by the explicit 'no changelog fragment' statement. Some sections are long and dense, and the Change section does not state a linked issue, but the template requires one only for features, and this is a test-only fix. The description is mostly complete.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 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

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Merging 7b46f7f (test-only: main CI was red on 4c62f57, scripts/file-viewer-regression.ts failing twice). Root cause: the #2435 step scrolled the broken image's transient viewer button, which the fallback replaces (a lazy image could also be remounted before it loaded), and the file-preview history steps clicked the notes link while reloaded images could still move the transcript between pointer down and up. The steps now arm the wait for the fallback before loading, act on the fresh node, load the test images eagerly, and open the file by keyboard (these steps check presentation and history, not pointer targeting). Checked in a real browser that the product does not flicker: a MutationObserver counted exactly one opener-to-fallback replacement and no fallback remount on a failed-stat retry. A deterministic mutation makes the old step fail and the new one pass; 5 consecutive full runs pass (65 cases each) and check fast passes. No CodeRabbit review needed for a test-only change. LOW, noted for a follow-up: the transcript can still shift under a pointer while chat images reload (why the history steps now use the keyboard); worth a look for layout stability with many inline images.

@devswha
devswha merged commit 52aa9bb into main Oct 30, 2026
12 checks passed
@devswha
devswha deleted the fix/file-viewer-broken-image-race branch October 30, 2026 10:46
@devswha devswha mentioned this pull request Oct 30, 2026
devswha added a commit that referenced this pull request Oct 30, 2026
## Release 0.4.21

The release PR, prepared by step 1 of
[docs/development.md#releasing](https://github.com/devswha/ovis/blob/main/docs/development.md#releasing),
now re-folded on main `1ef6ea329108a0985b823e8235b03daddcd0a5f4` after
the owner held 0.4.21 for more work. The merge pass reported the 0.4.21
queue empty.

**Do not merge yet:** the owner judges the final build before release.
No tag and no Release run from this PR's author.

- **Version:** `version` is 0.4.21 in `package.json` and
`herdr-plugin.toml`.
- **Changelog:** `bun scripts/changelog-fold.ts 0.4.21 2026-10-30`
folded 63 fragments into the 2026-10-30 section of `CHANGELOG.md` (71
entries), linked their PRs and deleted the fragments; `changelog.d`
holds only `README.md`.
- `by @login` on every outside contributor's PR link: #2361 @eddieparc,
#2333 @IdrisGit, #2355 @imurfutur3, #2341 @sulthonzh, #2359 @YuuuXie,
#2377 @IdrisGit, #2269 @CharleoYang, #2405 @jpcarranza94, #2414
@homebodify, #2417 @cheol-95, #2418 @eddieparc, #2435 @cheol-95.
- Two outside PRs had no fragment and got an entry by hand: #2341
(OpenCode background commands, Added) and #2359 (installer test timing,
Maintenance).
- Issue reporters are credited in their entries: @blaker3115-Agri
(#1488), @Hyd3-14 (#2026), @osamahbeig (#2343), @Shunamxiao (#2329),
@matiemer (#2362), @kilhyeonjun (#2344), @eddieparc (#2360), @Ploppy3
(#2236), @sulthonzh (#2340), @WOULDU-pres (#2056), @odfalik (#2038),
@aNNdii (#511), @Noobear (#2281, fixed by #2424); #2435 fixes
@cheol-95's own #2434.
- Two fragments ran past the changelog's width (#2418, #2269); their
entries are re-wrapped, words unchanged. #2382's entry reads "OpenCode's
installer puts its folder first" (reviewed earlier on this PR).
- Maintainer PRs without a fragment and without a user-facing change
have no entry: #2353 (check tool), #2371 (guide docs), #2396 and #2397
(tests), #2403 and #2433 (server and client transport seams, no
behaviour change), #2437 (test-only fix for #2435's check). #2438's own
entry (the sidebar selection marked by its fill again) is dropped: the
stroke #2352 added never shipped, so users see no change; #2352's entry
keeps only the Windows high-contrast Highlight bar.
- **Release summaries:** en, ko, ja and zh each have 5 new, 5 improved
and 5 fixed lines. Since the first review: New lists the in-browser
Claude Code / Codex sign-in (#2428) in place of the tab/workspace
shortcut line; Improved lists Settings → Agents (#2427) in place of the
sidebar fold line; Fixed lists the Codex wrong-session fix (#2426,
#2430) in place of the phone screenshot paste line. The Artifacts and
Claude status-line lines keep their reviewed wording (turned on in
Settings). Not in 0.4.21: #2420 (Codex chat behind Kiro), #2065 (Portal
sign-in) and #2436 (relay foundations) stay open for a later release.
- **Remote bundle:** `REMOTE_BUNDLE_VERSION` rises from 39 to 40 because
the bundle inputs (`server/`, `shared/`, `patches/`) changed since
remote-v39. After merge: push `remote-v40` on the merged commit and wait
for the Remote PC bundles workflow before running Release.
- **iOS:** `CURRENT_PROJECT_VERSION` stays 3 (#2370 changed
`Info.plist`; build 3 is not known to be uploaded yet).

## Validation

- `bun scripts/release-guards.ts --base v0.4.20`: "Release 0.4.21:
remote bundle, telemetry Worker and release metadata are in order."
- `dori heavy … bun run check fast` on this branch: workflow syntax,
generated types and themes, typecheck, build, unit tests all ok. Unit:
9166 pass, 0 fail, 36 skip in 591 files.
- Every PR in `v0.4.20..main` was pre-run for the owner's hands-on guide
on isolated copies (own herdr session, fresh state, never the owner's
live session). Items that need a real device (iPhone tap dictation
#2370, dictation keyboards #2386, the installed desktop app's title-bar
overlay #2381) are left for the owner's final check.

This is a release-metadata PR: it changes no code path. Per the release
steps, merge it after CI and the owner's go, then push `remote-v40`,
wait for its bundles, and run Release with `0.4.21`.
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