Skip to content

Enter an editor send on its own line, reveal the Stata pane on active-terminal sends, and copy unloaded rows whole with the latest copy winning - #425

Merged
jbearak merged 5 commits into
mainfrom
t3/fix-console-data-browser
Nov 19, 2026

Conversation

@jbearak

@jbearak jbearak commented Nov 19, 2026

Copy link
Copy Markdown
Owner

A cold review of #416 and #421 found that both introduced bugs in the console and the Data Browser. In the console, a send from the editor could be glued onto whatever the user was typing. In the Data Browser, copying could put incomplete data on the clipboard and report success, a slower copy could overwrite a newer one, and a large row selection was expanded into an index array on every render. This PR fixes the five regressions (part A). The bugs that predate those PRs are in a stacked follow-up (part B).

Fixed

Proof: each fix has a test that fails on origin/main and passes here. Item 3: four session.test.ts cases. Item 14: the show call in the active-terminal pane test. Items 6/8/13: copy-selection.test.ts, which doesn't load on main because the API it tests is new, and two host cases plus a Copy Column case in browser-panel.test.ts. Item 3 against real Stata 18 on macOS, driving the console session's editor-send path:

origin/main:  . di 9display "held send ran"
              9display invalid name
              r(198);
this branch:  [2.7s] editor send made at --more--
              [3.2s] answered --more--, typed "di 9" without Enter
              [3.3s] held send reported sent=true      (Stata ran `display "held send ran"`)
              [3.8s] input line after the held send: ". di 9"
              [3.9s] Enter on the restored line ran "di 9"

On that Mac, the console unit and integration tests and send-to-stata-integrated-terminal.test.ts passed: 275 pass, 0 fail. These tests use the fake Stata. A live sight console session there with set more on, sysuse auto, clear and list make price reached --more--. Space paged, q gave --Break-- / r(1);, the prompt returned, and di 6*7 printed 42. Run separately on this branch: check:line-endings, typecheck, bun test ./tests (10,174 pass, 15 skip, 0 fail), lint, test:ci and package all pass. The Data Browser changes are tested at module level and through the host messages. They have not been run by hand in a VS Code webview.

Created with Claude Opus 5.5 in Claude Code.

…e user was typing

A send held at --more-- was inserted at the cursor of the user's
unfinished input, so typing "di 9" before the prompt returned made
Stata run "di 9do file.do" and cleared the input. The console now sets
the typed text aside, enters the send alone, and puts the text back.
A line the user enters while sends wait still goes at once (typeahead),
so it runs first and can answer prompts the console doesn't know.
Routing the active-terminal commands through the pane's queue dropped
the terminal.show(true) the sendText path made. The routing now lives
in one helper, send_to_active_terminal, which shows the pane (keeping
editor focus) before queueing.
…n the Data Browser

- A copy whose selection includes rows the grid hasn't loaded reads them
  from the host first (in the order shown, strLs complete), and fails
  with a message, clipboard untouched, if they can't be read or the
  order changes meanwhile. It used to copy them as empty and report
  success.
- Every copy event bumps a sequence; an earlier copy still fetching
  posts nothing, and Copy Column's late write yields to a later copy.
- The selection stays a CompactSelection until copied, and a copy over
  1,000,000 cells fails with a message instead of expanding.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 87 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 5b86193d-4272-455b-9947-6059db683df2
Commits

Reviewing files that changed from the base of the PR and between 1c22bfb and 08c4ebd.

Files selected for processing: 15

  • client/src/data-browser/browser-panel.ts
  • client/src/data-browser/types.ts
  • client/src/data-browser/webview/app.tsx
  • client/src/data-browser/webview/copy-selection.ts
  • client/src/data-browser/webview/use-row-loader.ts
  • client/src/send-to-stata/commands.ts
  • client/src/send-to-stata/stata-terminal-manager.ts
  • docs/data-browser.md
  • docs/send-to-stata.md
  • src/console/session.ts
  • tests/integration/send-to-stata-integrated-terminal.test.ts
  • tests/unit/console/session.test.ts
  • tests/unit/data-browser/browser-panel.test.ts
  • tests/unit/data-browser/copy-selection.test.ts
  • tests/unit/data-browser/restore-cancel.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@jbearak
jbearak merged commit f0f129a into main Nov 19, 2026
16 checks passed
@jbearak
jbearak deleted the t3/fix-console-data-browser branch November 19, 2026 16:07
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