Skip to content

Add GitHub, CI and Deploy chapters - #5

Merged
royalpriest merged 1 commit into
mainfrom
feat/delivery-chapters
Nov 21, 2026
Merged

royalpriest merged 1 commit into
mainfrom
feat/delivery-chapters

Conversation

@royalpriest

@royalpriest royalpriest commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Three new chapters that play on your laptop in a ~/shop repo. With these, all five chapters are playable.

# Chapter What you do Based on
1 Open your first pull request Branch, add a free-shipping banner, commit, push, run gh pr create, and wait for CI to pass GitHub's standard PR flow
2 Works on my machine CI is red, but the tests pass locally. Read the log and notice that your .env sets FREE_SHIPPING_FROM but CI doesn't have it. Give it a default in code (or set it in the workflow), push, and get green The top cause in "Six reasons your build passes locally and fails in CI"; SadServers "Gitega" (find the commit that broke the tests)
3 The health check is lying A config change breaks /checkout with 500s while /health stays 200. Read the releases and logs, run deploy rollback r42, confirm checkout works, then git revert the bad commit and push Config-change outages in Dan Luu's post-mortems list (GitHub Aug 2024, Cloudflare Dec 2025)

Each chapter ends with a short "This happened for real" note and a source link.

Engine

  • lib/sim/repo.rb: a small git built on snapshot commits. It has branches, a staging area, .gitignore, a line diff, push to a remote, revert, and pull requests with CI runs.
  • lib/sim/delivery_commands.rb, mixed into the shell:
    • git: status, branch, switch/checkout, add, commit (-m, -am), log, diff, push, revert and restore.
    • gh: pr create/list/view/checks and run view --log-failed.
    • bin/rails test.
    • deploy: status, releases, logs and rollback.
  • lib/sim/delivery_ci.rb: a run finishes two ticks after a push. It runs the tests on the pushed commit using only the workflow's env vars, the way a clean runner would.
  • Shell fixes:
    • ls hides dotfiles unless you pass -a.
    • curl -X POST works.
    • sed turns \n in the replacement into a newline.
  • Scenarios can position their own map boxes. The new errors metric drives the Deploy chapter's gauge.

Frontend

  • The map uses the box positions a scenario sends, and falls back to the shop-server layout when it sends none.
  • The gauge is hidden in chapters that don't have one. The Logs tab only shows when there are logs.
  • The completion card shows the "This happened for real" note.

Checks

  • bin/rails test: 41 runs, 0 failures. These include full play-throughs of all three new chapters and guard-rail tests: no PR from main, nothing to commit, a missing commit message, and opening a PR before pushing.
  • bin/rubocop: clean. bin/brakeman: 0 warnings.
  • npm run lint: clean. npm run build: passes.
  • I played all three chapters in Chromium and saw no console errors.

All three play on the laptop in a ~/shop repo, using a small simulated
git (branch, add, commit, diff, log, push, revert), a GitHub CLI (pr
create/view/checks, run view), bin/rails test and a deploy tool
(status, releases, logs, rollback). CI runs the tests on the pushed
commit in a clean environment two ticks after a push.

- GitHub: branch, add a banner, commit, push, open a PR, CI passes.
- CI: tests pass locally thanks to a .env file but fail in CI.
- Deploy: a config change breaks checkout while /health stays green;
  roll back, verify, then revert the commit on main.

Each chapter ends with a short note on the real practice or incident it
is based on, with a link.
@royalpriest
royalpriest merged commit 2c3a8f6 into main Nov 21, 2026
2 checks passed
@royalpriest
royalpriest deleted the feat/delivery-chapters branch November 22, 2026 16:08
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