Repository navigation
simplify: one uv run pytest for every Python suite - #977
Conversation
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
left a comment
There was a problem hiding this comment.
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]>
|
Confirmed and fixed in eb26c6e — thanks, that one was invisible to my own check because I built with Took the suggested shape: root build with
|
…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]>
The three Python suites ran as three separate pytest invocations —
uv run pytestingenerator/, two--no-projectruns with ad-hoc dependency sets forproxy/and the install-tend scripts — which is whatdev/test.shexisted to sequence, along with per-suite failure accumulation, exit-code slack for filtered runs, and a conditionalnpm ci. The reason for three environments was the mitmproxy pin, since the proxy addon importsmitmproxy.testand 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. Plainuv run pytestfrom the root then collectsgenerator/,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 defaultnorecursedirsalready skipsnode_modulesand dot-dirs. Same 542 tests as before, plus one new guard.dev/test.shis deleted;wt testis 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.yamlwithyq, so the pin existed once. A dev group can't do that, so the version is now named twice andtest_pinned_mitmproxy_matches_the_actionasserts 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 inrunning-tendnames the second pin.Making
generator/a workspace member moves whereuv buildwrites: to the workspace root'sdist/, not the member's.pypi-release.yamlnow builds from the root withuv build --package tend(--packagebecause a bare root build tries to build the virtualtend-devthrough 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 forworker/;uv run pytest -k renderis the Python half on its own. Dropping{{ args }}from the alias instead would makewtswallow 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, cleantscpre-commit run --all-files→ all hooks passuv build --package tendfrom the root →dist/with sdist + wheel,twine checkcleanaction.yaml's default)test-install-tend-scriptscheck