Skip to content

Cross-Check Python Directories Against Dependabot's pip and uv Entries - #4460

Merged
ptr727 merged 2 commits into
developfrom
burndown/audit-python-dependabot
Nov 25, 2026
Merged

ptr727 merged 2 commits into
developfrom
burndown/audit-python-dependabot

Conversation

@ptr727

@ptr727 ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Summary

This addresses items 2 and 3 of #2286 only. Item 1 is a pip entry in KiCadLibrary's .github/dependabot.yml, a write in another repository, so #2286 stays open for that repository's resync.

  • Item 2. The dependabot.ecosystems check now asserts Python's ecosystems per directory, by the rule Audit Cross-Checks No Python Dependabot Ecosystem, and KiCadLibrary's requirements-dev.txt Is Untracked #2286 sets:

    • A uv.lock implies uv for its own directory.
    • A requirements*.txt implies pip for its own directory.
    • A pyproject.toml declaring [project] dependencies, with neither file beside it, implies pip or uv. It implies nothing when it is a member of a uv workspace whose root uv.lock is tracked.
    • A config-only pyproject.toml implies nothing.

    An entry covers a directory its directory value names literally, or one a directories glob matches. A pyproject.toml the audit cannot read or parse is reported rather than guessed.

  • Item 3. AUDIT.md section 4 records that Dependabot cannot see a uvx tool pinned to an exact version in a workflow. The fix is @latest, or a version pinned in a manifest a Dependabot entry tracks.

  • Split. spec/audit.py sits at its 3000-line ceiling, so the ecosystem helpers move to a new spec/audit_dependabot.py. That module gets a ceiling of its own in tests/test_audit_size.py. The root-suite check in spec/audit.py now uses the same uv.lock / requirements*.txt predicate.

  • Docs. AUDIT.md section 4 and the setup.dependabot.ecosystems assert in spec/project-types.json now describe the per-directory check. The other language ecosystems (nuget/npm) stay audited by inspection.

  • Tests. tests/test_audit.py's run_audit fixture gives its tracked pyproject.toml a config-only text, since the check now parses it.

Hub Self-Audit

Under this rule the hub's own audit reports one new DRIFT: pip is not declared for /tests though tests/requirements.txt is present. Nothing gates on it, since no workflow runs spec/audit.py and a DRIFT does not change its exit status. Whether to track that file or accept the finding is a question for the maintainer, filed as #4459.

Verification

  • python -m unittest discover -s tests passed in full apart from the three fixture tests the run_audit change fixes, and the audit suites pass after it.

  • ruff (pinned), mypy, spec/validate.py, and the prose gate are clean.

  • Local strict review: two recorded agent-skill passes. The first raised three findings, all on text this change wrote:

    • A glob in a directory value read as coverage. Fixed.
    • Duplicated manifest logic. The audit's root-suite site was moved onto the shared predicate. The validator action's shape() in .github/actions/python-directories/python_directories.py was declined: it is a separately deployed action the audit mirrors rather than imports, as python_directory_covers already does.
    • Shape guards that trusted fleet manifests never need. Removed.

    The second pass, over the full diff, raised none.

🤖 Generated with Claude Code

ptr727 and others added 2 commits November 25, 2026 15:08
The Dependabot ecosystem check now reads the tree's Python manifests and reports a directory no
entry of an ecosystem it implies covers. A uv.lock implies uv and a requirements*.txt implies pip,
each for its own directory. A pyproject.toml declaring [project] dependencies beside neither implies
pip or uv, unless it is a member of a uv workspace whose root uv.lock is tracked. A config-only
pyproject.toml implies nothing.

The ecosystem helpers move to spec/audit_dependabot.py, since spec/audit.py sits at its line
ceiling, and the new module gets a ceiling of its own. AUDIT.md section 4 and the
setup.dependabot.ecosystems assert describe the per-directory check, and AUDIT.md records that a
uvx tool pinned to an exact version in a workflow is invisible to Dependabot.

Addresses items 2 and 3 of #2286.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dicate

Dependabot reads a glob in directories alone, so a directory value now matches only itself.
The root-suite check takes the same uv.lock and requirements*.txt predicate the ecosystem check uses,
and the shape guards fleet manifests never need are gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 25, 2026 23:15
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 18920f4 and f6f2764.

Files selected for processing: 7

  • AUDIT.md
  • spec/audit.py
  • spec/audit_dependabot.py
  • spec/project-types.json
  • tests/test_audit.py
  • tests/test_audit_helpers.py
  • tests/test_audit_size.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ptr727

ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head f6f27642fa30c0ad0b1b735e8de1b6b8daed2a1a, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A moderate active finding remains because non-mapping TOML values can trigger an AttributeError and abort the fleet audit instead of reporting an unreadable dependency declaration.

1 open issue
What changed in this PR

This pull request extends the fleet audit to verify Python dependency manifests against directory-scoped Dependabot entries and documents uvx pin limitations. One issue remains: parseable non-table TOML values can abort the audit instead of being reported.

Changes:

  • Add per-directory detection for uv.lock, requirements*.txt, dependency-bearing pyproject.toml, and uv workspace members.
  • Extract Dependabot logic into a dedicated module with focused tests and a size ceiling.
  • Update audit contracts, documentation, and fixtures.
File Description
tests/​test_audit.py Updates audit fixtures to provide a parseable configuration-only pyproject.toml by default.
tests/​test_audit_size.py Adds a line-count ceiling for the new Dependabot audit module.
tests/​test_audit_helpers.py Adds tests for Python manifest inference, Dependabot coverage, workspaces, globs, and unreadable files.
spec/​project-types.json Defines the per-directory Python ecosystem coverage contract.
spec/​audit.py Integrates Python ecosystem findings and reuses shared manifest detection for root checks.
spec/​audit_dependabot.py Implements Dependabot directory matching and Python manifest analysis.
AUDIT.md Documents Python ecosystem coverage checks and exact uvx pin limitations.

Review effort: Lite

Comment thread spec/audit_dependabot.py Resolved
@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.75281% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.70%. Comparing base (b38e084) to head (f6f2764).
⚠️ Report is 351 commits behind head on develop.

Files with missing lines Patch % Lines
spec/audit_dependabot.py 97.46% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4460      +/-   ##
===========================================
- Coverage    81.60%   79.70%   -1.91%     
===========================================
  Files           26       48      +22     
  Lines         9070    16475    +7405     
===========================================
+ Hits          7402    13132    +5730     
- Misses        1668     3343    +1675     
Flag Coverage Δ
python-3.13 79.70% <97.75%> (-1.91%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit bbcc7a1 into develop Nov 25, 2026
15 checks passed
@ptr727
ptr727 deleted the burndown/audit-python-dependabot branch November 25, 2026 23:32
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