github / github/annotated-logger

Pytest matrix runs a single interpreter; binding it exposes a macOS/3.11 hatch env failure

Đang mở
#156 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
101
Fork
7
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
3

Mô tả

## Summary

`.github/workflows/pytest.yaml` declares a 15-cell test matrix, but every cell runs the same interpreter, so the repo currently has **no real Python version coverage**. Fixing that reveals a second, separate problem: `hatch env create dev` fails on `macos-latest` + Python 3.11.

Raised by Copilot review on #155; removed from that PR to keep it scoped to dependency patching.

## 1. The matrix does not test what it claims

```yaml
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.x' # <-- not bound to the matrix
```

`python-version` is hardcoded, so all 15 jobs install the newest available CPython. The job names (`pytest (ubuntu-latest, 3.10)`) claim coverage the run does not provide. `requires-python = ">=3.10"`, so 3.10–3.13 are effectively untested.

The one-line fix is `python-version: ${{ matrix.python-version }}`.

## 2. That fix exposes a macOS + 3.11 environment failure

With the binding applied, `pytest (macos-latest, 3.11)` fails during **Install dependencies**:

```
Syncing environment plugin requirements
Environment `dev` has unknown type: pip-compile
##[error]Process completed with exit code 1.
```

Notes:

- Reproducible across **two independent runner allocations** (initial run and `gh run rerun --failed`).
- The plugin sync completes in ~240 ms and installs nothing before the failure.
- `pip-compile` comes from `hatch-pip-compile`, declared in `[tool.hatch.env] requires`. The error means the plugin was not loaded, not that the dev dependencies are wrong.
- **Not reproducible locally.** On macOS arm64 with CPython 3.11.14, against a clean `main` worktree, `hatch env create dev` exits 0 and `hatch run dev:pytest` gives 76 passed / 100% coverage. Same result on the #155 branch.
- Other cells in the same run get past this step (`ubuntu-latest, 3.10` ran the full suite green before fail-fast cancelled it).

So this looks like a hosted-runner-specific hatch plugin resolution problem, not a dependency or source defect.

## 3. Fail-fast hides the picture

`strategy` has no `fail-fast: false`, so the single macOS/3.11 failure cancelled the other 14 jobs mid-step. Adding `fail-fast: false` alongside the matrix fix would show the true per-version state in one run instead of one failure at a time.

## Suggested order of work

1. Add `fail-fast: false`.
2. Bind `python-version: ${{ matrix.python-version }}`.
3. Triage the resulting failures; investigate the macOS/3.11 `hatch env create dev` failure (likely pinning `hatch`/`hatch-pip-compile`, or installing the plugin explicitly before `hatch env create`).

## Evidence

- Failing job: https://github.com/github/annotated-logger/actions/runs/31826048213/job/94850326975
- Reverted from #155 in `8818bb0`; the binding itself is `91eac8c`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with .github/workflows/pytest.yaml and inspect the matrix, Python setup step, and fail-fast behavior. Run the workflow to confirm that each matrix cell uses its declared interpreter and capture the macOS/3.11 hatch environment result. Done means the matrix reports genuine version coverage, fail-fast no longer hides cells, and the hosted environment failure is resolved or clearly isolated.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
github-actions, macos, python
Lĩnh vực
build-system, ci-cd, testing-qa
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.