Skip to content

Send only the cursor's statement under #delimit ;, and run the release build's tests the way CI does - #420

Merged
jbearak merged 3 commits into
mainfrom
t3/send-delimit-statement-and-release-tests
Nov 19, 2026
Merged

jbearak merged 3 commits into
mainfrom
t3/send-delimit-statement-and-release-tests

Conversation

@jbearak

@jbearak jbearak commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Under #delimit ;, Send Statement could run a neighbouring statement the user didn't ask for. With display on one line and 1; clear; on the next, Send Statement on display also ran clear;. v0.15.1 didn't. Separately, the release build ran its tests in one process, which can hang or throw EBADF on the Bun version CI pins. This is part 1 of 2 from a review of v0.15.1..main before a stable release. Part 2 covers the Data Browser, the CLI, and the Stata pane.

1. Send Statement under #delimit ;

The detector worked in whole lines, so it sent every statement on the first and last lines of the cursor's statement. It now reads each ; statement's character range. Send Statement sends the statements that start on the cursor's line, or the one passing through it if the line starts none, and cuts the lines it shares with other statements:

  • display / 1; clear;, cursor on display: sends display / 1;. The cursor stays on line 2, so the next Send Statement sends clear;. Stepping through runs each statement once.
  • foreach v in a b {; … }; clear;, cursor on the header: sends the block through };. On the closer line, it sends clear;. A }; with nothing after it still sends the block.
  • clear; display / 1;, cursor on 1;: sends display / 1;, not clear;.
  • No change for one statement per line, for several whole statements on the cursor's line (di 1; di 2;), for a comment after the last ;, or for #delimit cr code.
  • Send Upward Lines ends where the cursor's statement ends, and Send Downward Lines starts where it starts. Every cut falls between two ; statements, so neither splits a statement or a block (Send Upward and Downward Lines no longer cut a block in half #377).

docs/send-to-stata.md describes this. Decision for review: a block's closer starts no statement, so on }; clear; Send Statement sends clear;, not the block. Without that, stepping from the header would run the block twice.

2. Release build tests

release-build.yml ran bun test ./tests in one process. ci.yml explains why helper-pty.test.ts has to run on its own on Bun 1.3.13 (#380). Both workflows now run bun run test:ci, a new package.json script that splits the run as CI did, including src/providers/__tests__. A test checks that the two workflows run the same command. bun test ./tests still works locally, and DEVELOPMENT.md mentions test:ci. PR checks don't run release-build.yml, so this step runs for real only on the next release.

9. Faster sends on long files

Each send lexed and parsed the whole document, about 130 ms on a 50,000-line file even to send a selection. The reading is now cached per document version, so later sends from the same version take under 0.1 ms.

Proof: 16 cases in tests/unit/send-to-stata/semicolon-shared-lines.test.ts fail on main. One is a property test, which fails on main with a counterexample: for random layouts of di N; statements across lines, each line sends exactly the statements it starts, or else the one through it. A second property checks that stepping runs each statement once. The workflow test in binary-command-name.test.ts and the cache test in code-to-send.test.ts also fail on main. check:line-endings, typecheck, bun test ./tests (10,029 pass, 0 fail), lint and bun run test:ci each pass when run separately on this branch. bun run package builds the extension.

Created with Claude Opus 5.5 in Claude Code.

@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 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 86 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: e7547396-828e-4c5f-81a5-77cba014a227
Commits

Reviewing files that changed from the base of the PR and between b8819dc and 66fbfd8.

Files selected for processing: 9

  • .github/workflows/ci.yml
  • .github/workflows/release-build.yml
  • DEVELOPMENT.md
  • client/src/send-to-stata/statement-detector.ts
  • docs/send-to-stata.md
  • package.json
  • tests/unit/binary-command-name.test.ts
  • tests/unit/send-to-stata/code-to-send.test.ts
  • tests/unit/send-to-stata/semicolon-shared-lines.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@jbearak
jbearak force-pushed the t3/send-delimit-statement-and-release-tests branch from 1eceeb6 to b15dc15 Compare November 19, 2026 14:50
jbearak and others added 3 commits November 19, 2026 09:50
… its first or last line

With display on one line and 1; clear; on the next, Send Statement on
display also ran clear;, and the same held for }; clear; after a block
and for code before a statement on its first line. The detector now
reads each ; statement's character range and sends the statements that
start on the cursor's line (or the one through it), cutting the lines
they share. When the last line holds the next statement, the cursor
stays there. Send Upward and Downward Lines end and start at the same
cuts.

Co-authored-by: Claude Opus 5.5 <[email protected]>
…e pinned Bun

release-build.yml ran bun test ./tests in one process, which on Bun
1.3.13 can hang or throw EBADF unless helper-pty.test.ts runs on its
own (#380). Both workflows now run bun run test:ci, a package.json
script that does that split, and a test checks they still match.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Each send lexed and parsed the whole document, which took about 130 ms
on a 50,000-line file even to send a selection. The reading is now
kept per document until its version changes.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@jbearak
jbearak force-pushed the t3/send-delimit-statement-and-release-tests branch from b15dc15 to 66fbfd8 Compare November 19, 2026 14:53
@jbearak
jbearak merged commit b6b1699 into main Nov 19, 2026
16 checks passed
@jbearak
jbearak deleted the t3/send-delimit-statement-and-release-tests branch November 19, 2026 15:01
jbearak added a commit that referenced this pull request Nov 19, 2026
… or repeats code, and send input from a data line as its whole block (#424)

* Send whole lines again under #delimit ; so Send Statement never skips or repeats code, and send input from a data line as its whole block

#420 cut #delimit ; lines at statement boundaries by character. That
skipped a one-line if/else chain sharing lines with other statements,
sent a command twice when a block comment after its ; ended on the next
line (and cut the comment in Send Upward Lines), sent a lone input data
row, and took seconds on a large block because widening searched every
statement for each block edge.

Sends take whole lines again, as before #420, with one cut: a line that
ends a statement begun above it and then holds whole statements of its
own (display / 1; clear;). A send from above ends at that statement's ;
and leaves the cursor on the line; Send Statement there sends the rest.
A * comment whose ; is on a later line counts as such a statement.
Anything else, such as a closer, a header, or a comment ending on the
line, keeps the line whole.

Fixed in the whole-line code too: a block's closer line that continues
onto the next line (}; di ///) now takes that line, and a line holding
one block's closer and another's header takes both blocks. Every line of
input through its end now sends the whole block.

A property test steps through generated #delimit ; and cr documents
and checks that the sends, lexed one by one, add up to the document's
tokens: each statement once, in order, no comment or string cut.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Don't cut a line after a statement whose comment line, not its code, starts above it

With // note on one line and di 1; di 2; on the next, Send Statement on
the second line sent only di 2;, since the statement di 1; counted as
begun at its comment. A cut now needs the statement's code to start on
an earlier line. The step-through property also generates a comment
line before a statement and a cr program whose body switches to
#delimit ;.

Co-authored-by: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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