Skip to content

Recognize explicit tox environments and nox sessions in Python workflow checks - #344

Merged
adityankale190895 merged 4 commits into
DiffCI:mainfrom
KingEmma7:feat/python-tox-nox-checks
Nov 27, 2026
Merged

adityankale190895 merged 4 commits into
DiffCI:mainfrom
KingEmma7:feat/python-tox-nox-checks

Conversation

@KingEmma7

@KingEmma7 KingEmma7 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Addresses item 2 of #330.

DiffCI can now plan a root-level tox -e lint,type or nox -s lint when it can read every selected command from tox.ini or noxfile.py. Discovery reads text. Verification runs the original command, so a failure in either environment reaches the check receipt.

The supported subset uses preinstalled tools. Tox must skip installing the project and explicitly allow its check programs. Nox must declare literal sessions using the current environment. Ruff format needs --check, Ruff lint needs both --no-fix and --no-fix-only, and mypy needs --config-file= and literal paths. Non-isolated Ruff runs on any change because a config can include other file extensions. A Python-only session can skip unrelated edits after DiffCI checks both Git trees for symlinks and submodules.

Setup scripts, custom actions, alternate working directories, dynamic declarations, install steps, hooks, mixed mutating commands and ambiguous local overrides leave the session to CI. Tox also stays with CI on Windows because its effective user config cannot be confirmed there. The design note documents the grammar and the two public workflows that inspired the fixtures. Both real jobs set up Python and install packages first. Mykrok’s tox environments also install project extras. Google’s nox session builds its Black command in a Python helper. These jobs continue to run in CI. The CLI package keeps its existing Core pin for the normal release process.

Reproduction and validation

  • node --import tsx --test tests/planner/python-checks.test.ts runs synthetic workflows that model the named invocations from the mykrok and Google examples. mykrok workflow · google-ads-mcp workflow
  • On identical synthetic commits, upstream passed despite a mypy error behind tox and a Ruff formatting error behind nox. With matching candidate Core and CLI builds, each failing wrapper produced exit 1, valid input passed, and README-only edits skipped the isolated checks. A changed text file reached through a Python symlink also surfaced both failures. Tracked inputs, full test selection, and fallback reasons matched the expected outcomes.
  • A linked workflow and its regular target can both name the same session. With the link sorting first, the previous PR head missed a Ruff formatting failure. The revision keeps the check from the regular workflow and reports its failure. A declaration found only through a link still contributes no session.
  • Nox now accepts leading, doubled and trailing semicolons in Windows PATH when the remaining directories are fully qualified and the repository contains no candidate shell, runner or leaf executable. POSIX still requires absolute directories in uppercase PATH. The local Windows-rule tests used inert files on macOS. The CLI package suite exercises the Windows cases on native hosted runners.
  • With the same synthetic Git fixtures, the file-backed planner and real CLI were compared on main, the previous PR head and this revision. Both example-shaped setup sequences left the named session to CI. A plain checkout exposed the seeded errors. All 1,480 Core and 580 CLI tests passed locally. Installation, typecheck, build, the release-boundary audit, the agent packaging check, the benchmark, CLI packaging and the clean-consumer smoke passed.
  • The first PR head's merge gate failed on two existing tests for executable lookup and a linked-worktree Git hook. Upstream fixed both fixtures in f5ddf3d, which this revision incorporates. Both corrected fixtures passed in the full CLI suite.

…ow checks

