Browser rails#1941
Draft
tomaszpatrzek wants to merge 19 commits into
Draft
Conversation
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>
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.
No description provided.