Skip to content

Conversation

@chambridge
Copy link
Collaborator

@chambridge chambridge commented Jan 14, 2026

Description

Refactored FileSizeLimitsAssessor to use git ls-files instead of glob() to enumerate source files. This ensures that files in .gitignore'd directories (like .venv/, node_modules/) are not scanned, which was causing false failures when large vendored files exceeded the line count thresholds.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Related Issues

Fixes #245

Changes Made

  • Refactored FileSizeLimitsAssessor.assess() to use git ls-files instead of pathlib.glob() for file discovery, ensuring .gitignore rules are respected
  • Added graceful fallback to rglob() for non-git repositories
  • Added safe_subprocess_run import from subprocess_utils for secure subprocess execution with timeout
  • Added 5 new unit tests for FileSizeLimitsAssessor covering gitignore behavior, edge cases, and scoring logic

Testing

  • Unit tests pass (pytest)
  • Integration tests pass
  • Manual testing performed
  • No new warnings or errors

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

Refactored FileSizeLimitsAssessor to use `git ls-files` instead of
`glob()` to enumerate source files. This ensures that files in
.gitignore'd directories (like .venv/, node_modules/) are not scanned,
which was causing false failures when large vendored files exceeded
the line count thresholds.

Fixes ambient-code#245

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Chris Hambridge <chambrid@redhat.com>
@chambridge chambridge force-pushed the fix/245-file-size-assessor-respects-gitignore branch from 341bef8 to 12a70ab Compare January 14, 2026 21:53
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.

[BUG] file_size_limits includes .venv files despite .gitignore

1 participant