Skip to content

Fix lint-salt/lint-tests pre-commit hooks on non-Linux platforms - #69933

Merged
dwoz merged 6 commits into
saltstack:3006.xfrom
BrianHa94:fix-69932-lint-pre-commit-cross-platform-support
Aug 22, 2026
Merged

dwoz merged 6 commits into
saltstack:3006.xfrom
BrianHa94:fix-69932-lint-pre-commit-cross-platform-support

Conversation

@BrianHa94

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes the lint-salt/lint-tests pre-commit hooks, which failed outright
on macOS (and would have hit the same issues on Windows/FreeBSD):

  • _lint() in noxfile.py hardcoded requirements/static/ci/<pydir>/linux.lock
    regardless of host OS instead of using the existing _get_pip_requirements_file()
    helper, causing pip to attempt building pyinotify (a Linux-only package) on
    other platforms.
  • Several per-Python-version pip-compile hooks in .pre-commit-config.yaml
    were missing their own - id: pip-compile list marker, causing YAML to
    silently merge them into the preceding hook's mapping instead of creating a
    separate list item. This clobbered the Darwin/Linux/FreeBSD/Windows Py3.14
    ZeroMQ requirements hooks and the Docs CI Py3.14 hook, meaning those lock
    files could never actually be regenerated via pre-commit run <alias>. A
    related duplicate-key instance had also silently dropped the salt/ext/.*
    exclusion from the enforce-tornado-imports hook.
  • lint.lock was a single, Linux-pinned file compiled from the full
    base.txt/common.txt/linux.txt/pkg/linux.txt dependency graph rather
    than just the lint tooling itself, so it could pin different versions of
    shared packages (observed with boto3, aiohttp) than a platform's own CI
    lock, causing hard pip resolution conflicts on any platform other than
    Linux.
  • The new check-lint-locks consistency check (added as part of this fix)
    tried every platform combination regardless of host, but two of those
    combinations require building pyinotify's legacy sdist locally, which
    only succeeds on a real Linux host — causing false-positive failures on
    macOS/Windows.

Adds a yamllint pre-commit hook (key-duplicates rule) scoped to
.pre-commit-config.yaml and a tools/precommit/lintlocks.py check that
verifies every platform's base lock and lint lock resolve together, so these
classes of bugs can't recur silently.

What issues does this PR fix or reference?

Fixes #69932

Previous Behavior

Running lint-salt/lint-tests pre-commit hooks (or nox -e lint-salt/
lint-tests) on macOS failed immediately trying to build pyinotify. Working
around that surfaced a second failure: a hard version conflict between the
platform's CI lock and the shared lint.lock (e.g. boto3, aiohttp).
Several lock-file regeneration hooks for Py3.14 were also silently
non-functional due to a YAML authoring bug, with no error indicating they
didn't exist.

New Behavior

lint-salt/lint-tests pre-commit hooks run successfully on macOS (verified
manually) and Linux. lint.lock is now split into per-platform variants
containing only the lint tooling's own dependencies, eliminating the
cross-platform version drift entirely. All previously-clobbered pip-compile
hooks now exist and were used to regenerate their lock files. A new
yamllint check and a new check-lint-locks pre-commit check guard against
regressions in each of these areas going forward.

Merge requirements satisfied?

  • Docs — updated doc/topics/development/conventions/style.rst's stale
    lint.lock path reference to reflect the new per-platform lock files.
  • Changelog
  • Tests written/updated — added a yamllint key-duplicates pre-commit
    hook to catch the duplicate-key YAML bug class, and a new
    tools/precommit/lintlocks.py check (check-lint-locks) that verifies
    every platform's CI lock resolves against its lint lock, since CI's
    Lint job only runs on Linux and wouldn't otherwise catch this.

Commits signed with GPG?

No

@BrianHa94
BrianHa94 requested a review from a team as a code owner August 3, 2026 20:32
@welcome

welcome Bot commented Aug 3, 2026

Copy link
Copy Markdown

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We're glad you've joined our community and look forward to doing awesome things with you!

