Repository navigation
Add scenario engine with Linux and Monitoring chapters - #1
Merged
Merged
Conversation
The engine simulates a small shop's server (web-01) reached from a laptop. A command interpreter covers the bash subset beginners need (ssh, df, du, systemctl, journalctl, ps, free, sed -i, pipes, sudo). Time advances per command or via the tick endpoint, which drives incidents, metrics and alerts. Chapters: - Linux: the disk is full and the app crashed; fixing it has to stick. - Monitoring: a memory alert fires; trace it to the worker's cache config.
This was referenced Nov 20, 2026
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.
What this adds
A Rails 8.1 API-only backend in
backend/with the simulator's engine and the first two playable chapters (Linux and Monitoring, built early as planned).Engine (
backend/lib/sim/)world.rb: the whole fake environment as JSON (hosts, files with sizes, disk, services, processes, alerts, metrics, command history).shell.rb: command interpreter for the bash subset beginners need:ssh/exit,ls,cd,cat,head,tail,grep,du,df,rm,truncate,sed -i,echo >,systemctl,journalctl,ps,top,free,kill,curl,alerts,hint. Supportssudo(system files need it), globs, pipes intogrep/head/tail/sort/wc, and&&.engine.rb: each command is one tick of time;POST /ticklets time pass while the player reads. Scenarios react each tick (logs grow, memory leaks, alerts fire and resolve). Objectives complete in order.scenarios/: one class per chapter, each playable on its own.Chapters
debug.log, free space, turn off debug logging, restart, check health. Restarting with debug still on fills the disk again a few minutes later.shop-workerand itsREPORT_CACHE_MAX=0(unlimited) from the last deploy. A restart alone only buys time; if ignored, the OOM killer kicks in.API
GET /api/scenarios,POST /api/runs,GET /api/runs/:id,POST /api/runs/:id/commands,POST /api/runs/:id/tickRunChannel(Action Cable at/cable) broadcasts every step: output, notices, completed objectives, alerts, metrics, service states.Repo setup
README.md,CLAUDE.md(project notes),.gitignore, CI workflow at the root running brakeman, bundler-audit, rubocop and tests inbackend/..ruby-versionset to 3.3.14 because brakeman flags 3.3.6.Not in this PR
Checks
bin/rails test: 29 runs, 0 failuresbin/rubocop: no offensesbin/bundler-audit: no vulnerabilitiesbin/brakeman: only the local Ruby 3.3.6 version warning, fixed by the.ruby-versionbump