fix(web): recover aborted srcdoc previews - #7055
Conversation
PerishCode
left a comment
There was a problem hiding this comment.
The srcdoc completion/recovery path is coherent and the telemetry remains content-bounded, but the new CSS import extraction can corrupt otherwise renderable thumbnail styles because it does not distinguish CSS strings from top-level import rules.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
🧪 This PR has changes that need a manual QA pass before merge — please hold off self-merging for now; we'll loop QA in once it's merge-ready (and design/product have signed off, where applicable). |
PerishCode
left a comment
There was a problem hiding this comment.
The srcdoc completion witness and recovery path are coherent, and the previous string-matching blocker is fixed. The import lifting still changes CSS semantics for conditional or otherwise inactive imports, so the thumbnail fidelity portion needs one more correction before merge.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
The current blocker is already captured in @PerishCode's review: the new CSS import extraction still needs to avoid treating inert 💡 To drive this PR to merge hands-free, paste this to your AI coding agent (Claude Code / Codex / opencode / Cursor …): |
PerishCode
left a comment
There was a problem hiding this comment.
The CSS import follow-ups now preserve import placement and conditions, but the new srcdoc completion check is based on mutable authored DOM rather than a latched parser witness. That can misclassify healthy previews or accept incomplete ones, so the recovery path still needs one correction before merge.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
The current blocker has moved since the last push: @PerishCode's latest review is now focused on the srcdoc completion witness using mutable authored DOM rather than a latched parser witness. Once that current-head issue is addressed, we can re-check from there. |
PerishCode
left a comment
There was a problem hiding this comment.
The generation-specific completion latch fixes the prior mutable-marker problem, and the CSS import follow-ups remain sound. One recovery branch still conflates a healthy parser-blocked document with an aborted document and can re-execute authored code, so this needs correction before merge.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
The current blocker has moved again on this head: @PerishCode's latest review now points at a remaining recovery branch that still conflates a healthy parser-blocked document with an actually aborted one. Once that current-head distinction is fixed, we can re-check from there. |
PerishCode
left a comment
There was a problem hiding this comment.
@lefarcen The current head now distinguishes completed, settled-incomplete, and still-parsing srcdoc documents without remounting a healthy parser-blocked frame, while retaining bounded recovery for a genuinely stuck generation. I also verified that stylesheet imports are lifted only when doing so preserves activation semantics, with safe iframe fallback otherwise, and that the added telemetry remains content-bounded. The focused recovery, parser, srcdoc, and observability suites pass (92 tests), as does the web typecheck. Thank you for working through the follow-up edge cases carefully—the final recovery lifecycle and regression coverage are strong.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.
QA:旧版本复现与本 PR 验收这个问题是 Chromium/Electron 的 A. 旧客户端用户态复现(0.19.2 / prerelease.2)
这条路径已在用户的 prerelease.2 现场和同事的 stable 0.19.2 diagnostics 中命中过同一指纹。由于它是浏览器时序竞态,手工路径是高置信复现,但不能保证每次必现。 B. 确定性复现(推荐作为回归门禁)在 PR base/旧源码 git fetch origin pull/7055/head:qa/pr-7055
git show qa/pr-7055:apps/web/tests/components/FileViewer.srcdoc-refresh-recovery.test.tsx > apps/web/tests/components/FileViewer.srcdoc-refresh-recovery.test.tsx
pnpm --filter @open-design/web exec vitest run -c vitest.config.ts --maxWorkers=2 tests/components/FileViewer.srcdoc-refresh-recovery.test.tsx旧代码会在以下故障注入场景中稳定失败,因为 iframe 不会自愈 remount:
切到 PR head 修复版产品验收标准
PostHog 看板:https://us.posthog.com/project/420348/dashboard/2007098 |
PerishCode
left a comment
There was a problem hiding this comment.
@lefarcen The current head preserves the generation-latched srcdoc completion and bounded parser grace recovery, keeps thumbnail font-import lifting semantically safe through iframe fallback, and now confirms blank previews only after a visibility/viewport-aware second sample and one layout nudge. I verified the changed ranges and prior follow-up fixes, then ran the focused web suites (96 tests), the preview-observability contract suite (4 tests), and the web typecheck successfully. Thank you for carrying this through the successive edge cases—the final recovery and observability behavior is carefully bounded and well covered.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
补充浏览器级回归(commit c250eb3):
隐藏 tab / 零视口门控仍由 |
PerishCode
left a comment
There was a problem hiding this comment.
@lefarcen The current head keeps the generation-latched srcdoc recovery and semantically safe font-import fallback intact, and the new browser witness covers the full preview-to-safety-telemetry path for both a recoverable layout stall and a persistent blank. I re-reviewed every changed range, verified the focused web suites (96 tests), the preview-observability contract suite (4 tests), and both web and e2e typechecks. Thank you for adding the cross-layer regression coverage and for carrying the recovery behavior through the earlier edge cases—the final implementation is carefully bounded and well supported.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
Thanks for the contribution. I completed QA validation for this PR. QA Acceptance Record Scope:
Scope-to-evidence:
Verified:
Not verified:
Risks / notes:
Conclusion:
|
PerishCode
left a comment
There was a problem hiding this comment.
@lefarcen I reviewed the full changed ranges for srcdoc completion recovery, bounded white-screen confirmation telemetry, deck thumbnail font-import handling, and their web, contract, and Playwright coverage. The latest test-helper correction now selects the requested design-file tab before asserting the persistent-blank fixture, so the browser witness exercises the intended preview. The recovery state machine remains bounded and generation-scoped, the telemetry payload stays content-free and normalized, and approved font imports preserve safe fallback behavior. Nice work carrying the successive edge cases through to a focused, verifiable fix.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
Successfully created backport PR for |
* fix(web): recover aborted srcdoc previews * fix(web): parse only top-level stylesheet imports * fix(web): preserve font import conditions * fix(web): latch srcdoc parser completion * fix(web): defer recovery while srcdoc parses * fix(web): confirm blank previews before reporting * test(e2e): cover preview white-screen monitoring * test(e2e): select the requested preview file (cherry picked from commit 42faa84) Co-authored-by: lefarcen <935902669@qq.com>













