Signed-off-by: Emmanuel Mawulolo Tagbor <etagbor@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T09:35:46.134191Z 5c49a9c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c49a9c776

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +153 to +154
checks = checks.filter((check) => {
if (!isPythonSession(check.command)) return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Filter linked workflows before deduplicating sessions

When .github/workflows/a.yml is a symlink to a regular b.yml declaring a supported nox -s lint check, workflowFiles() reads a.yml first and discoverPythonChecks() deduplicates by command, retaining only the entry whose script is a.yml. This post-discovery filter then removes that entry even though the regular workflow still declares the check. I reproduced plannedChecks() changing from one RUN check to [] solely by adding the symlink. Reject linked workflow inputs before discovery/deduplication, or preserve the regular occurrence; otherwise verification silently omits a real CI check without reporting it as skipped.

Useful? React with 👍 / 👎.

Signed-off-by: Emmanuel Mawulolo Tagbor <etagbor@gmail.com>
@adityankale190895

Copy link
Copy Markdown
Member

Thanks for this, and for flagging the two CLI tests that fail on macOS. You were right that they weren't caused by this PR.

Both were broken on main for Linux and macOS, and Core CI never ran the CLI's own tests there, so nobody saw it. The merge gate selected them here because the PR touches gate-checks.ts and agent-selection.ts. f5ddf3d fixes both tests:

  • In the Python gate-checks test, the Windows-mode onPath assertion found the extensionless make fixture on POSIX. It now has its own make.CMD fixture.
  • The linked-worktree hook test wrote its pre-push hook without the execute bit, so Git skipped the hook on Linux and macOS.

CI also runs the CLI test suite on Ubuntu and Windows now.

Could you update the branch from main? The merge gate re-tests the old merge commit, so re-running the job alone won't clear it. I'll review the tox/nox changes in the meantime.

@adityankale190895 adityankale190895 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this. The parsing is careful: the tox and nox readers turn away anything unusual, the base-commit check declines when the session config changed, and the new files are in release-files.json. Two things before merge:

1. The two workflows this is modeled on don't get a check. Their real CI files set up Python and install the runner before calling it:

  • mykrok/mykrok: actions/checkout → actions/setup-python → pip install tox tox-uv → tox -e lint,type
  • googleads/google-ads-mcp: actions/checkout → actions/setup-python → pip install black nox → nox -s lint

Any uses other than a plain actions/checkout, and any earlier run step, sets unknownSessionContext, so discoverPythonChecks returns nothing for both. The same happens for actions/checkout with fetch-depth or a tag like @v4.2.2. Most real workflows have these steps, so as written the feature mostly matches the test fixtures.

Could you allow the usual setup steps? For example, actions/setup-python / astral-sh/setup-uv with literal inputs, checkout with literal inputs and semver tags, and a pip install / uv tool install whose arguments are only package names (tox, nox, tox-uv, and the check tools). A test against workflows shaped like these two would cover it. If you'd rather keep this PR strict, please say in the design note that real workflows aren't matched yet, and we can widen it in a follow-up.

2. Small: empty PATH entries on Windows (python-session-files.ts, pathIsUnambiguous). Windows PATHs often end with ; or contain ;;. The empty segment fails isAbsolute, so nox sessions are always left to CI there. Windows lookup ignores empty segments (only POSIX reads them as the current directory), so filtering them out on win32 should be safe.

Signed-off-by: Emmanuel Mawulolo Tagbor <etagbor@gmail.com>
Signed-off-by: Emmanuel Mawulolo Tagbor <etagbor@gmail.com>

@adityankale190895 adityankale190895 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @KingEmma7, this is ready. All three points are handled:

  • The design note now says real workflows with setup or install steps stay in CI, and names both examples. Keeping this PR strict is fine. I'll open a follow-up for actions/setup-python / astral-sh/setup-uv, checkout inputs and package-only installs.
  • The Windows PATH check drops empty segments and is stricter than I asked for (PATHEXT required, cwd checked for cmd.exe and the tools). Nice.
  • Linked workflows are now excluded before deduplication, so the regular workflow's session survives. The new test covers it.

I checked it merged with current main: typecheck, the planner and CLI tests, and the release boundary audit all pass.

@adityankale190895
adityankale190895 merged commit 2fe2a84 into DiffCI:main Nov 27, 2026
13 checks passed
@adityankale190895

Copy link
Copy Markdown
Member

Thank you @KingEmma7, merged! tox and nox sessions are now planned in Python workflow checks, after uv in #333.

With Yarn Classic (#63, #67, #70) and Yarn Berry (#245) behind you, I'd like to invite you to be Area maintainer: Yarn (tiers). You'd be named in the README and the Yarn docs, requested as a reviewer on Yarn PRs, and co-author of a short write-up on Yarn lockfile narrowing if you'd like one. As before, there's no fixed availability, and you can step back any time.

If you want the next piece, #345 is the follow-up to this PR (setup-python and pip install before tox/nox). It's yours to take first.

We also have a Discord for contributors if you'd like to chat there: https://discord.gg/vAftSVeYgk

Copy link
Copy Markdown
Contributor Author

Thanks, Aditya! I’d be happy to accept the Yarn Area Maintainer role. I appreciate the flexibility and look forward to weighing in on Yarn design decisions and reviewing PRs as my schedule allows.

adityankale190895 added a commit that referenced this pull request Nov 28, 2026
Accepted on #344. README tier and a maintainer line next to the Yarn
lockfile narrowing docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adityankale190895

Copy link
Copy Markdown
Member

Welcome aboard, @KingEmma7! You're now Area maintainer: Yarn. The README lists you that way (982291e), and the Yarn lockfile docs in release-boundary.md name you as maintainer. diffci.com/contributors will pick it up on its next sync. From now on I'll request your review on Yarn PRs and tag you on Yarn design questions.

We'd also like to hear what else would help you. That could be how your work is recognised, what you get out of contributing, or anything we could do better. We're collecting ideas in Contributors: how else would you like your work recognised?, and your input there would mean a lot.

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