Skip to content

simplify: one uv run pytest for every Python suite - #977

Merged
max-sixty merged 2 commits into
mainfrom
simplify-test-runner
Aug 14, 2026
Merged

max-sixty merged 2 commits into
mainfrom
simplify-test-runner

Conversation

@max-sixty

@max-sixty max-sixty commented Aug 13, 2026 •

Copy link
Copy Markdown
Owner

The three Python suites ran as three separate pytest invocations — uv run pytest in generator/, two --no-project runs with ad-hoc dependency sets for proxy/ and the install-tend scripts — which is what dev/test.sh existed to sequence, along with per-suite failure accumulation, exit-code slack for filtered runs, and a conditional npm ci. The reason for three environments was the mitmproxy pin, since the proxy addon imports mitmproxy.test and has to run against the version production runs.

The repo root becomes a uv workspace with generator/ as its only member, so one environment holds every Python test's dependencies, that mitmproxy pin included. Plain uv run pytest from the root then collects generator/, proxy/, and the install-tend scripts in a single session — with no pytest configuration at all, since collection from the root reaches all three and pytest's default norecursedirs already skips node_modules and dot-dirs. Same 542 tests as before, plus one new guard. dev/test.sh is deleted; wt test is four named steps in .config/wt.toml (pytest, then worker install, vitest, typecheck), and CI's three Python jobs collapse into - run: uv run pytest.

The one thing the old shape bought that this one doesn't: CI read the mitmproxy version out of claude/action.yaml with yq, so the pin existed once. A dev group can't do that, so the version is now named twice and test_pinned_mitmproxy_matches_the_action asserts the installed distribution matches the action's default — stronger than comparing the two files, since it also catches a lock that resolved elsewhere. The weekly bump rule in running-tend names the second pin.

Making generator/ a workspace member moves where uv build writes: to the workspace root's dist/, not the member's. pypi-release.yaml now builds from the root with uv build --package tend (--package because a bare root build tries to build the virtual tend-dev through setuptools), and CI runs the same command — that workflow only fires on an immutable tag, so a break there costs a manual publish. Caught by the review bot, which is also the reason the CI step exists.

wt test's arguments narrow pytest and nothing else, so a filtered run still pays for worker/; uv run pytest -k render is the Python half on its own. Dropping {{ args }} from the alias instead would make wt swallow the arguments silently.

