Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 43 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,35 @@ owner call when modified production files are restored to `<base>` and
newly added production files are removed temporarily:

```console
$ mapfile -t mod_py < <(
git diff --name-only -M --diff-filter=MDR <base>..HEAD -- '*.py' |
rg -v '(^|/)tests?/|(^|/)conftest\.py$|(^|/)test_[^/]*\.py$|_test\.py$'
) &&
mapfile -t add_py < <(
git diff --name-only -M --diff-filter=A <base>..HEAD -- '*.py' |
rg -v '(^|/)tests?/|(^|/)conftest\.py$|(^|/)test_[^/]*\.py$|_test\.py$'
) &&
test $(( ${#mod_py[@]} + ${#add_py[@]} )) -gt 0 &&
{ [ "${#mod_py[@]}" -eq 0 ] ||
git restore --source=<base> --worktree -- "${mod_py[@]}"; } &&
{ [ "${#add_py[@]}" -eq 0 ] || rm -f -- "${add_py[@]}"; } &&
! uv run pytest -x &&
git restore --source=HEAD --worktree -- "${mod_py[@]}" "${add_py[@]}" &&
uv run pytest
$ : "${BITE_TEST:?set BITE_TEST to the regression test}" && \
wt=$(mktemp -d) && \
git worktree add --quiet --detach "$wt" HEAD && \
( cd "$wt" && \
base=${BITE_BASE:-origin/master} && \
git diff --name-only --no-renames "$base" HEAD | \
grep -E '\.py$' | \
grep -Ev '(^|/)tests?/|(^|/)conftest\.py$|(^|/)test_[^/]*\.py$|_test\.py$' \
> bite.files && \
git restore --source="$base" --worktree \
--pathspec-from-file=bite.files && \
{ uv run pytest -rf "$BITE_TEST" 2>&1 | tee bite.log; \
grep -E '^FAILED ' bite.log | \
grep -F -- "$BITE_TEST" | \
grep -Ev 'ImportError|ModuleNotFoundError'; } ); \
bite=$?; \
git worktree remove --force "$wt"; \
test "$bite" -eq 0
```

This runs in a disposable `git worktree` at `HEAD`, so the checkout and any
uncommitted edit stay untouched; commit the change first. Set `BITE_TEST` to a
pytest node id such as `tests/test_x.py::test_name`. `BITE_BASE` defaults to
`origin/master`; set it to the pre-fix commit when the defect was introduced
earlier in the same pull request. The command succeeds only when the runner
reports that test as failed, and it prints the failure line. A missing runner,
a build error or an import error prints no such line, so it is not a bite.
Check that the printed failure is the assertion that describes the defect.

### Clean-room provenance

Apply the [clean-room review gate](../REVIEW.md#clean-room-provenance)
Expand Down Expand Up @@ -180,6 +192,22 @@ should pin `libvt>=0.0.1a6,<0.1` (and `>=0.x,<0.y` from `0.1.0` onward).
builds and publishes to PyPI via OIDC trusted publishing —
there is no manual upload step.

## Posture

`REVIEW.md` opens with this repository's posture. It tells a reviewer
how to treat a compatibility shim, meaning code kept only so an older
caller keeps working:

- `experimental`: the public interface can still change between
releases. Repair a wrong boundary at its owner and update callers in
the same change. A shim is residue unless a named consumer needs it
and its removal condition is recorded.
- `stable`: users depend on the released interface. A breaking change
ships with a shim or a deprecation path, a changelog entry and
migration notes. A shim stays until its removal condition is met.
- `private`: the repository has no outside consumers. Change every
caller in the same pull request and keep no shim.

## Pull requests

Use [REVIEW.md](../REVIEW.md) for design and pull request review.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Check types with ty
run: uv run ty check --python-version ${{ matrix.python-version }} --output-format github
- name: Check declared workarounds
run: PYTHONDONTWRITEBYTECODE=1 uv run python -B scripts/check_workarounds.py
uses: libtmux/.github/actions/check-workarounds@22703e1b8ee1c176ca72d9ffc9520f2ca0ce3a85 # main
- name: Tests (pytest)
if: matrix.python-version != '3.14'
run: uv run pytest -m ""
Expand Down
24 changes: 24 additions & 0 deletions REVIEW.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Design and pull request review

Posture: `experimental` (pre-alpha; no compatibility promise yet).
[Posture](.github/CONTRIBUTING.md#posture) defines `experimental`, `stable`
and `private`.

Review the complete change from its base, including local edits and new files.
Stop at the first failing gate and record its cause. Resume at the earliest
affected gate after a repair. Collect the pre-edit reproduction before
Expand Down Expand Up @@ -120,3 +124,23 @@ for screen regressions. Choose the boundaries that can trigger the defect.
rules for path handling.
- Stream and PTY EOF, cancellation, backpressure and private socket
ownership for transport and multiplexer changes.

## 5. Verdict

These rules decide which findings block.

- **Base run**: A finding that code misbehaves shows its check run on `<base>`
and on the change, with one line of output from each.
- **Existing and separate**: Behavior `<base>` already has does not block.
Report it as a `NOTE`, unless the change adds a promise the behavior breaks;
then the broken promise is the finding.
- **Unverified**: A gate nobody ran is unverified. Name the command that would
run it. It holds the merge until someone runs it, and it does not make the
verdict `BLOCK`.
- **Behavior defects**: A behavior defect blocks when a caller can reach it in
a supported environment, or when it breaks a promise in the pull request
description, a docstring, help text or the changelog. Otherwise it is a
`NOTE`.
- **Checks and claims**: A weakened check, a rule written in a second place
and a behavior claimed as tested with no test that bites block whether or
not a caller reaches them.
Loading
Loading