Skip to content

Either side of the diff, onto the clipboard — and the .har that crashed it - #59

Merged
mindaugaskasp merged 1 commit into
mainfrom
feat/copy-side-and-har-detection
Aug 14, 2026
Merged

Either side of the diff, onto the clipboard — and the .har that crashed it#59
mindaugaskasp merged 1 commit into
mainfrom
feat/copy-side-and-har-detection

Conversation

@mindaugaskasp

Copy link
Copy Markdown
Owner

Copy either side

Copying a side is not copying the diff. Each file slot now carries a copy control that puts that file's own text on the clipboard verbatim — reachable from the slot, Edit ▸ Copy Left/Right Side, the palette, and Cmd/Ctrl+Shift+1 / +2 (Shift over the digit that opens that side). Paste mode reads the typed buffers.

A side with no text to give — a spreadsheet carries sheets, a streamed file only a path — shows no control at all rather than one that refuses. utils/sideText.js answers that once for both the button and the action, so no surface can offer what another declines.

Two files sat at their exact ratchets and forced the extraction rather than a raised cap:

before after
diffStore.js 747 / 747 710 — copy actions → stores/diffCopy.js
buildMenus 87 / 87 67 — Edit section → editSection()

The .har crash — three faults

Reproduced in e2e/deep-html.spec.mjs (red → green):

  1. .har was in no extension map, so it fell through to content sniffing.
  2. Sniffing sees a 50k prefix, which cuts a multi-MB capture into JSON that no longer parses. HTML_RE then matched the <div>/<script> inside the captured response bodies and named the whole file HTML.
  3. Monaco's HTML worker walks document symbols by plain recursion with no depth guard, and every tag inside a JSON string is unclosed to an HTML parser — the nesting accumulated until the stack went.

Fixed: har/map/webmanifest resolve to json outright; the two sniffers that scan anywhere skip JSON-shaped text; documentSymbols is off for HTML, which removes the crash surface for any deeply nested HTML rather than this one route. Nothing here consumes symbols.

detectLanguage.js was itself at 250/250, so the claude.ai link helpers — never language detection — moved to utils/claudeLink.js.

The theme check, and the instrument that was wrong

The all-20 check for the new control lives in e2e, not theme-sweep: every surface there opens through paste mode, which replaces the slots row, and the control exists only once a real file is loaded.

It caught .btn-icon's --text-dim falling under the 3:1 mark floor on five light grounds — sepia 2.09, solar 2.37, bloom 2.58, linen 2.72, meridian 2.91 — so the revealed state takes full ink.

The first run of that probe was itself wrong: .btn transitions colour over 120ms and getComputedStyle reports the interpolated value, so it measured a colour no one ever sees and named the wrong themes. It now settles before measuring and carries a control probe that fails the instrument, not the theme, when a reading is impossible.

Verified

  • npm run check exit 0 — 3498 tests, re-run after rebasing onto main
  • Full e2e in Docker — 518 passed, 3 skipped
  • make theme-sweep — 1480 measurements across 20 themes
  • The spreadsheet guard proven red→green by deliberately breaking the rule

Not verified: the raw Cmd+Shift+1/2 keypress — CDP-injected keys never reach a native accelerator, so the spec drives the menu item and the binding rests on the unit-level shortcut guard.

🤖 Generated with Claude Code

…ed it

Copying a SIDE is not copying the diff: each slot now carries a copy control
that puts that file's own text on the clipboard verbatim, reachable from the
slot, Edit ▸ Copy Left/Right Side, the palette and CmdOrCtrl+Shift+1/2 —
Shift over the digit that OPENS that side.

A side with no text to give — a spreadsheet carries sheets, a streamed file
only a path — shows no control at all rather than one that refuses. utils/
sideText.js answers that once for both the button and the action, so no
surface can offer what another declines.

Two files sat at their exact ratchets and forced the extraction rather than a
raised cap: diffStore (747/747) hands its copy actions to stores/diffCopy.js,
the way snippetStore already hands off tags, colour and history; buildMenus
(87/87) hands its Edit section to editSection(). Both ratchets TIGHTEN —
747→710 and 87→67.

The crash a .har produced took three faults, and all three are fixed:

  - .har was in no extension map, so it fell through to content sniffing.
  - Sniffing sees a 50k prefix, which cuts a multi-MB capture into JSON that
    no longer parses; HTML_RE then matched the <div>/<script> inside the
    captured response bodies and named the whole file HTML.
  - Monaco's HTML worker walks document symbols by plain recursion with no
    depth guard, and every tag inside a JSON string is unclosed to an HTML
    parser, so the nesting accumulated until the stack went.

har/map/webmanifest now resolve to json outright; the two sniffers that scan
anywhere skip JSON-shaped text; and documentSymbols is off for HTML, which
removes the crash surface for ANY deeply nested HTML rather than this one
route. Nothing here consumes symbols — no outline, no breadcrumbs, and the
palette that would offer Go to Symbol is already unbound.

detectLanguage.js was itself at 250/250, so the claude.ai link helpers — never
language detection — moved to utils/claudeLink.js.

The all-20 theme check for the new control lives in e2e, not theme-sweep:
every surface there opens through paste mode, which replaces the slots row,
and the control exists only once a real file is loaded. It caught .btn-icon's
--text-dim falling under the 3:1 mark floor on five light grounds (sepia 2.09,
solar 2.37, bloom 2.58, linen 2.72, meridian 2.91), so the revealed state
takes full ink. The first run of that probe was itself wrong — .btn transitions
colour over 120ms and getComputedStyle reports the interpolated value — so it
settles before measuring and carries a control probe that fails the
INSTRUMENT, not the theme, when the reading is impossible.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mindaugaskasp
mindaugaskasp merged commit 5ff36be into main Aug 14, 2026
6 checks passed
@mindaugaskasp
mindaugaskasp deleted the feat/copy-side-and-har-detection branch August 14, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant