Skip to content

Bind go-ruby-rack and go-ruby-sinatra into rbgo as native modules#104

Merged
tannevaled merged 1 commit into
mainfrom
bind/web
Jul 2, 2026
Merged

Bind go-ruby-rack and go-ruby-sinatra into rbgo as native modules#104
tannevaled merged 1 commit into
mainfrom
bind/web

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Wire go-ruby-rack and go-ruby-sinatra into the embedded Ruby runtime, closing the two web-app gaps the run-conformance harness surfaced: require "rack" and the Sinatra DSL (require "sinatra/base"). Both libraries were CI-green but never bound.

rack (require "rack" / "rack/utils")

  • Rack::RELEASE, Rack::Request (env accessors + parsed params/GET/POST/cookies), Rack::Response (buffered status/headers/body, #finish/#to_a[status, headers, body]), Rack::Utils (escape/unescape/escape_html/parse_query/build_query/status_code).
  • Deterministic env/query/escape over the library — no socket, no network.

sinatra (require "sinatra/base" / "sinatra")

  • Sinatra::Base with the class-level routing DSL (get/post/put/delete/patch/options/head), before/after filters, not_found / error handlers, set/enable/disable/configure/helpers, and the Rack #call adapterApp.new.call(env)[status, headers, body] (also a class method).
  • Route/filter blocks run against a request context exposing params, request, response, status, body, headers, content_type, redirect, halt, pass, session, settings. halt/redirect/pass unwind through the library's panic-based control flow, which the dispatcher recovers. The handler-block eval is the rbgo seam; routing, param extraction and dispatch are the go-ruby-sinatra library over go-ruby-rack.
  • Subclasses inherit their ancestors' routes.

Conformance

The webapp run-conformance stage 3 (Sinatra DSL) now RUNS green (hard assertion): GET /hi?n=amy[200, headers, ["hi amy"]].

Gates

  • rbgo build + full go test ./... green under TZ=UTC.
  • New binding code at 100% coverage under the exact CI gate (-race -coverpkg=$(go list ./internal/... | paste -sd,)).
  • gofmt / vet clean.

🤖 Generated with Claude Code

Wire the go-ruby-rack and go-ruby-sinatra libraries into the embedded Ruby
runtime, closing the two web-app gaps the run-conformance harness surfaced:
`require "rack"` and the Sinatra DSL (`require "sinatra/base"`).

rack (require "rack" / "rack/utils"):
  - Rack::RELEASE, Rack::Request (env accessors + parsed params), Rack::Response
    (buffered status/headers/body + #finish/#to_a triple), Rack::Utils
    (escape/unescape/escape_html/parse_query/build_query/status_code).
  - Deterministic env/query/escape over the library; no socket, no network.

sinatra (require "sinatra/base" / "sinatra"):
  - Sinatra::Base with the class-level routing DSL (get/post/put/delete/patch/
    options/head), before/after filters, not_found / error handlers,
    set/enable/disable/configure/helpers, and the Rack #call adapter
    (App.new.call(env) -> [status, headers, body]) available as both an instance
    and a class method.
  - Route/filter blocks run against a SinatraCtx exposing params, request,
    response, status, body, headers, content_type, redirect, halt, pass, session
    and settings; halt/redirect/pass unwind through the library's panic-based
    control flow, which the dispatcher recovers. The handler-block eval is the
    rbgo seam; routing, param extraction and dispatch are the go-ruby-sinatra
    library over go-ruby-rack.
  - Subclasses inherit their ancestors' routes; per-class declarations are keyed
    by the class object.

The webapp run-conformance stage 3 (Sinatra DSL) now RUNS green:
GET /hi?n=amy -> [200, headers, ["hi amy"]].

Registered after registerRack (Sinatra reuses Rack::Request/Response and needs
StandardError for Sinatra::NotFound). New binding code is at 100% coverage under
the -race -coverpkg CI gate (TZ=UTC); gofmt/vet clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled tannevaled merged commit 500dd80 into main Jul 2, 2026
9 checks passed
@tannevaled tannevaled deleted the bind/web branch July 2, 2026 22:00
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