Abdk/multi platform detection v10#117861
Open
Abdkhan14 wants to merge 2 commits into
Open
Conversation
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.
Adds unit and integration tests for the previously untested parts of
multi_platform_detection.py, and cleans up minor quality issues in the existing test suite.New test coverage:
TestSelectActivePlatforms — MAX_LANGUAGES cap, language grouping (TypeScript + JavaScript → one javascript slot), IGNORED_LANGUAGES skipped, byte-count descending ordering
TestPathIsIgnored — segment-vs-substring correctness (e.g. build.gradle is not ignored even though build/ is an ignored directory)
TestGetTree — defensive parsing of non-dict responses, missing tree key, truncated flag propagation
TestDetectPlatformsMulti (extended) — existence-only Pass 1 high match with zero content reads, co-location false-positive prevention end-to-end, high confidence sorts before medium regardless of byte count
Test quality cleanup:
Replaced hardcoded "abcdef" / "packages/f/package.json" in the reads-cap test with MAX_CONTENT_READS-derived values via string.ascii_lowercase
Replaced the hardcoded 4-language dict in the languages-cap test with _distinct_platform_languages(), a shared module-level helper that derives n distinct-base-platform languages from GITHUB_LANGUAGE_TO_SENTRY_PLATFORM at runtime
Removed one duplicate test (test_max_languages_cap_end_to_end — already covered by the unit test in TestSelectActivePlatforms)
Removed one redundant test (test_match_content_honors_inline_ignorecase_flag — already proven by test_match_content_with_content_returns_parent_dir)
Test plan
pytest tests/sentry/integrations/github/test_multi_platform_detection.py — 63 passed