Skip to content

Browser rails#1941

Draft
tomaszpatrzek wants to merge 19 commits into
masterfrom
browser-rails
Draft

Browser rails#1941
tomaszpatrzek wants to merge 19 commits into
masterfrom
browser-rails

Conversation

@tomaszpatrzek

Copy link
Copy Markdown
Contributor

No description provided.

tomaszpatrzek and others added 19 commits July 6, 2026 14:38
Introduce RubyEventStore::Browser::Engine — an isolated Rails engine that
will host the server-rendered browser. Nothing is mounted or served yet;
the Elm app stays in place alongside it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Compile the stylesheet from the templates with the standalone Tailwind CLI
(no Node) via `make css`, and serve it through the assets controller. The
output is gitignored and built at release, not committed. Package app/ and
config/ in the gem.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add browser.js with the search, timezone and clipboard Stimulus controllers
and serve it plus the pinned Stimulus runtime through plain Rack endpoints
(so Rails' same-origin guard for JS doesn't block importing them as ES
modules). Stimulus itself is vendored from the CDN at release via
`make public/stimulus.js`, not committed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the layout — the red nav with stream search, the footer with a
timezone picker and the browser.js module — and the page routes it links
to. The views that fill it follow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the streams controller and its template, and reduce GetEventsFromStream
to a plain reader (events + pagination cursors) the controller uses to
render the "all" stream as a table with forward/backward pagination.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the events controller, the event view and its partials — the event
metadata, raw data/metadata with copy buttons, the streams the event
belongs to, its parent event and the events it caused. Icons, timestamps
and the raw sections are extracted into partials; the JSON tree renders
with Tailwind classes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mount the server-rendered engine instead of the Elm Rack app. The engine
reads Rails.configuration.event_store (as the wrapper already did), so the
root now renders the "all" stream server-side. Drop the JSON:API assertion
from the integration spec — the browser no longer exposes /api.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Repoint the ui and web specs from the Elm Rack app to a shared
TestApplication mounting the engine, so the existing behavioural assertions
verify the new implementation. Delete the JSON:API specs and their client
and schema — the browser no longer exposes /api.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Delete the Rack App, Router and Urls, plus the JSON:API objects (GetEvent,
GetStream, JsonApiEvent, JsonApiStream) and their specs. The engine renders
HTML directly and no longer serves /api; GetEventsFromStream stays as the
stream reader and GemSource stays for the CDN asset fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Delete the Elm app (elm/), the standalone Rack devserver and the
timezone-map generator, and drop the Elm build outputs (bootstrap.js,
ruby_event_store_browser.js) from the gem. The browser is now a Rails engine;
the README covers mounting it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Read the configured related-streams query
(config.x.ruby_event_store_browser_related_streams_query) and render the
"Related streams:" section with links, matching Elm. Nothing is shown when
no query is configured.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drive the browser with a New York timezone override and assert the event
view renders a UTC timestamp in local time — covering the conversion and
the midnight edge (00:00, not 24:00).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the standalone Rack mounting section (the browser is a Rails engine
now) and switch the related-streams example to the Rails config setting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Require ruby_event_store/browser instead of the deleted browser/app, and
drop the ignores for the removed App, Urls and Router classes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add direct specs for GetEventsFromStream (events, pagination cursors,
count) restoring the mutation coverage the deleted JSON:API specs used to
give it — 100% again.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The stylesheet and Stimulus are built/fetched rather than committed, so make
test/mutate depend on them, and the test workflow calls `make test` instead
of the removed `install-npm` target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The browser gemspec now depends on railties/actionpack/actionview; refresh
the lockfiles of every gem that mounts it as a path gem — rails_event_store
(and its dummy app), dres_rails, protobuf and sidekiq_scheduler — across
their Rails/rack Gemfile variants, so frozen bundle install passes in CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the setup-node and elm cache from the test workflow (the browser no
longer has a Node/Elm build), and point the assets workflow at the new
build: `make css public/stimulus.js` and upload the CSS, Stimulus and
browser.js to the CDN bucket instead of the Elm bundle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When the gem is installed from git the built CSS and Stimulus aren't
present, so link them (and browser.js) from the CDN keyed by the commit
SHA, using GemSource to tell a git checkout from a released gem. The
Stimulus route becomes stimulus.js so the relative import resolves both
locally and from the CDN.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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