Day 5 (Rails slice): real Layer 2 via bin/rails routes#12
Merged
Conversation
Fills the runLayer2 stub. Strategy: `bin/rails routes` boots Rails
fully (loads gems, resolves the class graph, compiles routes) and
exits. No server spawn, no DB churn, no background processes to
clean up — matches the spirit of "runtime check" without the
operational cost.
Three subprocess steps, each via `mise exec --` when mise is on
PATH (auto-detected):
1. bundle check — skip (fast path) if gems are satisfied
2. bundle install — only runs when check fails (first-ever run
or Ruby version change)
3. bin/rails routes — the actual Layer 2 assertion; exit 0 = pass
mise wrapping is required because Node's spawn() doesn't trigger
mise's directory-scoped Ruby switching. Without `mise exec`, the
subprocess inherits the agent's default Ruby (may not match the
generated project's .ruby-version) and bundler hard-fails on the
mismatch. With `mise exec`, mise reads .ruby-version from cwd and
resolves correctly.
Perf on clinic-queue (freshly generated, clean gem cache):
cold: 23.6s (full bundle install)
warm: 1.3s (bundle check pass + routes)
Layer2Input + Layer2Result reshaped: dropped the port / healthStatus
fields (we're not booting a server) and added exitCode + command +
durationMs to report what actually ran. Updated smoke test.
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Fills the
runLayer2stub with a real implementation for Rails. Strategy:bin/rails routesboots Rails fully (loads gems, resolves the class graph, compiles routes) and exits. No server spawn, no DB churn, no background processes.How it works
Three subprocess steps, each auto-wrapped with
mise exec --when mise is on PATH:bundle check— skip fast-path if gems satisfiedbundle install— only if check fails (first run or Ruby version change)bin/rails routes— the Layer 2 assertion; exit 0 = passWhy mise
Node's
spawndoesn't trigger mise's directory-scoped Ruby auto-switching. Withoutmise exec, the subprocess inherits the agent's default Ruby — may not match the generated project's.ruby-version— and bundler hard-fails. Withmise exec, mise reads the.ruby-versionfrom the subprocess's cwd and resolves correctly. If mise isn't installed, the wrapper falls back to a direct command (agent logs still report what was actually run).Type reshape
Layer2Input— droppedhealthPath, addedtimeoutMs(default 5 minutes).Layer2Result— droppedportandhealthStatus(we're not booting a server). Addedcommand,exitCode,durationMs.stderrTailis only emitted on failure.Perf on clinic-queue (freshly generated, clean gem cache)
bundle install)bundle checkpasses)Warm pace is demo-speed — well within the 20-second beat-5 budget.
Test plan
npm run ci— 5/5 green./out/clinic-queue/rails—pass: true,exitCode: 0, 23.6spass: true, 1.3sxcodebuild+./gradlewwrappers)What's not in this PR
xcodebuild -scheme <Slug> -destination '...iPhone 17...' build(~60-90s fresh, faster on rebuild)./gradlew assembleDebug(slow first run, fast on rebuild)runJudgestub doesn't invokerunLayer1/2/3. Real integration involves passingdomain.slug+ worker outputs into the judge.