Skip to content

Fix the open CodeRabbit findings from #47, #50, #72, #90 and the terminal gaps behind them; add a review skill - #97

Merged
Largo merged 9 commits into
masterfrom
claude/tender-pasteur-67de3v
Nov 4, 2026
Merged

Largo merged 9 commits into
masterfrom
claude/tender-pasteur-67de3v

Conversation

@Largo

@Largo Largo commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

A pass over CodeRabbit's reviews of PRs 17–95 found 95 findings, about 80% already addressed. This PR fixes the ones still open on master, each one reproduced first where that was possible, and the terminal gaps that came up while fixing #47. It also adds a project review skill built from what those findings caught.

Fixes for the open findings

Terminal gaps (on master too, all checked on a pty against CRuby)

Case Before Now, as CRuby
STDIN.read_nonblock(1), no input waited for input IO::EAGAINWaitReadable (:wait_readable with exception: false)
STDIN.raw(min: 0, time: 1) { STDIN.sysread(10) } System::NotSupportedException EOFError after 1 s
STDIN.close during STDIN.getch(min: 0, time: t) nil once VTIME runs out IOError at once
File.open("/dev/tty") (also IO.console): Thread#raise or close during getch waited out VTIME delivered at once

The changes behind the table:

  • DescriptorStream.Of finds the descriptor stream behind STDIN's console stream, for read_nonblock and syswrite.
  • The console input stream's Flush is now a no-op.
  • Closing the console input stream wakes its reader. fd 0 itself stays open, as before.
  • On Unix, a terminal device opened as a file is read and written through a DescriptorStream over the FileStream's descriptor. The FileStream still owns the handle and is disposed with it.

Review skill

.claude/skills/review/SKILL.md covers:

  • What to look for: the defect kinds CodeRabbit actually caught here. These include races with no GVL, waits that cannot be interrupted, native lifetimes, fast paths that ignore redefinition, mutation that bypasses Mutate, files run from the current directory, Windows and BSD differences, set -e pitfalls and generated files left stale.
  • How to prove each finding before reporting it: a concrete failure path, the pinned DLR revision, a CRuby comparison, a pty driver, and ruby/spec run on both base and head. CodeRabbit's three false alarms here all came from skipping that step.

It was tried once on this branch, which led to the Rational#** fix and the terminal gaps above. .gitignore still ignores the rest of .claude/.

Testing

  • ruby/spec:
    • Same results as master for spec/core/{string,rational,complex,float,integer}.
    • spec/core/io, spec/core/file, spec/library/io-wait and spec/library/stringio all pass: 3293 examples, 0 failures.
  • IO.console: class, tty?, fileno, winsize, echo?, raw, noecho, write, getch. Same output as CRuby.
  • A /dev/tty File: write, sync, path, stat.chardev?, gets of a typed line, close. Same output as CRuby.
  • irb on a pty evaluates and exits, as on master.
  • CRuby comparison scripts for Float#**, Rational#** and SetLength.
  • Markly navigation and a two-thread move/read stress run with markly 0.15.2. The race itself never reproduced, on this branch or on master.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW

ActivateScopedExtensions took the live list out of _loadedExtensions and
enumerated it after releasing ExtensionsLock. A concurrent LoadExtensions of the
same namespace appends to that list, and the enumeration could then throw
InvalidOperationException. The copy is taken under the lock; what a concurrent load
appends it adds itself, since the namespace is scoped by then. (CodeRabbit review
on #50.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
The complex result of (-4.0) ** 0.5 and (-4) ** 0.5 took its magnitude from
(-x) ** y, a second call through Float#**, so a wrapper around Float#** ran twice
per call (MRI calls it once). The magnitude now comes from a private alias of the
C# method. (CodeRabbit review on #72.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
It only marked the character index as changed. So it skipped the frozen check and
the copy of copy-on-write content, and it left CharArrayContent's cached CLR string
in place: after ConvertToString, shortening "abc" to one character still gave
"abc" from CreateFrozenSnapshot. It now goes through MutateRemove (shorter) or
Mutate (longer). No caller reaches the stale cache today; this closes it before one
does. (CodeRabbit review on #90.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
IO#getch(min: 0, time: t) on a terminal parked the thread inside read(2) for up to
VTIME (25.5 s): Thread#raise, Thread#kill and a close from another thread were not
noticed until it returned. MRI interrupts it at once. The wait now happens in
poll(2) slices up to the VTIME deadline, as WaitFor's do, and read(2) runs only
once there is input; VTIME running out is the empty read getch answers nil for.
(CodeRabbit review on #47.)

Checked on a pty: a raise 0.5 s into getch(min: 0, time: 50) now lands at 0.5 s
(was not delivered within 10 s); getch(min: 0, time: 1) still answers nil after
1.0 s, and a byte typed meanwhile is returned. After read_nonblock has left the
descriptor non-blocking, getch(min: 0, time: 1) still waits for input, as MRI's
does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
first_child, next, parent and the other neighbour readers read the native
neighbour and self.Tree before taking Tree.Lock, which Insert, Replace and Delete
read it under. A move of self to another document on another thread in between
left the new wrapper in the old tree: it kept that tree alive instead of the one
that owns the node, whose finalizer could then free the node under the wrapper.
The read and the wrap now happen under the lock. (CodeRabbit review on #47.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
.claude/skills/review: how to review an IronRuby change for the bugs that matter -
the kinds CodeRabbit found here across PRs 17-95 (races without a GVL, blocking
waits that cannot be interrupted, native lifetimes, CRuby-compatibility of fast
paths and errors, mutation bypassing Mutate, security of files found from the
current directory, Windows and BSD differences, shell scripts that defeat set -e,
generated files not regenerated) - and how to prove each finding before reporting
it, which is where its false alarms came from.

.gitignore keeps ignoring the rest of .claude/ (agent worktrees, session state).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
… once

(-8) ** Rational(1, 3) ran a wrapper of Float#** twice: Rational#** went through
the public Float#**, then its coercion called it again. MRI's rb_rational_pow
calls rb_float_pow directly. It now uses the C# method's private alias, so the
wrapper runs once, and the count matches CRuby for (-8) ** Rational(1,3),
(-8.0) ** Rational(1,3), Rational ** Float and Rational ** Rational. (Found by the
review skill run on this branch.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
Build and spec commands with the flags they need (IronRubyTargetFrameworks,
IR_CONFIG=Release, regen-initializers for [RubyMethod] changes, spec directories
rather than per-method files), how to get Markly's and rbs's native libraries or
else mark a finding reasoned only, which CRuby is the reference, a pty driver for
terminal behaviour, and: a commit that fixes only part of what its message claims
gets a Note even where the rest was broken on the base.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

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: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d46c0964-98ca-4371-8395-376e1012e877
Commits

Reviewing files that changed from the base of the PR and between 9619fc6 and 96ab147.

Files selected for processing: 10
  • .claude/skills/review/SKILL.md
  • .gitignore
  • Src/Libraries/Builtins/IoOps.cs
  • Src/Libraries/Markly/Markly.cs
  • Src/Ruby/Builtins/ConsoleStream.cs
  • Src/Ruby/Builtins/DescriptorStream.cs
  • Src/Ruby/Builtins/MutableString.cs
  • Src/Ruby/Builtins/RubyFile.cs
  • Src/Ruby/Runtime/RubyContext.cs
  • Src/StdLib/ironruby/ironruby/rational.rb
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Four gaps left after the VTIME fix, all checked through a pty against CRuby:

- STDIN.read_nonblock(1) on a terminal with no input waited for input instead of
  raising IO::EAGAINWaitReadable: STDIN's stream is a ConsoleStream, and the
  non-blocking read only recognized a DescriptorStream. DescriptorStream.Of finds
  the one behind the console stream (syswrite uses it too).
- STDIN.raw { STDIN.sysread(10) } raised System::NotSupportedException: sysread
  flushes the stream, and the console input stream refused Flush. It is a no-op now,
  and the read ends in EOFError when VTIME runs out, as in MRI.
- STDIN.close while another thread was in STDIN.getch(min: 0, time: t) left that
  thread waiting out VTIME and returning nil. Closing the console input stream now
  closes its descriptor stream, so the reader raises IOError at once; fd 0 itself
  stays open, as before.
- A terminal opened as a file (File.open("/dev/tty"), which is also what
  IO.console is) was a FileStream, whose reads park in read(2): Thread#raise and a
  close from another thread did not reach a thread in getch(min: 0, time: t). On
  Unix a terminal device is now read and written through a DescriptorStream over the
  FileStream's descriptor; the FileStream keeps the handle and is disposed with it.

IO.console (class, tty?, fileno, winsize, echo?, raw, noecho, write, getch), a
/dev/tty File (write, sync, path, stat.chardev?, gets of a typed line, close) and
the seven cases above print the same as CRuby. spec/core/io, spec/core/file,
spec/library/io-wait and spec/library/stringio pass (3293 examples, 0 failures),
and irb on a pty evaluates and exits as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW
@Largo Largo changed the title Fix the open CodeRabbit findings from #47, #50, #72, #90; add a review skill Fix the open CodeRabbit findings from #47, #50, #72, #90 and the terminal gaps behind them; add a review skill Nov 4, 2026
@Largo
Largo merged commit 5c77b68 into master Nov 4, 2026
8 checks passed
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.

2 participants