Why
Community template remixes and existing HTML artifacts could intermittently open as a blank file preview in packaged clients. We reproduced the issue against the original incident artifact and a colleague's diagnostics from stable 0.19.2: Electron repeatedly aborted the
about:srcdocsubframe withERR_ABORTED (-3), while the injected head bridge could still answer readiness probes. That let a half-parsed document look healthy, leaving users to toggle Code and Preview to force a remount.The same investigation found that deck thumbnails ignored approved
@importwebfonts, and that the existing white-screen detector treated hidden tabs, zero-sized preview frames, and one transient blank sample as confirmed failures. Historical PostHog events therefore mixed real blank previews with recoverable layout stalls and false positives.What users will see
Surface area
apps/weborapps/desktop(including Electron menu bar)odsubcommand or flag, newtools-dev/tools-packflag, or newOD_*env varpackages/contractsadds bounded confirmation metadataskills/,design-systems/,design-templates/, orcraft/, or change to the skills protocolTRANSLATIONS.mdfor the locale workflow)package.json(dependenciesordevDependencies); workspace-packagepackage.jsonfiles are out of scope. Include a paragraph on what we get vs. what bytes we ship (seeCONTRIBUTING.md→ Code style)Screenshots
No UI chrome changed. The behavior was verified in real Chrome across initial load, Code → Preview toggling, cold reload, background/foreground transitions, and forced blank/half-document fixtures.
Bug fix verification
apps/web/tests/components/FileViewer.srcdoc-refresh-recovery.test.tsxapps/web/tests/runtime/preview-observability-bridge.test.tsValidation
pnpm guardpnpm typecheckblank_observation_count=2andsample_interval_ms=1500