Skip to content

Does the Check Run?

Run the Does the Check Run? MicroSim Fullscreen

This MicroSim belongs to Chapter 17: Rules That Enforce Themselves.

About This MicroSim

This MicroSim separates two things that look alike: a check that exists and a check that is enforced. The repository in every scenario has a pre-push hook that runs a secret scan, and a CI check on GitHub that runs the same scan. The hook works only on copies where someone ran the one-time setup command.

You see seven illustrative scenarios in a fixed order. For each one you make two predictions before the answer is shown: does the hook run, and is a change that breaks the secret scan stopped before it reaches main? After you press Reveal, a picture of the change's path shows whether it went through the hook, through CI and through the merge gate, and whether it was stopped.

The summary at the end shows the pattern. The hook ran in 1 of 7 scenarios. The bad change was stopped in 6 of 7, and the one miss came from main not being protected, not from CI itself.

How to Use

  1. Read the scenario.
  2. Pick Yes or No for A: Hook runs? and for B: Stopped before main?
  3. Press Reveal. Each prediction is marked correct or incorrect, and the path fills in.
  4. Hover over any box in the path to see what that step does.
  5. Press Next scenario. After scenario 7, press See summary and hover over the numbered squares to read any scenario again.

Each scenario allows one attempt. Start over resets the activity.

Iframe Embed Code

You can add this MicroSim to any web page by adding this to your HTML:

<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/opt-in-hook-gap-predictor/main.html"
        height="564px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Learning Objective

Differentiate, for seven ways a change can reach a repository, whether a local pre-push hook runs and whether a CI check stops a bad change before it reaches the main branch.

Grade Level

Adult professional (Good Enough Engineering)

Duration

10-15 minutes

Prerequisites

Commit, push, main branch and pull request (Chapter 5); pre-commit hook, pre-push hook, the opt-in hook gap, CI check and --no-verify (Chapter 17).

Activities

  1. Exploration (3 min): Hover over each box in the path and read what it does before making any prediction.
  2. Guided Practice (7 min): Work through all seven scenarios. Before each Reveal, say aloud where the change comes from and whether that copy has the hook switched on.
  3. Assessment (5 min): Read the summary. Explain in two sentences why the hook ran only once, and what made scenario 7 different.

Common Misconceptions

  • A hook committed to the repository runs for everyone who clones it.
  • If the hook runs on my laptop, the check is enforced.
  • A CI check that runs is the same as a CI check that blocks a merge.

Assessment

Mastery is 6 of 7 scenarios correct on the first attempt, where a scenario counts only when both predictions are right. Reading the explanations after a reveal is exploration, not evidence.

References

  1. githooks documentation - Git. Describes when each hook runs and how --no-verify skips the pre-commit and pre-push hooks.
  2. About protected branches - GitHub Docs. Explains required status checks before merging.
  3. Gitleaks - an open-source secret scanner that can run as a hook or in CI.