Originally published on my blog.
Fuchikoma 0.0.3 is out. It is the first release that is only words: six RFCs, each one a design decision that the code will have to follow. The gem still exposes Fuchikoma::VERSION and nothing else.
Fuchikoma in one sentence
Fuchikoma is a fiber-native, typed, one-process Ruby web framework.
Why write before coding
The decisions that are hardest to undo are the ones everything else rests on: how work is scheduled, what a request is allowed to see, how data reaches the database. Once code depends on them, changing them means rewriting the code. On paper, changing them costs an afternoon.
An RFC here is a short document with a fixed shape: the proposal, its impact on concurrency, security and dependencies, the alternatives I rejected, the questions still open, and acceptance criteria that a test can check. I also tried to check every claim I could against running code or the source of the thing I was describing, and I say below where I could not.
The six RFCs
RFC 000, the founding period. Fuchikoma has one maintainer, so it cannot have a steering group that accepts RFCs. This RFC says so in writing, and says what changes until three maintainers and a fiscal host exist: I decide the RFCs and may merge my own changes, and the first steering group reviews all of it and can reopen any decision.
RFC 001, the fiber runtime. One process runs one event loop on one thread, on Ruby's fiber scheduler. Every connection, request, job and WebSocket gets its own fiber. The rule that matters is the sorting of every common operation into "yields to other fibers" or "blocks the whole loop", with the blocking ones sent to a bounded thread pool. I measured that sorting with a small probe rather than trusting memory, and it surprised me: reading a regular file blocks the loop whatever hook you install, Net::HTTP blocks on name resolution unless a process-wide setting is changed, and handing a 32 MB compression to the scheduler made it about 40% slower. The probe is in the repository.
RFC 002, the schema DSL. One definition, written once in Ruby, validates incoming query, form and JSON data, checks outgoing responses and component props, produces an OpenAPI 3.1 document and emits RBS types. Coercion is strict, unknown keys are rejected, and a failure is a 422 problem document with the path of the faulty value and a stable error code.
RFC 003, the scope object. Every request gets one immutable Scope: who is asking, for which organisation, with which permissions and request id. A repository bound to a scope adds the organisation condition to every query and fills it in on every insert. Reading data without a scope is an error. The one way around it needs a written reason, lasts for one block in one fiber, and is logged each time.
RFC 004, the persistence contract. A small contract lets the same application run on Sequel first and on ActiveRecord later, on PostgreSQL and SQLite. The core owns what must be identical everywhere: a fiber-safe connection pool, transactions, a structured query tree, and the scope rewrite from RFC 003. An adapter declares whether its driver yields, releases Ruby's global lock or holds it, and the core places each statement accordingly.
RFC 005, sidecar mode with a Rails app. A Fuchikoma process can run next to an existing Rails application behind the same proxy, with one login and one database. It reads the Rails session cookie with two keys derived from the Rails secret, never the secret itself, builds the scope, checks the origin of every request that changes data, and reads the Rails tables read-only. Rails keeps signing users in and out.
What I checked, and what broke
Most of the work was trying to break the documents.
- The scope rewrite. For RFC 003 and 004 I wrote throwaway prototypes of the query tree and of the rewrite that adds the organisation condition, then wrote attacks against them: an
INSERT ... SELECTthat names the tenant column, a value that is secretly a column, and so on. The rules in the RFC are the ones those attacks forced. - The connection pool. My prototype had two bugs that a design document would never have shown: waiting fibers were not woken when a broken connection was thrown away, and a failed connection attempt kept its slot forever. Both are now named cases in the acceptance criteria.
- The Rails cookies. For RFC 005 I read the cookie code in Rails and wrote a small reader that uses nothing but OpenSSL. I tested it against cookies produced by the real Rails classes, with both key-derivation digests, with key rotation, and against thousands of deliberately corrupted cookies. It never raised and never accepted a modified one.
- A second pair of eyes. I had each of the later RFCs reviewed by a separate reviewer that had not seen the drafting. For RFC 005 it caught that I had named the wrong Rails setting for the cookie signature digest, which would have made every login fail while the health check said all was well. It also pointed out that newer Rails can protect against cross-site requests without storing any token, which my first design assumed it would.
What this does not prove
- That the RFCs were reviewed in public. I accepted all six myself, on the same day, under the founding period rules of RFC 000. The 14-day public comment period that the roadmap asked for did not happen. That is a real shortcut. The honest remedy is the one RFC 000 describes: the decisions stay open to comment, and the first steering group can reopen them.
- That the designs work. Prototypes of a pool and a query tree are not the framework. The numbers in RFC 001 come from one machine and one Ruby version.
- That the Rails details hold for your Rails. I read the source of Rails main. The stable branches still have to be checked when the code is written, and the RFC says so.
- That I did this alone. I drafted and checked these documents with Claude, and the commits carry its co-author line. The decisions, and the mistakes, are mine.
What this release is not
It is not usable, and it does nothing. Don't depend on it. It exists so that the code that follows has something to be wrong against.
What's next
0.0.4 is the benchmark harness: a public report that compares Rails, Rage, Roda and Hanami on four scenarios, with the method and the hardware stated, so that every later claim about speed can be checked by anyone. Then comes the contributor experience (0.0.5) and gate A (0.0.6): three maintainers and a fiscal host. The first framework code, the fiber core, is 0.1.0.
How to get involved
The most useful thing you can do now is to find what is wrong in the RFCs. They are in rfcs/ at https://github.com/KevinSaison/fuchikoma. Open an issue or a discussion, and tell me which one you read and what you would change. RFC 001, 003 and 004 are the ones where an outside opinion would help most.
Commits must carry a Signed-off-by line (git commit -s); see CONTRIBUTING.md.
