Skip to content

test(selection): make the held-buffer terminal cases survive a stale swap file and catch an overflow - #496

Merged
ThomasK33 merged 1 commit into
mainfrom
test/selection-held-unique-names
Nov 11, 2026
Merged

ThomasK33 merged 1 commit into
mainfrom
test/selection-held-unique-names

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Two gaps in the real-Neovim cases of #493

#493 added three cases to tests/integration/selection_held_spec.lua that make a buffer look like the Claude terminal. The verifier of #493 found two gaps in them. Both are in the test only. No lua/ code changes.

  1. A stale swap file fails the cases with E325. Each case renames a buffer to the fixed name term://x//1:claude. Neovim opens a swap file under the new name at the rename. If a Neovim that a timeout killed left a swap file with that name, or if concurrent runs share one HOME, the rename raises E325: ATTENTION and the case fails for a reason that has nothing to do with the plugin. The new helper rename_to_claude_terminal(buf) sets swapfile = false on the buffer before the rename, so no swap file exists under that name.
  2. The "demotion is pending" case did not check v:errmsg. It asserted only that nothing was broadcast, so it passed on code that overflows the stack at that point. It now clears v:errmsg before the edit and asserts that it is still empty afterwards, as the first of the three cases does.

Proof

  • Real Neovim, with a stale swap file term:%%x%%1:claude.swp in $XDG_STATE_HOME/nvim/swap (left by a Neovim that I killed with SIGKILL after it renamed a modified buffer):
    • Spec from main (before this PR), 0.12.3: the three cases fail with E325.
    • Spec from this PR, with the same swap file: 14 of 14 pass on Neovim 0.12.3 and on v0.8.0.
  • With the selection.lua from before fix(selection): send no terminal cursor and do not recurse when the held buffer becomes a Claude terminal #493 (5faad5b), the spec of this PR fails 3 cases, including the "demotion is pending" case. The spec from main fails only the other 2 on that code.
  • mise run format-check and mise run check are clean. mise run test: 1396 successes, 0 failures (seed 1794381885).

Generated with xum • Model: anthropic:claude-sonnet-5-5 • Thinking: xhigh

…nal name, check v:errmsg when a demotion is pending

The three real-Neovim cases that rename a buffer to the fixed name term://x//1:claude failed with E325 when a swap
file with that name was left behind (a Neovim that a timeout killed, or a HOME that concurrent runs share). The
buffer now gets no swap file before the rename.

The case with a pending demotion did not check v:errmsg, so it passed on code that overflows the stack there. It
asserts that v:errmsg stays empty, as the first case does.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-sonnet-5-5` • Thinking: `xhigh`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T07:29:25.694846Z 2c347fa Manual request
🔒 Security Review ✅ Completed 2026-11-11T07:29:48.067028Z 2c347fa Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 2c347fa89a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2c347fa89a

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit e5c5ddb Nov 11, 2026
6 checks passed
@ThomasK33
ThomasK33 deleted the test/selection-held-unique-names branch November 11, 2026 09:11
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