Verification
  • uv run pytest → 543 passed (510 + 23 + 9 before, plus the new pin test)
  • npm --prefix worker ci/test/run typecheck → 31 passed, clean tsc
  • pre-commit run --all-files → all hooks pass
  • uv build --package tend from the root → dist/ with sdist + wheel, twine check clean
  • The pin test fails on drift (checked by editing action.yaml's default)
  • No ruleset required the deleted test-install-tend-scripts check

This was written by Claude Code on behalf of max-sixty

The repo root becomes a uv workspace with `generator/` as its only member, so
one environment holds every Python test's dependencies — the pinned mitmproxy
the proxy addon imports included — and plain `uv run pytest` from the root
collects generator/, proxy/, and the install-tend scripts in a single session,
with no pytest config at all. `dev/test.sh` goes, and with it the per-suite
failure accumulation, the filtered-run exit-code slack, and the conditional
`npm ci`; `wt test` is now four named steps in `.config/wt.toml`, and CI's
three Python jobs collapse into one.

The mitmproxy version is named twice now — the dev group installs it,
`claude/action.yaml` tells an adopter's job which to fetch — so a new test
asserts the installed distribution matches the action's default, and the
weekly bump rule names the second pin.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv build from a workspace member writes to the workspace root's dist/, not the member's — so once generator/ becomes a member, generator/dist is never created and pypi-release.yaml breaks. Its Build package step still succeeds (artifacts land in the repo root's dist/), but the step after it — Check artifacts, running uv tool run --from twine twine check dist/* under working-directory: generator — has no dist/ to glob, hands the literal pattern to twine, and exits 1. The upload-artifact step below it (path: generator/dist) would find nothing either. Nothing on this PR catches it: that workflow only fires on a tag push, and the tag is immutable by ruleset, so recovery is a manual build-and-publish.

Verified on this branch:

$ cd generator && uv build
Successfully built /…/tend/dist/tend-0.1.16.tar.gz
Successfully built /…/tend/dist/tend-0.1.16-py3-none-any.whl
$ ls generator/dist
ls: cannot access 'generator/dist': No such file or directory
$ (cd /tmp/empty && uv tool run --from twine twine check dist/*); echo $?
ERROR    InvalidDistribution: Cannot find file (or expand pattern): 'dist/*'
1

The fix that matches the rest of the PR is to build from the root: drop both working-directory: generator lines, use uv build --package tend, and set the artifact path: dist. The --package matters — a bare uv build at the root tries to build tend-dev itself through the legacy setuptools backend and fails, which is the one case the root pyproject.toml's "no build-system, so uv never builds it" doesn't cover. Happy to push that commit if you want it.

Everything else checks out: uv run pytest from the root collects all three suites (547 passed here), cd generator && uv run pytest still works off the same workspace env, uv lock --check is clean, and no ruleset required the deleted test-install-tend-scripts check.

`uv build` in a workspace member writes to the workspace root's `dist/`, so
once `generator/` became a member the release job's later steps globbed a
`generator/dist` that was never created. Build from the root with
`--package tend` (a bare root build tries to build the virtual `tend-dev`),
and run the same command in CI — the release workflow only fires on an
immutable tag, where a break costs a manual publish.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Confirmed and fixed in eb26c6e — thanks, that one was invisible to my own check because I built with --out-dir to keep the tree clean, which is exactly the flag that hides where the default lands.

Took the suggested shape: root build with uv build --package tend, no working-directory, artifact path: dist. Also added uv build --package tend as a step in CI's test job, since the point stands that nothing on a PR would have caught it — the release workflow only fires on a tag that's immutable by ruleset.

This was written by Claude Code on behalf of max-sixty

@max-sixty
max-sixty merged commit b38b77c into main Aug 14, 2026
9 checks passed
@max-sixty
max-sixty deleted the simplify-test-runner branch August 14, 2026 00:00
max-sixty pushed a commit that referenced this pull request Aug 27, 2026
…1065)

## Problem

Four live files enumerate the suites a root `uv run pytest` collects,
and all four still describe the pre-port set — "generator/, proxy/, and
the install-tend scripts". The bash→Python port of the composite-action
step bodies (`9a330b8`, `374f1b1`) added a fifth directory,
`shared/steps/`, whose `test_*.py` files contribute 164 of the 717 tests
the root run now collects, about 23% of the Python suite.

Those lists are the repo's own statement of what one `pytest` covers,
and a session reading any of them comes away thinking the step bodies —
the security preflight, the rate-limit gate, the agent supervisor, the
outage tracker — are tested somewhere else, or not at all.
`pyproject.toml`'s is the sharpest case: it's the file that configures
the collection, and its comment contradicts itself two lines apart,
naming `shared/steps/` in the sentence right after the list that omits
it.

## Fix

Add `shared/steps/` to all four, and reflow the paragraphs that the
added words pushed past their files' wrap width.

-
[`CLAUDE.md`](https://github.com/max-sixty/tend/blob/7a7a34c/CLAUDE.md#L32-L38)
— the Commands section
-
[`pyproject.toml`](https://github.com/max-sixty/tend/blob/7a7a34c/pyproject.toml#L1-L11)
— the workspace-root header comment
-
[`.github/workflows/ci.yaml`](https://github.com/max-sixty/tend/blob/7a7a34c/.github/workflows/ci.yaml#L8-L11)
— the comment above the `test:` job
-
[`.config/wt.toml`](https://github.com/max-sixty/tend/blob/7a7a34c/.config/wt.toml#L31-L35)
— the comment above `[[aliases.test]]`

`CHANGELOG.md`'s [#977](#977)
entry carries the same list and is left alone — it records what was true
at that release.

## Verification

```
$ uv run pytest --collect-only -q | grep -c '^shared/steps'
164
$ uv run pytest -q
717 passed
```

That run was from the first commit's session; `uv` isn't on the PATH in
this repo's agent sandbox, so the follow-up commit's verification is
CI's own `test` job. Every change in it is a comment or prose line — no
Python, no YAML key, no `wt` step body — and nothing under
`generator/tests` or `shared/steps` asserts on these strings (`grep -rn
'install-tend scripts\|Every Python test' --include='*.py'` is empty).

No regression test: the change is a noun in four documentation lists. A
test tying those sentences to the set of directories pytest actually
collects is the kind of machinery `CLAUDE.md` itself rules out —
complexity earns its place by preventing a wrong outward action, and a
stale doc sentence is not one.

---------

Co-authored-by: tend-agent <[email protected]>
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.

2 participants