Skip to content

fix(ci): run workspace checks on plugins and ai-tutors - #2207

Merged
KatalKavya96 merged 3 commits into
apache:mainfrom
Anurag-S1ngh:fix/2201-workspace-hook-filters
Nov 21, 2026
Merged

KatalKavya96 merged 3 commits into
apache:mainfrom
Anurag-S1ngh:fix/2201-workspace-hook-filters

Conversation

@Anurag-S1ngh

@Anurag-S1ngh Anurag-S1ngh commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The workspace-ruff-check, workspace-ruff-format and workspace-mypy hooks filtered on tools/ paths only, so Python under plugins/ and ai-tutors/ skipped all three on a pull request while main still checked it.
  • Extend the shared filter to both workspace members and pin it with a test that runs every member path through each hook's pattern.

Type of change

  • CI / dev loop (prek, workflows, validators)

Test plan

  • The new tools/dev/tests/test_workspace_hook_filters.py failed on the old filter and passes on the new one.
  • prek run workspace-ruff-check workspace-ruff-format workspace-mypy --files plugins/magpie-setup/skills/status/scripts/collect_status.py fires all three hooks and passes.
  • prek run --all-files --skip workspace-pytest passes.
  • prek run workspace-pytest --from-ref upstream/main --to-ref HEAD passes.

RFC-AI-0004 compliance

No principle touched: the hooks already existed, and this only widens when they run.

Linked issues

Closes #2201

Notes for reviewers

The filter now matches ^((tools|plugins|ai-tutors)/(.*\.py|.*pyproject\.toml)|pyproject\.toml|tools/dev/run-workspace-check\.sh)$, so Python and pyproject.toml anywhere under the three trees fire the hooks. Markdown-only changes in those trees still skip the static checks, which is deliberate. The test derives its paths from git ls-files filtered by the workspace members, so a new member or a new layout inside one is covered without edits.

Generative AI disclosure: written with help from OpenCode (DeepSeek V4.1 Flash 1017). I have read every line of the diff and run the checks.

The ruff, ruff-format and mypy workspace hooks filtered on `tools/`
paths only, so a pull request that changed Python under `plugins/` or
`ai-tutors/` skipped all three while `main` still checked them. That is
how the formatting and typing break in apache#2199 reached `main`.

Extend the shared filter to the two members and pin it with a test that
runs every member path through each hook's pattern.

Generated-by: OpenCode v2.3.2 (DeepSeek V4.1 Flash 1017)

@KatalKavya96 KatalKavya96 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.

@Anurag-S1ngh, thanks for the PR.
Reading the patterns straight out of .pre-commit-config.yaml in the new test is a good way to stop this from regressing quietly.
Giving all three hooks the same filter keeps them from drifting apart again.
It also helps that the PR body says the Markdown-only skip is deliberate, so nobody has to guess.

Should change

  • The inline comment on .pre-commit-config.yaml:691.

Smaller points (non-blocking)

  • Two small suggestions inline on tools/dev/tests/test_workspace_hook_filters.py (lines 24 and 59).

Thanks again for chasing this down.


This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. After you've
addressed the points above and pushed an update, an Apache Magpie
maintainer — a real person — will take the next look
at the PR. The findings cite the project's review criteria;
if you think one of them is mis-applied, please reply on the
PR and a maintainer will weigh in.

More on how Apache Magpie handles maintainer review:
Contributing guide.

Comment thread .pre-commit-config.yaml Resolved
The previous filter only recognised `src/`, `tests/` and a top-level
`pyproject.toml` under a `tools/` member, and only a top-level
`pyproject.toml` under `plugins/`. Scripts at a member root, such as
`tools/dev/check-doc-sync.py`, and nested member configs under
`plugins/magpie-*/tools/` still skipped ruff and mypy on a pull request.

Match Python and `pyproject.toml` anywhere under the three trees, the
same scope `workspace-pytest` already uses. Derive the test paths from
`git ls-files` filtered by the workspace members so a new member or a
new layout inside one cannot slip past, and pin the deliberate
Markdown-only skip with a negative case.
@Anurag-S1ngh

Copy link
Copy Markdown
Contributor Author

Pushed ddffea3.

  • .pre-commit-config.yaml: all three hooks now use ^((tools|plugins|ai-tutors)/(.*\.py|.*pyproject\.toml)|pyproject\.toml|tools/dev/run-workspace-check\.sh)$. Against tracked files it fixes 62 skips, not 33: the 33 .py files you listed, plus 29 nested pyproject.toml under plugins/magpie-security-tools/tools/ and plugins/magpie-vetted-ops/tools/, which the old filter also missed.
  • The test now builds its paths from git ls-files filtered by [tool.uv.workspace] members, so it covers every tracked .py and pyproject.toml in a member, and asserts the driver script still matches.
  • The docstring points at fix(setup): resolve comdev MCP dirs from the registered index.js #2199, with prek: workspace ruff and mypy hooks skip Python under plugins/ and ai-tutors/ on PRs #2201 as the tracking issue.
  • Added a negative case for plugins/magpie-setup/skills/setup/SKILL.md so the Markdown-only skip stays pinned.

prek run --all-files --skip workspace-pytest and prek run workspace-pytest --from-ref upstream/main --to-ref HEAD both pass.

@github-actions github-actions Bot added family:tools tools/* family:ci .github workflows, prek, validators substrate:framework-dev Tool substrate: build / validate / eval the framework itself labels Nov 20, 2026

@KatalKavya96 KatalKavya96 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.

@Anurag-S1ngh, thanks for the quick and thorough follow-up, especially building the test from git ls-files instead of examples.

I re-checked ddffea3a against main's tracked files: the old filter skips 62 .py / pyproject.toml files under workspace members (your count), the new one skips none, and the SKILL.md negative case holds. All three earlier threads are addressed and resolved.


Generated by Claude Code

@KatalKavya96
KatalKavya96 merged commit d912b5d into apache:main Nov 21, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

family:ci .github workflows, prek, validators family:tools tools/* substrate:framework-dev Tool substrate: build / validate / eval the framework itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prek: workspace ruff and mypy hooks skip Python under plugins/ and ai-tutors/ on PRs

2 participants