Fix vendored/build path exclusion in TechDetector (closes #150) - #804
Open
DataMnk wants to merge 9 commits into
Open
Fix vendored/build path exclusion in TechDetector (closes #150)#804DataMnk wants to merge 9 commits into
DataMnk wants to merge 9 commits into
Conversation
… filenames, build/vendor paths, Windows backslashes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the TechDetector tool so it correctly excludes vendored/build files
(e.g.
node_modules/,build/) when detecting a repository's primarylanguage, instead of incorrectly counting them and skewing the result
toward JavaScript.
Issue
Closes #150
Changes
_should_skip_file()inagent/tools/tech_detector.py: insteadof substring-matching slash-anchored patterns like
"/node_modules/"(which silently failed to match relative paths without a leading slash,
e.g.
"node_modules/lib/index.js"), it now splits each filepath intopath segments and checks whether any directory segment (excluding the
filename itself) exactly matches a known vendor/build directory name
avoiding false positives on filenames that merely contain a vendor
directory name as a substring (e.g.
src/node_modules_helper.py)Testing
make test-unit)make test-integration)make lint) — verified on the modified file withruff check agent/tools/tech_detector.pymake typecheck)tests named in the issue, test_node_modules_excluded and
test_build_directory_excluded, now pass. I also added three new
regression tests for edge cases identified in my PLAN.md: a
lookalike filename that should NOT be excluded
(test_node_modules_lookalike_filename_not_excluded), a build/vendor.js
path (test_build_vendor_file_excluded), and Windows backslash paths
(test_windows_backslash_paths_excluded). Full file suite is now 30/30
To verify by hand:
git checkout fix/150-tech-detector-vendored-filespytest tests/unit/test_tech_detector.py -v— all 30 tests passScreenshots / Demo
N/A — backend logic change, no UI impact.
Notes for Reviewers
When I first chose this bug, it took me some time to understand what it
was really about, so I started exploring the repo structure and files.
That took a while but there was a lot of new stuff to take in, so the
time was worth it. Once you understand it, it's pretty intuitive.
I used Claude to help explain the existing code and propose some fixes,
and this approach (splitting into path segments) was the one that made
the most sense to me — the best option out of what we considered.
There's always a lot to learn along the way, and it was tempting to look
into other bugs I noticed while exploring. That would have led to me not
delivering anything and just exploring endlessly, so I forced myself to
focus and just work on my bug.