Repository navigation
Fix the open CodeRabbit findings from #47, #50, #72, #90 and the terminal gaps behind them; add a review skill - #97
Merged
Conversation
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
|
Warning Review limit reachedYou'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. View limit details
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. |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
DescriptorStream: a timed terminal read could not be interrupted.IO#getch(min: 0, time: t)parked the thread in read(2) for up to VTIME (25.5 s), soThread#raise,Thread#killand a close from another thread waited for it. The VTIME deadline is now waited out in poll(2) slices.read_nonblockdid not reproduce. With the descriptor left non-blocking, both IronRuby and CRuby wait for input with no CPU use.first_child,next,parent, …) read the node andself.TreeoutsideTree.Lock. A concurrent move to another document could leave the new wrapper keeping the wrong tree alive, and that ends in a use-after-free. The read and the wrap now happen under the lock.using System::Linq: CLR extension methods scoped like C#'s using directive #50ActivateScopedExtensions: it enumerated the live extension list outsideExtensionsLock. It now copies the list under the lock.Float#**:(-4.0) ** 0.5and(-4) ** 0.5ran a wrapper ofFloat#**twice. The magnitude now comes from a private alias of the C# method.Rational#**with a Float or Rational exponent had the same problem, which the review skill found on this branch:(-8) ** Rational(1, 3)made two calls here and three on master.MutableString#SetLength: it bypassedMutate, so it skipped the frozen check, the copy of copy-on-write content and invalidation of the cached CLR string. It now goes throughMutateRemoveandMutate.Terminal gaps (on master too, all checked on a pty against CRuby)
STDIN.read_nonblock(1), no inputIO::EAGAINWaitReadable(:wait_readablewithexception: false)STDIN.raw(min: 0, time: 1) { STDIN.sysread(10) }System::NotSupportedExceptionEOFErrorafter 1 sSTDIN.closeduringSTDIN.getch(min: 0, time: t)IOErrorat onceFile.open("/dev/tty")(alsoIO.console):Thread#raiseorcloseduringgetchThe changes behind the table:
DescriptorStream.Offinds the descriptor stream behind STDIN's console stream, forread_nonblockandsyswrite.Flushis now a no-op.DescriptorStreamover the FileStream's descriptor. The FileStream still owns the handle and is disposed with it.Review skill
.claude/skills/review/SKILL.mdcovers:Mutate, files run from the current directory, Windows and BSD differences,set -epitfalls and generated files left stale.It was tried once on this branch, which led to the
Rational#**fix and the terminal gaps above..gitignorestill ignores the rest of.claude/.Testing
spec/core/{string,rational,complex,float,integer}.spec/core/io,spec/core/file,spec/library/io-waitandspec/library/stringioall pass: 3293 examples, 0 failures.IO.console: class,tty?,fileno,winsize,echo?,raw,noecho,write,getch. Same output as CRuby./dev/ttyFile:write,sync,path,stat.chardev?,getsof a typed line,close. Same output as CRuby.Float#**,Rational#**andSetLength.🤖 Generated with Claude Code
https://claude.ai/code/session_01KPwZf6zTBynkVVtAVjXKpW