Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(ok): stop false sidebar ellipses at fractional zoom (PRD-8297) (#3904)
Dimitri POSTOLOVec64d0daf1c5
diff --git a/.changeset/file-tree-fractional-zoom.md b/.changeset/file-tree-fractional-zoom.mdnew file mode 100644index 000000000..93511c997--- /dev/null+++ b/.changeset/file-tree-fractional-zoom.md@@ -0,0 +1,5 @@+---+"@inkeep/open-knowledge": patch+---++File and folder names that fit in the sidebar no longer show a truncation ellipsis at fractional zoom levels like 83% or 90%. The file tree decided a name was truncated by measuring its height against a single line, and at those zoom levels the browser rounded a one-line name a fraction of a pixel past that threshold, so names with room to spare picked up an ellipsis anyway. Names that genuinely run past the edge still show theirs.diff --git a/packages/app/package.json b/packages/app/package.jsonindex a82d5a079..423b93f5b 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/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/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/components/FileTree.tsx b/packages/app/src/components/FileTree.tsxindex bb272f655..0d44ab97f 100644--- a/packages/app/src/components/FileTree.tsx+++ b/packages/app/src/components/FileTree.tsx@@ -79,16 +79,8 @@ import {treePathToAppPath,uploadedPathForSidebarDrop,} from '@/components/file-tree-adapter';-import {- createFileTreeStyle,- FILE_TREE_DENSITY_OPTIONS,- FILE_TREE_INDENT_GUIDE_CSS,- FILE_TREE_STICKY_HEADER_CSS,-} from '@/components/file-tree-density';-import {- applyExtensionBadges,- FILE_TREE_EXT_BADGE_CSS,-} from '@/components/file-tree-extension-badge';+import { createFileTreeStyle, FILE_TREE_DENSITY_OPTIONS } from '@/components/file-tree-density';+import { applyExtensionBadges } from '@/components/file-tree-extension-badge';import {AGENT_DECORATION_ICON_ID,EXCALIDRAW_FILE_ICON_ID,@@ -145,7 +137,7 @@ import {resolveFileTreeSelection,resolveFileTreeSelectionAction,} from '@/components/file-tree-selection';-import { FILE_TREE_USER_NAME_DIRECTION_CSS } from '@/components/file-tree-shared';+import { OK_FILE_TREE_READONLY_UNSAFE_CSS } from '@/components/file-tree-shared';import { selectTrashConfirmCopy, trashTargetDisplayName } from '@/components/file-tree-trash-copy';import {classifyEmptyTree,@@ -436,12 +428,14 @@ const FILE_TREE_CREATION_CLEARED_CSS = `}`;-// Pierre's per-extension icon color (specificity 0,1,0 on the inner [data-icon-token]-// element) wins over the inherited selected-fg color from the parent row, so the-// markdown icon stays gray when its row is selected. The full styling block lives-// alongside the badge-injection processor in file-tree-extension-badge.ts so the-// CSS + DOM-mutation contract stays in one place.-const FILE_TREE_UNSAFE_CSS = `${FILE_TREE_EXT_BADGE_CSS}\n${FILE_TREE_PROBLEM_CSS}\n${FILE_TREE_RENAME_INPUT_CSS}\n${FILE_TREE_ROOT_DROP_CSS}\n${FILE_TREE_EXTERNAL_FILE_DROP_CSS}\n${FILE_TREE_CREATION_CLEARED_CSS}\n${FILE_TREE_INDENT_GUIDE_CSS}\n${FILE_TREE_STICKY_HEADER_CSS}\n${FILE_TREE_USER_NAME_DIRECTION_CSS}`;+const FILE_TREE_UNSAFE_CSS = [+ OK_FILE_TREE_READONLY_UNSAFE_CSS,+ FILE_TREE_PROBLEM_CSS,+ FILE_TREE_RENAME_INPUT_CSS,+ FILE_TREE_ROOT_DROP_CSS,+ FILE_TREE_EXTERNAL_FILE_DROP_CSS,+ FILE_TREE_CREATION_CLEARED_CSS,+].join('\n');interface PendingCreate {kind: 'file' | 'folder';diff --git a/packages/app/src/components/file-tree-extension-badge.ts b/packages/app/src/components/file-tree-extension-badge.tsindex 0720a4d35..ff9355e52 100644--- a/packages/app/src/components/file-tree-extension-badge.ts+++ b/packages/app/src/components/file-tree-extension-badge.ts@@ -27,8 +27,9 @@ export const OK_EXT_ROW_ATTR = 'data-ok-ext-row';export const OK_FULLNAME_ROW_ATTR = 'data-ok-fullname-row';/**- * CSS rules that apply inside Pierre's shadow root. Passed alongside the- * other `FILE_TREE_UNSAFE_CSS` rules in `FileTree.tsx`.+ * CSS rules that apply inside Pierre's shadow root. They reach it through+ * `OK_FILE_TREE_READONLY_UNSAFE_CSS` (`file-tree-shared.ts`), which both the+ * Files and Skills trees compose their `unsafeCSS` from.** - Hide the extension `[data-truncate-segment-priority]:last-child` for* rows the JS pass has classified as extension-bearing. CSS cannotdiff --git a/packages/app/src/components/file-tree-shared.test.ts b/packages/app/src/components/file-tree-shared.test.tsindex 483f1b2ee..76fe1b288 100644--- a/packages/app/src/components/file-tree-shared.test.ts+++ b/packages/app/src/components/file-tree-shared.test.ts@@ -8,6 +8,7 @@import { describe, expect, test } from 'vitest';import {buildOkFileTreeOptions,+ FILE_TREE_FRACTIONAL_ZOOM_TRUNCATION_GUARD_CSS,FILE_TREE_USER_NAME_DIRECTION_CSS,lucideMaskDataUri,MARKDOWN_FILE_ICON_ID,@@ -24,12 +25,16 @@ describe('buildOkFileTreeOptions', () => {test('the read-only base gives every row its own writing direction', () => {// File names are the user's own words, and the tree renders them inside a- // third-party shadow root that inherits the chrome's direction. The main- // tree composes its own `unsafeCSS`, so it carries this separately — the- // real-browser check for that one lives in `user-text-direction.e2e.ts`.+ // third-party shadow root that inherits the chrome's direction. Both trees+ // inherit this base; the real-browser check lives in `user-text-direction.e2e.ts`.expect(OK_FILE_TREE_READONLY_UNSAFE_CSS).toContain(FILE_TREE_USER_NAME_DIRECTION_CSS);});+ test('the read-only base suppresses fractional-zoom false truncation', () => {+ const opts = buildOkFileTreeOptions({ paths: [] });+ expect(opts.unsafeCSS).toContain(FILE_TREE_FRACTIONAL_ZOOM_TRUNCATION_GUARD_CSS);+ });+test('unsafeCSS override wins (the editable main tree passes its full composition)', () => {const full = `${OK_FILE_TREE_READONLY_UNSAFE_CSS}\n/* rename + drop */`;const opts = buildOkFileTreeOptions({ paths: [], unsafeCSS: full });diff --git a/packages/app/src/components/file-tree-shared.ts b/packages/app/src/components/file-tree-shared.tsindex ece437574..eae1f2eea 100644--- a/packages/app/src/components/file-tree-shared.ts+++ b/packages/app/src/components/file-tree-shared.ts@@ -3,12 +3,12 @@** The skills bundle-file tree (`SkillsSidebarSection.tsx`) renders through* `<OkFileTree>` (which mounts Pierre + the generic decoration observers). This- * module holds the reusable pieces — the ones the main Files tree (`FileTree.tsx`,- * still on its own inline Pierre mount) also needs when it migrates onto- * `<OkFileTree>`: the custom markdown glyph sprite, the generic- * lucide-sprite helpers, the read-only `unsafeCSS` base (colored-icon color- * rule + indent guides + sticky headers + extension badges), and the- * `useFileTree` options builder that produces the generic option slice.+ * module holds the reusable pieces. The read-only `unsafeCSS` base (see+ * `OK_FILE_TREE_READONLY_UNSAFE_CSS` below) is already shared by both trees. The+ * custom markdown glyph sprite, the generic lucide-sprite helpers, and the+ * `useFileTree` options builder that produces the generic option slice are what+ * the main Files tree (`FileTree.tsx`, still on its own inline Pierre mount)+ * picks up when it migrates onto `<OkFileTree>`.** Kept free of React and Lingui macros (like `file-tree-density.ts`) so it stays* unit-testable without pulling in the editor build graph.@@ -99,13 +99,41 @@ export const FILE_TREE_USER_NAME_DIRECTION_CSS = `}`;+/**+ * Pierre paints the marker from `@container measure (height > 1lh)` against a+ * size container on `[data-truncate-marker-cell]`. Blink can round a fitting+ * line just above `1lh` at fractional zoom, while real overflow wraps the+ * measured copy to at least `2lh`, so `1.5lh` separates the two cases.+ *+ * Re-declare Pierre's own `opacity` lever rather than reaching for a different+ * property: the guard stays a same-property override of the base rule and+ * degrades to a dead selector if that rule goes away. This works around+ * pierrecomputer/pierre#816. An unmerged upstream rewrite,+ * pierrecomputer/pierre#939, would replace the private marker mechanism with+ * native text overflow; if a version of it ships, delete this guard rather+ * than re-tuning its threshold.+ */+export const FILE_TREE_FRACTIONAL_ZOOM_TRUNCATION_GUARD_CSS = `+ @container measure (height <= 1.5lh) {+ [data-truncate-marker] {+ opacity: 0;+ }+ }+`;+/*** The read-only-safe `unsafeCSS` base: colored-icon selected-fg rule + extension- * badges + indent guides + sticky headers + per-name writing direction. This is- * everything a NON-editing tree needs. The main tree extends this with its- * rename / drop / creation CSS.+ * badges + indent guides + sticky headers + per-name writing direction + the+ * fractional-zoom truncation guard. This is everything a NON-editing tree+ * needs. The main tree extends this with its own editing and validation CSS.*/-export const OK_FILE_TREE_READONLY_UNSAFE_CSS = `${FILE_TREE_EXT_BADGE_CSS}\n${FILE_TREE_INDENT_GUIDE_CSS}\n${FILE_TREE_STICKY_HEADER_CSS}\n${FILE_TREE_USER_NAME_DIRECTION_CSS}`;+export const OK_FILE_TREE_READONLY_UNSAFE_CSS = [+ FILE_TREE_EXT_BADGE_CSS,+ FILE_TREE_INDENT_GUIDE_CSS,+ FILE_TREE_STICKY_HEADER_CSS,+ FILE_TREE_USER_NAME_DIRECTION_CSS,+ FILE_TREE_FRACTIONAL_ZOOM_TRUNCATION_GUARD_CSS,+].join('\n');export interface OkFileTreeOptionsInput {readonly paths: readonly string[];diff --git a/packages/app/tests/stress/file-tree-fractional-zoom.e2e.ts b/packages/app/tests/stress/file-tree-fractional-zoom.e2e.tsnew file mode 100644index 000000000..caf5c28c4--- /dev/null+++ b/packages/app/tests/stress/file-tree-fractional-zoom.e2e.ts@@ -0,0 +1,66 @@+/**+ * Pierre infers overflow from a hidden wrapping copy inside a CSS size+ * container. Only a real browser exposes the fractional layout-unit rounding+ * that can push a fitting one-line name above the marker threshold. CSS zoom+ * is a proxy for page zoom here because both feed Blink's effective zoom and+ * the same 1/64px layout-unit snapping, while Playwright has no page-zoom API.+ */+import type { Locator } from '@playwright/test';+import { expect, test } from './_helpers';++const FITTING_PATH = 'README.md';+const OVERFLOWING_PATH =+ 'this-document-name-is-deliberately-long-enough-to-overflow-the-sidebar-file-tree.md';+// Electron maps zoom level to `1.2 ** level`, and the desktop View menu steps+// levels by 0.5. The defect was first found while sweeping levels 0 to -2, so+// the negative half replays that range and the positive half is its+// reflection; browser presets set the union's outer bounds. Neighbours are not+// equivalent for sub-pixel rounding.+const DESKTOP_ZOOM_FACTORS = [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2].map((level) => 1.2 ** level);+const BROWSER_ZOOM_FACTORS = [0.25, 1 / 3, 0.5, 2 / 3, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2];+const ZOOM_FACTORS = [...new Set([...DESKTOP_ZOOM_FACTORS, ...BROWSER_ZOOM_FACTORS])].sort(+ (a, b) => a - b,+);++async function sampleMarkerOpacities(tree: Locator, zoomFactor: number): Promise<number[]> {+ return tree.evaluate(+ async (host, { itemPaths, zoom }) => {+ document.documentElement.style.zoom = String(zoom);+ // Let Blink settle both zoom-driven layout and its container queries.+ await new Promise<void>((resolve) =>+ requestAnimationFrame(() => requestAnimationFrame(resolve)),+ );++ return itemPaths.map((itemPath) => {+ const row = host.shadowRoot?.querySelector(`[data-item-path="${itemPath}"]`);+ const marker = row?.querySelector<HTMLElement>('[data-truncate-marker]');+ if (!marker) throw new Error(`Missing truncation marker for ${itemPath}`);+ return Number.parseFloat(getComputedStyle(marker).opacity);+ });+ },+ { itemPaths: [FITTING_PATH, OVERFLOWING_PATH], zoom: zoomFactor },+ );+}++test('fractional zoom marks only file names that actually overflow', async ({ page, api }) => {+ await api.seedDocs([+ { name: 'README', markdown: '# README\n' },+ { name: OVERFLOWING_PATH, markdown: '# Overflowing name\n' },+ ]);+ await page.goto('/');++ const tree = page.locator('file-tree-container');+ await expect(tree.getByRole('treeitem', { name: FITTING_PATH, exact: true })).toBeVisible();+ await expect(tree.getByRole('treeitem', { name: OVERFLOWING_PATH, exact: true })).toBeVisible();++ const falsePositiveFactors: number[] = [];+ const missingOverflowFactors: number[] = [];+ for (const zoomFactor of ZOOM_FACTORS) {+ const [fittingOpacity, overflowingOpacity] = await sampleMarkerOpacities(tree, zoomFactor);+ if (fittingOpacity > 0) falsePositiveFactors.push(zoomFactor);+ if (overflowingOpacity === 0) missingOverflowFactors.push(zoomFactor);+ }++ expect(falsePositiveFactors, 'fitting names must not show a truncation marker').toEqual([]);+ expect(missingOverflowFactors, 'overflowing names must keep their truncation marker').toEqual([]);+});