@BrianHa94
BrianHa94 force-pushed the fix-69932-lint-pre-commit-cross-platform-support branch from 74a91f9 to cd41e0f Compare August 3, 2026 20:35
@BrianHa94 BrianHa94 added the test:full Run the full test suite label Aug 3, 2026
@BrianHa94 BrianHa94 self-assigned this Aug 3, 2026
twangboy
twangboy previously approved these changes Aug 3, 2026
@BrianHa94 BrianHa94 added this to the Sulphur v3006.28 milestone Aug 5, 2026
_lint() hardcoded requirements/static/ci/<pydir>/linux.lock regardless
of host OS, breaking the lint-salt and lint-tests pre-commit hooks on
macOS (pip tries to build pyinotify, which is Linux-only). Use the
existing _get_pip_requirements_file() helper instead, matching every
other OS-aware nox session in this file.
Found by testing a new key-duplicates check: the same missing
`- id: pip-compile` merge bug that broke the Darwin Py3.14 zmq
requirements hook also silently destroyed the Linux, FreeBSD, Windows,
and Docs Py3.14 pip-compile hooks, each clobbered by the following
Py3.13 block. Also fixes two FreeBSD Crypto hooks with a leftover
duplicate `files:` key, and merges two duplicate `exclude:` keys on
the enforce-tornado-imports hook that were silently dropping the
salt/ext/.* exclusion.

Adds a yamllint hook scoped to .pre-commit-config.yaml with only
key-duplicates enabled, so this class of silent data loss can't
recur unnoticed.
_lint()/_lint_pre_commit() always installs a platform's own CI
requirements lock alongside the single, Linux-pinned lint.lock. Since
that lock re-declared the full common.txt/linux.txt/pkg/linux.txt
dependency graph (ansible, boto3, kubernetes, moto, mercurial, etc.)
as direct requirements, it could drift out of sync with what a
Darwin/FreeBSD/Windows base lock resolves for the same packages,
breaking lint-salt/lint-tests on those platforms with hard version
conflicts (e.g. boto3, importlib-metadata, more-itertools).

Add darwin-lint.lock/freebsd-lint.lock/windows-lint.lock alongside
the renamed linux-lint.lock (all Python versions), each compiled with
its own platform's pip-compile hook and matching noxfile.py's
_get_lint_requirements_file() platform selection.

Since .pylintrc disables import-error and no-member, pylint's
findings are provably unaffected by whether these third-party
integration libraries are installed at all (verified by running
pylint over the full salt/, tools/, and tests/ trees with and without
them). base_requirements_file already provides everything lint.lock
was redeclaring, so trim every lint lock down to compile from just
lint.txt, constrained against that platform's own CI+pkg lock. This
also removes the entire class of cross-file version drift, since
there is no longer any overlapping package declaration to drift.

Add a check-lint-locks pre-commit hook (tools/precommit/lintlocks.py)
that resolves each platform's CI lock together with its lint lock via
uv, catching future conflicts without needing a real macOS/FreeBSD/
Windows runner.
check-lint-locks tries every platform combination regardless of which
host it runs on, but resolving the linux/freebsd targets requires uv
to build pyinotify's legacy sdist locally to read its metadata, and
that build hard-checks the real host platform and aborts outside
Linux. This made the hook fail with 12 false-positive "conflicts" on
any macOS/Windows machine touching lock files, even when every actual
version conflict was already resolved. Skip those combinations when
not running on Linux, with an explicit warning so the gap in local
coverage stays visible instead of silent.

Also fixes a doc reference to the old single lint.lock path, which no
longer exists now that it's split per platform.
… 3006.x

Rebasing onto 3006.x hit a conflict in requirements/static/ci/py3.14/
{darwin,freebsd,windows}.lock against the "Regenerate py3.14 CI
requirements lock files" commit. Resolving it by taking 3006.x's side
made that commit a no-op, which silently reintroduced the boto3
version drift this branch fixes (darwin/freebsd/windows landed on
1.43.48 while linux/cloud kept 1.43.57).

Re-pinned boto3 to 1.43.57 on darwin.lock and windows.lock via
`uv pip compile -P boto3==1.43.57` to match linux.lock/cloud.lock.
freebsd.lock still needs the same treatment but can't be compiled
from this host: --universal resolution still needs pyinotify's
metadata, and building its legacy sdist only succeeds on a real
Linux host.
freebsd.lock was the last holdout at boto3==1.43.48 after the 3006.x
rebase reintroduced the version drift this branch fixes (darwin and
windows were already re-pinned to 1.43.57 in 8567cd8, but freebsd's
--universal resolution needs to evaluate pyinotify's metadata, which
only builds on a real Linux host).

Re-pinned via `uv pip compile -P boto3==1.43.57` from a Linux host to
match linux.lock/cloud.lock/darwin.lock/windows.lock.
@dwoz
dwoz merged commit 12f7174 into saltstack:3006.x Aug 22, 2026
428 checks passed
@BrianHa94
BrianHa94 deleted the fix-69932-lint-pre-commit-cross-platform-support branch August 24, 2026 17:16

This branch was previously deployed

1 inactive deployment
ci — db3bdead Deployed Aug 22, 2026 by BrianHa94 via Build Onedir Packages / RPM (x86_64) #26568
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants