CI & modes
How the mode is chosen
Section titled “How the mode is chosen”The first match wins:
mode=argument, orbeacon.snapshots.configure(mode=...)pytest --beacon-snapshot=new|check|updateBEACON_SNAPSHOT_MODEenvironment variablecheckifCIis set (to anything but0/false/no), otherwisenew
So on GitHub Actions, GitLab CI and most other providers (which set CI=true), a missing snapshot fails the build. You can’t forget to commit one.
Line endings
Section titled “Line endings”Snapshots are compared byte for byte, so stop git from rewriting them on Windows checkouts:
snapshots/** text eol=lfbeacon tolerates CRLF when reading, but always writes LF.
GitHub Actions
Section titled “GitHub Actions”name: testson: [push, pull_request]jobs: test: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" - run: pip install -e . llm-beacon pytest - run: pytest # CI=true → snapshot mode "check"Running the same snapshots on all three operating systems is the strongest determinism test you can have. beacon’s own CI does exactly this for its 111 golden files.
Reviewing changes
Section titled “Reviewing changes”When a snapshot changes intentionally:
python -m beacon.snapshots updategit diff snapshots/Read the diff before committing. It’s a precise record of how your app’s behaviour changed.