Security updates for JRuby: 9.4.16.1, 10.0.8.1, 10.1.3.1
jruby.orgSecurity alert! We have just released JRuby versions 9.4.16.1, 10.0.8.1, and 10.1.3.1 to address a medium to high-severity security issue. All users are strongly encouraged to upgrade and consider signing up for support services from https://headius.com
We will release technical details of this issue on December 8, 2026, at 18:00UTC.
See the release announcements at https://www.jruby.org/news for more details.
Security Upgrade Ruby ASAP - Security advisories: multiple vulnerabilities in Regexp and String case conversations
r/ruby • u/retro-rubies • 1d ago
2027 Gem Fellowship: Applications are Open!
mikeperham.comr/ruby • u/Edthal01 • 2d ago
Question GVL and concurrent programming
Ruby cannot perform real concurrent processing on multicore microprocessors without using ractors because of the GVL. It will only simulate multiple simultaneous processes with threads, queues, mutexes, etc. in a single processor core, no true parallel processing. How does this limitation affect true parallel programming in Ruby, that is, how much more complicated is it in producing true multicore parallel programming? I am still working on learning Ruby and this is part of my self-inflicted learning process in parallel with Huw Collingworth Book of Ruby.
r/ruby • u/unselective-amnesia • 1d ago
Using ARGF on a subset of ARGV?
This thread is solely a simple technical question about the ruby language.
As you read this question, please keep in mind that ...
... I am NOT asking about any alternative ways to accomplish what I'm discussing.
... I am NOT asking an "XY" question.
... I do not want to get into any discussions nor arguments about why I am doing what I'm discussing, nor concerning whether or not what I'm writing about is a recommended practice.
... and again, keep in mind that I am only looking for the answer to one simple technical question about the ruby language, and nothing else.
I'm sorry for this verbiage about what I don't want to discuss here. However, I have learned from the responses to other questions that I have asked in reddit that some people refuse to read the initial post of a thread in its entirety before responding, and that some other people do read the initial post, but then still make a point to disrespect the stipulations that are made in that initial post. I'm hoping that by all of what I've written here concerning what I don't want, that my stipulations will indeed be respected this time.
Thank you very much for keeping all of these points in mind as you read my question now:
I understand most of the information about ruby's ARGF construct. However, I want to do something involving ARGF that I couldn't find any documentation for.
I have a ruby program that is invoked as follows:
ruby-program operation [ optional arguments ... ]
I know that I can get 'operation' from ARGV[0]. And I then want to process the remaining 'optional arguments' via ARGF: i.e., to either treat these remaining arguments as filenames whose data is returned by ARGF, or if these optional arguments are missing, for the data to be obtained from stdin.
I know that ARGF normally processes the entire ARGV, but in this case, I'd like ARGF to ignore ARGV[0] and to only process whatever command-line arguments commence with ARGV[1] (if it exists, of course ... and if it doesn't exist, to then have ARGF get its data from stdin).
I know of alternative ways to accomplish this without using ARGF at all; however, please remember what I wrote at the beginning of this message about NOT wanting to discuss such alternatives. All I want in this case is to know of a way that I might be able to accomplish what I'm discussing via the use of ARGF.
And please note that if this is not possible via ARGF, since I already know of alternatives that I can utilize, I therefore don't want to discuss any of those alternatives here. In the case of this not being possible with ARGF, I just would ONLY like to know about this indeed being impossible, and then I won't want to discuss anything else.
Thank you very much in advance.
r/ruby • u/Sensitive-Training22 • 1d ago
Speed Demon II: a 72-hour optimisation race in slow languages, Ruby included
Speed Demon II runs online from 29 January to 1 February 2027. Teams of 1 to 4 make code in a slow language as fast as they can. Faster code moves your team's car round a race track through San Francisco.
Details: https://speeddemon.dev/2027/
Register: https://speeddemon.dev/2027/register/
r/ruby • u/ombulabs • 2d ago
Blog post Spotting a Typosquat in Your Gemfile.lock
r/ruby • u/javier_cervantes • 3d ago
Ruby Users Forum - Monthly Update - November 2026
r/ruby • u/pdabrowski • 3d ago
Closer to the business, further from the Rails way
r/ruby • u/Dry-Exam-3338 • 3d ago
I built schema_shard — dynamic Rails 8 database sharding & fail-closed multi-tenancy (when static connects_to isn't enough)
Hey r/ruby!
I recently published an open-source gem called **schema_shard** and would love some eyes on it from folks running multi-tenant or sharded Rails 8 apps, whether it’s code review, edge-case feedback, or testing it out in a staging setup.
### Why not just use Rails' built-in `connects_to` / `connected_to`?
Rails 8's native multi-DB support is great when you have a fixed, known set of shards declared at boot time on `ApplicationRecord`. Where it starts getting painful is when you need **dynamic, runtime-driven routing** or **schema/database-level tenant isolation** without bloating your connection count.
`schema_shard` sits on top of Active Record's connection pooling (`HashConfig` / `PoolConfig` + `IsolatedExecutionState`) to handle three things out of the box:
* **Dynamic Config-Driven Shards (No Static `connects_to` Boilerplate):** Define shards in `config/shards.yml` (or pass a runtime `Proc`) and route blocks with `SchemaShard.with('acme_corp', shard_key: 'replica_1')` or `SchemaShard.on_shard('write_shard_2', read_only: false)` without hardcoding shard mappings on every model class.
* **LRU-Bounded Connection Pools:** Instead of holding open pools forever for every shard/tenant combination, it uses an atomic refcounted LRU registry (`max_pools`) to evict idle pools safely under load without racing active queries.
* **Fail-Closed Multi-Tenant Isolation:** Supports PostgreSQL (`search_path` or `ros-apartment`), MySQL/MariaDB (`trilogy` & `mysql2`), and per-tenant SQLite3 files. In `:strict` mode, missing/blank tenants, system schemas, or nested tenant switches inside an open transaction fail closed rather than silently falling back to `public` or your primary DB.
### Quick Example
```ruby
# Fail-closed tenant + read-replica routing (read-only at both Rails and DB session levels)
SchemaShard.with('acme_corp', shard_key: 'replica_1') do
Order.where(status: 'paid').count
end
# Pure shard routing (no tenant switching)
SchemaShard.on_shard('write_shard_2', read_only: false) do
AuditLog.create!(event: 'synced')
end
Looking for Feedback
I'd genuinely appreciate any feedback on the architecture, pool lifecycle edge cases, or how you're handling dynamic sharding in Rails 8 today:
* GitHub: https://github.com/syrens/schema_shard
* RubyGems: https://rubygems.org/gems/schema_shard
Thanks in advance for checking it out!
r/ruby • u/maokomioko • 5d ago
Steep / RBS toolkit - (steep-kit gem)
Hi all,
I just open-sourced (slope-coded) steep-kit, a companion toolkit for Ruby apps and gems typed with inline RBS (# u/rbs / #:) and checked with Steep.
It was battle-tested in our company for about 4-5 months and evolved (slope-rewritten) to a point of being community ready. https://github.com/maokomioko/steep-kit
Why it exists
RBS 4.2's native inline parser + Steep 2.1 are great, but adopting them incrementally on a larger codebase hits two recurring gaps:
- Runtime definitions the inline parser can't see:
Data.define/Struct.new, class-bodyalias/alias_method, unannotated literal constants,ClassMethodsmixins, dynamic superclasses, and macros likeattr_json. - Scaling friction: body-checking overhead on silent donor files, CLI/LSP memory retention, drifted
rbs_railsoutput, and signature/runtime drift.
What it does
- Projected RBS (
sig/projected+watch): generates classic RBS reopenings forData.define/Struct.new,alias/alias_method, and (opt-in)attr_json. - In-memory RBS & Steep enhancements: infers literal/record constants, handles value/dynamic superclasses and opt-in mixin contracts (
ClassMethods, command aliases, nested classes), and patches Steep for lower overhead (signature-only silent donors, path-indexed lookups, completed-typing compaction). - Single CI / pre-push gate (
bundle exec steep-kit): syncsrbs_collection, lints inline grammar pitfalls (class << self,Data.defineblocks), validates record-constant key lookups workspace-wide via Rubydex, and checkssig/projectedfreshness. - Optional tooling:
steep-kit fast(targeted--validate=skipchecks), deterministic scratch-DBsteep-kit rbs-rails, andSteepKit::Runtime(rbs/testwith inline RBS + nested mismatch paths).
All Rails and convention features are off by default, so it works for plain Ruby apps and gems too (Ruby 3.3+, RBS 4.2, Steep 2.1, Rubydex 0.4).
Hope it helps someone else :3
Snails is a Rails-like framework for API-only Ruby apps.
snails-rb.orgSnails builds on Matz's Spinel to compile apps into a single native binary, minus Active Record, server-rendered views and gems. It keeps the Rails conventions and builds the framework in plain Ruby. One process, multi-threaded, across all cores: no worker processes, no GVL. On the benchmark, Snails serves about 3× the requests per second of Rails in cluster mode, with more than 10× lower peak memory under load.
Site: https://snails-rb.org/
Repository: https://github.com/snails-rb/snails
r/ruby • u/_joeldrapper • 8d ago
Phlex 3 Beta is out with a specialised Ruby-to-Ruby JIT for components
We just released the first beta of Phlex 3, which includes a special Ruby-to-Ruby just-in-time compiler, allowing us to optimise performance far beyond what’s possible at runtime.
The compiler starts from what’s actually loaded. It asks each component’s live methods where they were defined, parses those files with Prism and turns them into a syntax tree.
Then it walks the tree and decides what each call really means by asking the running program: is div still Phlex’s div, or has someone overridden it, refined it or mixed something over it? Is that constant still the string it was? Each call we can prove is ours is replaced with a node that just appends text. Everything else is left as it was.
Next comes fusing: neighbouring appends merge, so a run of static elements becomes a single string, escaped and serialised once.
Finally, the tree is formatted back into Ruby, with a source map so that errors point to your original file and line, and this is evaluated in place of the original methods.
I posted more details including some micro benchmark results. You can also see the full release notes on GitHub.
I don’t know if this is going to work or if we’re going to discover some new edge case we hadn’t thought of, but it looks promising so far and it’s been running in production with 465 components for over 24 hours without any issues.
Blog post Start with one server, even if you plan to take over the world
A lesson from maintaining legacy Ruby on Rails apps.
r/ruby • u/nateberkopec • 9d ago
stylebench: compare how different models write ruby, stylistically
nateberkopec.github.ioVibe coded in an hour. Please send all feedback to https://github.com/nateberkopec/stylebench. If you wish there was a model here that I didn't include, go run it yourself!
JRuby 9.4.16.0 Released with security updates
jruby.orgWe are happy to announce the release of JRuby 9.4.16.0, a sponsored release mostly containing third-party security updates. Users still on JRuby 9.4 are encouraged to update and sign up for support services at https://headius.com to assist with future releases and upgrading to JRuby 10.x.
- Homepage: https://www.jruby.org/
- Download: https://www.jruby.org/download
JRuby 9.4.x targets Ruby 3.1 compatibility.
Thank you to our contributors this release, you help keep JRuby moving forward! @jessecai33, @mnpoonia
Notable Changes
Security
Updated several dependencies to pick up security fixes.
- jruby-opensl 0.16.3 with Bouncy Castle 1.86. #9730
- rdoc 6.6.3.1, fixing sonatype-2022-6090. #9730
- uri 0.12.5, fixing CVE-2025-61594. #9730
- net-imap 0.6.7, with over 15 years of bug and security updates. #9730
- asm bytecode library 9.11.1, fixing several potential DoS security issues. #10119
- resolv equivalent to 0.7.2 (vendored) for hostname-length and generic-resource fixes. #10119
Compatibility
- Improved handling of ruby2_keywords argument passing. #9517
- Marshal dump and load of an identity hash no longer loses identity bit. #9584
Java Integration
- JVM bytecode output will now better match the current JVM, up to the limits of the ASM bytecode library. #9483
5 Issues and PRs resolved for 9.4.16.0
r/ruby • u/chrisrackstallion • 11d ago
Agent_primitives – capabilities your coding agent has to prove with specs
**Edited to better explain my ramblings. Hopefully...
Morning all,
You ask a coding agent to refactor the comments view. It breaks reply nesting, and this spec fails:
it "shows replies nested under their parent" do
expect(page).to have_css(".comment .comment", text: "Nice post")
expect(page).to have_css(".comment[data-depth='1']")
endThe agent "fixes" the failure by deleting the second assertion. The suite is green. The only evidence is one hunk in a 600 line diff, and nothing tells you that this spec mattered more than the forty around it.
Tests protect your code, but nothing protects the tests. That matters once agents write both.
I've released agent_primitives, a gem that covers that gap. It has two parts.
1. You write down what the app must keep doing. Each capability gets a short doc with plain numbered sentences:
I1 — A reader can reply to any comment.
I2 — Replies show nested under their parent.2. You tag the specs that prove each sentence.
it "shows replies nested under their parent", intent: "comment_threads#I2" doThese are ordinary RSpec examples and they run as before. The tag is just metadata.
Now the same agent edit gets reported:
$ bundle exec agent_primitives guard --base main
spec/system/comment_threads_spec.rb
7:1 N the example proving comment_threads#I2 lost 1 assertion(s) — it still carries the tag while proving less of the clause [proof/weakened]If the agent deletes the example outright, the check that runs in CI fails:
$ bundle exec agent_primitives evals
docs/primitives/capabilities/comment_threads.md
9:1 E spec/system/comment_threads_spec.rb carries no `intent: "comment_threads#I2"` tag [evaluation/untagged]
1 capability, 4 clauses — 1 offenceRewording a sentence is reported too, so an agent can't change what the app is supposed to do without you seeing it.
A few other things it does:
- The agent reads the doc before it plans a change, so it stops "fixing" deliberate decisions that look like bugs.
- Each doc keeps a history of decisions and rejected alternatives, so the agent stops proposing the approach you turned down last month.
- It works forwards. Write the sentences before the code, and each one becomes a spec the agent has to make pass.
- You don't write the docs by hand. The gem ships agent skills that fold this into planning, building and review, and one that interviews you to backfill an existing feature.
It needs RSpec and an agent that can load skills.
gem "agent_primitives", group: :developmentSource and README: GitHub - pitch-sourcery/agent_primitives · GitHub
I extracted it from the harness I use every day on my own startup's Rails app. It's a 0.1.0, so tell me where it's confusing or wrong.