Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Pin the cv:auto chunk-wrapper display-lock site (PRD-8158) (#3919)

Andrew Mikofalvy0a285dd554fd
diff --git a/knip.config.ts b/knip.config.ts
index 8ad68f996..b61debe5e 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -124,9 +124,7 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: [
- '@types/shell-quote',
- ],
+ ignoreDependencies: ['@types/shell-quote'],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
diff --git a/packages/app/package.json b/packages/app/package.json
index a11227711..3b2cb638c 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -28,7 +28,7 @@
"measure:stress": "bash scripts/measure-stress.sh",
"measure:sweep": "bash scripts/measure-sweep.sh",
"perf:compare": "bash scripts/perf-compare.sh",
- "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-collapse-spaced-folder.e2e.ts tests/stress/sidebar-file-list-fills.e2e.ts tests/stress/file-tree-sticky-collapse.e2e.ts tests/stress/file-tree-fractional-zoom.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/plugin-enable-notice.e2e.ts tests/stress/schema-edit-fields-view.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/navigation-history.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/new-item-shortcut-fast-path.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/okf-generated-index-settings.e2e.ts tests/stress/okf-recommended-skill-install.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/frontmatter-schema-badge.e2e.ts tests/stress/frontmatter-glob-picker.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/selection-surface-pane-clip.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/image-invalid-placeholder.e2e.ts tests/stress/local-target-audit.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-active-heading.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/prd-7627-default-swatch.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts tests/stress/source-mode-undo-keymap.e2e.ts tests/stress/timeline-recovered-restore.e2e.ts tests/stress/blank-line-preservation.e2e.ts tests/stress/landing-helpers.e2e.ts tests/stress/mode-switch-landing.e2e.ts tests/stress/mode-switch-ordinal-divergence.e2e.ts tests/stress/comment-annotation-visibility.e2e.ts tests/stress/comment-opens-in-panel.e2e.ts tests/stress/qa-miles-edge-blanks.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/editor-split-view.e2e.ts tests/stress/language-load-failure.e2e.ts tests/stress/language-first-paint.e2e.ts tests/stress/user-text-direction.e2e.ts tests/stress/pseudolocale.e2e.ts tests/stress/language-picker.e2e.ts tests/stress/zh-hans-coverage-sweep.e2e.ts tests/stress/preview-tab-promotion.e2e.ts tests/stress/cv-paint-lock-click.e2e.ts tests/stress/history-traversal-preview-tab.e2e.ts tests/stress/tab-close-scroll-restore.e2e.ts tests/stress/skills-sidebar-open.e2e.ts",
+ "test:e2e": "playwright test tests/stress/ux-interactions.e2e.ts tests/stress/file-tree-create.e2e.ts tests/stress/file-tree-drag-to-root.e2e.ts tests/stress/file-tree-deselect-to-root.e2e.ts tests/stress/file-tree-collapse-spaced-folder.e2e.ts tests/stress/sidebar-file-list-fills.e2e.ts tests/stress/file-tree-sticky-collapse.e2e.ts tests/stress/file-tree-fractional-zoom.e2e.ts tests/stress/create-then-rename-editable.e2e.ts tests/stress/find-replace.e2e.ts tests/stress/editor-tabs.e2e.ts tests/stress/crdt-stress.e2e.ts tests/stress/slash-command.e2e.ts tests/stress/paste-fidelity.e2e.ts tests/stress/fr-7a-disconnect-source-mode.e2e.ts tests/stress/docs-open.e2e.ts tests/stress/frozen-table-headers.e2e.ts tests/stress/asset-embed.e2e.ts tests/stress/asset-embed-advanced.e2e.ts tests/stress/asset-click-dispatch.e2e.ts tests/stress/handoff.e2e.ts tests/stress/multi-agent-presence.e2e.ts tests/stress/editor-mode-persistence.e2e.ts tests/stress/lint-config-toggle.e2e.ts tests/stress/plugin-enable-notice.e2e.ts tests/stress/schema-edit-fields-view.e2e.ts tests/stress/sidebar-search-pill.e2e.ts tests/stress/navigation-history.e2e.ts tests/stress/command-palette-semantic.e2e.ts tests/stress/agent-activity-panel.e2e.ts tests/stress/drop-pipeline-auto-open.e2e.ts tests/stress/command-palette-flicker.e2e.ts tests/stress/cm6-list-hanging-indent.e2e.ts tests/stress/ng7-rapid-nav-coherence.e2e.ts tests/stress/reveal-on-activate.e2e.ts tests/stress/selection-indicator.e2e.ts tests/stress/new-file-cross-doc-bleed.e2e.ts tests/stress/new-item-shortcut-fast-path.e2e.ts tests/stress/editor-mode-flip-cross-doc-bleed.e2e.ts tests/stress/editor-area-viewport-resize.e2e.ts tests/stress/qa-sidebar-responsive.e2e.ts tests/stress/prd-6955-reassertion-repro.e2e.ts tests/stress/prd-6955-reassertion-wedge.e2e.ts tests/stress/prd-6914-repro.e2e.ts tests/stress/showall-lazy-tree.e2e.ts tests/stress/tabs-component-strip.e2e.ts tests/stress/source-find-scroll.e2e.ts tests/stress/harness-app-warmth.e2e.ts tests/stress/qa-canary-authoring-both-modes.e2e.ts tests/stress/qa-canary-live-typing.e2e.ts tests/stress/keystroke-cadence-danger-space.e2e.ts tests/stress/jsx-unregistered-backspace-delete.e2e.ts tests/stress/jsx-unregistered-ime-concurrent.e2e.ts tests/stress/jsx-backspace-delete.e2e.ts tests/stress/link-authoring-bytes.e2e.ts tests/stress/link-authoring-apex.e2e.ts tests/stress/command-palette-parity.e2e.ts tests/stress/settings-search.e2e.ts tests/stress/okf-generated-index-settings.e2e.ts tests/stress/okf-recommended-skill-install.e2e.ts tests/stress/chip-popover-positioning.e2e.ts tests/stress/docs-open-scroll-restore.e2e.ts tests/stress/file-tree-decoration-chip-strip-repro.e2e.ts tests/stress/grip-click-nodeselect.e2e.ts tests/stress/jsx-halo-semantics.e2e.ts tests/stress/jsx-image-body-click.e2e.ts tests/stress/jsx-prop-panel-placeholder.e2e.ts tests/stress/jsx-range-encompass-halo.e2e.ts tests/stress/jsx-wildcard-convert.e2e.ts tests/stress/markdown-lint.e2e.ts tests/stress/frontmatter-schema-badge.e2e.ts tests/stress/frontmatter-glob-picker.e2e.ts tests/stress/unified-problems.e2e.ts tests/stress/mid-type-recovery.e2e.ts tests/stress/observer-a-multi-client.e2e.ts tests/stress/outline-toolbar-occlusion.e2e.ts tests/stress/selection-surface-pane-clip.e2e.ts tests/stress/quiet-tree-hidden-doc.e2e.ts tests/stress/raw-mdx-fallback-onblur-upgrade.e2e.ts tests/stress/rename-noext-probe.e2e.ts tests/stress/show-ok-folders.e2e.ts tests/stress/source-polish.e2e.ts tests/stress/warm-skeleton-scroll-restore.e2e.ts tests/stress/props-toggle-scroll-preserve.e2e.ts tests/stress/yjs-no-dual-import.e2e.ts tests/stress/graph-panel-surfaces.e2e.ts tests/stress/asset-embed-real-fidelity.e2e.ts tests/stress/image-invalid-placeholder.e2e.ts tests/stress/local-target-audit.e2e.ts tests/stress/rename-content-preservation.e2e.ts tests/stress/rename-consolidation.e2e.ts tests/stress/outline-active-heading.e2e.ts tests/stress/outline-navigation.e2e.ts tests/stress/prd-7627-default-swatch.e2e.ts tests/stress/clipboard-dollar-math-source-fallback.e2e.ts tests/stress/source-mode-undo-keymap.e2e.ts tests/stress/timeline-recovered-restore.e2e.ts tests/stress/blank-line-preservation.e2e.ts tests/stress/landing-helpers.e2e.ts tests/stress/mode-switch-landing.e2e.ts tests/stress/mode-switch-ordinal-divergence.e2e.ts tests/stress/comment-annotation-visibility.e2e.ts tests/stress/comment-opens-in-panel.e2e.ts tests/stress/qa-miles-edge-blanks.e2e.ts tests/stress/prop-upload.e2e.ts tests/stress/slash-command-auto-open.e2e.ts tests/stress/clipboard-relative-url-source-fallback.e2e.ts tests/stress/editor-split-view.e2e.ts tests/stress/language-load-failure.e2e.ts tests/stress/language-first-paint.e2e.ts tests/stress/user-text-direction.e2e.ts tests/stress/pseudolocale.e2e.ts tests/stress/language-picker.e2e.ts tests/stress/zh-hans-coverage-sweep.e2e.ts tests/stress/preview-tab-promotion.e2e.ts tests/stress/cv-paint-lock-click.e2e.ts tests/stress/cv-auto-paint-lock-click.e2e.ts tests/stress/history-traversal-preview-tab.e2e.ts tests/stress/tab-close-scroll-restore.e2e.ts tests/stress/skills-sidebar-open.e2e.ts",
"test:e2e:install-browsers": "playwright install chromium webkit firefox",
"test:visual": "playwright test --config playwright.visual.config.ts",
"test:visual:update": "playwright test --config playwright.visual.config.ts --update-snapshots",
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index 389d84d5e..9b813c37a 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -5882,8 +5882,11 @@ html.electron-mode [data-slot="sidebar-inner"] {
first-insertion path is click-safe by construction (a freshly inserted
node cannot be an ancestor of a node hit-tested earlier in the same
dispatch), but do not rely on the deferral for newly mounted subtrees.
- That deferred scheduling is the same rendering-update lock scheduling
- `content-visibility: auto` has natively (see `.ok-chunk-wrapper` below).
+ Do NOT read this deferral as equivalent to what `content-visibility: auto`
+ does natively — an earlier version of this note did, and the corrected
+ account is on `.ok-chunk-wrapper` below. cv:auto defers only its
+ INTERSECTION-driven lock; a style-driven one still lands at the next
+ recalc. The deferral here is explicit and owned by this rule.
`visibility: hidden` covers the deferral window: it removes the subtree
from hit-testing entirely (unlike `pointer-events: none`, which does not
invalidate a hit test captured earlier in the same dispatch), and it
@@ -5966,11 +5969,25 @@ html.electron-mode [data-slot="sidebar-inner"] {
Scoped to `.ProseMirror` so source-mode CodeMirror DOM is untouched
(CM6 has its own line-oriented viewport rendering).
- Click-safety: cv:auto is safe under clicks because its lock state
- changes only at rendering updates (never synchronously inside an input
- dispatch) and hit-testing skips already-locked subtrees. Do not replace
- `auto` with `hidden` here without the same deferred-lock + visibility
- pair `.ok-mode-hidden` carries — an undeferred paint lock over
+ Click-safety, corrected. An earlier version of this note argued cv:auto is
+ safe under clicks because its lock state "changes only at rendering updates,
+ never synchronously inside an input dispatch". That holds for the
+ INTERSECTION path (scrolling a block out of the render margin) and NOT for
+ the style path: a newly created display-lock context starts with its
+ viewport-intersection flag false, so applying cv:auto to an element that did
+ not have it locks during the very next style recalc, on-screen, and the
+ mousedown path runs several forced style flushes between capturing a hit
+ result and reading a caret out of it.
+
+ What actually protects this site is the selection pin: a click places the
+ caret in the block, and cv:auto keeps a selection-containing element
+ relevant to the user, so the clicked wrapper cannot acquire the lock that
+ would make the CHECK reachable. That is Chromium behavior, not ours, and it
+ is pinned by `tests/stress/cv-auto-paint-lock-click.e2e.ts` — which fails if
+ a future Chromium drops it.
+
+ Do not replace `auto` with `hidden` here without the same deferred-lock +
+ visibility pair `.ok-mode-hidden` carries — an undeferred paint lock over
hit-testable editor content trips Blink's display-lock CHECK (see the
`.ok-mode-hidden` comment above). */
.ProseMirror .ok-chunk-wrapper {
diff --git a/packages/app/src/globals.cv-paint-lock.test.ts b/packages/app/src/globals.cv-paint-lock.test.ts
index 25f0c729f..b194740fd 100644
--- a/packages/app/src/globals.cv-paint-lock.test.ts
+++ b/packages/app/src/globals.cv-paint-lock.test.ts
@@ -22,9 +22,19 @@
* the lock can form (`pointer-events: none` is NOT sufficient: it does
* not invalidate a hit test captured earlier in the same dispatch).
* Additionally, no `content-visibility: hidden` may appear under a
- * `.ProseMirror` scope at all — PM blocks are always live hit-test targets,
- * and the chunk-wrapper rule relies on cv:auto's native rendering-update
- * lock scheduling for its click-safety.
+ * `.ProseMirror` scope at all — PM blocks are always live hit-test targets.
+ *
+ * The chunk-wrapper rule's own click-safety was once explained here as
+ * reliance on "cv:auto's native rendering-update lock scheduling". That
+ * explanation is withdrawn: it holds for the intersection path and not the
+ * style path, where a newly created display-lock context locks during the
+ * next style recalc, on-screen, and the mousedown path runs forced style
+ * flushes between capturing a hit result and reading a caret from it. What
+ * actually protects that site is Chromium keeping a selection-containing
+ * element relevant, which is pinned by
+ * `tests/stress/cv-auto-paint-lock-click.e2e.ts` rather than asserted here.
+ * The guard below is unaffected either way — it bans cv:hidden under
+ * `.ProseMirror` regardless of why cv:auto is tolerable.
*
* These are source-level regex guards by necessity: the runtime behavior is
* only exercisable below-the-DOM in a real Chromium layout/paint engine —
diff --git a/packages/app/tests/stress/cv-auto-paint-lock-click.e2e.ts b/packages/app/tests/stress/cv-auto-paint-lock-click.e2e.ts
new file mode 100644
index 000000000..20997522e
--- /dev/null
+++ b/packages/app/tests/stress/cv-auto-paint-lock-click.e2e.ts
@@ -0,0 +1,604 @@
+/**
+ * Renderer-survival pin for the SECOND display-lock site: `.ok-chunk-wrapper`
+ * (`content-visibility: auto`), which `cv-paint-lock-click.e2e.ts` leaves
+ * explicitly unpinned.
+ *
+ * Blink hard-CHECKs (`third_party/blink/renderer/core/layout/hit_test_result.cc`,
+ * `LockedAncestorPreventingPaint` inside `HitTestResult::GetPosition()`) when a
+ * mouse press's hit-tested node has a paint-blocked ANCESTOR at the moment the
+ * click's default selection resolution reads a caret position out of the
+ * already-captured hit result. The whole renderer dies; the desktop shell
+ * auto-reloads the window, which users experience as an app reboot. Note the
+ * asymmetry that makes this a crash rather than a no-op: one line below the
+ * CHECK, Blink returns gracefully when the hit node's own CHILDREN are
+ * lock-blocked. Only the ancestor case aborts.
+ *
+ * `.ok-mode-hidden` (`content-visibility: hidden`) is the site the sibling test
+ * pins. This file covers the other one: OK stamps `.ok-chunk-wrapper` on EVERY
+ * top-level ProseMirror block (`chunk-wrapper-decoration.ts`) with a bare
+ * `content-visibility: auto` and no deferral.
+ *
+ * A field renderer crash landed on exactly that CHECK, on a build that already
+ * carried the `.ok-mode-hidden` fix, with a recovered stack showing the click
+ * dispatched as RAF-aligned input from inside `BeginMainFrame` — the input
+ * dispatch happening *within* a rendering update.
+ *
+ * WHY THE CRASH NEEDS A DESCENDANT HIT. A locked cv:auto wrapper does not lay
+ * out its contents, so a hit inside it resolves to the wrapper itself and takes
+ * the graceful child-blocked path. The CHECK is only reachable if the hit test
+ * resolves to a DESCENDANT while the wrapper is unlocked, and the wrapper then
+ * locks before the caret is read.
+ *
+ * WHAT IS AND IS NOT OBSERVABLE FROM A TEST. The window between the hit result
+ * being captured and `GetPosition()` reading it is real, and script plus several
+ * forced style/layout flushes run inside it. But the two ways a cv:auto element
+ * can lock behave differently there:
+ *
+ * - Intersection-driven (scrolling it out of the render margin) cannot land in
+ * the window. The mousedown path's flushes stop at pre-paint, before the
+ * post-layout intersection-observer step, and a scroll only marks
+ * intersection state dirty rather than delivering synchronously. CSS
+ * Contain 2 corroborates: skipped-state updates are deferred to the
+ * rendering update's own step, so a forced `offsetHeight` cannot deliver a
+ * relevance change.
+ * - Style-driven can, in principle: a newly created display-lock context
+ * starts with its viewport-intersection flag false, so applying cv:auto to
+ * an element that did not have it locks it during the next style recalc,
+ * even fully on-screen.
+ *
+ * NO TEST HERE CAN PROVE A LOCK DID NOT COMMIT INSIDE THE DISPATCH, and this
+ * file deliberately does not claim to. `contentvisibilityautostatechange` is
+ * dispatched by POSTING A TASK, not inline with the lock flip
+ * (`DisplayLockContext::ScheduleStateChangeEventIfNeeded`), so run-to-completion
+ * guarantees it lands after any synchronous handler finishes. An earlier draft
+ * timed the event against a window stamped inside the handler and asserted the
+ * count was zero; that assertion was structurally incapable of failing and has
+ * been removed rather than left to read as evidence.
+ *
+ * THE SAFETY PROPERTY THIS FILE DISCOVERED AND NOW PINS. A clicked block cannot
+ * enter the cv:auto paint lock at all, because the click places the caret in it
+ * and `content-visibility: auto` keeps a selection-containing element relevant
+ * to the user indefinitely. The committed arm measures this within-subject:
+ * scrolled two viewports away UNCLICKED the target locks; clicked first and
+ * scrolled FOUR TIMES that distance it does not, while dozens of sibling blocks
+ * lock in the same run. (An investigation run, not committed here, also found
+ * no lock for a clicked block at the control's own two viewports — so the
+ * result is not an artifact of the larger distance.) So it is the selection
+ * pin, not scroll distance. That
+ * pin is what keeps this site safe, it is a Chromium behavior rather than
+ * anything OK controls, and the first test below fails loudly if a future
+ * Chromium drops it.
+ *
+ * PRECONDITIONS ARE MEASURED, NOT ASSUMED. `landing.ts` warns that "whether
+ * Chromium actually skips an off-screen chunk in a headless run is a runtime
+ * decision", and a green here would be worthless if nothing ever locked. Two
+ * plausible oracles are blind and must not be used. Measured, not reasoned:
+ * the box-height probe `landing.ts` uses for materialization reported a
+ * non-zero child height for EVERY block, including one 12,543px off-screen —
+ * so it cannot distinguish skipped from painted here. (The mechanism behind
+ * that is not established. Reading a descendant's rect inside a skipped
+ * subtree plausibly forces the layout it is trying to observe, but this file
+ * does not claim that; what it relies on is the observation.) Separately,
+ * `Element.checkVisibility({contentVisibilityAuto:true})`
+ * reported 0 skipped of 389 off-screen wrappers because it answers about the
+ * wrapper, which stays visible while its CONTENTS are skipped. The spec'd
+ * `contentvisibilityautostatechange` event is the honest signal for WHETHER a
+ * relevance flip happened, with the caveat above that it cannot time one.
+ * Measured on this harness (400-block doc): a mid-document scroll jump produces
+ * 42 `skipped: true` transitions, identically headless and headed — so headless
+ * is a faithful substrate and this pin belongs in CI.
+ *
+ * WHAT WAS TRIED AND SURVIVED. Six shapes, all leaving the renderer alive:
+ * scrolling the clicked block out of relevance mid-dispatch; applying a fresh
+ * cv:auto to an on-screen ancestor inside the capture-phase mousedown; a
+ * remove/flush/re-add of the app's own wrapper class (the shape a ProseMirror
+ * decoration recompute produces); an `auto -> visible -> flush -> auto`
+ * retoggle; clicks under scroll churn on a congested main thread; and
+ * CDP-batched move+press so the press dispatches from inside `BeginMainFrame`.
+ * None reproduced the CHECK. Note for anyone re-running these: removing and
+ * re-adding a cv:auto class inside ONE task is a no-op, because Blink's
+ * requested-state setter early-returns when the computed value did not change.
+ * An experiment built that way tests nothing and reads exactly like proof of
+ * safety.
+ *
+ * This seam only exists in a real Chromium layout/paint engine — jsdom has no
+ * display-lock machinery — so the pin lives at Playwright fidelity.
+ *
+ * KNOWN EXPOSURE IN CI ONLY, RECORDED RATHER THAN FIXED. `playwright.config.ts`
+ * sets `retries: isCI ? 2 : 0` and `failOnFlakyTests: false` unconditionally.
+ * In CI a test therefore runs up to three times, Playwright classifies
+ * failed-then-passed as flaky rather than failed, and flaky is let through — so
+ * the run goes red only when the crash reproduces on ALL THREE attempts.
+ * Anything short of that is masked equally: two-of-three is hidden exactly as
+ * thoroughly as one-of-three. Locally retries are 0 and a single crash fails
+ * the run outright, so a local green is exactly as strong as it looks.
+ *
+ * What that means in practice: a red run from this file is strong evidence, and
+ * a green CI run is weaker than it looks for an intermittent crash. It is
+ * recorded rather than special-cased because a per-file `retries: 0` is a
+ * policy call for the suite's owners, not something this pin should make
+ * unilaterally — and the sibling `.ok-mode-hidden` pin has carried the same
+ * exposure since it landed.
+ */
+
+import { randomUUID } from 'node:crypto';
+import type { Page } from '@playwright/test';
+import {
+ type ApiHelpers,
+ blockMarker,
+ expect,
+ generateTallDoc,
+ scrollWysiwygBlockToTop,
+ test,
+ waitForActiveProviderSynced,
+} from './_helpers';
+
+const WYSIWYG = '.ProseMirror:not(.composer-prosemirror)';
+const CHUNK_WRAPPER = `${WYSIWYG} .ok-chunk-wrapper`;
+const SCROLLER = '[data-testid="editor-scroll-container"]';
+
+/**
+ * Tall enough that blocks away from the viewport genuinely leave the cv:auto
+ * render margin — the scale the landing tests rely on for honest virtualization.
+ * Much below this nothing ever locks and every arm would pass vacuously.
+ */
+const BLOCK_COUNT = 400;
+/** Mid-document target: far from both ends, so neither edge special-cases it. */
+const TARGET_INDEX = 150;
+/** Marker text length (`OKBLK####`), the key lock transitions are recorded under. */
+const MARKER_LENGTH = 9;
+/** Budget for a scroll's relevance transitions to arrive and stop arriving. */
+const SETTLE_TIMEOUT_MS = 15_000;
+/**
+ * Poll cadence for that wait. With `REQUIRED_STABLE_SAMPLES`, this is what
+ * makes the accepted quiescence window an explicit half-second rather than
+ * whatever `expect.poll`'s default backoff happens to produce.
+ */
+const SETTLE_POLL_INTERVAL_MS = 100;
+/**
+ * Clicks the churn arm lands while wrappers flip relevance underneath them.
+ *
+ * Named rather than inlined because `pressAndProbe`'s listener-cleanup rationale
+ * depends on this being more than a couple — it is repeated presses against one
+ * `Page` that turn a leaked `crash` listener into log noise. A bare literal in
+ * the loop would let the two drift apart, and this value has already moved once.
+ */
+const CHURN_CLICK_COUNT = 20;
+
+type ClickOutcome = 'alive' | 'renderer-crashed';
+
+interface LockEvent {
+ marker: string;
+ skipped: boolean;
+}
+
+interface LockReport {
+ events: LockEvent[];
+ /** Transitions into the locked state, across all wrappers. */
+ skippedCount: number;
+ /** Whether the capture-phase arm ran at all. */
+ armRan: boolean;
+}
+
+/** Shape of the page-context recorder the helpers below read and write. */
+interface CvRecorder {
+ events: LockEvent[];
+ armRan: boolean;
+}
+
+/** Install (or reset) cv:auto transition recording on every chunk wrapper. */
+async function trackLockTransitions(page: Page): Promise<void> {
+ await page.evaluate(
+ ({ wrapperSelector, markerLength }) => {
+ const w = window as unknown as { __cv: CvRecorder; __cvBound?: boolean };
+ w.__cv = { events: [], armRan: false };
+ // Listeners are bound once; re-invoking only clears the log, so a test can
+ // take a fresh reading between phases without double-recording.
+ if (w.__cvBound) return;
+ w.__cvBound = true;
+ for (const el of document.querySelectorAll<HTMLElement>(wrapperSelector)) {
+ const marker = (el.textContent ?? '').slice(0, markerLength);
+ el.addEventListener('contentvisibilityautostatechange', (ev) => {
+ w.__cv.events.push({ marker, skipped: (ev as Event & { skipped: boolean }).skipped });
+ });
+ }
+ },
+ { wrapperSelector: CHUNK_WRAPPER, markerLength: MARKER_LENGTH },
+ );
+}
+
+async function readLockReport(page: Page): Promise<LockReport> {
+ return page.evaluate(() => {
+ const w = window as unknown as { __cv?: CvRecorder };
+ if (!w.__cv) throw new Error('readLockReport: lock tracking was never installed');
+ return {
+ events: w.__cv.events,
+ skippedCount: w.__cv.events.filter((e) => e.skipped).length,
+ armRan: w.__cv.armRan,
+ };
+ });
+}
+
+async function lockEventCount(page: Page): Promise<number> {
+ return page.evaluate(() => {
+ const w = window as unknown as { __cv?: CvRecorder };
+ return w.__cv?.events.length ?? 0;
+ });
+}
+
+/**
+ * Wait until relevance transitions have both ARRIVED and STOPPED arriving.
+ *
+ * Condition-based rather than a fixed sleep, per the repo's zero-allowlist e2e
+ * STOP rule. It is also the stronger check: requiring `count > since` means a
+ * scroll that provoked nothing fails here instead of silently handing a later
+ * absence-assertion a page where nothing ever happened.
+ *
+ * Several consecutive stable samples, not two. Relevance transitions arrive in
+ * ragged waves as off-screen chunks refine their reserved size over successive
+ * frames, so two equal readings are routinely a lull inside a burst rather than
+ * its end. `scrollWysiwygBlockToTop` in `_helpers/landing.ts` reached the same
+ * conclusion about the same phenomenon and holds for five stable frames; this
+ * matches it. Under-waiting matters here more than it does there, because what
+ * this gates is an ABSENCE assertion — settle too early and the target's lock
+ * simply has not happened yet, which reads as the property holding.
+ */
+const REQUIRED_STABLE_SAMPLES = 5;
+
+async function waitForLockTransitionsToSettle(page: Page, since: number): Promise<void> {
+ let previous = -1;
+ let stable = 0;
+ await expect
+ .poll(
+ async () => {
+ const now = await lockEventCount(page);
+ stable = now > since && now === previous ? stable + 1 : 0;
+ previous = now;
+ return stable;
+ },
+ {
+ timeout: SETTLE_TIMEOUT_MS,
+ // Fixed cadence, not `expect.poll`'s default exponential backoff. Under
+ // the default, five stable samples cannot be reached before the sixth
+ // attempt, which alone eats seconds of the budget and leaves real
+ // settling headroom well under what `SETTLE_TIMEOUT_MS` implies. It
+ // fails safe either way — a premature timeout is a false failure, never
+ // a false pass — but a fixed interval makes the accepted quiescence
+ // window a stated number rather than a side effect of the backoff curve.
+ intervals: [SETTLE_POLL_INTERVAL_MS],
+ message: 'cv:auto relevance transitions never arrived, or never stopped arriving',
+ },
+ )
+ .toBeGreaterThanOrEqual(REQUIRED_STABLE_SAMPLES);
+}
+
+/** Isolated per-test tall doc: seed, navigate, wait for sync + editor mount. */
+async function setupTallDoc(page: Page, api: ApiHelpers): Promise<void> {
+ const docName = `test-cvauto-${randomUUID().slice(0, 8)}`;
+ const { markdown } = generateTallDoc({ blockCount: BLOCK_COUNT });
+ await api.seedDocs([{ name: docName, markdown }]);
+ await page.goto(`/#/${docName}`);
+ await waitForActiveProviderSynced(page);
+ await expect(page.locator(WYSIWYG).first()).toBeVisible();
+}
+
+/** Put the target at the readable top and confirm the scroll converged. */
+async function stageTargetForClick(page: Page, marker: string): Promise<void> {
+ const settleDelta = await scrollWysiwygBlockToTop(page, marker);
+ expect(
+ Math.abs(settleDelta),
+ `setup scroll did not converge block "${marker}" to the readable top`,
+ ).toBeLessThan(40);
+}
+
+/**
+ * Scroll down by `viewports` viewport heights, then wait for the relevance
+ * transitions that provokes to settle.
+ *
+ * Returns the distance the browser ACTUALLY applied. `scrollTop +=` is clamped
+ * at the scroller's maximum, so a caller that reasons about distance has to
+ * measure it: the phase asserting a clicked block never locks would otherwise
+ * be silently weakened by a clamp while sibling-block transitions kept the run
+ * looking healthy.
+ */
+async function scrollAway(page: Page, viewports: number): Promise<number> {
+ const before = await lockEventCount(page);
+ const moved = await page.evaluate(
+ ({ scrollSelector, viewports }) => {
+ const s = Array.from(document.querySelectorAll<HTMLElement>(scrollSelector)).find(
+ (el) => el.getClientRects().length > 0,
+ );
+ if (!s) throw new Error('scrollAway: no visible scroll container');
+ const from = s.scrollTop;
+ s.scrollTop += s.clientHeight * viewports;
+ return s.scrollTop - from;
+ },
+ { scrollSelector: SCROLLER, viewports },
+ );
+ await waitForLockTransitionsToSettle(page, before);
+ return moved;
+}
+
+/**
+ * Press-and-release at (x, y), then classify whether the renderer survived.
+ *
+ * Raced against the page `crash` event because a dead renderer can leave the
+ * in-flight input protocol call hanging (it would otherwise burn the whole test
+ * budget before the assertion runs); either signal classifies as
+ * `renderer-crashed` so the test fails on the assertion, not on infrastructure
+ * noise. Mirrors the sibling `.ok-mode-hidden` pin's probe.
+ */
+async function pressAndProbe(page: Page, x: number, y: number): Promise<ClickOutcome> {
+ // Registered and removed explicitly rather than via `once`, which only
+ // detaches when the event FIRES. On the asserted path the renderer survives,
+ // so a `once` listener would linger along with its never-settling promise,
+ // and the churn arm calls this repeatedly against a single `Page`
+ // (`CHURN_CLICK_COUNT`) — enough accumulation to spill listener warnings into
+ // exactly the CI log someone would be reading if this pin ever went red.
+ let onCrash: (() => void) | undefined;
+ const crashed = new Promise<ClickOutcome>((resolve) => {
+ onCrash = () => resolve('renderer-crashed');
+ page.on('crash', onCrash);
+ });
+ try {
+ const clickAndProbe = (async (): Promise<ClickOutcome> => {
+ await page.mouse.move(x, y);
+ await page.mouse.down();
+ await page.mouse.up();
+ // Liveness probe: a crashed page rejects (or never answers) evaluate.
+ await page.evaluate(() => document.readyState);
+ return 'alive';
+ })().catch((): ClickOutcome => 'renderer-crashed');
+ return await Promise.race([crashed, clickAndProbe]);
+ } finally {
+ if (onCrash) page.off('crash', onCrash);
+ }
+}
+
+/**
+ * A point over the block's emphasised marker element, so the hit test resolves
+ * to a DESCENDANT of the wrapper rather than the wrapper itself — the only
+ * shape that can reach the CHECK. Throws on an empty box, because a click at a
+ * guessed coordinate would miss the editor and pass for the wrong reason.
+ */
+async function pointInsideBlockText(page: Page, marker: string): Promise<{ x: number; y: number }> {
+ const box = await page.evaluate(
+ ({ marker, wrapperSelector }) => {
+ const wrapper = Array.from(document.querySelectorAll<HTMLElement>(wrapperSelector)).find(
+ (w) => w.textContent?.includes(marker),
+ );
+ if (!wrapper) throw new Error(`pointInsideBlockText: block "${marker}" not in the DOM`);
+ const probe = wrapper.firstElementChild ?? wrapper;
+ const r = probe.getBoundingClientRect();
+ return { x: r.x, y: r.y, width: r.width, height: r.height };
+ },
+ { marker, wrapperSelector: CHUNK_WRAPPER },
+ );
+ if (box.height <= 0 || box.width <= 0) {
+ throw new Error(
+ `pointInsideBlockText: block "${marker}" has an empty box (${JSON.stringify(box)})`,
+ );
+ }
+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 };
+}
+
+test('PRD-8158: a clicked .ok-chunk-wrapper stays out of the cv:auto paint lock', async ({
+ page,
+ api,
+}) => {
+ await setupTallDoc(page, api);
+ const targetMarker = blockMarker(TARGET_INDEX);
+
+ // Phase 1 (control) — scroll the target away WITHOUT clicking it. This proves
+ // the display-lock machinery is live in this run and that the scroll distance
+ // is enough to move this particular block out of the render margin. Without
+ // it, phase 2's "did not lock" result would be indistinguishable from "never
+ // could have locked".
+ await stageTargetForClick(page, targetMarker);
+ await trackLockTransitions(page);
+ const controlDistance = await scrollAway(page, 2);
+ const control = await readLockReport(page);
+ expect(
+ control.events.filter((e) => e.marker === targetMarker && e.skipped).length,
+ `control failed: block "${targetMarker}" did not enter a cv:auto paint lock even unclicked, so this run cannot tell a selection pin from an inert page`,
+ ).toBeGreaterThan(0);
+
+ // Phase 2 — bring it back (which makes it relevant again), click it to place
+ // the caret inside it, then scroll it FOUR TIMES the control distance away.
+ await stageTargetForClick(page, targetMarker);
+ await trackLockTransitions(page);
+ const point = await pointInsideBlockText(page, targetMarker);
+ const outcome = await pressAndProbe(page, point.x, point.y);
+ expect(outcome, 'renderer must survive an ordinary click into a chunk wrapper').toBe('alive');
+ const clickedDistance = await scrollAway(page, 8);
+
+ // The distance claim is measured, not inferred from the seed geometry: a
+ // clamped or short scroll would quietly turn "distance-independent" into
+ // "barely moved". The bound has to be STRICTLY GREATER by a real margin, not
+ // merely "at least as far" — a clamp down to exactly the control distance
+ // would satisfy that weaker form while destroying the only thing this phase
+ // establishes, and every other check here would still pass because sibling
+ // blocks carry `skippedCount`.
+ expect(
+ clickedDistance,
+ 'the post-click scroll was clamped to near the control distance, so this phase no longer distinguishes a selection pin from simply not having travelled far enough',
+ ).toBeGreaterThan(controlDistance * 2);
+
+ const after = await readLockReport(page);
+ // Sibling blocks must still be locking, or the page went inert and the
+ // assertion below would pass for the wrong reason.
+ expect(
+ after.skippedCount,
+ 'no wrapper at all entered a cv:auto paint lock after the click — the page went inert, so the selection-pin assertion would be vacuous',
+ ).toBeGreaterThan(0);
+ expect(
+ after.events.filter((e) => e.marker === targetMarker && e.skipped).length,
+ `the clicked block "${targetMarker}" entered a cv:auto paint lock. Chromium no longer keeps a ` +
+ 'selection-containing element relevant, which is the property that currently keeps this site ' +
+ "safe: a click's hit test resolves to a descendant, and a wrapper that can lock afterwards " +
+ 'reopens the display-lock CHECK. Harden .ok-chunk-wrapper with the same deferral trio ' +
+ '.ok-mode-hidden carries.',
+ ).toBe(0);
+});
+
+test('PRD-8158: a click survives its chunk wrapper being scrolled out of relevance mid-dispatch', async ({
+ page,
+ api,
+}) => {
+ await setupTallDoc(page, api);
+ const targetMarker = blockMarker(TARGET_INDEX);
+ await stageTargetForClick(page, targetMarker);
+ await trackLockTransitions(page);
+
+ // Arm: on the next mousedown (capture phase — after Blink's hit test has
+ // resolved a descendant text node, before the default selection handling
+ // reads a caret out of it), scroll the clicked block two viewports out of the
+ // cv:auto render margin and force style+layout.
+ await page.evaluate(
+ ({ scrollSelector }) => {
+ const scroller = Array.from(document.querySelectorAll<HTMLElement>(scrollSelector)).find(
+ (el) => el.getClientRects().length > 0,
+ );
+ if (!scroller) throw new Error('no visible scroll container');
+ const w = window as unknown as { __cv: CvRecorder };
+ window.addEventListener(
+ 'mousedown',
+ () => {
+ w.__cv.armRan = true;
+ scroller.scrollTop += scroller.clientHeight * 2;
+ void scroller.offsetHeight;
+ },
+ { capture: true, once: true },
+ );
+ },
+ { scrollSelector: SCROLLER },
+ );
+
+ const before = await lockEventCount(page);
+ const point = await pointInsideBlockText(page, targetMarker);
+ const outcome = await pressAndProbe(page, point.x, point.y);
+ expect(
+ outcome,
+ 'renderer must survive a click whose .ok-chunk-wrapper is scrolled out of cv:auto relevance during the same dispatch',
+ ).toBe('alive');
+
+ await waitForLockTransitionsToSettle(page, before);
+ const report = await readLockReport(page);
+ // A `window` capture listener proves a press was DISPATCHED, not that it
+ // landed on a descendant of the target wrapper — so this cannot say "the
+ // click missed", only that no press reached the page at all.
+ expect(report.armRan, 'no mousedown was dispatched to the page, so the arm never ran').toBe(true);
+ // Aggregate-only on purpose, unlike test 1's target-specific check. The
+ // clicked block CANNOT lock here — the click pins it relevant, which is the
+ // property test 1 establishes — so a symmetric per-target assertion would be
+ // asserting the opposite of a known result. What this arm needs is only that
+ // the scroll drove SOME wrapper out of relevance, proving the machinery ran.
+ expect(
+ report.skippedCount,
+ 'the scroll drove no wrapper into a cv:auto paint lock, so this run exercised nothing',
+ ).toBeGreaterThan(0);
+});
+
+test('PRD-8158: rapid clicks during scroll churn survive cv:auto relevance flips on a congested main thread', async ({
+ page,
+ api,
+}) => {
+ await setupTallDoc(page, api);
+ const targetMarker = blockMarker(TARGET_INDEX);
+ await stageTargetForClick(page, targetMarker);
+ await trackLockTransitions(page);
+
+ // The field stack has the click dispatched as RAF-aligned input from inside
+ // `BeginMainFrame` — Chromium coalesces input onto the frame boundary when
+ // the main thread is congested, which is the one path where a rendering
+ // update can occur inside an input dispatch. Script cannot select that path
+ // directly, so this arm reproduces the condition that selects it: a busy main
+ // thread plus continuous scrolling that keeps wrappers flipping in and out of
+ // relevance while clicks land. It therefore does NOT prove the RAF-aligned
+ // path was taken; it makes it likely and asserts the renderer survived.
+ await page.evaluate(
+ ({ scrollSelector }) => {
+ const scroller = Array.from(document.querySelectorAll<HTMLElement>(scrollSelector)).find(
+ (el) => el.getClientRects().length > 0,
+ );
+ if (!scroller) throw new Error('no visible scroll container');
+ const w = window as unknown as { __churn: number; __churnStop?: () => void };
+ w.__churn = 0;
+ let direction = 1;
+ let running = true;
+ // Cancellable: without this the loop keeps burning ~12 of every ~16ms and
+ // scrolling a viewport per frame through the post-loop reads, teardown,
+ // and any failure-artifact capture — which is both wasted CI time and a
+ // page still moving underneath whatever a red run tries to screenshot.
+ w.__churnStop = () => {
+ running = false;
+ };
+ const step = (): void => {
+ if (!running) return;
+ // Overrun a 60Hz frame budget without stalling the run, so Chromium
+ // starts coalescing input onto the frame boundary.
+ const until = performance.now() + 12;
+ while (performance.now() < until) {
+ /* deliberate main-thread burn */
+ }
+ scroller.scrollTop += direction * scroller.clientHeight;
+ const maxScroll = scroller.scrollHeight - scroller.clientHeight;
+ if (scroller.scrollTop <= 0 || scroller.scrollTop >= maxScroll) direction *= -1;
+ w.__churn += 1;
+ requestAnimationFrame(step);
+ };
+ requestAnimationFrame(step);
+ },
+ { scrollSelector: SCROLLER },
+ );
+
+ const band = await page.evaluate(
+ ({ scrollSelector }) => {
+ const scroller = Array.from(document.querySelectorAll<HTMLElement>(scrollSelector)).find(
+ (el) => el.getClientRects().length > 0,
+ );
+ if (!scroller) throw new Error('no visible scroll container');
+ const r = scroller.getBoundingClientRect();
+ return { x: Math.round(r.x + r.width / 2), top: Math.round(r.top + 80), height: r.height };
+ },
+ { scrollSelector: SCROLLER },
+ );
+
+ let outcome: ClickOutcome = 'alive';
+ const span = Math.max(1, Math.round(band.height - 160));
+ for (let i = 0; i < CHURN_CLICK_COUNT && outcome === 'alive'; i++) {
+ outcome = await pressAndProbe(page, band.x, band.top + ((i * 37) % span));
+ }
+ // Survival is asserted FIRST, before anything else touches the page. The
+ // loop exits early on a crash, so any `page.evaluate` placed above this
+ // would be the first call against a dead renderer: it would reject, and the
+ // test would fail on "Target crashed" instead of on the message below, which
+ // names the property and the site that failed. That is exactly what
+ // `pressAndProbe` races the `crash` event to avoid, and it would be undone
+ // on the single path this whole file exists to detect.
+ expect(
+ outcome,
+ 'renderer must survive clicks landing while .ok-chunk-wrapper blocks flip cv:auto relevance under a congested main thread',
+ ).toBe('alive');
+
+ // Now that the renderer is known alive, stop the churn so the reads below
+ // measure a settled page and nothing keeps scrolling during teardown.
+ await page.evaluate(() => {
+ (window as unknown as { __churnStop?: () => void }).__churnStop?.();
+ });
+
+ const churn = await page.evaluate(() => (window as unknown as { __churn: number }).__churn);
+ expect(
+ churn,
+ 'the scroll-churn loop never ran — no relevance flips were provoked',
+ ).toBeGreaterThan(10);
+ const report = await readLockReport(page);
+ expect(
+ report.skippedCount,
+ 'no wrapper entered a cv:auto paint lock during the churn — the precondition was never built, so a pass here would be vacuous',
+ ).toBeGreaterThan(0);
+ expect(
+ report.events.some((e) => e.marker === targetMarker),
+ `the staged block "${targetMarker}" never changed cv:auto relevance — the churn did not reach it`,
+ ).toBe(true);
+});
diff --git a/packages/app/tests/stress/cv-paint-lock-click.e2e.ts b/packages/app/tests/stress/cv-paint-lock-click.e2e.ts
index 54d49095f..12b1cded4 100644
--- a/packages/app/tests/stress/cv-paint-lock-click.e2e.ts
+++ b/packages/app/tests/stress/cv-paint-lock-click.e2e.ts
@@ -24,13 +24,17 @@
* app's own DOM, then asserts the renderer survived.
*
* Only the `.ok-mode-hidden` site is pinned here. The `.ok-chunk-wrapper`
- * (cv:auto) site shares the same invariant and the same fix surface, but its
- * crashing precondition — a paint-locked (off-viewport) wrapper as ancestor
- * of a hit-tested node — is not deterministically constructible from script:
- * cv:auto lock state flips only at rendering-update time, never inside an
- * input dispatch (verified empirically: removing + re-applying the class with
- * forced layout inside the mousedown does not paint-lock an on-viewport
- * block, so no crash), and a click cannot land inside an off-viewport block.
+ * (cv:auto) site is pinned separately, by `cv-auto-paint-lock-click.e2e.ts`.
+ *
+ * An earlier version of this note claimed that site's crashing precondition was
+ * not constructible from script, citing an experiment that removed and
+ * re-applied the class with a forced layout inside the mousedown. That
+ * experiment was inert: Blink's requested-state setter early-returns when the
+ * computed value did not change, so a same-task remove-and-re-add is a no-op
+ * and could not have locked anything either way. The conclusion survived
+ * re-testing, but on different evidence — see the sibling file's header for
+ * what actually keeps the cv:auto site safe, and for the six shapes that were
+ * tried against it.
*
* This seam only exists in a real Chromium layout/paint engine — jsdom has
* no display-lock machinery, so the pin lives at Playwright fidelity.
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index dfd95ef49..d7a845280 100644
--- a/packages/core/src/bridge/bind-frontmatter-doc.ts
+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts
@@ -1,4 +1,3 @@
-
import type * as Y from 'yjs';
import type { Err, Ok, Result } from '../config/result.ts';
import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';
diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.ts
index 8bfdb40cd..005627195 100644
--- a/packages/core/src/bridge/bridge-invariant.ts
+++ b/packages/core/src/bridge/bridge-invariant.ts
@@ -1,4 +1,3 @@
-
import { fnv1aDigest } from './hash-util.ts';
export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index 2a597ec3d..f4cc8a286 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,4 +1,3 @@
-
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/divergence-locate.ts b/packages/core/src/bridge/divergence-locate.ts
index d979f4b39..6b505314d 100644
--- a/packages/core/src/bridge/divergence-locate.ts
+++ b/packages/core/src/bridge/divergence-locate.ts
@@ -1,4 +1,3 @@
-
import { findFirstDivergenceIndex } from './tolerance-telemetry.ts';
export const BRIDGE_LINE_KINDS = [
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 01ef76a9f..8fb428b90 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,4 +1,3 @@
-
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/bridge/growth-detect.ts b/packages/core/src/bridge/growth-detect.ts
index 463e89595..9d9c244b0 100644
--- a/packages/core/src/bridge/growth-detect.ts
+++ b/packages/core/src/bridge/growth-detect.ts
@@ -1,4 +1,3 @@
-
const DEFAULT_MIN_SUBSTANTIVE_LINE_LENGTH = 16;
export const DUPLICATION_GATE_MIN_LINE_LENGTH = 8;
diff --git a/packages/core/src/bridge/intraline-predicate.ts b/packages/core/src/bridge/intraline-predicate.ts
index 0939885bb..c43fdd7e7 100644
--- a/packages/core/src/bridge/intraline-predicate.ts
+++ b/packages/core/src/bridge/intraline-predicate.ts
@@ -1,4 +1,3 @@
-
export function rawLineCounts(doc: string): Map<string, number> {
const counts = new Map<string, number>();
for (const line of doc.split('\n')) {
diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.ts
index c0dc65705..251560a35 100644
--- a/packages/core/src/bridge/merge-three-way.ts
+++ b/packages/core/src/bridge/merge-three-way.ts
@@ -65,7 +65,6 @@ export function tryLineLevelCombine(
return { clean: true, merged };
}
-
export type BridgeMergeContentLossSide = 'user' | 'agent';
export type BridgeMergeContentLossWhich = 'substring' | 'order' | 'growth';
diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.ts
index dcc5b0690..01ac80099 100644
--- a/packages/core/src/bridge/normalize.ts
+++ b/packages/core/src/bridge/normalize.ts
@@ -1,4 +1,3 @@
-
import { stripFrontmatter } from '../extensions/frontmatter.ts';
import { bodyEdgeEmpties } from './doc-boundary-space.ts';
diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.ts
index 4f7b79587..bb53e7c7c 100644
--- a/packages/core/src/bridge/pm-structural-equivalence.ts
+++ b/packages/core/src/bridge/pm-structural-equivalence.ts
@@ -32,7 +32,6 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };
const BR_LITERAL_RE = /^<br\s*\/?>$/i;
-
interface DegradeEntry {
readonly label: string;
readonly severity: ToleranceClassSeverity;
@@ -129,7 +128,6 @@ export interface ComparePmStructuralOptions {
rawSourceSide?: 'expected';
}
-
/** Rebuild a node with `fn` applied to each child; identity when childless.
* Shared by the degrade canonicalizers so none re-implements the walk. */
function mapChildren(
@@ -255,7 +253,6 @@ function applyDegrades(tree: PmStructuralNode): {
return { normalized: current, fired };
}
-
export function comparePmStructural(
expected: PmStructuralNode,
actual: PmStructuralNode,
diff --git a/packages/core/src/bridge/subsequence.ts b/packages/core/src/bridge/subsequence.ts
index dca644141..af20de1e2 100644
--- a/packages/core/src/bridge/subsequence.ts
+++ b/packages/core/src/bridge/subsequence.ts
@@ -1,4 +1,3 @@
-
/** True when `needle` is a subsequence of `haystack` (two-pointer, O(n+m)):
* insertions in `haystack` are free; any dropped or substituted `needle` byte
* fails. */
diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.ts
index a363dfd54..83d47404a 100644
--- a/packages/core/src/markdown/callout-transformer.ts
+++ b/packages/core/src/markdown/callout-transformer.ts
@@ -1,4 +1,3 @@
-
import type { Blockquote, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/code-fence.ts b/packages/core/src/markdown/code-fence.ts
index 4499dbc92..9807a7e82 100644
--- a/packages/core/src/markdown/code-fence.ts
+++ b/packages/core/src/markdown/code-fence.ts
@@ -1,4 +1,3 @@
-
export function selectFenceChar(info: string): '`' | '~' {
return info.includes('`') ? '~' : '`';
}
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 34704165b..7415c474a 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.ts
index b6299a948..ece5c02a1 100644
--- a/packages/core/src/markdown/dedent-block-jsx-close.ts
+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts
@@ -1,4 +1,3 @@
-
import { findFencedRegions, isInsideFence } from './fence-regions.ts';
const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;
diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.ts
index acd398aa6..54774764a 100644
--- a/packages/core/src/markdown/details-accordion-promoter.ts
+++ b/packages/core/src/markdown/details-accordion-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/div-align-promoter.ts b/packages/core/src/markdown/div-align-promoter.ts
index ba9b56384..43ecdc709 100644
--- a/packages/core/src/markdown/div-align-promoter.ts
+++ b/packages/core/src/markdown/div-align-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.ts
index 4513da9bb..6d3f3643e 100644
--- a/packages/core/src/markdown/fence-regions.ts
+++ b/packages/core/src/markdown/fence-regions.ts
@@ -1,4 +1,3 @@
-
const FENCE_RE = /^(`{3,}|~{3,})/gm;
export function findFencedRegions(src: string): Array<[number, number]> {
diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.ts
index 6931623c7..00f5771ee 100644
--- a/packages/core/src/markdown/fixtures/index.ts
+++ b/packages/core/src/markdown/fixtures/index.ts
@@ -1,4 +1,3 @@
-
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -9,7 +8,6 @@ function fixturePath(...segments: string[]): string {
return resolve(FIXTURES_DIR, ...segments);
}
-
interface GfmExample {
section: string;
markdown: string;
@@ -19,7 +17,6 @@ export function loadGfmExamples(): GfmExample[] {
return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];
}
-
interface MdxCrashEntry {
id: string;
input: string;
@@ -71,7 +68,6 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {
) as LargeEmbedFixture[];
}
-
export function loadPrd6955Before(): string {
return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');
}
@@ -80,7 +76,6 @@ export function loadPrd6955CorruptedTriplicated(): string {
return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');
}
-
export interface NgPinnedCase {
id: string;
name: string;
@@ -97,7 +92,6 @@ export function loadNgPinnedCases(): NgPinnedCase[] {
) as NgPinnedCase[];
}
-
export function loadLargeRealistic(): string {
return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');
}
diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.ts
index daa3ef82b..8b1eb8519 100644
--- a/packages/core/src/markdown/fixtures/perf/generate.ts
+++ b/packages/core/src/markdown/fixtures/perf/generate.ts
@@ -1,4 +1,3 @@
-
import { writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -11,7 +10,6 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;
const SEED = 0xf1de1117;
-
function mulberry32(seed: number): () => number {
let a = seed >>> 0;
return () => {
@@ -38,7 +36,6 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {
return items[items.length - 1][0];
}
-
const WORDS = [
'lorem',
'ipsum',
@@ -156,7 +153,6 @@ function mdxBlock(rand: () => number): string {
return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;
}
-
type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';
const MIX: readonly [BlockKind, number][] = [
@@ -195,7 +191,6 @@ function generateDocument(blockCount: number, seed: number): string {
return `${blocks.join('\n\n')}\n`;
}
-
function main(): void {
for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {
const doc = generateDocument(count, SEED);
diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.ts
index 32c055c5b..420dc0fe5 100644
--- a/packages/core/src/markdown/guard-flanking-matrix.ts
+++ b/packages/core/src/markdown/guard-flanking-matrix.ts
@@ -7,7 +7,6 @@ import {
import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';
import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';
-
export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;
export type FlankClass = 'whitespace' | 'punctuation' | 'other';
diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.ts
index 283913255..2653473da 100644
--- a/packages/core/src/markdown/handler-shadow-audit.ts
+++ b/packages/core/src/markdown/handler-shadow-audit.ts
@@ -1,4 +1,3 @@
-
export interface HandlerShadowWitness {
input: string;
expect: 'byte' | 'byte-and-reparse-type';
diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.ts
index 5d1000cc4..da0a81d23 100644
--- a/packages/core/src/markdown/highlight-promoter.ts
+++ b/packages/core/src/markdown/highlight-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.ts
index 9681c0056..787315157 100644
--- a/packages/core/src/markdown/html-to-mdast.ts
+++ b/packages/core/src/markdown/html-to-mdast.ts
@@ -1,4 +1,3 @@
-
import type { Element as HastElement, Root as HastRoot } from 'hast';
import type { List, Nodes as MdastNodes, Root as MdastRoot } from 'mdast';
import rehypeParse from 'rehype-parse';
@@ -129,8 +128,7 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRo
throw new HtmlPayloadTooLargeError(html.length, maxBytes);
}
- const processor = unified()
- .use(rehypeParse, { fragment: true });
+ const processor = unified().use(rehypeParse, { fragment: true });
for (const plugin of cleanupPlugins) {
processor.use(plugin);
diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.ts
index 994eb6917..706fa9afb 100644
--- a/packages/core/src/markdown/image-promoter.ts
+++ b/packages/core/src/markdown/image-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Image, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.ts
index ec1ac1b7e..779e27500 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -207,7 +206,6 @@ export class MarkdownManager {
}
}
-
const registry = createRegistry();
function destructureAttrs(
@@ -256,7 +254,6 @@ function destructureAttrs(
return result;
}
-
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -279,7 +276,6 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChec
return freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;
}
-
function isEmptyMdastParagraph(node: MdastNodes): boolean {
if (node.type !== 'paragraph') return false;
const children = node.children ?? [];
@@ -348,7 +344,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
-
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -601,7 +596,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -682,7 +676,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -980,7 +973,6 @@ function buildMdastToPmHandlers(
};
}
-
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1106,7 +1098,6 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
-
function buildPmToMdastHandlers(
schema: Schema,
freshness: FreshnessCheckerHolder,
diff --git a/packages/core/src/markdown/lint/applies-to.ts b/packages/core/src/markdown/lint/applies-to.ts
index b79e9aef7..fa0be9e86 100644
--- a/packages/core/src/markdown/lint/applies-to.ts
+++ b/packages/core/src/markdown/lint/applies-to.ts
@@ -1,4 +1,3 @@
-
import picomatch from 'picomatch';
import { SUPPORTED_DOC_EXTENSIONS } from '../../constants/doc-extensions.ts';
diff --git a/packages/core/src/markdown/lint/config-files.ts b/packages/core/src/markdown/lint/config-files.ts
index 94b34dee1..312c9c74b 100644
--- a/packages/core/src/markdown/lint/config-files.ts
+++ b/packages/core/src/markdown/lint/config-files.ts
@@ -1,4 +1,3 @@
-
const MARKDOWNLINT_JSON_CONFIG_FILES: ReadonlySet<string> = new Set([
'.markdownlint.json',
'.markdownlint.jsonc',
diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.ts
index 7c54c0a73..cc667b93e 100644
--- a/packages/core/src/markdown/lint/config-schemas.ts
+++ b/packages/core/src/markdown/lint/config-schemas.ts
@@ -52,7 +52,6 @@ const fullPluginShape = Object.fromEntries(
LINT_PLUGINS.map((plugin) => [plugin.id, plugin.sliceSchema]),
) as z.ZodRawShape;
-
export const LinterConfigSchema = z.object({
enabled: z.boolean(),
plugins: z.object(fullPluginShape),
diff --git a/packages/core/src/markdown/lint/default-config.ts b/packages/core/src/markdown/lint/default-config.ts
index a51f2ffb0..d48eea5e4 100644
--- a/packages/core/src/markdown/lint/default-config.ts
+++ b/packages/core/src/markdown/lint/default-config.ts
@@ -6,7 +6,6 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSetting
MD013: false,
};
-
export function resolveMarkdownlintConfig(
rules: Record<string, MarkdownlintRuleSetting> | undefined,
): Configuration {
diff --git a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
index 9c9542661..ef478e268 100644
--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
@@ -1,4 +1,3 @@
-
import { CANONICAL_SCHEMA_DIALECT_URIS, DEFAULT_SCHEMA_DIALECT } from './frontmatter-validate.ts';
export interface FrontmatterFieldConstraint {
diff --git a/packages/core/src/markdown/lint/frontmatter-validate.ts b/packages/core/src/markdown/lint/frontmatter-validate.ts
index b0e7833fd..5f953d667 100644
--- a/packages/core/src/markdown/lint/frontmatter-validate.ts
+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts
@@ -1,4 +1,3 @@
-
import Ajv, { type ValidateFunction } from 'ajv';
import Ajv2019 from 'ajv/dist/2019.js';
import Ajv2020 from 'ajv/dist/2020.js';
diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.ts
index 26fbc2b22..781226a5d 100644
--- a/packages/core/src/markdown/lint/index.ts
+++ b/packages/core/src/markdown/lint/index.ts
@@ -1,4 +1,3 @@
-
import type { LintPluginFailureReporter } from './plugin-failure.ts';
import { isLintPluginSelected, LINT_PLUGINS, type LinterConfig } from './plugins.ts';
import type { LintDiagnostic } from './types.ts';
@@ -80,8 +79,7 @@ function renderErrorMessage(error: unknown, depth = 0): string {
try {
const json = JSON.stringify(error);
if (json !== undefined) return json;
- } catch {
- }
+ } catch {}
}
return String(error);
}
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
index f438f1b16..7a5af097e 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
@@ -1,4 +1,3 @@
-
import type { OkfRuleId } from '../okf-rule-meta.ts';
import { fileNameFor, OKF_SCHEMA_DIR, okfSchemaPathFor } from './paths.ts';
import { OKF_FRONTMATTER_REGISTRY } from './registry.ts';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
index c290b6878..1ee913527 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
@@ -1,4 +1,3 @@
-
import type { OkfRuleId } from '../okf-rule-meta.ts';
export const OKF_SCHEMA_DIR = '.ok/okf';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
index 53ecb619d..f325fbbb4 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
@@ -1,4 +1,3 @@
-
import { compileAppliesTo } from '../applies-to.ts';
import { validateFrontmatterSource } from '../frontmatter-validate.ts';
import {
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
index 89845d3d5..f1c37671b 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
@@ -1,4 +1,3 @@
-
// file-level form is deliberate: the sibling `biome-ignore` must sit on the line
// oxlint-disable unicorn/no-thenable
diff --git a/packages/core/src/markdown/lint/okf-project/rules.ts b/packages/core/src/markdown/lint/okf-project/rules.ts
index 8b476332e..6d691ae2b 100644
--- a/packages/core/src/markdown/lint/okf-project/rules.ts
+++ b/packages/core/src/markdown/lint/okf-project/rules.ts
@@ -1,4 +1,3 @@
-
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from '../okf-rule-meta.ts';
diff --git a/packages/core/src/markdown/lint/okf-rule-meta.ts b/packages/core/src/markdown/lint/okf-rule-meta.ts
index 44913a9dc..4de50d79f 100644
--- a/packages/core/src/markdown/lint/okf-rule-meta.ts
+++ b/packages/core/src/markdown/lint/okf-rule-meta.ts
@@ -1,4 +1,3 @@
-
export const OKF_RULE_IDS = [
'no-wiki-links',
'log-shape',
diff --git a/packages/core/src/markdown/lint/okf-rules.ts b/packages/core/src/markdown/lint/okf-rules.ts
index d0999b62e..1d5538421 100644
--- a/packages/core/src/markdown/lint/okf-rules.ts
+++ b/packages/core/src/markdown/lint/okf-rules.ts
@@ -1,4 +1,3 @@
-
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from './okf-rule-meta.ts';
import type { OkfRule } from './okf-runner.ts';
import { indexShape } from './rules/index-shape.ts';
diff --git a/packages/core/src/markdown/lint/okf-runner.ts b/packages/core/src/markdown/lint/okf-runner.ts
index fabb08d6e..de130e3f4 100644
--- a/packages/core/src/markdown/lint/okf-runner.ts
+++ b/packages/core/src/markdown/lint/okf-runner.ts
@@ -1,4 +1,3 @@
-
import type { Root } from 'mdast';
import remarkFrontmatter from 'remark-frontmatter';
import remarkGfm from 'remark-gfm';
diff --git a/packages/core/src/markdown/lint/plugin-failure.ts b/packages/core/src/markdown/lint/plugin-failure.ts
index 1cd0d2543..e7d694890 100644
--- a/packages/core/src/markdown/lint/plugin-failure.ts
+++ b/packages/core/src/markdown/lint/plugin-failure.ts
@@ -1,4 +1,3 @@
-
import type { LintPluginId } from './types.ts';
export interface LintPluginFailure {
diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.ts
index 1dae8316d..e7455ccf7 100644
--- a/packages/core/src/markdown/lint/plugins.ts
+++ b/packages/core/src/markdown/lint/plugins.ts
@@ -1,4 +1,3 @@
-
import { z } from 'zod';
import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';
import {
@@ -24,7 +23,6 @@ import {
type OkfSlice,
} from './types.ts';
-
const MarkdownlintRuleSettingSchema = z.union([
z.boolean(),
z.enum(MARKDOWNLINT_RULE_SEVERITIES),
diff --git a/packages/core/src/markdown/lint/rules/index-shape.ts b/packages/core/src/markdown/lint/rules/index-shape.ts
index fcbb1b56c..59fe9b87d 100644
--- a/packages/core/src/markdown/lint/rules/index-shape.ts
+++ b/packages/core/src/markdown/lint/rules/index-shape.ts
@@ -1,4 +1,3 @@
-
import type { List, ListItem } from 'mdast';
import { EXIT, visit } from 'unist-util-visit';
import { defineScopedOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/log-shape.ts b/packages/core/src/markdown/lint/rules/log-shape.ts
index 431e4e9c8..e0159519f 100644
--- a/packages/core/src/markdown/lint/rules/log-shape.ts
+++ b/packages/core/src/markdown/lint/rules/log-shape.ts
@@ -1,4 +1,3 @@
-
import type { Heading } from 'mdast';
import { toString as headingText } from 'mdast-util-to-string';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/lint/rules/no-wiki-links.ts b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
index f75a04d15..2123e977f 100644
--- a/packages/core/src/markdown/lint/rules/no-wiki-links.ts
+++ b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
@@ -1,4 +1,3 @@
-
import type { Point } from 'unist';
import { visit } from 'unist-util-visit';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/reserved-casing.ts b/packages/core/src/markdown/lint/rules/reserved-casing.ts
index c8b4d8f28..89ef3e4a9 100644
--- a/packages/core/src/markdown/lint/rules/reserved-casing.ts
+++ b/packages/core/src/markdown/lint/rules/reserved-casing.ts
@@ -1,4 +1,3 @@
-
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.ts
index 594830b88..2cffecae6 100644
--- a/packages/core/src/markdown/lint/types.ts
+++ b/packages/core/src/markdown/lint/types.ts
@@ -1,4 +1,3 @@
-
import type { BrokenLinkReason } from '../../schemas/api/agent-write.ts';
import type { OkfRuleId } from './okf-rule-meta.ts';
@@ -113,7 +112,6 @@ export interface OkfSlice {
generate?: { index?: boolean };
}
-
interface RuleOptionSpecBase {
key: string;
description: string;
diff --git a/packages/core/src/markdown/lint/validation-counts.ts b/packages/core/src/markdown/lint/validation-counts.ts
index 437cc539a..98238656e 100644
--- a/packages/core/src/markdown/lint/validation-counts.ts
+++ b/packages/core/src/markdown/lint/validation-counts.ts
@@ -1,4 +1,3 @@
-
export interface ValidationSourceCounts {
errorCount: number;
warningCount: number;
diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.ts
index bd79424c7..a5b511f25 100644
--- a/packages/core/src/markdown/math-promoter.ts
+++ b/packages/core/src/markdown/math-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Code, Root } from 'mdast';
import type { Math as MdastMath } from 'mdast-util-math';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.ts
index 00fbc0035..ed89371d0 100644
--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts
+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, ElementContent, Properties } from 'hast';
import type { FootnoteDefinition, FootnoteReference } from 'mdast';
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.ts
index df788a80d..8ce2b2492 100644
--- a/packages/core/src/markdown/mdast-to-html.ts
+++ b/packages/core/src/markdown/mdast-to-html.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root as HastRoot, Text as HastText } from 'hast';
import type { Root as MdastRoot, Text as MdastText } from 'mdast';
import type { Handler } from 'mdast-util-to-hast';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index fa3cfcd86..bfd7e3109 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.ts
index 17ed2b829..1a897fca8 100644
--- a/packages/core/src/markdown/mermaid-promoter.ts
+++ b/packages/core/src/markdown/mermaid-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Code, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.ts
index 4aa0490c4..d988f4b8b 100644
--- a/packages/core/src/markdown/parse-with-fallback.ts
+++ b/packages/core/src/markdown/parse-with-fallback.ts
@@ -168,7 +168,6 @@ export function parseRecursive(
}
}
-
interface VFilePlace {
offset?: number;
start?: { offset?: number };
@@ -187,7 +186,6 @@ function extractErrorOffset(err: unknown): number | undefined {
return undefined;
}
-
interface Region {
start: number;
end: number;
@@ -211,7 +209,6 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {
return null;
}
-
export interface TagEvent {
kind: 'open' | 'close' | 'self-close';
name: string;
@@ -358,7 +355,6 @@ function findFallbackRegion(src: string, errorOffset: number): Region {
return { start: blockStart, end: blockEnd };
}
-
interface SourceBlock {
src: string;
start: number;
@@ -456,7 +452,6 @@ function tryPerBlockFallback(
};
}
-
function wholeDocRawText(source: string): JSONContent {
return {
type: 'doc',
diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.ts
index 43d420187..e6ab4fd57 100644
--- a/packages/core/src/markdown/parser-drop-closure.ts
+++ b/packages/core/src/markdown/parser-drop-closure.ts
@@ -1,4 +1,3 @@
-
export type DroppedTokenAdjudication =
| {
kind: 'format-dof-axis';
diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.ts
index 55736041c..0e3224206 100644
--- a/packages/core/src/markdown/pipeline.ts
+++ b/packages/core/src/markdown/pipeline.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromProseMirror,
diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.ts
index ccf06e94d..91cdf658f 100644
--- a/packages/core/src/markdown/position-aware-join.ts
+++ b/packages/core/src/markdown/position-aware-join.ts
@@ -1,4 +1,3 @@
-
import type { Join } from 'mdast-util-to-markdown';
import type { Position } from 'unist';
import { isBlankLineParagraph } from './zero-emission-blocks.ts';
diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.ts
index e5b4c9eba..0f399d34c 100644
--- a/packages/core/src/markdown/position-slice.ts
+++ b/packages/core/src/markdown/position-slice.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Root } from 'mdast';
import { visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
@@ -477,8 +476,7 @@ export function applyPositionSliceToNode(
const first = source[startOff];
if (first !== '[' && first !== '<' && !node.title) {
node.data.sourceStyle = 'gfm-autolink';
- }
- else if (first === '[') {
+ } else if (first === '[') {
const slice = source.slice(startOff, endOff);
const closeBracketIdx = slice.lastIndexOf('](');
if (closeBracketIdx !== -1) {
diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
index ca225ce9b..db10fa54b 100644
--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, Root, Text } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
index 3a2524a9a..34068d103 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
index 2279a0189..93151d43b 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
index a0f467c42..188f02d83 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
index 4e8542a21..4ba2c3418 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
index a3c96b24a..1a74b1272 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
index e95cf43d6..de35e7b79 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
index ffdb4d5b5..b4be1b2ea 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
index e2a96d1a7..3c8d88b7c 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.ts
index 0389575ac..cf2c9da8e 100644
--- a/packages/core/src/markdown/resolve-image-url.ts
+++ b/packages/core/src/markdown/resolve-image-url.ts
@@ -1,4 +1,3 @@
-
import { isRelativeUrl } from './safe-url.ts';
function isDevDiagnosticContext(): boolean {
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 8be632ba4..4d3250d3a 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,4 +1,3 @@
-
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');
diff --git a/packages/core/src/markdown/serialize-fidelity.test-helper.ts b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
index 96304e7a5..0dd54070e 100644
--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts
+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
@@ -1,4 +1,3 @@
-
import type { JSONContent } from '@tiptap/core';
import type { Nodes } from 'mdast';
import { expect } from 'vitest';
diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.ts
index 93798cf83..7cac5b042 100644
--- a/packages/core/src/markdown/serialize-helpers.ts
+++ b/packages/core/src/markdown/serialize-helpers.ts
@@ -1,4 +1,3 @@
-
import type { Node as PmNode } from '@tiptap/pm/model';
import type {
MdxJsxAttribute,
diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.ts
index 8c08b7a04..b012a5aff 100644
--- a/packages/core/src/markdown/single-dollar-math-promoter.ts
+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts
@@ -1,4 +1,3 @@
-
import type { PhrasingContent, Root, Text } from 'mdast';
import type { InlineMath } from 'mdast-util-math';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.ts
index 83d4af672..b50bea5ec 100644
--- a/packages/core/src/markdown/to-markdown-handlers.ts
+++ b/packages/core/src/markdown/to-markdown-handlers.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parents } from 'mdast';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { Handle, Info, State } from 'mdast-util-to-markdown';
diff --git a/packages/core/src/markdown/underline-promoter.ts b/packages/core/src/markdown/underline-promoter.ts
index 6e6d73400..0f1b0f27d 100644
--- a/packages/core/src/markdown/underline-promoter.ts
+++ b/packages/core/src/markdown/underline-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, Root } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.ts
index 932d7d2a8..1a082bda7 100644
--- a/packages/core/src/markdown/unknown-mdast-guard.ts
+++ b/packages/core/src/markdown/unknown-mdast-guard.ts
@@ -1,4 +1,3 @@
-
import type { Root as MdastRoot } from 'mdast';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.ts
index ac9f5239b..d578476a7 100644
--- a/packages/core/src/markdown/whitespace-char-ref.ts
+++ b/packages/core/src/markdown/whitespace-char-ref.ts
@@ -1,4 +1,3 @@
-
const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([
[0x20, ' '],
[0x09, '\t'],
diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.ts
index afd9936fe..6dad26200 100644
--- a/packages/core/src/markdown/wiki-link-micromark.ts
+++ b/packages/core/src/markdown/wiki-link-micromark.ts
@@ -17,7 +17,6 @@ declare module 'micromark-util-types' {
}
}
-
const CODE_BANG = 33; // !
const CODE_LBRACKET = 91; // [
const CODE_RBRACKET = 93; // ]
@@ -261,7 +260,6 @@ export function wikiLinkSyntax(): Extension {
};
}
-
function enterWikiLink(this: CompileContext, token: Token) {
this.enter(
{
@@ -387,7 +385,6 @@ export const wikiLinkToMarkdown: {
unsafe: [{ character: '[', inConstruct: ['phrasing'] }],
};
-
const MICROMARK_EXT = wikiLinkSyntax();
export function remarkWikiLink(this: Processor) {