Skip to content

Run selected checks once per project (shared-run method) - #15

Merged
kpenfound merged 1 commit into
mainfrom
shared-run
Nov 6, 2026
Merged

kpenfound merged 1 commit into
mainfrom
shared-run

Conversation

@kpenfound

Copy link
Copy Markdown
Contributor

Summary

.batch is gone: the engine no longer supports it. Every leaf check now calls one byte-identical shared command per dedup unit, so the engine runs the tool once and each check reads its own result. This follows github.com/dagger/go (go.dang runTests/assertPassed).

Dimensions

  • pytest: pytest-project (the dedup unit) → pytest-test-file (project-relative path) → pytest-test (a top-level test: a module-level test* function with all its parameters, or a Test* class with all its tests). The @check is PytestTest.test(ws, selection: PytestTestFiles!). The engine passes in the project's filtered file collection, with each file's test collection filtered too.
  • ruff, mypy, ty, uv: one level, <tool>-project. The project is both the leaf and the dedup unit, as for golangci-lint and staticcheck in dagger/go. These tools take files, but their machine output lists only diagnostics, so a per-file check could not tell a pass from a file the tool never read. mypy and ty also check a whole program, and a file list on the command line overrides the project's own files config.

Behaviour and API changes for callers

  • engineVersion is now v1.0.0-beta.22 in every module, for selected collection arguments on checks.

  • Collection-level @check/@generate functions are now plain functions:

    • ruff: lint, format, fix
    • mypy and ty: typeCheck
    • uv: audit, lock, build
    • pytest: projects(...).test, tests(...).test

    Write projects(ws).lint(ws) where you wrote run(projects(ws).batch.lint(ws)). They return Void and raise on failure. The README spells this out for each function.

  • New pytest flag --pytest-test. --pytest-test-file is unchanged.

  • PytestTestFile.test is removed. Use tests(ws).subset(keys: [file]).test(ws), or call a test's check with selection:.

  • pytest discovery reads top-level declarations only. It skips pytest's default norecursedirs (build, dist, venv, node_modules, *.egg, dot-directories).

  • The shared pytest run adds --continue-on-collection-errors and loads a bundled reporter plugin with -p.

  • The indexer runs in a digest-pinned python:3.14-slim.

  • No cache busters: results are keyed by content.

  • Library additions: attempt, ownedMatches, searchMatches, ownMatches and a PythonMatch type. Base image argument types are unchanged.

Attribution

  • A failed test fails its own check, with every failing parameter or method.
  • A file that fails to import fails that file's selected tests.
  • A failing test that discovery missed, in a file it found, also fails that file's selected tests.
  • An environment that can't be built fails its project's tests only.
  • A failure in a file with no selected test, or a non-zero exit with no failure to show, fails every check sharing the command.
  • A selected test pytest never runs fails with "did not run".
  • These pass:
    • tests deselected by the project's own -m, -k or addopts
    • module-level skips
    • tests that -x or --maxfail never reached after a reported failure

Testing

dagger check: 46/46 passed, covering e2e, dagger-pytest-otel and the dang-sdk stale check. The new checks run the engine's CLI against fixture workspaces:

  • selected-*:
    • tests: two projects, two files, excluded tests and files not run
    • file-only selection
    • an isolated failure
    • an import failure
    • an environment failure
    • a failure outside any selected test
    • an undiscovered failure
    • a test that never ran
    • pytest-xdist with -n 2
    • per-project checks for ruff and for mypy
  • selected-one-run-check: each test draws a random token once per pytest session. Every failing check of a project must show the same token, and the two projects must show different ones.
  • listing-check: lists all five modules over a project whose dependency doesn't exist, whose uv.lock and ruff.toml are garbage and whose imports fail, with base images that hold no tool.

Overlap with open PRs

Known limitations

  • Logs and test spans belong to the check that started the shared run. The others share its result.
  • The CLI report may show a failing test's span instead of the check's own error.
  • Discovery uses pytest's defaults. A project's own python_files, python_functions or testpaths, tests declared inside an if, and runtime-built tests are not checks. Under a whole-project run their failures fail every check of the project. A test discovery lists that pytest skips fails as "did not run".
  • Each check does O(selection) Dang work, as in dagger/go.

🤖 Generated with Claude Code

The `.batch` collection form is no longer supported. Collection-level
checks and generators become plain helpers, so each check lives on a
leaf only.

pytest checks each top-level test: a module-level test function or a
test class, under its test file, under its project. Every test check of
a project takes the engine-filtered test file collection as its
selection and builds the same pytest command from it, so the engine
runs pytest once per project. A bundled plugin records each report as
a JSON line, and an indexer writes one bounded result per check, which
each check reads. This follows the go module's runTests and
assertPassed.

ruff, mypy, ty and uv keep the project as the leaf: their reports list
only diagnostics, so a per-file check could not tell a pass from a
file never read.

The modules now need engine v1.0.0-beta.22, for selected collection
arguments on checks. The e2e suite drops `.batch` and adds CLI-driven
selection checks, a check that a project runs pytest once, and a check
that listing runs no tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kpenfound
kpenfound merged commit 286435a into main Nov 6, 2026
48 checks passed
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